mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-08 07:51:19 +12:00
implement shader uint min max instructions
This commit is contained in:
parent
e8c7e9d093
commit
4281f6e0c8
1 changed files with 12 additions and 8 deletions
|
@ -1331,19 +1331,23 @@ static void _emitALUOP2InstructionCode(LatteDecompilerShaderContext* shaderConte
|
||||||
}
|
}
|
||||||
else if( aluInstruction->opcode == ALU_OP2_INST_ADD_INT )
|
else if( aluInstruction->opcode == ALU_OP2_INST_ADD_INT )
|
||||||
_emitALUOperationBinary<LATTE_DECOMPILER_DTYPE_SIGNED_INT>(shaderContext, aluInstruction, " + ");
|
_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
|
// 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);
|
_emitInstructionOutputVariableName(shaderContext, aluInstruction);
|
||||||
if( aluInstruction->opcode == ALU_OP2_INST_MAX_INT )
|
src->add(" = ");
|
||||||
src->add(" = max(");
|
_emitTypeConversionPrefixMSL(shaderContext, opType, outputType);
|
||||||
|
if( aluInstruction->opcode == ALU_OP2_INST_MAX_INT || aluInstruction->opcode == ALU_OP2_INST_MAX_UINT )
|
||||||
|
src->add("max(");
|
||||||
else
|
else
|
||||||
src->add(" = min(");
|
src->add("min(");
|
||||||
_emitTypeConversionPrefixMSL(shaderContext, LATTE_DECOMPILER_DTYPE_SIGNED_INT, outputType);
|
_emitOperandInputCode(shaderContext, aluInstruction, 0, opType);
|
||||||
_emitOperandInputCode(shaderContext, aluInstruction, 0, LATTE_DECOMPILER_DTYPE_SIGNED_INT);
|
|
||||||
src->add(", ");
|
src->add(", ");
|
||||||
_emitOperandInputCode(shaderContext, aluInstruction, 1, LATTE_DECOMPILER_DTYPE_SIGNED_INT);
|
_emitOperandInputCode(shaderContext, aluInstruction, 1, opType);
|
||||||
_emitTypeConversionSuffixMSL(shaderContext, LATTE_DECOMPILER_DTYPE_SIGNED_INT, outputType);
|
_emitTypeConversionSuffixMSL(shaderContext, opType, outputType);
|
||||||
src->add(");" _CRLF);
|
src->add(");" _CRLF);
|
||||||
}
|
}
|
||||||
else if( aluInstruction->opcode == ALU_OP2_INST_SUB_INT )
|
else if( aluInstruction->opcode == ALU_OP2_INST_SUB_INT )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue