diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-06-08 00:29:13 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:37 +0200 |
commit | fc0db612abedbba8245f94d03049f65d78819b26 (patch) | |
tree | 57904777ada6b9bf6db9e4108a30b1d0aa99bdd4 | |
parent | glsl: Remove output generic indexing for geometry stage (diff) | |
download | yuzu-fc0db612abedbba8245f94d03049f65d78819b26.tar yuzu-fc0db612abedbba8245f94d03049f65d78819b26.tar.gz yuzu-fc0db612abedbba8245f94d03049f65d78819b26.tar.bz2 yuzu-fc0db612abedbba8245f94d03049f65d78819b26.tar.lz yuzu-fc0db612abedbba8245f94d03049f65d78819b26.tar.xz yuzu-fc0db612abedbba8245f94d03049f65d78819b26.tar.zst yuzu-fc0db612abedbba8245f94d03049f65d78819b26.zip |
-rw-r--r-- | src/shader_recompiler/backend/glsl/emit_context.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp index 50a7a7447..8cbb2ec57 100644 --- a/src/shader_recompiler/backend/glsl/emit_context.cpp +++ b/src/shader_recompiler/backend/glsl/emit_context.cpp @@ -206,6 +206,20 @@ void SetupOutPerVertex(EmitContext& ctx, std::string& header) { header += "out int gl_ViewportIndex;"; } } + +bool UsesTyplessImage(const Info& info) { + for (const auto& desc : info.image_buffer_descriptors) { + if (desc.format == ImageFormat::Typeless) { + return true; + } + } + for (const auto& desc : info.image_descriptors) { + if (desc.format == ImageFormat::Typeless) { + return true; + } + } + return false; +} } // Anonymous namespace EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile& profile_, @@ -281,8 +295,7 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile void EmitContext::SetupExtensions(std::string&) { // TODO: track this usage - header += "#extension GL_ARB_sparse_texture2 : enable\n" - "#extension GL_EXT_shader_image_load_formatted : enable\n"; + header += "#extension GL_ARB_sparse_texture2 : enable\n"; if (profile.support_gl_texture_shadow_lod) { header += "#extension GL_EXT_texture_shadow_lod : enable\n"; } @@ -318,6 +331,9 @@ void EmitContext::SetupExtensions(std::string&) { stage != Stage::Geometry) { header += "#extension GL_ARB_shader_viewport_layer_array : enable\n"; } + if (UsesTyplessImage(info)) { + header += "#extension GL_EXT_shader_image_load_formatted : enable\n"; + } } void EmitContext::DefineConstantBuffers(Bindings& bindings) { |