diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2021-09-19 09:38:39 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-19 14:38:39 +0200 |
| commit | f08a280adef015e9a9a0e9273b4edffeb1157f3a (patch) | |
| tree | 26baeacb8b094e77aa0d8cde15073d12e080305a /Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs | |
| parent | 7379bc2f39557929f283a423fe7f4b7390d08261 (diff) | |
Use shader subgroup extensions if shader ballot is not supported (#2627)
* Use shader subgroup extensions if shader ballot is not supported
* Shader cache version bump + cleanup
* The type is still required on the table
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs')
| -rw-r--r-- | Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs index 7b26801a..e29ff486 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs @@ -13,7 +13,17 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl { context.AppendLine("#version 450 core"); context.AppendLine("#extension GL_ARB_gpu_shader_int64 : enable"); - context.AppendLine("#extension GL_ARB_shader_ballot : enable"); + + if (context.Config.GpuAccessor.QueryHostSupportsShaderBallot()) + { + context.AppendLine("#extension GL_ARB_shader_ballot : enable"); + } + else + { + context.AppendLine("#extension GL_KHR_shader_subgroup_basic : enable"); + context.AppendLine("#extension GL_KHR_shader_subgroup_ballot : enable"); + } + context.AppendLine("#extension GL_ARB_shader_group_vote : enable"); context.AppendLine("#extension GL_EXT_shader_image_load_formatted : enable"); context.AppendLine("#extension GL_EXT_texture_shadow_lod : enable"); @@ -531,6 +541,17 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl code = code.Replace("$SHARED_MEM$", DefaultNames.SharedMemoryName); code = code.Replace("$STORAGE_MEM$", OperandManager.GetShaderStagePrefix(context.Config.Stage) + "_" + DefaultNames.StorageNamePrefix); + if (context.Config.GpuAccessor.QueryHostSupportsShaderBallot()) + { + code = code.Replace("$SUBGROUP_INVOCATION$", "gl_SubGroupInvocationARB"); + code = code.Replace("$SUBGROUP_BROADCAST$", "readInvocationARB"); + } + else + { + code = code.Replace("$SUBGROUP_INVOCATION$", "gl_SubgroupInvocationID"); + code = code.Replace("$SUBGROUP_BROADCAST$", "subgroupBroadcast"); + } + context.AppendLine(code); context.AppendLine(); } |
