diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs index 5fcc1b277..c5ac06b3d 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);