1
0
Fork 0
forked from suyu/suyu

Merge pull request #3561 from ReinUsesLisp/f2f-conversion

shader/conversion: Fix F2F rounding operations with different sizes
This commit is contained in:
Fernando Sahmkow 2020-03-31 14:45:02 -04:00 committed by GitHub
commit b03c0536ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -138,18 +138,23 @@ u32 ShaderIR::DecodeConversion(NodeBlock& bb, u32 pc) {
value = GetOperandAbsNegFloat(value, instr.conversion.abs_a, instr.conversion.negate_a); value = GetOperandAbsNegFloat(value, instr.conversion.abs_a, instr.conversion.negate_a);
value = [&]() { value = [&] {
if (instr.conversion.src_size != instr.conversion.dst_size) {
// Rounding operations only matter when the source and destination conversion size
// is the same.
return value;
}
switch (instr.conversion.f2f.GetRoundingMode()) { switch (instr.conversion.f2f.GetRoundingMode()) {
case Tegra::Shader::F2fRoundingOp::None: case Tegra::Shader::F2fRoundingOp::None:
return value; return value;
case Tegra::Shader::F2fRoundingOp::Round: case Tegra::Shader::F2fRoundingOp::Round:
return Operation(OperationCode::FRoundEven, PRECISE, value); return Operation(OperationCode::FRoundEven, value);
case Tegra::Shader::F2fRoundingOp::Floor: case Tegra::Shader::F2fRoundingOp::Floor:
return Operation(OperationCode::FFloor, PRECISE, value); return Operation(OperationCode::FFloor, value);
case Tegra::Shader::F2fRoundingOp::Ceil: case Tegra::Shader::F2fRoundingOp::Ceil:
return Operation(OperationCode::FCeil, PRECISE, value); return Operation(OperationCode::FCeil, value);
case Tegra::Shader::F2fRoundingOp::Trunc: case Tegra::Shader::F2fRoundingOp::Trunc:
return Operation(OperationCode::FTrunc, PRECISE, value); return Operation(OperationCode::FTrunc, value);
default: default:
UNIMPLEMENTED_MSG("Unimplemented F2F rounding mode {}", UNIMPLEMENTED_MSG("Unimplemented F2F rounding mode {}",
static_cast<u32>(instr.conversion.f2f.rounding.Value())); static_cast<u32>(instr.conversion.f2f.rounding.Value()));