mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-11-02 13:27:52 +00:00
Merge pull request #574 from Subv/shader_abs_neg
GPU: Perform negation after absolute value in the float shader instructions.
This commit is contained in:
commit
7a0bb406d5
1 changed files with 14 additions and 7 deletions
|
@ -822,21 +822,24 @@ private:
|
||||||
|
|
||||||
switch (opcode->GetType()) {
|
switch (opcode->GetType()) {
|
||||||
case OpCode::Type::Arithmetic: {
|
case OpCode::Type::Arithmetic: {
|
||||||
std::string op_a = instr.alu.negate_a ? "-" : "";
|
std::string op_a = regs.GetRegisterAsFloat(instr.gpr8);
|
||||||
op_a += regs.GetRegisterAsFloat(instr.gpr8);
|
|
||||||
if (instr.alu.abs_a) {
|
if (instr.alu.abs_a) {
|
||||||
op_a = "abs(" + op_a + ')';
|
op_a = "abs(" + op_a + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string op_b = instr.alu.negate_b ? "-" : "";
|
if (instr.alu.negate_a) {
|
||||||
|
op_a = "-(" + op_a + ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string op_b;
|
||||||
|
|
||||||
if (instr.is_b_imm) {
|
if (instr.is_b_imm) {
|
||||||
op_b += GetImmediate19(instr);
|
op_b = GetImmediate19(instr);
|
||||||
} else {
|
} else {
|
||||||
if (instr.is_b_gpr) {
|
if (instr.is_b_gpr) {
|
||||||
op_b += regs.GetRegisterAsFloat(instr.gpr20);
|
op_b = regs.GetRegisterAsFloat(instr.gpr20);
|
||||||
} else {
|
} else {
|
||||||
op_b += regs.GetUniform(instr.cbuf34.index, instr.cbuf34.offset,
|
op_b = regs.GetUniform(instr.cbuf34.index, instr.cbuf34.offset,
|
||||||
GLSLRegister::Type::Float);
|
GLSLRegister::Type::Float);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -845,6 +848,10 @@ private:
|
||||||
op_b = "abs(" + op_b + ')';
|
op_b = "abs(" + op_b + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (instr.alu.negate_b) {
|
||||||
|
op_b = "-(" + op_b + ')';
|
||||||
|
}
|
||||||
|
|
||||||
switch (opcode->GetId()) {
|
switch (opcode->GetId()) {
|
||||||
case OpCode::Id::MOV_C:
|
case OpCode::Id::MOV_C:
|
||||||
case OpCode::Id::MOV_R: {
|
case OpCode::Id::MOV_R: {
|
||||||
|
|
Loading…
Reference in a new issue