summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authornamkazy <nam.kazt.91@gmail.com>2020-04-05 09:46:43 +0200
committernamkazy <nam.kazt.91@gmail.com>2020-04-05 09:46:43 +0200
commit6f2b7087c28cb4fea46485987540f2b9a7a6640d (patch)
treea7a5a6f3af49f005b1b5bf014c46003df7daf7bd /src/video_core
parentclang-format (diff)
downloadyuzu-6f2b7087c28cb4fea46485987540f2b9a7a6640d.tar
yuzu-6f2b7087c28cb4fea46485987540f2b9a7a6640d.tar.gz
yuzu-6f2b7087c28cb4fea46485987540f2b9a7a6640d.tar.bz2
yuzu-6f2b7087c28cb4fea46485987540f2b9a7a6640d.tar.lz
yuzu-6f2b7087c28cb4fea46485987540f2b9a7a6640d.tar.xz
yuzu-6f2b7087c28cb4fea46485987540f2b9a7a6640d.tar.zst
yuzu-6f2b7087c28cb4fea46485987540f2b9a7a6640d.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/shader/decode/image.cpp19
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) {
Node converted_value = [&] {
switch (component_type) {
case ComponentType::SNORM: {
+ is_signed = true;
// range [-1.0, 1.0]
- auto cnv_value =
- Operation(OperationCode::FAdd, original_value, Immediate(1.f));
- cnv_value = Operation(OperationCode::FMul, std::move(cnv_value),
- Immediate(127.f));
- is_signed = false;
- return SignedOperation(OperationCode::ICastFloat, is_signed,
- std::move(cnv_value));
+ 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::UNORM: {
+ is_signed = false;
// range [0.0, 1.0]
auto cnv_value =
Operation(OperationCode::FMul, original_value, Immediate(255.f));
- is_signed = false;
return SignedOperation(OperationCode::ICastFloat, is_signed,
std::move(cnv_value));
}
- case ComponentType::SINT: // range [-128,128]
- return Operation(OperationCode::IAdd, original_value, Immediate(128));
+ case ComponentType::SINT: // range [-128,127]
+ is_signed = true;
+ return original_value;
case ComponentType::UINT: // range [0, 255]
is_signed = false;
return original_value;