From 8bb64ac69c82d55dbb0ef25c472a640fe2d5ba18 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 14 Mar 2020 21:24:45 -0300 Subject: [PATCH] Improve shader sampler type selection (#989) --- Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 samplers = new Dictionary(); - 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);