From bf826ed9d14b3a3eae0539f90559900acb10f3b3 Mon Sep 17 00:00:00 2001 From: riperiperi Date: Mon, 13 Jun 2022 22:46:17 +0100 Subject: [PATCH] Fix shader specialization fast texture lookup --- Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs index fca13b84d..5ee01ef86 100644 --- a/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs @@ -220,16 +220,18 @@ namespace Ryujinx.Graphics.Gpu.Shader var texBindings = new Box[textures.Count]; var imageBindings = new Box[images.Count]; + int stageIndex = Math.Max(i - 1, 0); // Don't count VertexA for looking up spec state. No-Op for compute. + for (int j = 0; j < textures.Count; j++) { var texture = textures[j]; - texBindings[j] = GetTextureSpecState(i, texture.HandleIndex, texture.CbufSlot); + texBindings[j] = GetTextureSpecState(stageIndex, texture.HandleIndex, texture.CbufSlot); } for (int j = 0; j < images.Count; j++) { var image = images[j]; - imageBindings[j] = GetTextureSpecState(i, image.HandleIndex, image.CbufSlot); + imageBindings[j] = GetTextureSpecState(stageIndex, image.HandleIndex, image.CbufSlot); } _textureByBinding[i] = texBindings;