mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-01-15 11:25:13 +00:00
hotfix: Fix cube instructions.
This commit is contained in:
parent
62bbad62fc
commit
5810c88c00
|
@ -1069,9 +1069,9 @@ void Translator::V_CUBEID_F32(const GcnInst& inst) {
|
||||||
const auto x_neg_cond{ir.FPLessThan(x, ir.Imm32(0.f))};
|
const auto x_neg_cond{ir.FPLessThan(x, ir.Imm32(0.f))};
|
||||||
const auto y_neg_cond{ir.FPLessThan(y, ir.Imm32(0.f))};
|
const auto y_neg_cond{ir.FPLessThan(y, ir.Imm32(0.f))};
|
||||||
const auto z_neg_cond{ir.FPLessThan(z, ir.Imm32(0.f))};
|
const auto z_neg_cond{ir.FPLessThan(z, ir.Imm32(0.f))};
|
||||||
const IR::F32 x_face{ir.Select(x_neg_cond, ir.Imm32(5.f), ir.Imm32(4.f))};
|
const IR::F32 x_face{ir.Select(x_neg_cond, ir.Imm32(1.f), ir.Imm32(0.f))};
|
||||||
const IR::F32 y_face{ir.Select(y_neg_cond, ir.Imm32(3.f), ir.Imm32(2.f))};
|
const IR::F32 y_face{ir.Select(y_neg_cond, ir.Imm32(3.f), ir.Imm32(2.f))};
|
||||||
const IR::F32 z_face{ir.Select(z_neg_cond, ir.Imm32(1.f), ir.Imm32(0.f))};
|
const IR::F32 z_face{ir.Select(z_neg_cond, ir.Imm32(5.f), ir.Imm32(4.f))};
|
||||||
|
|
||||||
result = SelectCubeResult(x, y, z, x_face, y_face, z_face);
|
result = SelectCubeResult(x, y, z, x_face, y_face, z_face);
|
||||||
}
|
}
|
||||||
|
@ -1090,10 +1090,11 @@ void Translator::V_CUBESC_F32(const GcnInst& inst) {
|
||||||
} else {
|
} else {
|
||||||
const auto x_neg_cond{ir.FPLessThan(x, ir.Imm32(0.f))};
|
const auto x_neg_cond{ir.FPLessThan(x, ir.Imm32(0.f))};
|
||||||
const auto z_neg_cond{ir.FPLessThan(z, ir.Imm32(0.f))};
|
const auto z_neg_cond{ir.FPLessThan(z, ir.Imm32(0.f))};
|
||||||
const IR::F32 x_sc{ir.Select(x_neg_cond, ir.FPNeg(x), x)};
|
const IR::F32 x_sc{ir.Select(x_neg_cond, z, ir.FPNeg(z))};
|
||||||
const IR::F32 z_sc{ir.Select(z_neg_cond, z, ir.FPNeg(z))};
|
const IR::F32 y_sc{x};
|
||||||
|
const IR::F32 z_sc{ir.Select(z_neg_cond, ir.FPNeg(x), x)};
|
||||||
|
|
||||||
result = SelectCubeResult(x, y, z, x_sc, x, z_sc);
|
result = SelectCubeResult(x, y, z, x_sc, y_sc, z_sc);
|
||||||
}
|
}
|
||||||
SetDst(inst.dst[0], result);
|
SetDst(inst.dst[0], result);
|
||||||
}
|
}
|
||||||
|
@ -1109,10 +1110,10 @@ void Translator::V_CUBETC_F32(const GcnInst& inst) {
|
||||||
result = IR::F32{ir.CompositeExtract(coords, 1)};
|
result = IR::F32{ir.CompositeExtract(coords, 1)};
|
||||||
} else {
|
} else {
|
||||||
const auto y_neg_cond{ir.FPLessThan(y, ir.Imm32(0.f))};
|
const auto y_neg_cond{ir.FPLessThan(y, ir.Imm32(0.f))};
|
||||||
const IR::F32 x_z_sc{ir.FPNeg(y)};
|
const IR::F32 x_z_tc{ir.FPNeg(y)};
|
||||||
const IR::F32 y_sc{ir.Select(y_neg_cond, ir.FPNeg(z), z)};
|
const IR::F32 y_tc{ir.Select(y_neg_cond, ir.FPNeg(z), z)};
|
||||||
|
|
||||||
result = SelectCubeResult(x, y, z, x_z_sc, y_sc, x_z_sc);
|
result = SelectCubeResult(x, y, z, x_z_tc, y_tc, x_z_tc);
|
||||||
}
|
}
|
||||||
SetDst(inst.dst[0], result);
|
SetDst(inst.dst[0], result);
|
||||||
}
|
}
|
||||||
|
@ -1122,7 +1123,7 @@ void Translator::V_CUBEMA_F32(const GcnInst& inst) {
|
||||||
const auto y = GetSrc<IR::F32>(inst.src[1]);
|
const auto y = GetSrc<IR::F32>(inst.src[1]);
|
||||||
const auto z = GetSrc<IR::F32>(inst.src[2]);
|
const auto z = GetSrc<IR::F32>(inst.src[2]);
|
||||||
|
|
||||||
const auto two{ir.Imm32(4.f)};
|
const auto two{ir.Imm32(2.f)};
|
||||||
const IR::F32 x_major_axis{ir.FPMul(x, two)};
|
const IR::F32 x_major_axis{ir.FPMul(x, two)};
|
||||||
const IR::F32 y_major_axis{ir.FPMul(y, two)};
|
const IR::F32 y_major_axis{ir.FPMul(y, two)};
|
||||||
const IR::F32 z_major_axis{ir.FPMul(z, two)};
|
const IR::F32 z_major_axis{ir.FPMul(z, two)};
|
||||||
|
|
Loading…
Reference in a new issue