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

James Zhu jamesz at amd.com
Mon Apr 8 19:12:36 UTC 2019


This patch is Acked-by: James Zhu <James.Zhu at amd.com><mailto:James.Zhu at amd.com>

On 2019-04-08 3:02 p.m., Marek Olšák wrote:
On Mon, Apr 8, 2019 at 2:45 PM James Zhu <jamesz at amd.com<mailto:jamesz at amd.com>> wrote:


On 2019-04-08 2:39 p.m., Marek Olšák wrote:
On Mon, Apr 8, 2019 at 2:33 PM James Zhu <jamesz at amd.com<mailto: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<mailto: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.

Then we should not call unbind sampler state after compute shader launch. Since it is doing nothing.

You are right.

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


More information about the mesa-dev mailing list