diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-04-25 10:02:18 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-25 23:02:18 +1000 |
| commit | 3cb1fa0e853efc04cc183d3ee75ec1bbe2c845a4 (patch) | |
| tree | cf19d371b99cffdbff03e2f20271927cb7b08bf8 /Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs | |
| parent | a065dc1626d2fa4cb5c7300a1aa8713ffb4f5896 (diff) | |
Implement texture buffers (#1152)
* Implement texture buffers
* Throw NotSupportedException where appropriate
Diffstat (limited to 'Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs')
| -rw-r--r-- | Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs index 4f8100cb..18552d0a 100644 --- a/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs +++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs @@ -376,6 +376,7 @@ namespace Ryujinx.Graphics.Shader.Instructions { case TextureTarget.Texture1DLodZero: sourcesList.Add(Ra()); + sourcesList.Add(ConstF(0)); break; case TextureTarget.Texture2D: @@ -429,11 +430,21 @@ namespace Ryujinx.Graphics.Shader.Instructions flags = ConvertTextureFlags(tldsOp.Target) | TextureFlags.IntCoords; + if (tldsOp.Target == TexelLoadTarget.Texture1DLodZero && context.Config.QueryInfoBool(QueryInfoName.IsTextureBuffer, tldsOp.Immediate)) + { + type = SamplerType.TextureBuffer; + flags &= ~TextureFlags.LodLevel; + } + switch (tldsOp.Target) { case TexelLoadTarget.Texture1DLodZero: sourcesList.Add(Ra()); - sourcesList.Add(Const(0)); + + if (type != SamplerType.TextureBuffer) + { + sourcesList.Add(Const(0)); + } break; case TexelLoadTarget.Texture1DLodLevel: @@ -615,8 +626,7 @@ namespace Ryujinx.Graphics.Shader.Instructions List<Operand> sourcesList = new List<Operand>(); - SamplerType type = ConvertSamplerType(op.Dimensions); - + SamplerType type = ConvertSamplerType(op.Dimensions); TextureFlags flags = TextureFlags.Gather; if (op.Bindless) @@ -1008,6 +1018,16 @@ namespace Ryujinx.Graphics.Shader.Instructions type |= SamplerType.Multisample; } + if (type == SamplerType.Texture1D && flags == TextureFlags.IntCoords && !isBindless) + { + bool isTypeBuffer = context.Config.QueryInfoBool(QueryInfoName.IsTextureBuffer, op.Immediate); + + if (isTypeBuffer) + { + type = SamplerType.TextureBuffer; + } + } + Operand[] sources = sourcesList.ToArray(); int rdIndex = op.Rd.Index; @@ -1190,7 +1210,7 @@ namespace Ryujinx.Graphics.Shader.Instructions return SamplerType.None; } - private static TextureFlags ConvertTextureFlags(Decoders.TextureTarget type) + private static TextureFlags ConvertTextureFlags(TextureTarget type) { switch (type) { |
