gallium/drivers/radeonsi: Add si_bind_sampler_states unbind support

Submitted by Zhu, James on April 6, 2019, 1:07 p.m.

Details

Message ID 1554556043-19137-1-git-send-email-James.Zhu@amd.com
State New
Headers show
Series "gallium/drivers/radeonsi: Add si_bind_sampler_states unbind support" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Zhu, James April 6, 2019, 1:07 p.m.
commit a613607dc3dab2b43884a4e5891aa5939cdcfbe0 will cause segfault
during unbind sampler state. This patch will fix the issue.

Signed-off-by: James Zhu <James.Zhu@amd.com>

---
 src/gallium/drivers/radeonsi/si_descriptors.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

-- 
2.7.4

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 244ba5a..883b91c 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -956,8 +956,11 @@  static void si_bind_sampler_states(struct pipe_context *ctx,
 		unsigned slot = start + i;
 		unsigned desc_slot = si_get_sampler_slot(slot);
 
-		if (!sstates[i] ||
-		    sstates[i] == samplers->sampler_states[slot])
+		if(!sstates) {
+			samplers->sampler_states[slot] = NULL;
+			continue;
+		} else if (!sstates[i] ||
+			sstates[i] == samplers->sampler_states[slot])
 			continue;
 
 #ifdef DEBUG

Comments

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>

Thank you James!

Dieter

Am 06.04.2019 15:07, schrieb Zhu, James:
> commit a613607dc3dab2b43884a4e5891aa5939cdcfbe0 will cause segfault
> during unbind sampler state. This patch will fix the issue.
> 
> Signed-off-by: James Zhu <James.Zhu@amd.com>
> ---
>  src/gallium/drivers/radeonsi/si_descriptors.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c
> b/src/gallium/drivers/radeonsi/si_descriptors.c
> index 244ba5a..883b91c 100644
> --- a/src/gallium/drivers/radeonsi/si_descriptors.c
> +++ b/src/gallium/drivers/radeonsi/si_descriptors.c
> @@ -956,8 +956,11 @@ static void si_bind_sampler_states(struct
> pipe_context *ctx,
>  		unsigned slot = start + i;
>  		unsigned desc_slot = si_get_sampler_slot(slot);
> 
> -		if (!sstates[i] ||
> -		    sstates[i] == samplers->sampler_states[slot])
> +		if(!sstates) {
> +			samplers->sampler_states[slot] = NULL;
> +			continue;
> +		} else if (!sstates[i] ||
> +			sstates[i] == samplers->sampler_states[slot])
>  			continue;
> 
>  #ifdef DEBUG