diff options
author | riperiperi <rhy3756547@hotmail.com> | 2023-05-20 14:52:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-20 15:52:26 +0200 |
commit | 69a9de33d37de03693a4a4f6f51aead63b0c6334 (patch) | |
tree | 5382d54803f01c296f404684c4b8fbf20d613ec8 /src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs | |
parent | bba51c2eeb21da09e53caef52163f3e1c7598689 (diff) |
SPIR-V: Only allow implicit LOD sampling on fragment (#5026)1.1.809
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs')
-rw-r--r-- | src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs index 5521fa5c..6da8f29d 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs @@ -1623,7 +1623,19 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv if (hasLodBias) { - lodBias = Src(AggregateType.FP32); + lodBias = Src(AggregateType.FP32); + } + + if (!isGather && !intCoords && !isMultisample && !hasLodLevel && !hasDerivatives && context.Config.Stage != ShaderStage.Fragment) + { + // Implicit LOD is only valid on fragment. + // Use the LOD bias as explicit LOD if available. + + lod = lodBias ?? context.Constant(context.TypeFP32(), 0f); + + lodBias = null; + hasLodBias = false; + hasLodLevel = true; } SpvInstruction compIdx = null; |