diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-10-20 19:03:20 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-20 19:03:20 -0300 |
| commit | 2dcc6333f8cbb959293832f52857bdaeab1918bf (patch) | |
| tree | 1aefd3ff6abb23d1a4efc78ee14274283b9041a4 /Ryujinx.Graphics.Shader | |
| parent | 08332bdc041a594d389b0b732b3c4b5f8573e3fb (diff) | |
Fix image binding format (#1625)
* Fix image binding format
* XML doc
Diffstat (limited to 'Ryujinx.Graphics.Shader')
4 files changed, 11 insertions, 11 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs index cd82aa02..08279839 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs @@ -345,14 +345,14 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl string indexedSamplerName = OperandManager.GetSamplerName(context.Config.Stage, texOp, indexExpr); - desc = new TextureDescriptor(indexedSamplerName, texOp.Type, texOp.Handle + index * 2); + desc = new TextureDescriptor(indexedSamplerName, texOp.Type, texOp.Format, texOp.Handle + index * 2); context.TextureDescriptors.Add(desc); } } else { - desc = new TextureDescriptor(samplerName, texOp.Type, texOp.Handle); + desc = new TextureDescriptor(samplerName, texOp.Type, texOp.Format, texOp.Handle); context.TextureDescriptors.Add(desc); } @@ -371,10 +371,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl if (!images.TryAdd(imageName, texOp)) { - // Ensure that all texture operations share the same format. - // This avoid errors like mismatched formats. - texOp.Format = images[imageName].Format; - continue; } @@ -404,14 +400,14 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl string indexedSamplerName = OperandManager.GetSamplerName(context.Config.Stage, texOp, indexExpr); - var desc = new TextureDescriptor(indexedSamplerName, texOp.Type, texOp.Handle + index * 2); + var desc = new TextureDescriptor(indexedSamplerName, texOp.Type, texOp.Format, texOp.Handle + index * 2); context.TextureDescriptors.Add(desc); } } else { - var desc = new TextureDescriptor(imageName, texOp.Type, texOp.Handle); + var desc = new TextureDescriptor(imageName, texOp.Type, texOp.Format, texOp.Handle); context.ImageDescriptors.Add(desc); } diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs index 465356e6..459b60c4 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs @@ -260,7 +260,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl public static string GetImageName(ShaderStage stage, AstTextureOperation texOp, string indexExpr) { - string suffix = texOp.Handle.ToString("X"); + string suffix = texOp.Handle.ToString("X") + "_" + texOp.Format.ToGlslFormat(); if ((texOp.Type & SamplerType.Indexed) != 0) { diff --git a/Ryujinx.Graphics.Shader/StructuredIr/AstTextureOperation.cs b/Ryujinx.Graphics.Shader/StructuredIr/AstTextureOperation.cs index bb935ce7..a3fa3e3a 100644 --- a/Ryujinx.Graphics.Shader/StructuredIr/AstTextureOperation.cs +++ b/Ryujinx.Graphics.Shader/StructuredIr/AstTextureOperation.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr class AstTextureOperation : AstOperation { public SamplerType Type { get; } - public TextureFormat Format { get; set; } + public TextureFormat Format { get; } public TextureFlags Flags { get; } public int Handle { get; } diff --git a/Ryujinx.Graphics.Shader/TextureDescriptor.cs b/Ryujinx.Graphics.Shader/TextureDescriptor.cs index a9900fb8..7c2bd714 100644 --- a/Ryujinx.Graphics.Shader/TextureDescriptor.cs +++ b/Ryujinx.Graphics.Shader/TextureDescriptor.cs @@ -6,6 +6,8 @@ namespace Ryujinx.Graphics.Shader public SamplerType Type { get; } + public TextureFormat Format { get; } + public int HandleIndex { get; } public bool IsBindless { get; } @@ -15,10 +17,11 @@ namespace Ryujinx.Graphics.Shader public TextureUsageFlags Flags { get; set; } - public TextureDescriptor(string name, SamplerType type, int handleIndex) + public TextureDescriptor(string name, SamplerType type, TextureFormat format, int handleIndex) { Name = name; Type = type; + Format = format; HandleIndex = handleIndex; IsBindless = false; @@ -33,6 +36,7 @@ namespace Ryujinx.Graphics.Shader { Name = name; Type = type; + Format = TextureFormat.Unknown; HandleIndex = 0; IsBindless = true; |
