diff options
author | Rob Clark <[email protected]> | 2013-11-01 10:09:39 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2013-11-01 20:20:29 -0400 |
commit | 83318d6511da580e3b40af7cb0111684b165f315 (patch) | |
tree | beeebad396062ff7983de0c21b69355d27cf4e54 /src/gallium/drivers/freedreno/a3xx | |
parent | a53fe2221c3d48b3b1c8bdf4c2da33fe91ad7cda (diff) |
freedreno/a3xx: allow num_samplers != num_textures
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a3xx')
-rw-r--r-- | src/gallium/drivers/freedreno/a3xx/fd3_emit.c | 109 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a3xx/fd3_util.c | 2 |
2 files changed, 55 insertions, 56 deletions
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c index 47c57133965..b1c0e74a2ee 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c @@ -163,65 +163,64 @@ emit_textures(struct fd_ringbuffer *ring, }; unsigned i, j; - assert(tex->num_samplers == tex->num_textures); // TODO check.. - - if (!tex->num_samplers) - return; - - /* output sampler state: */ - OUT_PKT3(ring, CP_LOAD_STATE, 2 + (2 * tex->num_samplers)); - OUT_RING(ring, CP_LOAD_STATE_0_DST_OFF(tex_off[sb]) | - CP_LOAD_STATE_0_STATE_SRC(SS_DIRECT) | - CP_LOAD_STATE_0_STATE_BLOCK(sb) | - CP_LOAD_STATE_0_NUM_UNIT(tex->num_samplers)); - 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]); - OUT_RING(ring, sampler->texsamp0); - OUT_RING(ring, sampler->texsamp1); - } - - /* emit texture state: */ - OUT_PKT3(ring, CP_LOAD_STATE, 2 + (4 * tex->num_textures)); - OUT_RING(ring, CP_LOAD_STATE_0_DST_OFF(tex_off[sb]) | - CP_LOAD_STATE_0_STATE_SRC(SS_DIRECT) | - CP_LOAD_STATE_0_STATE_BLOCK(sb) | - CP_LOAD_STATE_0_NUM_UNIT(tex->num_textures)); - 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]); - OUT_RING(ring, view->texconst0); - OUT_RING(ring, view->texconst1); - OUT_RING(ring, view->texconst2 | - A3XX_TEX_CONST_2_INDX(BASETABLE_SZ * i)); - OUT_RING(ring, view->texconst3); + if (tex->num_samplers > 0) { + /* output sampler state: */ + OUT_PKT3(ring, CP_LOAD_STATE, 2 + (2 * tex->num_samplers)); + OUT_RING(ring, CP_LOAD_STATE_0_DST_OFF(tex_off[sb]) | + CP_LOAD_STATE_0_STATE_SRC(SS_DIRECT) | + CP_LOAD_STATE_0_STATE_BLOCK(sb) | + CP_LOAD_STATE_0_NUM_UNIT(tex->num_samplers)); + 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]); + OUT_RING(ring, sampler->texsamp0); + OUT_RING(ring, sampler->texsamp1); + } } - /* emit mipaddrs: */ - OUT_PKT3(ring, CP_LOAD_STATE, 2 + (BASETABLE_SZ * tex->num_textures)); - OUT_RING(ring, CP_LOAD_STATE_0_DST_OFF(BASETABLE_SZ * tex_off[sb]) | - CP_LOAD_STATE_0_STATE_SRC(SS_DIRECT) | - CP_LOAD_STATE_0_STATE_BLOCK(mipaddr[sb]) | - CP_LOAD_STATE_0_NUM_UNIT(BASETABLE_SZ * tex->num_textures)); - 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]); - struct fd_resource *rsc = view->tex_resource; - - for (j = 0; j < view->mipaddrs; j++) { - struct fd_resource_slice *slice = fd_resource_slice(rsc, j); - OUT_RELOC(ring, rsc->bo, slice->offset, 0, 0); + if (tex->num_textures > 0) { + /* emit texture state: */ + OUT_PKT3(ring, CP_LOAD_STATE, 2 + (4 * tex->num_textures)); + OUT_RING(ring, CP_LOAD_STATE_0_DST_OFF(tex_off[sb]) | + CP_LOAD_STATE_0_STATE_SRC(SS_DIRECT) | + CP_LOAD_STATE_0_STATE_BLOCK(sb) | + CP_LOAD_STATE_0_NUM_UNIT(tex->num_textures)); + 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]); + OUT_RING(ring, view->texconst0); + OUT_RING(ring, view->texconst1); + OUT_RING(ring, view->texconst2 | + A3XX_TEX_CONST_2_INDX(BASETABLE_SZ * i)); + OUT_RING(ring, view->texconst3); } - /* pad the remaining entries w/ null: */ - for (; j < BASETABLE_SZ; j++) { - OUT_RING(ring, 0x00000000); + /* emit mipaddrs: */ + OUT_PKT3(ring, CP_LOAD_STATE, 2 + (BASETABLE_SZ * tex->num_textures)); + OUT_RING(ring, CP_LOAD_STATE_0_DST_OFF(BASETABLE_SZ * tex_off[sb]) | + CP_LOAD_STATE_0_STATE_SRC(SS_DIRECT) | + CP_LOAD_STATE_0_STATE_BLOCK(mipaddr[sb]) | + CP_LOAD_STATE_0_NUM_UNIT(BASETABLE_SZ * tex->num_textures)); + 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]); + struct fd_resource *rsc = view->tex_resource; + + for (j = 0; j < view->mipaddrs; j++) { + struct fd_resource_slice *slice = fd_resource_slice(rsc, j); + OUT_RELOC(ring, rsc->bo, slice->offset, 0, 0); + } + + /* pad the remaining entries w/ null: */ + for (; j < BASETABLE_SZ; j++) { + OUT_RING(ring, 0x00000000); + } } } } diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_util.c b/src/gallium/drivers/freedreno/a3xx/fd3_util.c index 21ef43434f9..7503dfefa31 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_util.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_util.c @@ -267,7 +267,7 @@ fd3_pipe2fetchsize(enum pipe_format format) // TODO add more.. default: - return TFETCH_DISABLE; /* save default */ + return TFETCH_DISABLE; /* safe default */ } } |