Mesa (master): freedreno: handle null sampler

Rob Clark robclark at kemper.freedesktop.org
Sun Mar 30 14:35:41 UTC 2014


Module: Mesa
Branch: master
Commit: 92141afd0eda8ac4c3940fdb5682d39a5726e36a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=92141afd0eda8ac4c3940fdb5682d39a5726e36a

Author: Rob Clark <robclark at freedesktop.org>
Date:   Thu Mar 27 14:47:48 2014 -0400

freedreno: handle null sampler

This is something that XA triggers.  In some cases it will only use
SAMP[1] (composite mask) but not SAMP[0] (composite src).

Signed-off-by: Rob Clark <robclark at freedesktop.org>

---

 src/gallium/drivers/freedreno/a2xx/fd2_emit.c |    5 ++++-
 src/gallium/drivers/freedreno/a3xx/fd3_emit.c |    6 ++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c
index 35511ba..d1a586c 100644
--- a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c
@@ -124,13 +124,16 @@ emit_texture(struct fd_ringbuffer *ring, struct fd_context *ctx,
 		struct fd_texture_stateobj *tex, unsigned samp_id, texmask emitted)
 {
 	unsigned const_idx = fd2_get_const_idx(ctx, tex, samp_id);
+	static const struct fd2_sampler_stateobj dummy_sampler = {};
 	struct fd2_sampler_stateobj *sampler;
 	struct fd2_pipe_sampler_view *view;
 
 	if (emitted & (1 << const_idx))
 		return 0;
 
-	sampler = fd2_sampler_stateobj(tex->samplers[samp_id]);
+	sampler = tex->samplers[samp_id] ?
+			fd2_sampler_stateobj(tex->samplers[samp_id]) :
+			&dummy_sampler;
 	view = fd2_pipe_sampler_view(tex->textures[samp_id]);
 
 	OUT_PKT3(ring, CP_SET_CONSTANT, 7);
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
index 619ac1e..365cb37 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
@@ -176,8 +176,10 @@ emit_textures(struct fd_ringbuffer *ring,
 		OUT_RING(ring, CP_LOAD_STATE_1_STATE_TYPE(ST_SHADER) |
 				CP_LOAD_STATE_1_EXT_SRC_ADDR(0));
 		for (i = 0; i < tex->num_samplers; i++) {
-			struct fd3_sampler_stateobj *sampler =
-					fd3_sampler_stateobj(tex->samplers[i]);
+			static const struct fd3_sampler_stateobj dummy_sampler = {};
+			struct fd3_sampler_stateobj *sampler = tex->samplers[i] ?
+					fd3_sampler_stateobj(tex->samplers[i]) :
+					&dummy_sampler;
 			OUT_RING(ring, sampler->texsamp0);
 			OUT_RING(ring, sampler->texsamp1);
 		}




More information about the mesa-commit mailing list