freedreno/nir: sysval fixes

Signed-off-by: Rob Clark <robclark@freedesktop.org>
This commit is contained in:
Rob Clark
2015-04-22 13:07:33 -04:00
parent 13527df143
commit 632ea2a113
2 changed files with 12 additions and 5 deletions

View File

@@ -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;

View File

@@ -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: