summaryrefslogtreecommitdiff
path: root/src/systems
diff options
context:
space:
mode:
Diffstat (limited to 'src/systems')
-rw-r--r--src/systems/grid.c5
-rw-r--r--src/systems/terrain.c9
2 files changed, 6 insertions, 8 deletions
diff --git a/src/systems/grid.c b/src/systems/grid.c
index 70092e0..14722e3 100644
--- a/src/systems/grid.c
+++ b/src/systems/grid.c
@@ -37,7 +37,7 @@ void Grid_Init(Grid_Storage* storage) {
ERROR_EXIT("Failed to load shaders from disk")
}
- ShaderData camera_data = { .get_layout = &Binding_Camera_GetLayout };
+ ShaderDataLayout camera_data = Binding_Camera_GetLayout(NULL);
GraphicsPipelineDesc pipeline_desc = {
.debug_name = "Infinite grid pipeline",
@@ -77,8 +77,7 @@ void Grid_Execute(Grid_Storage* storage) {
.projection = proj,
.viewPos = vec4(camera.position.x, camera.position.y,
camera.position.z, 1.0) };
- GPU_EncodeBindShaderData(
- enc, 0, (ShaderData){ .data = &camera_data, .get_layout = &Binding_Camera_GetLayout });
+ GPU_EncodeBindShaderData(enc, 0, Binding_Camera_GetLayout(&camera_data));
GPU_EncodeSetVertexBuffer(enc, storage->plane_vertices);
GPU_EncodeSetIndexBuffer(enc, storage->plane_indices);
GPU_EncodeDrawIndexed(enc, 6);
diff --git a/src/systems/terrain.c b/src/systems/terrain.c
index d2a9300..bde4b4d 100644
--- a/src/systems/terrain.c
+++ b/src/systems/terrain.c
@@ -38,8 +38,8 @@ bool Terrain_Init(Terrain_Storage* storage) {
ERROR_EXIT("Failed to load shaders from disk")
}
- ShaderData camera_data = { .get_layout = &Binding_Camera_GetLayout };
- ShaderData terrain_data = { .get_layout = &TerrainUniforms_GetLayout };
+ ShaderDataLayout camera_data = Binding_Camera_GetLayout(NULL);
+ ShaderDataLayout terrain_data = TerrainUniforms_GetLayout(NULL);
GraphicsPipelineDesc pipeline_desc = {
.debug_name = "terrain rendering pipeline",
@@ -166,11 +166,10 @@ void Terrain_Draw(Terrain_Storage* storage) {
.projection = proj,
.viewPos = vec4(scene->camera.position.x, scene->camera.position.y,
scene->camera.position.z, 1.0) };
- GPU_EncodeBindShaderData(
- enc, 0, (ShaderData){ .data = &camera_data, .get_layout = &Binding_Camera_GetLayout });
+ GPU_EncodeBindShaderData(enc, 0, Binding_Camera_GetLayout(&camera_data));
TerrainUniforms uniforms = { .tex_slot_1 = storage->texture };
- ShaderData terrain_data = { .data = &uniforms, .get_layout = &TerrainUniforms_GetLayout };
+ ShaderDataLayout terrain_data = TerrainUniforms_GetLayout(&uniforms);
GPU_EncodeBindShaderData(enc, 1, terrain_data);
GPU_EncodeSetVertexBuffer(enc, storage->vertex_buffer);