diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-05-27 11:07:10 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-27 16:07:10 +0200 |
| commit | 5795bb15282498b3824a5d15fe1ff78b85a18c23 (patch) | |
| tree | 6d4ee54c218e81fc6efaad279a5b1ade3ca8ec59 /Ryujinx.Graphics.Shader/Instructions | |
| parent | 0b6d206daad7202d4e271118b631feb7dd363bbc (diff) | |
Support separate textures and samplers (#1216)
* Support separate textures and samplers
* Add missing bindless flag, fix SNORM format on buffer textures
* Add missing separation
* Add comments about the new handles
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; |
