Mesa (master): r600g: add draw_vbo check for a NULL pixel shader

Marek Olšák mareko at kemper.freedesktop.org
Mon Apr 10 20:48:12 UTC 2017


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

Author: Constantine Kharlamov <Hi-Angel at yandex.ru>
Date:   Mon Apr 10 23:04:36 2017 +0300

r600g: add draw_vbo check for a NULL pixel shader

Taken from radeonsi, required to remove dummy pixel shader in the next patch

Signed-off-by: Constantine Kharlamov <Hi-Angel at yandex.ru>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Signed-off-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/drivers/r600/evergreen_state.c   | 1 +
 src/gallium/drivers/r600/r600_pipe.h         | 1 +
 src/gallium/drivers/r600/r600_state.c        | 3 ++-
 src/gallium/drivers/r600/r600_state_common.c | 7 ++++++-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 371e7ce212..5697da4af9 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -471,6 +471,7 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx,
 	rs->clip_halfz = state->clip_halfz;
 	rs->flatshade = state->flatshade;
 	rs->sprite_coord_enable = state->sprite_coord_enable;
+	rs->rasterizer_discard = state->rasterizer_discard;
 	rs->two_side = state->light_twoside;
 	rs->clip_plane_enable = state->clip_plane_enable;
 	rs->pa_sc_line_stipple = state->line_stipple_enable ?
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index 86634b8681..7f1ecc278b 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -279,6 +279,7 @@ struct r600_rasterizer_state {
 	bool				scissor_enable;
 	bool				multisample_enable;
 	bool				clip_halfz;
+	bool				rasterizer_discard;
 };
 
 struct r600_poly_offset_state {
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index 1f7e9b3aa5..06100abc4a 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -470,6 +470,7 @@ static void *r600_create_rs_state(struct pipe_context *ctx,
 	rs->clip_halfz = state->clip_halfz;
 	rs->flatshade = state->flatshade;
 	rs->sprite_coord_enable = state->sprite_coord_enable;
+	rs->rasterizer_discard = state->rasterizer_discard;
 	rs->two_side = state->light_twoside;
 	rs->clip_plane_enable = state->clip_plane_enable;
 	rs->pa_sc_line_stipple = state->line_stipple_enable ?
@@ -622,7 +623,7 @@ static void *r600_create_sampler_state(struct pipe_context *ctx,
 static struct pipe_sampler_view *
 texture_buffer_sampler_view(struct r600_pipe_sampler_view *view,
 			    unsigned width0, unsigned height0)
-			    
+
 {
 	struct r600_texture *tmp = (struct r600_texture*)view->base.texture;
 	int stride = util_format_get_blocksize(view->base.format);
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 922030a1ed..5be49dcdfe 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -1712,7 +1712,12 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info
 		return;
 	}
 
-	if (unlikely(!rctx->vs_shader || !rctx->ps_shader)) {
+	if (unlikely(!rctx->vs_shader)) {
+		assert(0);
+		return;
+	}
+	if (unlikely(!rctx->ps_shader &&
+		     (!rctx->rasterizer || !rctx->rasterizer->rasterizer_discard))) {
 		assert(0);
 		return;
 	}




More information about the mesa-commit mailing list