Commit: 9bc3a313fc19c4390129e2b68fb7e26bc6a543ef
Author: Jeroen Bakker
Date: Fri Jul 9 14:19:40 2021 +0200
Branches: temp-gpu-uniform-builtin-structs
https://developer.blender.org/rB9bc3a313fc19c4390129e2b68fb7e26bc6a543ef
Cleanup: use shader_block.
===================================================================
M source/blender/gpu/intern/gpu_shader.cc
M source/blender/gpu/intern/gpu_shader_block.cc
M source/blender/gpu/intern/gpu_shader_block.hh
===================================================================
diff --git a/source/blender/gpu/intern/gpu_shader.cc
b/source/blender/gpu/intern/gpu_shader.cc
index 0b5e12268be..a0c67734432 100644
--- a/source/blender/gpu/intern/gpu_shader.cc
+++ b/source/blender/gpu/intern/gpu_shader.cc
@@ -126,7 +126,7 @@ GPUShader *GPU_shader_create_ex(const char *vertcode,
const eGPUShaderTFBType tf_type,
const char **tf_names,
const int tf_count,
- const GPUShaderBlockType uniform_struct_type,
+ const GPUShaderBlockType shader_block,
const char *shname)
{
/* At least a vertex shader and a fragment shader are required, or only a
compute shader. */
@@ -135,8 +135,8 @@ GPUShader *GPU_shader_create_ex(const char *vertcode,
(computecode != nullptr)));
Shader *shader = GPUBackend::get()->shader_alloc(shname);
- if (uniform_struct_type != GPU_SHADER_BLOCK_CUSTOM) {
- shader->set_shader_struct(uniform_struct_type);
+ if (shader_block != GPU_SHADER_BLOCK_CUSTOM) {
+ shader->set_shader_struct(shader_block);
}
if (vertcode) {
@@ -228,15 +228,15 @@ GPUShader *GPU_shader_create_ex(const char *vertcode,
};
if (G.debug & G_DEBUG_GPU) {
- std::optional<GPUShaderBlockType> best_struct_type =
find_smallest_uniform_builtin_struct(
+ std::optional<GPUShaderBlockType> best_struct_type =
find_smallest_shader_block(
*shader->interface);
if (best_struct_type) {
if (/*uniform_struct_type != GPU_SHADER_BLOCK_CUSTOM &&*/
- uniform_struct_type != *best_struct_type) {
+ shader_block != *best_struct_type) {
CLOG_WARN(&LOG,
"Found better matching uniform struct for '%s'; current %d,
suggested %d",
shname,
- static_cast<int>(uniform_struct_type),
+ static_cast<int>(shader_block),
static_cast<int>(*best_struct_type));
}
}
diff --git a/source/blender/gpu/intern/gpu_shader_block.cc
b/source/blender/gpu/intern/gpu_shader_block.cc
index a1181218534..7014f416deb 100644
--- a/source/blender/gpu/intern/gpu_shader_block.cc
+++ b/source/blender/gpu/intern/gpu_shader_block.cc
@@ -219,7 +219,7 @@ const ShaderBlockType &ShaderBlockType::get(const
GPUShaderBlockType type)
return STRUCT_TYPE_INFOS[type];
}
-std::optional<const GPUShaderBlockType> find_smallest_uniform_builtin_struct(
+std::optional<const GPUShaderBlockType> find_smallest_shader_block(
const ShaderInterface &interface)
{
if (!interface.has_builtin_uniforms()) {
diff --git a/source/blender/gpu/intern/gpu_shader_block.hh
b/source/blender/gpu/intern/gpu_shader_block.hh
index 74ccac10472..d04568f1755 100644
--- a/source/blender/gpu/intern/gpu_shader_block.hh
+++ b/source/blender/gpu/intern/gpu_shader_block.hh
@@ -110,7 +110,7 @@ class ShaderBlockBuffer {
UniformBuf *m_ubo;
};
-std::optional<const GPUShaderBlockType> find_smallest_uniform_builtin_struct(
+std::optional<const GPUShaderBlockType> find_smallest_shader_block(
const ShaderInterface &interface);
} // namespace blender::gpu
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs