aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-05-27 06:00:21 -0300
committerGitHub <noreply@github.com>2020-05-27 11:00:21 +0200
commit0b6d206daad7202d4e271118b631feb7dd363bbc (patch)
tree61f5e40728fb77eb2ea4628cb4b94caef86b4a0a /Ryujinx.Graphics.Shader
parentb663cd22c87f13f40e1753bf22bef12d08bf6f3e (diff)
Omit image format if possible, and fix BA bit (#1280)
* Omit image format if possible, and fix BA bit * Match extension name
Diffstat (limited to 'Ryujinx.Graphics.Shader')
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs1
-rw-r--r--Ryujinx.Graphics.Shader/Decoders/OpCodeImage.cs2
-rw-r--r--Ryujinx.Graphics.Shader/IGpuAccessor.cs5
-rw-r--r--Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs7
4 files changed, 14 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
index da902aa3..a45c10c3 100644
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
+++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
@@ -19,6 +19,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
context.AppendLine("#extension GL_ARB_gpu_shader_int64 : enable");
context.AppendLine("#extension GL_ARB_shader_ballot : enable");
context.AppendLine("#extension GL_ARB_shader_group_vote : enable");
+ context.AppendLine("#extension GL_EXT_shader_image_load_formatted : enable");
if (context.Config.Stage == ShaderStage.Compute)
{
diff --git a/Ryujinx.Graphics.Shader/Decoders/OpCodeImage.cs b/Ryujinx.Graphics.Shader/Decoders/OpCodeImage.cs
index 42fe677b..265d45a9 100644
--- a/Ryujinx.Graphics.Shader/Decoders/OpCodeImage.cs
+++ b/Ryujinx.Graphics.Shader/Decoders/OpCodeImage.cs
@@ -37,7 +37,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
Size = (IntegerSize)opCode.Extract(20, 4);
}
- ByteAddress = !opCode.Extract(23);
+ ByteAddress = opCode.Extract(23);
Dimensions = (ImageDimensions)opCode.Extract(33, 3);
diff --git a/Ryujinx.Graphics.Shader/IGpuAccessor.cs b/Ryujinx.Graphics.Shader/IGpuAccessor.cs
index 13281bf0..e10d869b 100644
--- a/Ryujinx.Graphics.Shader/IGpuAccessor.cs
+++ b/Ryujinx.Graphics.Shader/IGpuAccessor.cs
@@ -54,6 +54,11 @@
return 16;
}
+ public bool QuerySupportsImageLoadFormatted()
+ {
+ return true;
+ }
+
public bool QuerySupportsNonConstantTextureOffset()
{
return true;
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs
index af5122be..7bed3f30 100644
--- a/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs
+++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs
@@ -1217,6 +1217,13 @@ namespace Ryujinx.Graphics.Shader.Instructions
private static TextureFormat GetTextureFormat(EmitterContext context, int handle)
{
+ // When the formatted load extension is supported, we don't need to
+ // specify a format, we can just declare it without a format and the GPU will handle it.
+ if (context.Config.GpuAccessor.QuerySupportsImageLoadFormatted())
+ {
+ return TextureFormat.Unknown;
+ }
+
var format = context.Config.GpuAccessor.QueryTextureFormat(handle);
if (format == TextureFormat.Unknown)