From 5987bfe607b8606c93f9384d31a727f3170dfa57 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Sat, 24 Feb 2018 01:40:10 +0100 Subject: [PATCH] r600: Take ALU_EXTENDED into account when evaluating jump offsets ALU_EXTENDED needs 4 DWORDS instead of the usual 2, and the jump targets for IF and ELSE branches must be set accordingly. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104654 Signed-off-by: Gert Wollny diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index b49c79c040..ff78238c81 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -10409,6 +10409,7 @@ static int tgsi_else(struct r600_shader_ctx *ctx) static int tgsi_endif(struct r600_shader_ctx *ctx) { + int offset = 2; pops(ctx, 1); if (ctx->bc->fc_stack[ctx->bc->fc_sp - 1].type != FC_IF) { R600_ERR("if/endif unbalanced in shader\n"); @@ -10416,10 +10417,15 @@ static int tgsi_endif(struct r600_shader_ctx *ctx) } if (ctx->bc->fc_stack[ctx->bc->fc_sp - 1].mid == NULL) { + if (ctx->bc->cf_last->eg_alu_extended) + offset += 2; ctx->bc->fc_stack[ctx->bc->fc_sp - 1].start->cf_addr = ctx->bc->cf_last->id + 2; ctx->bc->fc_stack[ctx->bc->fc_sp - 1].start->pop_count = 1; } else { - ctx->bc->fc_stack[ctx->bc->fc_sp - 1].mid[0]->cf_addr = ctx->bc->cf_last->id + 2; + + if (ctx->bc->cf_last->eg_alu_extended) + offset += 2; + ctx->bc->fc_stack[ctx->bc->fc_sp - 1].mid[0]->cf_addr = ctx->bc->cf_last->id + offset; } fc_poplevel(ctx); -- 2.16.1