diff --git a/src/shader_recompiler/frontend/translate/vector_alu.cpp b/src/shader_recompiler/frontend/translate/vector_alu.cpp index 375c5f07..9d0cd8b4 100644 --- a/src/shader_recompiler/frontend/translate/vector_alu.cpp +++ b/src/shader_recompiler/frontend/translate/vector_alu.cpp @@ -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 y_neg_cond{ir.FPLessThan(y, 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 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); } @@ -1090,10 +1090,11 @@ void Translator::V_CUBESC_F32(const GcnInst& inst) { } else { 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 IR::F32 x_sc{ir.Select(x_neg_cond, ir.FPNeg(x), x)}; - const IR::F32 z_sc{ir.Select(z_neg_cond, z, ir.FPNeg(z))}; + const IR::F32 x_sc{ir.Select(x_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); } @@ -1109,10 +1110,10 @@ void Translator::V_CUBETC_F32(const GcnInst& inst) { result = IR::F32{ir.CompositeExtract(coords, 1)}; } else { const auto y_neg_cond{ir.FPLessThan(y, ir.Imm32(0.f))}; - const IR::F32 x_z_sc{ir.FPNeg(y)}; - const IR::F32 y_sc{ir.Select(y_neg_cond, ir.FPNeg(z), z)}; + const IR::F32 x_z_tc{ir.FPNeg(y)}; + 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); } @@ -1122,7 +1123,7 @@ void Translator::V_CUBEMA_F32(const GcnInst& inst) { const auto y = GetSrc(inst.src[1]); const auto z = GetSrc(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 y_major_axis{ir.FPMul(y, two)}; const IR::F32 z_major_axis{ir.FPMul(z, two)};