aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-06-23 18:31:14 -0300
committerGitHub <noreply@github.com>2021-06-23 23:31:14 +0200
commitc71ae9c85c70bb2174807e21da16db427097c690 (patch)
treee3424e77a118045937462d3053dd3443817051bf
parentab9d4b862d6ef5bc67cbb1afe0e1f55f24c028fa (diff)
Fix shader texture LOD query (#2397)
-rw-r--r--Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs2
-rw-r--r--Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs6
-rw-r--r--Ryujinx.Graphics.Shader/Translation/Rewriter.cs4
3 files changed, 6 insertions, 6 deletions
diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs
index a4408192..f9ad0ad2 100644
--- a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs
+++ b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs
@@ -36,7 +36,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// <summary>
/// Version of the codegen (to be changed when codegen or guest format change).
/// </summary>
- private const ulong ShaderCodeGenVersion = 2362;
+ private const ulong ShaderCodeGenVersion = 2397;
// Progress reporting helpers
private volatile int _shaderCount;
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs
index 69d3ffb3..b59f0d31 100644
--- a/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs
+++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs
@@ -889,7 +889,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
type,
flags,
handle,
- compIndex,
+ compIndex ^ 1, // The instruction component order is the inverse of GLSL's.
tempDest,
sources);
@@ -897,9 +897,9 @@ namespace Ryujinx.Graphics.Shader.Instructions
tempDest = context.FPMultiply(tempDest, ConstF(256.0f));
- Operand finalValue = context.FPConvertToS32(tempDest);
+ Operand fixedPointValue = context.FPConvertToS32(tempDest);
- context.Copy(dest, finalValue);
+ context.Copy(dest, fixedPointValue);
}
}
}
diff --git a/Ryujinx.Graphics.Shader/Translation/Rewriter.cs b/Ryujinx.Graphics.Shader/Translation/Rewriter.cs
index 912d61f1..84aa7c10 100644
--- a/Ryujinx.Graphics.Shader/Translation/Rewriter.cs
+++ b/Ryujinx.Graphics.Shader/Translation/Rewriter.cs
@@ -155,7 +155,7 @@ namespace Ryujinx.Graphics.Shader.Translation
{
return node;
}
-
+
bool isGather = (texOp.Flags & TextureFlags.Gather) != 0;
bool hasDerivatives = (texOp.Flags & TextureFlags.Derivatives) != 0;
bool intCoords = (texOp.Flags & TextureFlags.IntCoords) != 0;
@@ -360,7 +360,7 @@ namespace Ryujinx.Graphics.Shader.Translation
texOp.Format,
texOp.Flags,
texOp.Handle,
- 1,
+ 0,
lod,
lodSources));