summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/shader_recompiler/backend/glsl/emit_context.cpp20
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) {
206 header += "out int gl_ViewportIndex;"; 206 header += "out int gl_ViewportIndex;";
207 } 207 }
208} 208}
209
210bool UsesTyplessImage(const Info& info) {
211 for (const auto& desc : info.image_buffer_descriptors) {
212 if (desc.format == ImageFormat::Typeless) {
213 return true;
214 }
215 }
216 for (const auto& desc : info.image_descriptors) {
217 if (desc.format == ImageFormat::Typeless) {
218 return true;
219 }
220 }
221 return false;
222}
209} // Anonymous namespace 223} // Anonymous namespace
210 224
211EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile& profile_, 225EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile& profile_,
@@ -281,8 +295,7 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
281 295
282void EmitContext::SetupExtensions(std::string&) { 296void EmitContext::SetupExtensions(std::string&) {
283 // TODO: track this usage 297 // TODO: track this usage
284 header += "#extension GL_ARB_sparse_texture2 : enable\n" 298 header += "#extension GL_ARB_sparse_texture2 : enable\n";
285 "#extension GL_EXT_shader_image_load_formatted : enable\n";
286 if (profile.support_gl_texture_shadow_lod) { 299 if (profile.support_gl_texture_shadow_lod) {
287 header += "#extension GL_EXT_texture_shadow_lod : enable\n"; 300 header += "#extension GL_EXT_texture_shadow_lod : enable\n";
288 } 301 }
@@ -318,6 +331,9 @@ void EmitContext::SetupExtensions(std::string&) {
318 stage != Stage::Geometry) { 331 stage != Stage::Geometry) {
319 header += "#extension GL_ARB_shader_viewport_layer_array : enable\n"; 332 header += "#extension GL_ARB_shader_viewport_layer_array : enable\n";
320 } 333 }
334 if (UsesTyplessImage(info)) {
335 header += "#extension GL_EXT_shader_image_load_formatted : enable\n";
336 }
321} 337}
322 338
323void EmitContext::DefineConstantBuffers(Bindings& bindings) { 339void EmitContext::DefineConstantBuffers(Bindings& bindings) {