diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-11-09 19:35:04 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-09 19:35:04 -0300 |
| commit | 934a78005e75653529c320cf90e78fe6536447c2 (patch) | |
| tree | a0601ef1abfbace3c35c10fb048d2e33447054c2 /Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions | |
| parent | eda6b78894eef3d9dc1e8ea6984e2f5bd319d68e (diff) | |
Simplify logic for bindless texture handling (#1667)
* Simplify logic for bindless texture handling
* Nits
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions')
| -rw-r--r-- | Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs index f10eb101..6244f68b 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs @@ -15,7 +15,13 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions bool isBindless = (texOp.Flags & TextureFlags.Bindless) != 0; - bool isArray = (texOp.Type & SamplerType.Array) != 0; + // TODO: Bindless texture support. For now we just return 0/do nothing. + if (isBindless) + { + return texOp.Inst == Instruction.ImageLoad ? NumberFormatter.FormatFloat(0) : "// imageStore(bindless)"; + } + + bool isArray = (texOp.Type & SamplerType.Array) != 0; bool isIndexed = (texOp.Type & SamplerType.Indexed) != 0; string texCall = texOp.Inst == Instruction.ImageLoad ? "imageLoad" : "imageStore"; @@ -79,7 +85,10 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions flags |= TextureUsageFlags.ResScaleUnsupported; } - context.ImageDescriptors[index] = context.ImageDescriptors[index].SetFlag(flags); + if (!isBindless) + { + context.ImageDescriptors[index] = context.ImageDescriptors[index].SetFlag(flags); + } return vector; } @@ -212,6 +221,12 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions bool isBindless = (texOp.Flags & TextureFlags.Bindless) != 0; + // TODO: Bindless texture support. For now we just return 0. + if (isBindless) + { + return NumberFormatter.FormatFloat(0); + } + bool isIndexed = (texOp.Type & SamplerType.Indexed) != 0; string indexExpr = null; @@ -306,6 +321,12 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions bool isMultisample = (texOp.Type & SamplerType.Multisample) != 0; bool isShadow = (texOp.Type & SamplerType.Shadow) != 0; + // TODO: Bindless texture support. For now we just return 0. + if (isBindless) + { + return NumberFormatter.FormatFloat(0); + } + // This combination is valid, but not available on GLSL. // For now, ignore the LOD level and do a normal sample. // TODO: How to implement it properly? @@ -469,7 +490,10 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions flags |= TextureUsageFlags.ResScaleUnsupported; } - context.TextureDescriptors[index] = context.TextureDescriptors[index].SetFlag(flags); + if (!isBindless) + { + context.TextureDescriptors[index] = context.TextureDescriptors[index].SetFlag(flags); + } } return vector; @@ -572,6 +596,12 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions bool isBindless = (texOp.Flags & TextureFlags.Bindless) != 0; + // TODO: Bindless texture support. For now we just return 0. + if (isBindless) + { + return NumberFormatter.FormatInt(0); + } + bool isIndexed = (texOp.Type & SamplerType.Indexed) != 0; string indexExpr = null; |
