r600g: simplify instance addr calculation
Use MULHI_UINT instead of the more complex INT_TO_FLT->MUL->TRUNC->FLT_TO_INT
This commit is contained in:
@@ -53,6 +53,7 @@ static inline unsigned int r600_bc_get_num_operands(struct r600_bc *bc, struct r
|
||||
case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE:
|
||||
case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE:
|
||||
case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL:
|
||||
case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT:
|
||||
case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX:
|
||||
case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN:
|
||||
case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE:
|
||||
@@ -102,6 +103,7 @@ static inline unsigned int r600_bc_get_num_operands(struct r600_bc *bc, struct r
|
||||
case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE:
|
||||
case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE:
|
||||
case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL:
|
||||
case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT:
|
||||
case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX:
|
||||
case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN:
|
||||
case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE:
|
||||
@@ -2095,57 +2097,12 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru
|
||||
struct r600_bc_alu alu;
|
||||
|
||||
memset(&alu, 0, sizeof(alu));
|
||||
alu.inst = BC_INST(&bc, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_INT_TO_FLT);
|
||||
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.dst.sel = i + 1;
|
||||
alu.dst.chan = 3;
|
||||
alu.dst.write = 1;
|
||||
alu.last = 1;
|
||||
|
||||
if ((r = r600_bc_add_alu(&bc, &alu))) {
|
||||
r600_bc_clear(&bc);
|
||||
return r;
|
||||
}
|
||||
|
||||
memset(&alu, 0, sizeof(alu));
|
||||
alu.inst = BC_INST(&bc, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL);
|
||||
alu.src[0].sel = i + 1;
|
||||
alu.src[0].chan = 3;
|
||||
|
||||
alu.src[1].sel = V_SQ_ALU_SRC_LITERAL;
|
||||
alu.src[1].value = fui(1.0f / (float)elements[i].instance_divisor);
|
||||
|
||||
alu.dst.sel = i + 1;
|
||||
alu.dst.chan = 3;
|
||||
alu.dst.write = 1;
|
||||
alu.last = 1;
|
||||
|
||||
if ((r = r600_bc_add_alu(&bc, &alu))) {
|
||||
r600_bc_clear(&bc);
|
||||
return r;
|
||||
}
|
||||
|
||||
memset(&alu, 0, sizeof(alu));
|
||||
alu.inst = BC_INST(&bc, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC);
|
||||
alu.src[0].sel = i + 1;
|
||||
alu.src[0].chan = 3;
|
||||
|
||||
alu.dst.sel = i + 1;
|
||||
alu.dst.chan = 3;
|
||||
alu.dst.write = 1;
|
||||
alu.last = 1;
|
||||
|
||||
if ((r = r600_bc_add_alu(&bc, &alu))) {
|
||||
r600_bc_clear(&bc);
|
||||
return r;
|
||||
}
|
||||
|
||||
memset(&alu, 0, sizeof(alu));
|
||||
alu.inst = BC_INST(&bc, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT);
|
||||
alu.src[0].sel = i + 1;
|
||||
alu.src[0].chan = 3;
|
||||
alu.src[1].value = (1l << 32) / elements[i].instance_divisor + 1;
|
||||
|
||||
alu.dst.sel = i + 1;
|
||||
alu.dst.chan = 3;
|
||||
|
||||
Reference in New Issue
Block a user