[Bf-blender-cvs] [6dccc7cdab1] master: GPUInterface: Add builtin check in uniform location request.
Clément Foucault
noreply at git.blender.org
Thu Jan 17 19:49:30 CET 2019
Commit: 6dccc7cdab171e791188ac65d70ae16d51c74d0a
Author: Clément Foucault
Date: Thu Jan 17 19:42:17 2019 +0100
Branches: master
https://developer.blender.org/rB6dccc7cdab171e791188ac65d70ae16d51c74d0a
GPUInterface: Add builtin check in uniform location request.
This is a compile time option to remove the unecessary uniform queries.
===================================================================
M source/blender/gpu/intern/gpu_shader_interface.c
===================================================================
diff --git a/source/blender/gpu/intern/gpu_shader_interface.c b/source/blender/gpu/intern/gpu_shader_interface.c
index f5ba30ac2df..6e05609a3ae 100644
--- a/source/blender/gpu/intern/gpu_shader_interface.c
+++ b/source/blender/gpu/intern/gpu_shader_interface.c
@@ -42,6 +42,7 @@
#include <string.h>
#define DEBUG_SHADER_INTERFACE 0
+#define DEBUG_SHADER_UNIFORMS 0
#if DEBUG_SHADER_INTERFACE
# include <stdio.h>
@@ -326,6 +327,16 @@ const GPUShaderInput *GPU_shaderinterface_uniform_ensure(const GPUShaderInterfac
fprintf(stderr, "GPUShaderInterface: Warning: Uniform '%s' not found!\n", name);
}
}
+
+#if DEBUG_SHADER_UNIFORMS
+ if ((G.debug & G_DEBUG_GPU) &&
+ input->builtin_type != GPU_UNIFORM_NONE &&
+ input->builtin_type != GPU_UNIFORM_CUSTOM)
+ {
+ /* Warn if we find a matching builtin, since these can be looked up much quicker. */
+ fprintf(stderr, "GPUShaderInterface: Warning: Uniform '%s' is a builtin uniform but not queried as such!\n", name);
+ }
+#endif
return (input->location != -1) ? input : NULL;
}
More information about the Bf-blender-cvs
mailing list