SPIR-V: Only allow implicit LOD sampling on fragment (#5026)

This commit is contained in:
riperiperi 2023-05-20 14:52:26 +01:00 committed by GitHub
parent bba51c2eeb
commit 69a9de33d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View file

@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
private const ushort FileFormatVersionMajor = 1; private const ushort FileFormatVersionMajor = 1;
private const ushort FileFormatVersionMinor = 2; private const ushort FileFormatVersionMinor = 2;
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor; private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
private const uint CodeGenVersion = 4578; private const uint CodeGenVersion = 5027;
private const string SharedTocFileName = "shared.toc"; private const string SharedTocFileName = "shared.toc";
private const string SharedDataFileName = "shared.data"; private const string SharedDataFileName = "shared.data";

View file

@ -1623,7 +1623,19 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
if (hasLodBias) 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; SpvInstruction compIdx = null;