diff options
author | Rob Clark <[email protected]> | 2014-04-22 15:43:51 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2014-04-23 07:32:16 -0400 |
commit | 05b3cea77badffa84ba0fe7b233b2be70239d618 (patch) | |
tree | dc41e031e9b3fcc93066da977115e62a163fb0a6 | |
parent | 34a68345e228b7cbc1bc6909704a89c08bf5368e (diff) |
freedreno/a3xx: fix TOTALATTRTOVS
In cases where varying fetches are optimized away (just pass-through in
vertex shader, but unused in fragment shader) we need to calculate the
correct TOTALATTROVS based on the actual number of varyings fetched,
otherwise lockup.
Signed-off-by: Rob Clark <[email protected]>
4 files changed, 7 insertions, 1 deletions
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c b/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c index fd385d77024..4f8dcc5fe61 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c @@ -2317,12 +2317,14 @@ fd3_compile_shader(struct fd3_shader_variant *so, actual_in = 0; for (i = 0; i < so->inputs_count; i++) { unsigned j, regid = ~0, compmask = 0; + so->inputs[i].ncomp = 0; for (j = 0; j < 4; j++) { struct ir3_instruction *in = inputs[(i*4) + j]; if (in) { compmask |= (1 << j); regid = in->regs[0]->num - j; actual_in++; + so->inputs[i].ncomp++; } } so->inputs[i].regid = regid; diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_compiler_old.c b/src/gallium/drivers/freedreno/a3xx/fd3_compiler_old.c index ee58591fffc..ddb69243c11 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_compiler_old.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_compiler_old.c @@ -1326,6 +1326,7 @@ decl_in(struct fd3_compile_context *ctx, struct tgsi_full_declaration *decl) so->inputs[n].semantic = decl_semantic(&decl->Semantic); so->inputs[n].compmask = (1 << ncomp) - 1; + so->inputs[n].ncomp = ncomp; so->inputs[n].regid = r; so->inputs[n].inloc = ctx->next_inloc; so->inputs[n].bary = true; /* all that is supported */ diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c index b1cf3fd131a..c78d5e83a93 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c @@ -311,6 +311,7 @@ fd3_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd3_vertex_buf *vbufs, uint32_t n) { uint32_t i, j, last = 0; + uint32_t total_in = 0; n = MIN2(n, vp->inputs_count); @@ -343,12 +344,13 @@ fd3_emit_vertex_bufs(struct fd_ringbuffer *ring, A3XX_VFD_DECODE_INSTR_LASTCOMPVALID | COND(switchnext, A3XX_VFD_DECODE_INSTR_SWITCHNEXT)); + total_in += vp->inputs[i].ncomp; j++; } } OUT_PKT0(ring, REG_A3XX_VFD_CONTROL_0, 2); - OUT_RING(ring, A3XX_VFD_CONTROL_0_TOTALATTRTOVS(vp->total_in) | + OUT_RING(ring, A3XX_VFD_CONTROL_0_TOTALATTRTOVS(total_in) | A3XX_VFD_CONTROL_0_PACKETSIZE(2) | A3XX_VFD_CONTROL_0_STRMDECINSTRCNT(j) | A3XX_VFD_CONTROL_0_STRMFETCHINSTRCNT(j)); diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_program.h b/src/gallium/drivers/freedreno/a3xx/fd3_program.h index e0866c1d008..0439d39dbff 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_program.h +++ b/src/gallium/drivers/freedreno/a3xx/fd3_program.h @@ -100,6 +100,7 @@ struct fd3_shader_variant { fd3_semantic semantic; uint8_t regid; uint8_t compmask; + uint8_t ncomp; /* in theory inloc of fs should match outloc of vs: */ uint8_t inloc; uint8_t bary; |