@ -5,7 +5,8 @@ Creation-Date: 2020-02-28T22:36:46-08:00
====== PossiblePathfinderPort ======
====== PossiblePathfinderPort ======
Created Friday 28 February 2020
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
pub struct RenderState<'a, D> where D: Device
@ -38,17 +39,32 @@ pub struct RenderState<'a, D> where D: Device
[ ] fn create_texture(&self, format: TextureFormat, size: Vector2I) -> Self::Texture;
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_texture_from_data(&self, format: TextureFormat, size: Vector2I, data: TextureDataRef)
**For now I'm going to create just the shader and not the pipeline**
-> Self::Texture;
fn create_shader(&self,
fn create_shader(&self, resources: &dyn ResourceLoader, name: &str, kind: ShaderKind)
resources: &dyn ResourceLoader,
-> Self::Shader;
name: &str,
fn create_shader_from_source(&self, name: &str, source: &[u8], kind: ShaderKind)
kind: ShaderKind)
-> Self::Shader;
-> Self::Shader;
fn create_shader_from_source(&self,
name: &str,
source: &[u8],
kind: ShaderKind) -> Self::Shader;
fn create_vertex_array(&self) -> Self::VertexArray;
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(
fn create_program_from_shaders(
&self,
&self,
resources: &dyn ResourceLoader,
resources: &dyn ResourceLoader,
@ -56,18 +72,38 @@ pub struct RenderState<'a, D> where D: Device
vertex_shader: Self::Shader,
vertex_shader: Self::Shader,
fragment_shader: Self::Shader,
fragment_shader: Self::Shader,
) -> Self::Program;
) -> 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<Self::VertexAttr>;
fn get_vertex_attr(&self, program: &Self::Program, name: &str) -> Option<Self::VertexAttr>;
**This one as well, how am I storing these?**
fn get_uniform(&self, program: &Self::Program, name: &str) -> Self::Uniform;
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,
fn bind_buffer(&self,
vertex_array: &Self::VertexArray,
vertex_array: &Self::VertexArray,
buffer: &Self::Buffer,
buffer: &Self::Buffer,
target: BufferTarget);
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,
fn configure_vertex_attr(&self,
vertex_array: &Self::VertexArray,
vertex_array: &Self::VertexArray,
attr: &Self::VertexAttr,
attr: &Self::VertexAttr,
descriptor: &VertexAttrDescriptor);
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;
fn create_framebuffer(&self, texture: Self::Texture) -> Self::Framebuffer;
**This just creates an empty buffer **
fn create_buffer(&self) -> Self::Buffer;
fn create_buffer(&self) -> Self::Buffer;
**Allocates using an empty buffer. target is buffer_usage**
fn allocate_buffer<T>(
fn allocate_buffer<T>(
&self,
&self,
buffer: &Self::Buffer,
buffer: &Self::Buffer,