diff --git a/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp b/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp index c50c708249..8b93e309a4 100644 --- a/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp +++ b/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp @@ -402,13 +402,13 @@ bool FragmentProgramDecompiler::handle_scb(u32 opcode) case RSX_FP_OPCODE_DP4: SetDst(getFunction(FUNCTION::FUNCTION_DP4)); return true; case RSX_FP_OPCODE_DP2A: SetDst(getFunction(FUNCTION::FUNCTION_DP2A)); return true; case RSX_FP_OPCODE_DST: SetDst("vec4(distance($0, $1))"); return true; - case RSX_FP_OPCODE_REFL: LOG_ERROR(RSX, "Unimplemented SCB instruction: REFL"); return true; // TODO: Is this in the right category? + case RSX_FP_OPCODE_REFL: SetDst(getFunction(FUNCTION::FUNCTION_REFL)); return true; case RSX_FP_OPCODE_EX2: SetDst("exp2($0.xxxx)"); return true; case RSX_FP_OPCODE_FLR: SetDst("floor($0)"); return true; case RSX_FP_OPCODE_FRC: SetDst(getFunction(FUNCTION::FUNCTION_FRACT)); return true; case RSX_FP_OPCODE_LIT: SetDst("lit_legacy($0)"); return true; case RSX_FP_OPCODE_LIF: SetDst(getFloatTypeName(4) + "(1.0, $0.y, ($0.y > 0 ? pow(2.0, $0.w) : 0.0), 1.0)"); return true; - case RSX_FP_OPCODE_LRP: LOG_ERROR(RSX, "Unimplemented SCB instruction: LRP"); return true; // TODO: Is this in the right category? + case RSX_FP_OPCODE_LRP: SetDst(getFloatTypeName(4) + "($2 * (1 - $0) + $1 * $0)"); return true; case RSX_FP_OPCODE_LG2: SetDst("log2($0.xxxx)"); return true; case RSX_FP_OPCODE_MAD: SetDst("($0 * $1 + $2)"); return true; case RSX_FP_OPCODE_MAX: SetDst("max($0, $1)"); return true; diff --git a/rpcs3/Emu/RSX/Common/ShaderParam.h b/rpcs3/Emu/RSX/Common/ShaderParam.h index d5cb7513b6..4060a25bee 100644 --- a/rpcs3/Emu/RSX/Common/ShaderParam.h +++ b/rpcs3/Emu/RSX/Common/ShaderParam.h @@ -16,6 +16,7 @@ enum class FUNCTION { FUNCTION_FRACT, FUNCTION_DFDX, FUNCTION_DFDY, + FUNCTION_REFL, FUNCTION_TEXTURE_SAMPLE1D, FUNCTION_TEXTURE_SAMPLE1D_PROJ, FUNCTION_TEXTURE_SAMPLE1D_LOD, diff --git a/rpcs3/Emu/RSX/D3D12/D3D12CommonDecompiler.cpp b/rpcs3/Emu/RSX/D3D12/D3D12CommonDecompiler.cpp index 1280bab1b0..79add39722 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12CommonDecompiler.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12CommonDecompiler.cpp @@ -42,6 +42,8 @@ std::string getFunctionImp(FUNCTION f) return "float4(1., 1., 1., 1.)"; case FUNCTION::FUNCTION_FRACT: return "frac($0)"; + case FUNCTION::FUNCTION_REFL: + return "($0 - 2.0 * (dot($0, $1)) * $1)"; case FUNCTION::FUNCTION_TEXTURE_SAMPLE1D: return "$t.Sample($tsampler, $0.x)"; case FUNCTION::FUNCTION_TEXTURE_SAMPLE1D_PROJ: diff --git a/rpcs3/Emu/RSX/GL/GLCommonDecompiler.cpp b/rpcs3/Emu/RSX/GL/GLCommonDecompiler.cpp index 90ebd14afb..d2d8daafad 100644 --- a/rpcs3/Emu/RSX/GL/GLCommonDecompiler.cpp +++ b/rpcs3/Emu/RSX/GL/GLCommonDecompiler.cpp @@ -40,6 +40,8 @@ std::string getFunctionImpl(FUNCTION f) return "vec4(1., 1., 1., 1.)"; case FUNCTION::FUNCTION_FRACT: return "fract($0)"; + case FUNCTION::FUNCTION_REFL: + return "vec4($0 - 2.0 * (dot($0, $1)) * $1)"; case FUNCTION::FUNCTION_TEXTURE_SAMPLE1D: return "texture($t, $0.x)"; case FUNCTION::FUNCTION_TEXTURE_SAMPLE1D_PROJ: diff --git a/rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp b/rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp index 6bb454bd53..d5c6c166ef 100644 --- a/rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp +++ b/rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp @@ -43,6 +43,8 @@ namespace vk return "vec4(1., 1., 1., 1.)"; case FUNCTION::FUNCTION_FRACT: return "fract($0)"; + case FUNCTION::FUNCTION_REFL: + return "vec4($0 - 2.0 * (dot($0, $1)) * $1)"; case FUNCTION::FUNCTION_TEXTURE_SAMPLE1D: return "texture($t, $0.x)"; case FUNCTION::FUNCTION_TEXTURE_SAMPLE1D_PROJ: