diff options
author | gdkchan <gab.dark.100@gmail.com> | 2023-07-03 14:29:27 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-03 14:29:27 -0300 |
commit | 1c7a90ef359d9974e5bd257c4d8e9bf526a6966c (patch) | |
tree | 3ab1644927819b90b0aef78ed6749c6434150490 /src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs | |
parent | 3b46bb73f781a011705ecbc8a1d3207dfb145829 (diff) |
Stop identifying shader textures with handle and cbuf, use binding instead (#5266)1.1.952
* Stop identifying shader textures with handle and cbuf, use binding instead
* Remove now unused code
* Consider image operations as having accurate type information too
I don't know why that was not the case before
* Fix missing unscale on InsertCoordNormalization, stop calling SetUsageFlagsForTextureQuery when not needed
* Shader cache version bump
* Change get texture methods to return descriptors created from ResourceManager state
This is required to ensure that reserved textures and images will not be bound as a guest texture/image
* Fix BindlessElimination.SetHandle inserting coords at the wrong place
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs')
-rw-r--r-- | src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs index a53b40b2..9489397b 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs @@ -657,7 +657,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv SpvInstruction value = Src(componentType); - (SpvInstruction imageType, SpvInstruction imageVariable) = context.Images[new TextureMeta(texOp.CbufSlot, texOp.Handle, texOp.Format)]; + (var imageType, var imageVariable) = context.Images[texOp.Binding]; context.Load(imageType, imageVariable); @@ -742,7 +742,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv pCoords = Src(AggregateType.S32); } - var (imageType, imageVariable) = context.Images[new TextureMeta(texOp.CbufSlot, texOp.Handle, texOp.Format)]; + (var imageType, var imageVariable) = context.Images[texOp.Binding]; var image = context.Load(imageType, imageVariable); var imageComponentType = context.GetType(componentType); @@ -829,7 +829,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv var texel = context.CompositeConstruct(context.TypeVector(context.GetType(componentType), ComponentsCount), cElems); - var (imageType, imageVariable) = context.Images[new TextureMeta(texOp.CbufSlot, texOp.Handle, texOp.Format)]; + (var imageType, var imageVariable) = context.Images[texOp.Binding]; var image = context.Load(imageType, imageVariable); @@ -908,9 +908,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv pCoords = Src(AggregateType.FP32); } - var meta = new TextureMeta(texOp.CbufSlot, texOp.Handle, texOp.Format); - - var (_, sampledImageType, sampledImageVariable) = context.Samplers[meta]; + (_, var sampledImageType, var sampledImageVariable) = context.Samplers[texOp.Binding]; var image = context.Load(sampledImageType, sampledImageVariable); @@ -1511,9 +1509,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv var resultType = colorIsVector ? context.TypeVector(context.TypeFP32(), 4) : context.TypeFP32(); - var meta = new TextureMeta(texOp.CbufSlot, texOp.Handle, texOp.Format); - - var (imageType, sampledImageType, sampledImageVariable) = context.Samplers[meta]; + (var imageType, var sampledImageType, var sampledImageVariable) = context.Samplers[texOp.Binding]; var image = context.Load(sampledImageType, sampledImageVariable); @@ -1592,9 +1588,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv context.GetS32(texOp.GetSource(0)); } - var meta = new TextureMeta(texOp.CbufSlot, texOp.Handle, texOp.Format); - - (SpvInstruction imageType, SpvInstruction sampledImageType, SpvInstruction sampledImageVariable) = context.Samplers[meta]; + (var imageType, var sampledImageType, var sampledImageVariable) = context.Samplers[texOp.Binding]; var image = context.Load(sampledImageType, sampledImageVariable); image = context.Image(imageType, image); @@ -1605,7 +1599,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv } else { - var type = context.SamplersTypes[meta]; + var type = context.SamplersTypes[texOp.Binding]; bool hasLod = !type.HasFlag(SamplerType.Multisample) && type != SamplerType.TextureBuffer; int dimensions = (type & SamplerType.Mask) == SamplerType.TextureCube ? 2 : type.GetDimensions(); |