[Mesa-dev] [PATCH 4/5] radeonsi: fix binding the dummy pixel shader
Marek Olšák
maraeo at gmail.com
Thu Dec 5 09:43:03 PST 2013
From: Marek Olšák <marek.olsak at amd.com>
This fixes valgrind errors in glxinfo.
---
src/gallium/drivers/radeonsi/radeonsi_pipe.h | 2 +-
src/gallium/drivers/radeonsi/si_state.c | 23 +++++++++--------------
src/gallium/drivers/radeonsi/si_state_draw.c | 10 +---------
3 files changed, 11 insertions(+), 24 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
index e84088f..56145bc 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
@@ -166,7 +166,7 @@ struct r600_context {
/* With rasterizer discard, there doesn't have to be a pixel shader.
* In that case, we bind this one: */
- struct si_pipe_shader *dummy_pixel_shader;
+ void *dummy_pixel_shader;
struct r600_atom cache_flush;
struct pipe_constant_buffer null_const_buf; /* used for set_constant_buffer(NULL) on CIK */
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 9831fd8..b644d56 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2282,15 +2282,12 @@ static void si_bind_vs_shader(struct pipe_context *ctx, void *state)
if (rctx->vs_shader == sel)
return;
- rctx->vs_shader = sel;
-
- if (sel && sel->current) {
- si_pm4_bind_state(rctx, vs, sel->current->pm4);
- rctx->b.streamout.stride_in_dw = sel->so.stride;
- } else {
- si_pm4_bind_state(rctx, vs, rctx->dummy_pixel_shader->pm4);
- }
+ if (!sel || !sel->current)
+ return;
+ rctx->vs_shader = sel;
+ si_pm4_bind_state(rctx, vs, sel->current->pm4);
+ rctx->b.streamout.stride_in_dw = sel->so.stride;
rctx->b.flags |= R600_CONTEXT_INV_SHADER_CACHE;
}
@@ -2302,13 +2299,11 @@ static void si_bind_ps_shader(struct pipe_context *ctx, void *state)
if (rctx->ps_shader == sel)
return;
- rctx->ps_shader = sel;
-
- if (sel && sel->current)
- si_pm4_bind_state(rctx, ps, sel->current->pm4);
- else
- si_pm4_bind_state(rctx, ps, rctx->dummy_pixel_shader->pm4);
+ if (!sel || !sel->current)
+ sel = rctx->dummy_pixel_shader;
+ rctx->ps_shader = sel;
+ si_pm4_bind_state(rctx, ps, sel->current->pm4);
rctx->b.flags |= R600_CONTEXT_INV_SHADER_CACHE;
}
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index f0716f3..cf543f3 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -470,17 +470,9 @@ static void si_update_derived_state(struct r600_context *rctx)
si_pipe_shader_ps(ctx, rctx->ps_shader->current);
ps_dirty = 0;
}
- if (!rctx->ps_shader->current->bo) {
- if (!rctx->dummy_pixel_shader->pm4)
- si_pipe_shader_ps(ctx, rctx->dummy_pixel_shader);
- else
- si_pm4_bind_state(rctx, vs, rctx->dummy_pixel_shader->pm4);
-
- ps_dirty = 0;
- }
if (rctx->ps_shader->current->cb0_is_integer != rctx->fb_cb0_is_integer) {
si_pipe_shader_ps(ctx, rctx->ps_shader->current);
- ps_dirty = 1;
+ ps_dirty = 0;
}
if (ps_dirty) {
--
1.8.3.2
More information about the mesa-dev
mailing list