diff options
author | Rob Clark <[email protected]> | 2014-06-09 13:34:07 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2014-06-13 15:20:34 -0400 |
commit | 6aeeb706d218be030b39e431e53ec07edb974564 (patch) | |
tree | c49419217048779913bf4230937eb1a6fd2769fd /src/gallium/drivers/freedreno/a3xx/fd3_emit.c | |
parent | 2ea8e2fccfc298e799b47ab172ce0356a7afcd60 (diff) |
freedreno: fix for null textures
Some apps seem to give us a null sampler/view for texture slots which
come before the last used texture slot. In particular 0ad triggers
this.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a3xx/fd3_emit.c')
-rw-r--r-- | src/gallium/drivers/freedreno/a3xx/fd3_emit.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c index c78d5e83a93..4c6b5c15aaa 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c @@ -195,8 +195,10 @@ emit_textures(struct fd_ringbuffer *ring, OUT_RING(ring, CP_LOAD_STATE_1_STATE_TYPE(ST_CONSTANTS) | CP_LOAD_STATE_1_EXT_SRC_ADDR(0)); for (i = 0; i < tex->num_textures; i++) { - struct fd3_pipe_sampler_view *view = - fd3_pipe_sampler_view(tex->textures[i]); + static const struct fd3_pipe_sampler_view dummy_view = {}; + const struct fd3_pipe_sampler_view *view = tex->textures[i] ? + fd3_pipe_sampler_view(tex->textures[i]) : + &dummy_view; OUT_RING(ring, view->texconst0); OUT_RING(ring, view->texconst1); OUT_RING(ring, view->texconst2 | @@ -213,8 +215,10 @@ emit_textures(struct fd_ringbuffer *ring, OUT_RING(ring, CP_LOAD_STATE_1_STATE_TYPE(ST_CONSTANTS) | CP_LOAD_STATE_1_EXT_SRC_ADDR(0)); for (i = 0; i < tex->num_textures; i++) { - struct fd3_pipe_sampler_view *view = - fd3_pipe_sampler_view(tex->textures[i]); + static const struct fd3_pipe_sampler_view dummy_view = {}; + const struct fd3_pipe_sampler_view *view = tex->textures[i] ? + fd3_pipe_sampler_view(tex->textures[i]) : + &dummy_view; struct fd_resource *rsc = view->tex_resource; for (j = 0; j < view->mipaddrs; j++) { |