From d35ea0e81a102905346eb3393fa6821a787dcc1c Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Tue, 26 Mar 2019 22:06:39 -0700 Subject: [PATCH] interp: Don't write lane 2 on single colorconv. Not that it's valid to use the op with that size anyway. --- Core/MIPS/IR/IRCompVFPU.cpp | 3 ++- Core/MIPS/MIPSIntVFPU.cpp | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Core/MIPS/IR/IRCompVFPU.cpp b/Core/MIPS/IR/IRCompVFPU.cpp index aaeb70be85..1c466f8164 100644 --- a/Core/MIPS/IR/IRCompVFPU.cpp +++ b/Core/MIPS/IR/IRCompVFPU.cpp @@ -1940,8 +1940,9 @@ namespace MIPSComp { void IRFrontend::Comp_ColorConv(MIPSOpcode op) { CONDITIONAL_DISABLE(VFPU_VEC); - if (js.HasUnknownPrefix()) + if (js.HasUnknownPrefix() || !IsPrefixWithinSize(js.prefixS, op) || js.HasTPrefix()) { DISABLE; + } // Vector color conversion // d[N] = ConvertTo16(s[N*2]) | (ConvertTo16(s[N*2+1]) << 16) diff --git a/Core/MIPS/MIPSIntVFPU.cpp b/Core/MIPS/MIPSIntVFPU.cpp index 2728c62daf..91e6e548f0 100644 --- a/Core/MIPS/MIPSIntVFPU.cpp +++ b/Core/MIPS/MIPSIntVFPU.cpp @@ -1045,10 +1045,13 @@ namespace MIPSInt int vd = _VD; int vs = _VS; u32 s[4]; + VectorSize isz = GetVecSize(op); VectorSize sz = V_Quad; ReadVector(reinterpret_cast(s), sz, vs); ApplySwizzleS(reinterpret_cast(s), sz); u16 colors[4]; + // TODO: Invalid swizzle values almost seem to use the last value converted in a + // previous execution of these ops. It's a bit odd. for (int i = 0; i < 4; i++) { u32 in = s[i]; @@ -1086,7 +1089,7 @@ namespace MIPSInt } u32 ov[2] = {(u32)colors[0] | (colors[1] << 16), (u32)colors[2] | (colors[3] << 16)}; ApplyPrefixD(reinterpret_cast(ov), V_Pair); - WriteVector((const float *)ov, V_Pair, vd); + WriteVector((const float *)ov, isz == V_Single ? V_Single : V_Pair, vd); PC += 4; EatPrefixes(); }