Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2019-01-17 21:42:17 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-01-17 21:48:00 +0300
commit6dccc7cdab171e791188ac65d70ae16d51c74d0a (patch)
tree0b6510293a124750cb8fddeb1a87e728ffd9091b /source/blender/gpu/intern/gpu_shader_interface.c
parent844cda8f22f8b28b8892057cbd2070bb06642775 (diff)
GPUInterface: Add builtin check in uniform location request.
This is a compile time option to remove the unecessary uniform queries.
Diffstat (limited to 'source/blender/gpu/intern/gpu_shader_interface.c')
-rw-r--r--source/blender/gpu/intern/gpu_shader_interface.c11
1 files changed, 11 insertions, 0 deletions
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;
}