[Mesa-dev] [PATCH] radeonsi: fix a crash when unbinding sampler states

Marek Olšák maraeo at gmail.com
Mon Apr 8 18:39:24 UTC 2019


On Mon, Apr 8, 2019 at 2:33 PM James Zhu <jamesz at amd.com> wrote:

>
> On 2019-04-08 2:25 p.m., Marek Olšák wrote:
> > From: Marek Olšák <marek.olsak at amd.com>
> >
> > ---
> >   src/gallium/drivers/radeonsi/si_descriptors.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c
> b/src/gallium/drivers/radeonsi/si_descriptors.c
> > index 244ba5a7bec..ac40ed27f91 100644
> > --- a/src/gallium/drivers/radeonsi/si_descriptors.c
> > +++ b/src/gallium/drivers/radeonsi/si_descriptors.c
> > @@ -942,21 +942,21 @@ void si_update_ps_colorbuf0_slot(struct si_context
> *sctx)
> >   static void si_bind_sampler_states(struct pipe_context *ctx,
> >                                      enum pipe_shader_type shader,
> >                                      unsigned start, unsigned count,
> void **states)
> >   {
> >       struct si_context *sctx = (struct si_context *)ctx;
> >       struct si_samplers *samplers = &sctx->samplers[shader];
> >       struct si_descriptors *desc =
> si_sampler_and_image_descriptors(sctx, shader);
> >       struct si_sampler_state **sstates = (struct
> si_sampler_state**)states;
> >       int i;
> >
> > -     if (!count || shader >= SI_NUM_SHADERS)
> > +     if (!count || shader >= SI_NUM_SHADERS || !sstates)
>
> if sstates == NULL, it means we want to unbind samplers->sampler_states
> from current setting.
>
> So I think it is better not just bypass it.
>

The driver never unbinds constant state objects. If sstates[i] == NULL,
it's not unbound. sstates == NULL is a similar case.

It's not a standard behavior, but the driver has been doing it for a very
long time.

Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190408/60a41895/attachment-0001.html>


More information about the mesa-dev mailing list