radeonsi: add draw_vbo check for a NULL pixel shader
authorMarek Olšák <marek.olsak@amd.com>
Thu, 22 Oct 2015 20:18:49 +0000 (22:18 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 23 Oct 2015 22:01:20 +0000 (00:01 +0200)
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/radeonsi/si_state.h
src/gallium/drivers/radeonsi/si_state_draw.c

index e91b6c7c6657b8f6a97ef0e88af5069c55a4888f..aef85579085b2232e574b02f8cfaf4ea069902f6 100644 (file)
@@ -698,6 +698,7 @@ static void *si_create_rs_state(struct pipe_context *ctx,
        rs->clamp_fragment_color = state->clamp_fragment_color;
        rs->flatshade = state->flatshade;
        rs->sprite_coord_enable = state->sprite_coord_enable;
+       rs->rasterizer_discard = state->rasterizer_discard;
        rs->pa_sc_line_stipple = state->line_stipple_enable ?
                                S_028A0C_LINE_PATTERN(state->line_stipple_pattern) |
                                S_028A0C_REPEAT_COUNT(state->line_stipple_factor) : 0;
index fba6619d2fdb028256151c3dba91ed657d4968e5..8b9a311cd3f09f741684a01bef512fb8424e87fa 100644 (file)
@@ -61,6 +61,7 @@ struct si_state_rasterizer {
        bool                    poly_smooth;
        bool                    uses_poly_offset;
        bool                    clamp_fragment_color;
+       bool                    rasterizer_discard;
 };
 
 struct si_dsa_stencil_ref_part {
index ce6c98c3124e38cb9f85f1e6d02eec5757d508ea..59845c4b43bfe74ee16c6fd023227273538db943 100644 (file)
@@ -728,6 +728,7 @@ static void si_get_draw_start_count(struct si_context *sctx,
 void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
 {
        struct si_context *sctx = (struct si_context *)ctx;
+       struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
        struct pipe_index_buffer ib = {};
        unsigned mask;
 
@@ -735,7 +736,11 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
            (info->indexed || !info->count_from_stream_output))
                return;
 
-       if (!sctx->ps_shader.cso || !sctx->vs_shader.cso) {
+       if (!sctx->vs_shader.cso) {
+               assert(0);
+               return;
+       }
+       if (!sctx->ps_shader.cso && (!rs || !rs->rasterizer_discard)) {
                assert(0);
                return;
        }