[Mesa-dev] [PATCH 1/3] freedreno: fix bind_sampler_states when hwcso is NULL

Serge Martin edb+mesa at sigluy.net
Sun Dec 6 06:32:15 PST 2015


src/gallium/tests/trivial/compute.c expects samplers to be cleaned
when the samplers list is NULL.
Like in radeon, the function behave like when the number of samplers
parameter is set to 0.
---
 src/gallium/drivers/freedreno/a2xx/fd2_texture.c | 3 +++
 src/gallium/drivers/freedreno/a3xx/fd3_texture.c | 3 +++
 src/gallium/drivers/freedreno/a4xx/fd4_texture.c | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
index 90013e2..85fbfa0 100644
--- a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
@@ -106,6 +106,9 @@ fd2_sampler_states_bind(struct pipe_context *pctx,
 		unsigned shader, unsigned start,
 		unsigned nr, void **hwcso)
 {
+	if (!hwsco)
+		nr = 0;
+
 	if (shader == PIPE_SHADER_FRAGMENT) {
 		struct fd_context *ctx = fd_context(pctx);
 
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
index 99ae99e..1bb41ae 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
@@ -149,6 +149,9 @@ fd3_sampler_states_bind(struct pipe_context *pctx,
 	uint16_t saturate_s = 0, saturate_t = 0, saturate_r = 0;
 	unsigned i;
 
+	if (!hwsco)
+		nr = 0;
+
 	for (i = 0; i < nr; i++) {
 		if (hwcso[i]) {
 			struct fd3_sampler_stateobj *sampler =
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
index 0eba755..70c1727 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
@@ -150,6 +150,9 @@ fd4_sampler_states_bind(struct pipe_context *pctx,
 	uint16_t saturate_s = 0, saturate_t = 0, saturate_r = 0;
 	unsigned i;
 
+	if (!hwsco)
+		nr = 0;
+
 	for (i = 0; i < nr; i++) {
 		if (hwcso[i]) {
 			struct fd4_sampler_stateobj *sampler =
-- 
2.1.0



More information about the mesa-dev mailing list