From 268c605d3202fe38946b4556bae5652902542ab9 Mon Sep 17 00:00:00 2001 From: mitchellhansen Date: Wed, 11 Mar 2020 20:14:27 -0700 Subject: [PATCH] notes --- notes/Home.txt | 12 ++++--- notes/PossiblePathfinderPort.txt | 62 +++++++++++++++++++++++++------- 2 files changed, 56 insertions(+), 18 deletions(-) diff --git a/notes/Home.txt b/notes/Home.txt index 6560d342..af186ee1 100644 --- a/notes/Home.txt +++ b/notes/Home.txt @@ -8,9 +8,10 @@ Creation-Date: 2020-02-03T22:11:42-08:00 === Trac3r : A program to convert images to 2D toolpaths === TODO: - [ ] Text rendering is half implemented. + [x] Text rendering is half implemented. + [ ] Pathfinder vulkan backend implementation [ ] Currently using local copies of a few libraries: - shade_runner + [x] shade_runner ( not gonna happen, my fork has diverged too far ) vulkano/vulkano-win vulkano/vulkano-shaders vulkano/vulkano @@ -18,7 +19,6 @@ Creation-Date: 2020-02-03T22:11:42-08:00 [*] Figure out how to make this POS stable (semi stable) - -------------------- [[~/source/Trac3r-rust/doc/sfml_rust/index.html|Documentation Root]] @@ -38,9 +38,11 @@ Creation-Date: 2020-02-03T22:11:42-08:00 ==== Context switching ==== -So lets finish this text rendering! +Okay. So now I have gotten myself into a bit of a pickle with the text rendering. What was supposed to be an "easy" hack to get it to work, ended turning into a complete vulkan backend written for the pathfinder gpu abstraction layer. This luckily is within my level of skill (I think) but it is no small task. + +When I finally get this done, I should be able to allow [[VkProcessor]] to implement the Device trait, and then replicate the behaviour I am writing for the PoC!! -I remember using a triangle fan to render the fonts using the stencil buffer swapping +After this. I should have very robust and (hopefully) simple text rendering interface. -------------------- diff --git a/notes/PossiblePathfinderPort.txt b/notes/PossiblePathfinderPort.txt index 0a8aca8d..8f3d3ced 100644 --- a/notes/PossiblePathfinderPort.txt +++ b/notes/PossiblePathfinderPort.txt @@ -5,7 +5,8 @@ Creation-Date: 2020-02-28T22:36:46-08:00 ====== PossiblePathfinderPort ====== Created Friday 28 February 2020 - +So I'm just going to use this space to talk about hooking up vulkano to this backend. +All in all, this seems somewhat simple. This backend expects you to define a dozen or so types which are then passed around and manipulated using this interface. pub struct RenderState<'a, D> where D: Device @@ -37,18 +38,33 @@ pub struct RenderState<'a, D> where D: Device type VertexAttr; - - [ ] fn create_texture(&self, format: TextureFormat, size: Vector2I) -> Self::Texture; - - So for this function I'm going to need to convert Texture - - fn create_texture_from_data(&self, format: TextureFormat, size: Vector2I, data: TextureDataRef) - -> Self::Texture; - fn create_shader(&self, resources: &dyn ResourceLoader, name: &str, kind: ShaderKind) - -> Self::Shader; - fn create_shader_from_source(&self, name: &str, source: &[u8], kind: ShaderKind) - -> Self::Shader; + + fn create_texture(&self, format: TextureFormat, size: Vector2I) -> Self::Texture; + + fn create_texture_from_data(&self, + format: TextureFormat, + size: Vector2I, + data: [[TextureDataRef]] + ) -> Self::Texture; + + **For now I'm going to create just the shader and not the pipeline** + fn create_shader(&self, + resources: &dyn ResourceLoader, + name: &str, + kind: ShaderKind) + -> Self::Shader; + + + fn create_shader_from_source(&self, + name: &str, + source: &[u8], + kind: ShaderKind) -> Self::Shader; + + fn create_vertex_array(&self) -> Self::VertexArray; + + **This means more in GL as a program is a part of the state machine** + **In vk and metal this just returns the two shaders in one object** fn create_program_from_shaders( &self, resources: &dyn ResourceLoader, @@ -56,18 +72,38 @@ pub struct RenderState<'a, D> where D: Device vertex_shader: Self::Shader, fragment_shader: Self::Shader, ) -> Self::Program; + + **This one I'm a little shakey on. Where do I get these attributes?** fn get_vertex_attr(&self, program: &Self::Program, name: &str) -> Option; + + **This one as well, how am I storing these?** fn get_uniform(&self, program: &Self::Program, name: &str) -> Self::Uniform; + + **Probably just allocating a buffer with data. Target is just usage** + **See that it passes in a borrow for Buffer, I assume we should do an** + **uninitialized_buffer type of deal** fn bind_buffer(&self, vertex_array: &Self::VertexArray, - buffer: &Self::Buffer, + buffer: &Self::Buffer, target: BufferTarget); + + **This first bind_vertex_array()'s ** + **Then it appears to set the instancing using the descriptor and divisor?** + **Then it configures the vertex attributes for the state. it's push pop it seems in gl** fn configure_vertex_attr(&self, vertex_array: &Self::VertexArray, attr: &Self::VertexAttr, descriptor: &VertexAttrDescriptor); + + **This creates the framebuffer using the ** + **render_pass and swap_image. I assume what is happening here is that** + **the api is forcing me to genericize the swap_image into a texture** fn create_framebuffer(&self, texture: Self::Texture) -> Self::Framebuffer; + + **This just creates an empty buffer ** fn create_buffer(&self) -> Self::Buffer; + + **Allocates using an empty buffer. target is buffer_usage** fn allocate_buffer( &self, buffer: &Self::Buffer,