[Mesa-dev] [PATCH 4/5] radeonsi: fix binding the dummy pixel shader

Michel Dänzer michel at daenzer.net
Sun Dec 8 17:50:36 PST 2013


On Fre, 2013-12-06 at 20:14 +0100, Marek Olšák wrote:
> On Fri, Dec 6, 2013 at 4:08 AM, Michel Dänzer <michel at daenzer.net> wrote:
> > On Don, 2013-12-05 at 18:43 +0100, Marek Olšák wrote:
> >> From: Marek Olšák <marek.olsak at amd.com>
> >>
> >> This fixes valgrind errors in glxinfo.
> >
> > [...]
> >
> >> 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;
> >>  }
> >
> > I've been wondering for a while if it's a good idea to use the dummy
> > pixel shader as the vertex shader... It might be safer to just not draw
> > anything if there is no vertex shader, or is there anything sensible a
> > dummy vertex shader could do?
> 
> The vertex shader must never be NULL when draw_vbo is called. The
> pixel shader can be NULL if pipe_rasterizer_state::rasterizer_discard
> is 1. That's the only reason we care about a NULL pixel shader.

That's only true if you ignore shader compiler failures.


-- 
Earthling Michel Dänzer            |                  http://www.amd.com
Libre software enthusiast          |                Mesa and X developer



More information about the mesa-dev mailing list