aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2022-06-23 21:41:57 -0300
committerGitHub <noreply@github.com>2022-06-24 02:41:57 +0200
commite747f5cd836b73661414134b182fc50121e56865 (patch)
treeefaea2ff6ea098ed4f1e0dca35a421020f57ac52 /Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs
parent8aff17a93c27dea7339c20f9cf73535e110ffb72 (diff)
Ensure texture ID is valid before getting texture descriptor (#3406)1.1.154
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs12
1 files changed, 7 insertions, 5 deletions
diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs
index 44ffd687..587d60a7 100644
--- a/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs
+++ b/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs
@@ -579,14 +579,16 @@ namespace Ryujinx.Graphics.Gpu.Shader
textureKey.StageIndex);
int packedId = TextureHandle.ReadPackedId(textureKey.Handle, cachedTextureBuffer, cachedSamplerBuffer);
-
int textureId = TextureHandle.UnpackTextureId(packedId);
- ref readonly Image.TextureDescriptor descriptor = ref pool.GetDescriptorRef(textureId);
-
- if (!MatchesTexture(kv.Value, descriptor))
+ if (pool.IsValidId(textureId))
{
- return false;
+ ref readonly Image.TextureDescriptor descriptor = ref pool.GetDescriptorRef(textureId);
+
+ if (!MatchesTexture(kv.Value, descriptor))
+ {
+ return false;
+ }
}
}
}