diff options
Diffstat (limited to 'Ryujinx.Graphics.Shader/Instructions')
| -rw-r--r-- | Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs index 7bed3f30..43e5822e 100644 --- a/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs +++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs @@ -879,6 +879,8 @@ namespace Ryujinx.Graphics.Shader.Instructions if (op.IsBindless) { sourcesList.Add(Ra()); + + flags |= TextureFlags.Bindless; } SamplerType type = ConvertSamplerType(op.Dimensions); @@ -1081,6 +1083,24 @@ namespace Ryujinx.Graphics.Shader.Instructions SamplerType type = ConvertSamplerType(op.Dimensions); + bool hasLod = op.LodMode > TextureLodMode.LodZero; + + if (type == SamplerType.Texture1D && (flags & ~TextureFlags.Bindless) == TextureFlags.IntCoords && !(hasLod || + op.HasDepthCompare || + op.HasOffset || + op.IsArray || + op.IsMultisample)) + { + // For bindless, we don't have any way to know the texture type, + // so we assume it's texture buffer when the sampler type is 1D, since that's more common. + bool isTypeBuffer = isBindless || context.Config.GpuAccessor.QueryIsTextureBuffer(op.Immediate); + + if (isTypeBuffer) + { + type = SamplerType.TextureBuffer; + } + } + int coordsCount = type.GetDimensions(); for (int index = 0; index < coordsCount; index++) @@ -1095,8 +1115,6 @@ namespace Ryujinx.Graphics.Shader.Instructions type |= SamplerType.Array; } - bool hasLod = op.LodMode > TextureLodMode.LodZero; - Operand lodValue = hasLod ? Rb() : ConstF(0); Operand packedOffs = op.HasOffset ? Rb() : null; @@ -1110,7 +1128,7 @@ namespace Ryujinx.Graphics.Shader.Instructions if ((op.LodMode == TextureLodMode.LodZero || op.LodMode == TextureLodMode.LodLevel || - op.LodMode == TextureLodMode.LodLevelA) && !op.IsMultisample) + op.LodMode == TextureLodMode.LodLevelA) && !op.IsMultisample && type != SamplerType.TextureBuffer) { sourcesList.Add(lodValue); @@ -1142,16 +1160,6 @@ namespace Ryujinx.Graphics.Shader.Instructions type |= SamplerType.Multisample; } - if (type == SamplerType.Texture1D && flags == TextureFlags.IntCoords && !isBindless) - { - bool isTypeBuffer = context.Config.GpuAccessor.QueryIsTextureBuffer(op.Immediate); - - if (isTypeBuffer) - { - type = SamplerType.TextureBuffer; - } - } - Operand[] sources = sourcesList.ToArray(); int rdIndex = op.Rd.Index; |
