Module: Mesa Branch: 8.0 Commit: 1c66286bd6915352eb747cb479b5d651c936c8fe URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1c66286bd6915352eb747cb479b5d651c936c8fe
Author: Marek Olšák <[email protected]> Date: Fri Oct 19 21:53:31 2012 +0200 r600g: fix instance divisor on Cayman NOTE: This is a candidate for the stable branches. (cherry picked from commit 836325bf7edd797e02ab0717a05ca5c51aa1ac93) Conflicts: src/gallium/drivers/r600/r600_asm.c --- src/gallium/drivers/r600/r600_asm.c | 54 ++++++++++++++++++++++------------ 1 files changed, 35 insertions(+), 19 deletions(-) diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index f4977fb..b12a8a3 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -2689,7 +2689,7 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru unsigned fetch_resource_start = rctx->chip_class >= EVERGREEN ? 0 : 160; unsigned format, num_format, format_comp, endian; u32 *bytecode; - int i, r; + int i, j, r; /* Vertex element offsets need special handling. If the offset is * bigger than what we can put in the fetch instruction we need to @@ -2708,24 +2708,40 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru for (i = 0; i < ve->count; i++) { if (elements[i].instance_divisor > 1) { - struct r600_bytecode_alu alu; - - memset(&alu, 0, sizeof(alu)); - alu.inst = BC_INST(&bc, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT); - alu.src[0].sel = 0; - alu.src[0].chan = 3; - - alu.src[1].sel = V_SQ_ALU_SRC_LITERAL; - alu.src[1].value = (1ll << 32) / elements[i].instance_divisor + 1; - - alu.dst.sel = i + 1; - alu.dst.chan = 3; - alu.dst.write = 1; - alu.last = 1; - - if ((r = r600_bytecode_add_alu(&bc, &alu))) { - r600_bytecode_clear(&bc); - return r; + if (rctx->chip_class == CAYMAN) { + for (j = 0; j < 4; j++) { + struct r600_bytecode_alu alu; + memset(&alu, 0, sizeof(alu)); + alu.inst = BC_INST(&bc, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT); + alu.src[0].sel = 0; + alu.src[0].chan = 3; + alu.src[1].sel = V_SQ_ALU_SRC_LITERAL; + alu.src[1].value = (1ll << 32) / elements[i].instance_divisor + 1; + alu.dst.sel = i + 1; + alu.dst.chan = j; + alu.dst.write = j == 3; + alu.last = j == 3; + if ((r = r600_bytecode_add_alu(&bc, &alu))) { + r600_bytecode_clear(&bc); + return r; + } + } + } else { + struct r600_bytecode_alu alu; + memset(&alu, 0, sizeof(alu)); + alu.inst = BC_INST(&bc, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT); + alu.src[0].sel = 0; + alu.src[0].chan = 3; + alu.src[1].sel = V_SQ_ALU_SRC_LITERAL; + alu.src[1].value = (1ll << 32) / elements[i].instance_divisor + 1; + alu.dst.sel = i + 1; + alu.dst.chan = 3; + alu.dst.write = 1; + alu.last = 1; + if ((r = r600_bytecode_add_alu(&bc, &alu))) { + r600_bytecode_clear(&bc); + return r; + } } } } _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
