freedreno/ir3: also precompile compute shaders for shaderdb
authorRob Clark <robdclark@chromium.org>
Thu, 2 Apr 2020 19:13:38 +0000 (12:13 -0700)
committerMarge Bot <eric+marge@anholt.net>
Sat, 4 Apr 2020 00:07:10 +0000 (00:07 +0000)
Similar as with draw shaders, nothing will trigger the final variant in
shader-db.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4423>

src/gallium/drivers/freedreno/ir3/ir3_gallium.c

index 9ad67d2ec9b07b01eae943ef03f611613b04534a..31dc82b1b6e445cc62ef00dde470afa8263ea459 100644 (file)
@@ -144,6 +144,7 @@ ir3_shader_create(struct ir3_compiler *compiler,
                if (nir->info.stage != MESA_SHADER_FRAGMENT)
                        ir3_shader_variant(shader, key, true, debug);
        }
+
        return shader;
 }
 
@@ -170,6 +171,15 @@ ir3_shader_create_compute(struct ir3_compiler *compiler,
 
        struct ir3_shader *shader = ir3_shader_from_nir(compiler, nir);
 
+       if (fd_mesa_debug & FD_DBG_SHADERDB) {
+               /* if shader-db run, create a standard variant immediately
+                * (as otherwise nothing will trigger the shader to be
+                * actually compiled)
+                */
+               static struct ir3_shader_key key; /* static is implicitly zeroed */
+               ir3_shader_variant(shader, key, false, debug);
+       }
+
        return shader;
 }