mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-10 08:51:19 +12:00
Latte: Add support for shader instructions MIN_UINT and MAX_UINT
Seen in the eShop version of Fatal Frame Also made some warnings less spammy since this game seems to trigger it a lot
This commit is contained in:
parent
2065ac5f63
commit
c3e29fb619
6 changed files with 20 additions and 10 deletions
|
@ -1415,19 +1415,23 @@ void _emitALUOP2InstructionCode(LatteDecompilerShaderContext* shaderContext, Lat
|
|||
}
|
||||
else if( aluInstruction->opcode == ALU_OP2_INST_ADD_INT )
|
||||
_emitALUOperationBinary<LATTE_DECOMPILER_DTYPE_SIGNED_INT>(shaderContext, aluInstruction, " + ");
|
||||
else if( aluInstruction->opcode == ALU_OP2_INST_MAX_INT || aluInstruction->opcode == ALU_OP2_INST_MIN_INT )
|
||||
else if( aluInstruction->opcode == ALU_OP2_INST_MAX_INT || aluInstruction->opcode == ALU_OP2_INST_MIN_INT ||
|
||||
aluInstruction->opcode == ALU_OP2_INST_MAX_UINT || aluInstruction->opcode == ALU_OP2_INST_MIN_UINT)
|
||||
{
|
||||
// not verified
|
||||
bool isUnsigned = aluInstruction->opcode == ALU_OP2_INST_MAX_UINT || aluInstruction->opcode == ALU_OP2_INST_MIN_UINT;
|
||||
auto opType = isUnsigned ? LATTE_DECOMPILER_DTYPE_UNSIGNED_INT : LATTE_DECOMPILER_DTYPE_SIGNED_INT;
|
||||
_emitInstructionOutputVariableName(shaderContext, aluInstruction);
|
||||
if( aluInstruction->opcode == ALU_OP2_INST_MAX_INT )
|
||||
src->add(" = max(");
|
||||
src->add(" = ");
|
||||
_emitTypeConversionPrefix(shaderContext, opType, outputType);
|
||||
if( aluInstruction->opcode == ALU_OP2_INST_MAX_INT || aluInstruction->opcode == ALU_OP2_INST_MAX_UINT )
|
||||
src->add("max(");
|
||||
else
|
||||
src->add(" = min(");
|
||||
_emitTypeConversionPrefix(shaderContext, LATTE_DECOMPILER_DTYPE_SIGNED_INT, outputType);
|
||||
_emitOperandInputCode(shaderContext, aluInstruction, 0, LATTE_DECOMPILER_DTYPE_SIGNED_INT);
|
||||
src->add("min(");
|
||||
_emitOperandInputCode(shaderContext, aluInstruction, 0, opType);
|
||||
src->add(", ");
|
||||
_emitOperandInputCode(shaderContext, aluInstruction, 1, LATTE_DECOMPILER_DTYPE_SIGNED_INT);
|
||||
_emitTypeConversionSuffix(shaderContext, LATTE_DECOMPILER_DTYPE_SIGNED_INT, outputType);
|
||||
_emitOperandInputCode(shaderContext, aluInstruction, 1, opType);
|
||||
_emitTypeConversionSuffix(shaderContext, opType, outputType);
|
||||
src->add(");" _CRLF);
|
||||
}
|
||||
else if( aluInstruction->opcode == ALU_OP2_INST_SUB_INT )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue