From 9d3a4dc656c63bbf25df6913c22af4f35c59ad84 Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Tue, 1 Sep 2026 15:22:52 +0200 Subject: [PATCH] Latte: Fix incorrect signedness of LSHR_INT instruction --- .../LatteDecompilerEmitGLSL.cpp | 13 ++----------- .../LatteDecompilerEmitMSL.cpp | 13 ++----------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitGLSL.cpp b/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitGLSL.cpp index e7ebcf3a..f7af1e4f 100644 --- a/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitGLSL.cpp +++ b/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitGLSL.cpp @@ -1446,18 +1446,9 @@ void _emitALUOP2InstructionCode(LatteDecompilerShaderContext* shaderContext, Lat else if( aluInstruction->opcode == ALU_OP2_INST_LSHL_INT ) _emitALUOperationBinary(shaderContext, aluInstruction, " << "); else if( aluInstruction->opcode == ALU_OP2_INST_LSHR_INT ) - _emitALUOperationBinary(shaderContext, aluInstruction, " >> "); + _emitALUOperationBinary(shaderContext, aluInstruction, " >> "); else if( aluInstruction->opcode == ALU_OP2_INST_ASHR_INT ) - { - _emitInstructionOutputVariableName(shaderContext, aluInstruction); - src->add(" = "); - _emitTypeConversionPrefix(shaderContext, LATTE_DECOMPILER_DTYPE_SIGNED_INT, outputType); - _emitOperandInputCode(shaderContext, aluInstruction, 0, LATTE_DECOMPILER_DTYPE_SIGNED_INT); - src->add(" >> "); - _emitOperandInputCode(shaderContext, aluInstruction, 1, LATTE_DECOMPILER_DTYPE_SIGNED_INT); - _emitTypeConversionSuffix(shaderContext, LATTE_DECOMPILER_DTYPE_SIGNED_INT, outputType); - src->add(";" _CRLF); - } + _emitALUOperationBinary(shaderContext, aluInstruction, " >> "); else if( aluInstruction->opcode == ALU_OP2_INST_SETGT || aluInstruction->opcode == ALU_OP2_INST_SETGE || aluInstruction->opcode == ALU_OP2_INST_SETNE || diff --git a/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitMSL.cpp b/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitMSL.cpp index cb512308..e265ebd1 100644 --- a/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitMSL.cpp +++ b/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitMSL.cpp @@ -1379,18 +1379,9 @@ static void _emitALUOP2InstructionCode(LatteDecompilerShaderContext* shaderConte else if( aluInstruction->opcode == ALU_OP2_INST_LSHL_INT ) _emitALUOperationBinary(shaderContext, aluInstruction, " << "); else if( aluInstruction->opcode == ALU_OP2_INST_LSHR_INT ) - _emitALUOperationBinary(shaderContext, aluInstruction, " >> "); + _emitALUOperationBinary(shaderContext, aluInstruction, " >> "); else if( aluInstruction->opcode == ALU_OP2_INST_ASHR_INT ) - { - _emitInstructionOutputVariableName(shaderContext, aluInstruction); - src->add(" = "); - _emitTypeConversionPrefixMSL(shaderContext, LATTE_DECOMPILER_DTYPE_SIGNED_INT, outputType); - _emitOperandInputCode(shaderContext, aluInstruction, 0, LATTE_DECOMPILER_DTYPE_SIGNED_INT); - src->add(" >> "); - _emitOperandInputCode(shaderContext, aluInstruction, 1, LATTE_DECOMPILER_DTYPE_SIGNED_INT); - _emitTypeConversionSuffixMSL(shaderContext, LATTE_DECOMPILER_DTYPE_SIGNED_INT, outputType); - src->add(";" _CRLF); - } + _emitALUOperationBinary(shaderContext, aluInstruction, " >> "); else if( aluInstruction->opcode == ALU_OP2_INST_SETGT || aluInstruction->opcode == ALU_OP2_INST_SETGE || aluInstruction->opcode == ALU_OP2_INST_SETNE ||