aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-03-14 21:24:45 -0300
committerGitHub <noreply@github.com>2020-03-15 11:24:45 +1100
commit8bb64ac69c82d55dbb0ef25c472a640fe2d5ba18 (patch)
treefa6e01449e20f0d8834338d5fcaa0b2dcfbe7fc8
parent8ce3993afa222850cb896e9b6bd9303f3a9dc16b (diff)
Improve shader sampler type selection (#989)
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
index 5fcc1b27..c5ac06b3 100644
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
+++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
@@ -254,7 +254,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
{
Dictionary<string, AstTextureOperation> samplers = new Dictionary<string, AstTextureOperation>();
- foreach (AstTextureOperation texOp in info.Samplers.OrderBy(x => x.Handle))
+ // Texture instructions other than TextureSample (like TextureSize)
+ // may have incomplete sampler type information. In those cases,
+ // we prefer instead the more accurate information from the
+ // TextureSample instruction, if both are available.
+ foreach (AstTextureOperation texOp in info.Samplers.OrderBy(x => x.Handle * 2 + (x.Inst == Instruction.TextureSample ? 0 : 1)))
{
string indexExpr = NumberFormatter.FormatInt(texOp.ArraySize);