Module: Mesa
Branch: master
Commit: a75fee78c680054aeb1b96ec25e02dd36286fed5
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a75fee78c680054aeb1b96ec25e02dd36286fed5

Author: Michel Dänzer <[email protected]>
Date:   Wed Aug 27 17:29:08 2014 +0900

radeonsi: Compile dummy pixel shader on demand

It's never used under normal circumstances.

Reviewed-by: Marek Olšák <[email protected]>

---

 src/gallium/drivers/radeonsi/si_pipe.c  |    7 -------
 src/gallium/drivers/radeonsi/si_state.c |   11 ++++++++++-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
b/src/gallium/drivers/radeonsi/si_pipe.c
index abd7d4f..b63c5d7 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -27,7 +27,6 @@
 
 #include "radeon/radeon_uvd.h"
 #include "util/u_memory.h"
-#include "util/u_simple_shaders.h"
 #include "vl/vl_decoder.h"
 
 /*
@@ -124,12 +123,6 @@ static struct pipe_context *si_create_context(struct 
pipe_screen *screen, void *
                goto fail;
        sctx->blitter->draw_rectangle = r600_draw_rectangle;
 
-       sctx->dummy_pixel_shader =
-               util_make_fragment_cloneinput_shader(&sctx->b.b, 0,
-                                                    TGSI_SEMANTIC_GENERIC,
-                                                    TGSI_INTERPOLATE_CONSTANT);
-       sctx->b.b.bind_fs_state(&sctx->b.b, sctx->dummy_pixel_shader);
-
        /* these must be last */
        si_begin_new_cs(sctx);
        r600_query_init_backend_mask(&sctx->b); /* this emits commands and must 
be last */
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index bb8deb6..1d6ae86 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -36,6 +36,7 @@
 #include "util/u_framebuffer.h"
 #include "util/u_helpers.h"
 #include "util/u_memory.h"
+#include "util/u_simple_shaders.h"
 
 static void si_init_atom(struct r600_atom *atom, struct r600_atom **list_elem,
                         void (*emit)(struct si_context *ctx, struct r600_atom 
*state),
@@ -2283,8 +2284,16 @@ static void si_bind_ps_shader(struct pipe_context *ctx, 
void *state)
                return;
 
        /* use dummy shader if supplied shader is corrupt */
-       if (!sel || !sel->current)
+       if (!sel || !sel->current) {
+               if (!sctx->dummy_pixel_shader) {
+                       sctx->dummy_pixel_shader =
+                               
util_make_fragment_cloneinput_shader(&sctx->b.b, 0,
+                                                                    
TGSI_SEMANTIC_GENERIC,
+                                                                    
TGSI_INTERPOLATE_CONSTANT);
+               }
+
                sel = sctx->dummy_pixel_shader;
+       }
 
        sctx->ps_shader = sel;
 }

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to