1
0
Fork 0
forked from suyu/suyu

shader_decode: SULD.D -> SINT actually same as UNORM.

This commit is contained in:
namkazy 2020-04-05 15:18:42 +07:00
parent 6f2b7087c2
commit 9f6ebccf06

View file

@ -352,11 +352,13 @@ u32 ShaderIR::DecodeImage(NodeBlock& bb, u32 pc) {
case ComponentType::SNORM: {
is_signed = true;
// range [-1.0, 1.0]
auto cnv_value = Operation(OperationCode::FMul, original_value, Immediate(127.f));
auto cnv_value =
Operation(OperationCode::FMul, original_value, Immediate(127.f));
cnv_value = SignedOperation(OperationCode::ICastFloat, is_signed,
std::move(cnv_value));
return BitfieldExtract(std::move(cnv_value), 0, 8);
}
case ComponentType::SINT:
case ComponentType::UNORM: {
is_signed = false;
// range [0.0, 1.0]
@ -365,9 +367,6 @@ u32 ShaderIR::DecodeImage(NodeBlock& bb, u32 pc) {
return SignedOperation(OperationCode::ICastFloat, is_signed,
std::move(cnv_value));
}
case ComponentType::SINT: // range [-128,127]
is_signed = true;
return original_value;
case ComponentType::UINT: // range [0, 255]
is_signed = false;
return original_value;