From 3103f383751a12f8a0bdb22309704f1f826d204c Mon Sep 17 00:00:00 2001 From: omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Tue, 9 Jul 2024 23:32:33 +1000 Subject: wip: some cleanup of ral --- src/render/static_pipeline.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/render/static_pipeline.h (limited to 'src/render/static_pipeline.h') diff --git a/src/render/static_pipeline.h b/src/render/static_pipeline.h new file mode 100644 index 0000000..bf5bc42 --- /dev/null +++ b/src/render/static_pipeline.h @@ -0,0 +1,30 @@ +#pragma once +#include "defines.h" +#include "maths_types.h" +#include "ral.h" +#include "ral_types.h" +#include "render_types.h" + +typedef struct mvp_uniforms { + mat4 model; + mat4 view; + mat4 projection; +} mvp_uniforms; +typedef struct my_shader_bind_group { + mvp_uniforms mvp; +} my_shader_bind_group; + +static shader_data_layout mvp_uniforms_layout(void* data) { + my_shader_bind_group* d = (my_shader_bind_group*)data; + bool has_data = data != NULL; + + shader_binding b1 = { .label = "Matrices", + .type = SHADER_BINDING_BYTES, + .stores_data = has_data, + .data = { .bytes = { .size = sizeof(mvp_uniforms) } } }; + + if (has_data) { + b1.data.bytes.data = &d->mvp; + } + return (shader_data_layout){ .name = "global_ubo", .bindings = { b1 }, .bindings_count = 1 }; +} -- cgit v1.2.3-70-g09d2