diff options
-rw-r--r-- | examples/cube/ex_cube.c | 2 | ||||
-rw-r--r-- | examples/triangle/ex_triangle.c | 2 | ||||
-rw-r--r-- | src/renderer/backends/backend_vulkan.c | 2 | ||||
-rw-r--r-- | src/renderer/ral_types.h | 1 | ||||
-rw-r--r-- | src/renderer/render.c | 2 |
5 files changed, 5 insertions, 4 deletions
diff --git a/examples/cube/ex_cube.c b/examples/cube/ex_cube.c index 264bf71..346dd10 100644 --- a/examples/cube/ex_cube.c +++ b/examples/cube/ex_cube.c @@ -48,7 +48,7 @@ int main() { vec3 camera_front = vec3_normalise(vec3_negate(camera_pos)); camera cam = camera_create(camera_pos, camera_front, VEC3_Y, deg_to_rad(45.0)); - vertex_description vertex_input; + vertex_description vertex_input = {.use_full_vertex_size = true}; vertex_input.debug_label = "Standard Static 3D Vertex Format"; vertex_desc_add(&vertex_input, "inPosition", ATTR_F32x3); vertex_desc_add(&vertex_input, "inNormal", ATTR_F32x3); diff --git a/examples/triangle/ex_triangle.c b/examples/triangle/ex_triangle.c index 886637a..69c29ac 100644 --- a/examples/triangle/ex_triangle.c +++ b/examples/triangle/ex_triangle.c @@ -27,7 +27,7 @@ int main() { core_bringup(); arena scratch = arena_create(malloc(1024 * 1024), 1024 * 1024); - vertex_description vertex_input = {0}; + vertex_description vertex_input = {.use_full_vertex_size=false}; vertex_input.debug_label = "Hello"; vertex_desc_add(&vertex_input, "inPos", ATTR_F32x2); vertex_desc_add(&vertex_input, "inColor", ATTR_F32x3); diff --git a/src/renderer/backends/backend_vulkan.c b/src/renderer/backends/backend_vulkan.c index 208aef0..ae49cc3 100644 --- a/src/renderer/backends/backend_vulkan.c +++ b/src/renderer/backends/backend_vulkan.c @@ -446,7 +446,7 @@ gpu_pipeline* gpu_graphics_pipeline_create(struct graphics_pipeline_desc descrip // TODO: Generate this from descroiption now VkVertexInputBindingDescription binding_desc; binding_desc.binding = 0; - binding_desc.stride = description.vertex_desc.stride; + binding_desc.stride = description.vertex_desc.use_full_vertex_size ? sizeof(vertex) : description.vertex_desc.stride; binding_desc.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; VkPipelineVertexInputStateCreateInfo vertex_input_info = { diff --git a/src/renderer/ral_types.h b/src/renderer/ral_types.h index fc8bb8b..8339625 100644 --- a/src/renderer/ral_types.h +++ b/src/renderer/ral_types.h @@ -160,6 +160,7 @@ typedef struct vertex_description { vertex_attrib_type attributes[MAX_VERTEX_ATTRIBUTES]; u32 attributes_count; size_t stride; + bool use_full_vertex_size; } vertex_description; // --- Shaders & Bindings diff --git a/src/renderer/render.c b/src/renderer/render.c index fc45093..9f9a97c 100644 --- a/src/renderer/render.c +++ b/src/renderer/render.c @@ -209,7 +209,7 @@ texture_data texture_data_load(const char* path, bool invert_y) { stbi_set_flip_vertically_on_load(invert_y); #pragma GCC diagnostic ignored "-Wpointer-sign" - char* data = stbi_load(path, &width, &height, &num_channels, 0); // STBI_rgb_alpha); + char* data = stbi_load(path, &width, &height, &num_channels, STBI_rgb_alpha); if (data) { DEBUG("loaded texture: %s", path); } else { |