summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2015-04-22 13:07:33 -0400
committerRob Clark <[email protected]>2015-04-22 13:20:28 -0400
commit632ea2a1139f4b228ca55331e411dbae9920c28d (patch)
tree90bf43853f598af9aa8a347a740d10394c6f778b /src/gallium
parent13527df143be1ca6e2f69bf4728f69efaebb3b13 (diff)
freedreno/nir: sysval fixes
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_emit.c2
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c15
2 files changed, 12 insertions, 5 deletions
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c
index 7a244d8a4c5..353873daa05 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c
@@ -302,7 +302,7 @@ fd4_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd4_emit *emit)
for (i = 0; i < vp->inputs_count; i++) {
uint8_t semantic = sem2name(vp->inputs[i].semantic);
- if (semantic == TGSI_SEMANTIC_VERTEXID)
+ if (semantic == TGSI_SEMANTIC_VERTEXID_NOBASE)
vertex_regid = vp->inputs[i].regid;
else if (semantic == TGSI_SEMANTIC_INSTANCEID)
instance_regid = vp->inputs[i].regid;
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
index e5f6c2a5e83..05e7049ad55 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
@@ -1140,6 +1140,7 @@ static void add_sysval_input(struct ir3_compile *ctx, unsigned name,
so->inputs[n].interpolate = TGSI_INTERPOLATE_CONSTANT;
so->total_in++;
+ ctx->block->ninputs = MAX2(ctx->block->ninputs, r + 1);
ctx->block->inputs[r] = instr;
}
@@ -1785,16 +1786,22 @@ emit_instructions(struct ir3_compile *ctx)
unsigned noutputs = exec_list_length(&ctx->s->outputs) * 4;
/* we need to allocate big enough outputs array so that
- * we can stuff the kill's at the end:
+ * we can stuff the kill's at the end. Likewise for vtx
+ * shaders, we need to leave room for sysvals:
*/
- if (ctx->so->type == SHADER_FRAGMENT)
+ if (ctx->so->type == SHADER_FRAGMENT) {
noutputs += ARRAY_SIZE(ctx->kill);
+ } else if (ctx->so->type == SHADER_VERTEX) {
+ ninputs += 8;
+ }
ctx->block = ir3_block_create(ctx->ir, 0, ninputs, noutputs);
- if (ctx->so->type == SHADER_FRAGMENT)
+ if (ctx->so->type == SHADER_FRAGMENT) {
ctx->block->noutputs -= ARRAY_SIZE(ctx->kill);
-
+ } else if (ctx->so->type == SHADER_VERTEX) {
+ ctx->block->ninputs -= 8;
+ }
/* for fragment shader, we have a single input register (usually
* r0.xy) which is used as the base for bary.f varying fetch instrs: