DRW: Make missing uniform debuging print only once
authorClément Foucault <foucault.clem@gmail.com>
Thu, 17 Jan 2019 18:39:27 +0000 (19:39 +0100)
committerClément Foucault <foucault.clem@gmail.com>
Thu, 17 Jan 2019 18:48:00 +0000 (19:48 +0100)
source/blender/draw/intern/draw_manager_data.c
source/blender/gpu/intern/gpu_shader_interface.c

index 0df1603a860fe49c8cd65a465f3d0e1077d24660..45365ed299e10507e8064fa2c5c09731adcf2b40 100644 (file)
@@ -122,8 +122,6 @@ static void drw_shgroup_uniform(DRWShadingGroup *shgroup, const char *name,
        }
 
        if (location == -1) {
-               if (G.debug & G_DEBUG_GPU)
-                       fprintf(stderr, "Warning: Pass : %s, Uniform '%s' not found!\n", shgroup->pass_parent->name, name);
                /* Nice to enable eventually, for now eevee uses uniforms that might not exist. */
                // BLI_assert(0);
                return;
index 7522c92eb93cfba1ff15ab600c6ff09e4da51f30..f5ba30ac2dfc42bd5252663cb249f8c573fdf73f 100644 (file)
@@ -30,6 +30,7 @@
  */
 
 #include "MEM_guardedalloc.h"
+#include "BKE_global.h"
 
 #include "GPU_shader_interface.h"
 
@@ -316,11 +317,14 @@ const GPUShaderInput *GPU_shaderinterface_uniform(const GPUShaderInterface *shad
 
 const GPUShaderInput *GPU_shaderinterface_uniform_ensure(const GPUShaderInterface *shaderface, const char *name)
 {
-       /* TODO: Warn if we find a matching builtin, since these can be looked up much quicker. */
        const GPUShaderInput *input = GPU_shaderinterface_uniform(shaderface, name);
        /* If input is not found add it so it's found next time. */
        if (input == NULL) {
                input = add_uniform((GPUShaderInterface *)shaderface, name);
+
+               if ((G.debug & G_DEBUG_GPU) && (input->location == -1)) {
+                       fprintf(stderr, "GPUShaderInterface: Warning: Uniform '%s' not found!\n", name);
+               }
        }
        return (input->location != -1) ? input : NULL;
 }