diff options
| author | 2020-04-05 14:46:43 +0700 | |
|---|---|---|
| committer | 2020-04-05 14:46:43 +0700 | |
| commit | 6f2b7087c28cb4fea46485987540f2b9a7a6640d (patch) | |
| tree | a7a5a6f3af49f005b1b5bf014c46003df7daf7bd /src/video_core | |
| parent | clang-format (diff) | |
| download | yuzu-6f2b7087c28cb4fea46485987540f2b9a7a6640d.tar.gz yuzu-6f2b7087c28cb4fea46485987540f2b9a7a6640d.tar.xz yuzu-6f2b7087c28cb4fea46485987540f2b9a7a6640d.zip | |
shader_decode: SULD.D fix decode SNORM component
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/shader/decode/image.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/video_core/shader/decode/image.cpp b/src/video_core/shader/decode/image.cpp index c125674b2..efcf271dc 100644 --- a/src/video_core/shader/decode/image.cpp +++ b/src/video_core/shader/decode/image.cpp | |||
| @@ -350,25 +350,24 @@ u32 ShaderIR::DecodeImage(NodeBlock& bb, u32 pc) { | |||
| 350 | Node converted_value = [&] { | 350 | Node converted_value = [&] { |
| 351 | switch (component_type) { | 351 | switch (component_type) { |
| 352 | case ComponentType::SNORM: { | 352 | case ComponentType::SNORM: { |
| 353 | is_signed = true; | ||
| 353 | // range [-1.0, 1.0] | 354 | // range [-1.0, 1.0] |
| 354 | auto cnv_value = | 355 | auto cnv_value = Operation(OperationCode::FMul, original_value, Immediate(127.f)); |
| 355 | Operation(OperationCode::FAdd, original_value, Immediate(1.f)); | 356 | cnv_value = SignedOperation(OperationCode::ICastFloat, is_signed, |
| 356 | cnv_value = Operation(OperationCode::FMul, std::move(cnv_value), | 357 | std::move(cnv_value)); |
| 357 | Immediate(127.f)); | 358 | return BitfieldExtract(std::move(cnv_value), 0, 8); |
| 358 | is_signed = false; | ||
| 359 | return SignedOperation(OperationCode::ICastFloat, is_signed, | ||
| 360 | std::move(cnv_value)); | ||
| 361 | } | 359 | } |
| 362 | case ComponentType::UNORM: { | 360 | case ComponentType::UNORM: { |
| 361 | is_signed = false; | ||
| 363 | // range [0.0, 1.0] | 362 | // range [0.0, 1.0] |
| 364 | auto cnv_value = | 363 | auto cnv_value = |
| 365 | Operation(OperationCode::FMul, original_value, Immediate(255.f)); | 364 | Operation(OperationCode::FMul, original_value, Immediate(255.f)); |
| 366 | is_signed = false; | ||
| 367 | return SignedOperation(OperationCode::ICastFloat, is_signed, | 365 | return SignedOperation(OperationCode::ICastFloat, is_signed, |
| 368 | std::move(cnv_value)); | 366 | std::move(cnv_value)); |
| 369 | } | 367 | } |
| 370 | case ComponentType::SINT: // range [-128,128] | 368 | case ComponentType::SINT: // range [-128,127] |
| 371 | return Operation(OperationCode::IAdd, original_value, Immediate(128)); | 369 | is_signed = true; |
| 370 | return original_value; | ||
| 372 | case ComponentType::UINT: // range [0, 255] | 371 | case ComponentType::UINT: // range [0, 255] |
| 373 | is_signed = false; | 372 | is_signed = false; |
| 374 | return original_value; | 373 | return original_value; |