summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-06-18 22:31:03 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-06-18 22:31:03 +1000
commit259da84075c62c2ab96c7cb922df2000ebefb735 (patch)
tree423106dd69711794a4d5b3d1f5031a65960d186d /src
parentb2c9782ab2f4abec8f8548e667a8f2ad6e36bd4b (diff)
pbr progress
Diffstat (limited to 'src')
-rw-r--r--src/renderer/backends/opengl/backend_opengl.c2
-rw-r--r--src/renderer/builtin_materials.h8
-rw-r--r--src/renderer/ral.h4
3 files changed, 9 insertions, 5 deletions
diff --git a/src/renderer/backends/opengl/backend_opengl.c b/src/renderer/backends/opengl/backend_opengl.c
index 18cd7ee..18d1617 100644
--- a/src/renderer/backends/opengl/backend_opengl.c
+++ b/src/renderer/backends/opengl/backend_opengl.c
@@ -211,6 +211,8 @@ void encode_bind_shader_data(gpu_cmd_encoder* encoder, u32 group, shader_data* d
} else if (binding.type == SHADER_BINDING_TEXTURE) {
gpu_texture* tex = TEXTURE_GET(binding.data.texture.handle);
+ GLuint tex_slot = glGetUniformLocation(encoder->pipeline->shader_id, binding.label);
+ glUniform1i(tex_slot, i);
glActiveTexture(GL_TEXTURE0 + i);
glBindTexture(GL_TEXTURE_2D, tex->id);
}
diff --git a/src/renderer/builtin_materials.h b/src/renderer/builtin_materials.h
index f0e7d2f..f2db5f4 100644
--- a/src/renderer/builtin_materials.h
+++ b/src/renderer/builtin_materials.h
@@ -127,16 +127,16 @@ static shader_data_layout pbr_textured_shader_layout(void* data) {
.stores_data = has_data,
.data = { .bytes = { .size = sizeof(pbr_params_light_uniforms) } } };
- shader_binding b3 = {.label = "Albedo",
+ shader_binding b3 = {.label = "albedoMap",
.type = SHADER_BINDING_TEXTURE,
.stores_data = has_data };
- shader_binding b4 = {.label = "Metallic Roughness",
+ shader_binding b4 = {.label = "metallicRoughnessMap",
.type = SHADER_BINDING_TEXTURE,
.stores_data = has_data };
- shader_binding b5 = {.label = "Ambient Occlusion",
+ shader_binding b5 = {.label = "aoMap",
.type = SHADER_BINDING_TEXTURE,
.stores_data = has_data };
- shader_binding b6 = {.label = "Normal Vectors",
+ shader_binding b6 = {.label = "normalMap",
.type = SHADER_BINDING_TEXTURE,
.stores_data = has_data };
diff --git a/src/renderer/ral.h b/src/renderer/ral.h
index 067847b..cd3f19f 100644
--- a/src/renderer/ral.h
+++ b/src/renderer/ral.h
@@ -96,7 +96,9 @@ struct graphics_pipeline_desc {
bool depth_test;
};
-typedef struct gpu_renderpass_desc { /* TODO */
+typedef struct gpu_renderpass_desc {
+ texture_handle color_target; // for now only support one
+ texture_handle depth_stencil;
} gpu_renderpass_desc;
// --- Lifecycle functions