diff options
author | riperiperi <rhy3756547@hotmail.com> | 2022-08-02 08:11:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-02 08:11:10 +0200 |
commit | f92650fcffa69cc45899b73e14d3dc7316b05d44 (patch) | |
tree | b21ce8e99d9e728caaf75dd74876ee2c4fe66761 | |
parent | 712361f6e12f3f6e21858ad3a89db3cd94a8be79 (diff) |
SPIR-V: Initialize undefined variables with 0 (#3526)1.1.202
* SPIR-V: Initialize undefined variables with a value
Changes undefined values on spir-v shaders (caused by phi nodes) to be initialized instead of truly undefined.
Fixes an issue with NVIDIA gpus seemingly not liking when a variable is _potentially_ undefined. Not sure about the details at the moment.
Fixes:
- Tilt shift blur effect in Link's Awakening (bottom of the screen)
- Potentially block flickering on newer NVIDIA gpus in Splatoon 2? Needs testing.
Testing is welcome.
* Update Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
-rw-r--r-- | Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs | 2 | ||||
-rw-r--r-- | Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs b/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs index b625835c..d15820b0 100644 --- a/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs +++ b/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs @@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache private const ushort FileFormatVersionMajor = 1; private const ushort FileFormatVersionMinor = 2; private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor; - private const uint CodeGenVersion = 13; + private const uint CodeGenVersion = 14; private const string SharedTocFileName = "shared.toc"; private const string SharedDataFileName = "shared.data"; diff --git a/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs b/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs index 7c402a44..bdd92553 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs @@ -234,7 +234,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv IrOperandType.Constant => GetConstant(type, operand), IrOperandType.ConstantBuffer => GetConstantBuffer(type, operand), IrOperandType.LocalVariable => GetLocal(type, operand), - IrOperandType.Undefined => Undef(GetType(type)), + IrOperandType.Undefined => Constant(GetType(type), 0), _ => throw new ArgumentException($"Invalid operand type \"{operand.Type}\".") }; } |