[Mesa-dev] [PATCH] radeonsi: fix a crash when unbinding sampler states
James Zhu
jamesz at amd.com
Mon Apr 8 18:33:37 UTC 2019
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.
James
> return;
>
> for (i = 0; i < count; i++) {
> unsigned slot = start + i;
> unsigned desc_slot = si_get_sampler_slot(slot);
>
> if (!sstates[i] ||
> sstates[i] == samplers->sampler_states[slot])
> continue;
>
More information about the mesa-dev
mailing list