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/Declarations.cs | |
| 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/Declarations.cs')
| -rw-r--r-- | Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs index 56a01264..825564b8 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs @@ -305,24 +305,14 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl string samplerName = OperandManager.GetSamplerName(context.Config.Stage, texOp, indexExpr); - if (!samplers.Add(samplerName)) + if ((texOp.Flags & TextureFlags.Bindless) != 0 || !samplers.Add(samplerName)) { continue; } int firstBinding = -1; - if ((texOp.Flags & TextureFlags.Bindless) != 0) - { - AstOperand operand = texOp.GetSource(0) as AstOperand; - - firstBinding = context.Config.Counts.IncrementTexturesCount(); - - var desc = new TextureDescriptor(firstBinding, texOp.Type, operand.CbufSlot, operand.CbufOffset); - - context.TextureDescriptors.Add(desc); - } - else if ((texOp.Type & SamplerType.Indexed) != 0) + if ((texOp.Type & SamplerType.Indexed) != 0) { for (int index = 0; index < texOp.ArraySize; index++) { @@ -333,7 +323,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl firstBinding = binding; } - var desc = new TextureDescriptor(binding, texOp.Type, texOp.Format, texOp.Handle + index * 2); + var desc = new TextureDescriptor(binding, texOp.Type, texOp.Format, texOp.CbufSlot, texOp.Handle + index * 2); context.TextureDescriptors.Add(desc); } @@ -342,7 +332,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl { firstBinding = context.Config.Counts.IncrementTexturesCount(); - var desc = new TextureDescriptor(firstBinding, texOp.Type, texOp.Format, texOp.Handle); + var desc = new TextureDescriptor(firstBinding, texOp.Type, texOp.Format, texOp.CbufSlot, texOp.Handle); context.TextureDescriptors.Add(desc); } @@ -363,7 +353,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl string imageName = OperandManager.GetImageName(context.Config.Stage, texOp, indexExpr); - if (!images.Add(imageName)) + if ((texOp.Flags & TextureFlags.Bindless) != 0 || !images.Add(imageName)) { continue; } @@ -381,7 +371,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl firstBinding = binding; } - var desc = new TextureDescriptor(binding, texOp.Type, texOp.Format, texOp.Handle + index * 2); + var desc = new TextureDescriptor(binding, texOp.Type, texOp.Format, texOp.CbufSlot, texOp.Handle + index * 2); context.ImageDescriptors.Add(desc); } @@ -390,7 +380,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl { firstBinding = context.Config.Counts.IncrementImagesCount(); - var desc = new TextureDescriptor(firstBinding, texOp.Type, texOp.Format, texOp.Handle); + var desc = new TextureDescriptor(firstBinding, texOp.Type, texOp.Format, texOp.CbufSlot, texOp.Handle); context.ImageDescriptors.Add(desc); } |
