radeonsi: add a debug option to compile shaders when they're created
authorMarek Olšák <marek.olsak@amd.com>
Fri, 10 Apr 2015 21:58:34 +0000 (23:58 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 16 Apr 2015 16:36:29 +0000 (18:36 +0200)
Tested-by: Tom Stellard <thomas.stellard@amd.com>
src/gallium/drivers/radeon/r600_pipe_common.c
src/gallium/drivers/radeon/r600_pipe_common.h
src/gallium/drivers/radeonsi/si_state_shaders.c

index 0ef5fc24d997feb17e0ebed89e44f807eddc5aae..2b27e0ab200bdb6a373b0e30ccfd212b5bfa51ca 100644 (file)
@@ -323,6 +323,7 @@ static const struct debug_named_value common_debug_options[] = {
        { "notiling", DBG_NO_TILING, "Disable tiling" },
        { "switch_on_eop", DBG_SWITCH_ON_EOP, "Program WD/IA to switch on end-of-packet." },
        { "forcedma", DBG_FORCE_DMA, "Use asynchronous DMA for all operations when possible." },
+       { "precompile", DBG_PRECOMPILE, "Compile one shader variant at shader creation." },
 
        DEBUG_NAMED_VALUE_END /* must be last */
 };
index a08d08cdf14cbfbe23aa8c0c2b342ae005b2ba2d..febd2a167bbb58c6d678d73498a7f2a950d81d29 100644 (file)
@@ -83,6 +83,7 @@
 #define DBG_NO_TILING          (1 << 14)
 #define DBG_SWITCH_ON_EOP      (1 << 15)
 #define DBG_FORCE_DMA          (1 << 16)
+#define DBG_PRECOMPILE         (1 << 17)
 /* The maximum allowed bit is 20. */
 
 #define R600_MAP_BUFFER_ALIGNMENT 64
index b0a6fb9fc846fb37daa65745b218370caff4dbb9..1bbc6b3ca7aa7d7e4322dd54f0bf9aaf438d717d 100644 (file)
@@ -465,6 +465,7 @@ static void *si_create_shader_state(struct pipe_context *ctx,
                                    const struct pipe_shader_state *state,
                                    unsigned pipe_shader_type)
 {
+       struct si_screen *sscreen = (struct si_screen *)ctx->screen;
        struct si_shader_selector *sel = CALLOC_STRUCT(si_shader_selector);
        int i;
 
@@ -494,6 +495,9 @@ static void *si_create_shader_state(struct pipe_context *ctx,
                }
        }
 
+       if (sscreen->b.debug_flags & DBG_PRECOMPILE)
+               si_shader_select(ctx, sel);
+
        return sel;
 }