[Mesa-dev] [PATCH] draw: make sure pipeline is revalidated when sampler views or samplers change.

sroland at vmware.com sroland at vmware.com
Fri Feb 22 16:22:37 PST 2013


From: Roland Scheidegger <sroland at vmware.com>

Since with llvm execution parts of sampler view and sampler state is baked into
the shader, we need to revalidate otherwise the wrong shader might get used.
(Not completely sure but I think this would not be required for non-llvm case,
along with everything else in these functions.)
This caused bugs in piglit arb_texture_buffer_object-formats, because we never
noticed that the view format changed.
---
 src/gallium/auxiliary/draw/draw_context.c     |    4 ++++
 src/gallium/auxiliary/gallivm/lp_bld_sample.c |    3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index c2b6851..528543b 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -764,6 +764,8 @@ draw_set_sampler_views(struct draw_context *draw,
    debug_assert(shader_stage < PIPE_SHADER_TYPES);
    debug_assert(num <= PIPE_MAX_SHADER_SAMPLER_VIEWS);
 
+   draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
+
    for (i = 0; i < num; ++i)
       draw->sampler_views[shader_stage][i] = views[i];
    for (i = num; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; ++i)
@@ -783,6 +785,8 @@ draw_set_samplers(struct draw_context *draw,
    debug_assert(shader_stage < PIPE_SHADER_TYPES);
    debug_assert(num <= PIPE_MAX_SAMPLERS);
 
+   draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
+
    for (i = 0; i < num; ++i)
       draw->samplers[shader_stage][i] = samplers[i];
    for (i = num; i < PIPE_MAX_SAMPLERS; ++i)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index 5322397..ef0631c 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -117,7 +117,8 @@ lp_sampler_static_texture_state(struct lp_static_texture_state *state,
    state->level_zero_only   = !view->u.tex.last_level;
 
    /*
-    * FIXME: Handle the remainder of pipe_sampler_view.
+    * the layer / element / level parameters are all either dynamic
+    * state or handled transparently wrt execution.
     */
 }
 
-- 
1.7.9.5



More information about the mesa-dev mailing list