summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/shader_recompiler/backend/glsl/emit_context.cpp8
-rw-r--r--src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp10
-rw-r--r--src/shader_recompiler/shader_info.h1
3 files changed, 15 insertions, 4 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp
index d0880bdcb..e18f8257e 100644
--- a/src/shader_recompiler/backend/glsl/emit_context.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_context.cpp
@@ -302,9 +302,11 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
302 break; 302 break;
303 case Stage::Compute: 303 case Stage::Compute:
304 stage_name = "cs"; 304 stage_name = "cs";
305 const u32 local_x{std::max(program.workgroup_size[0], 1u)};
306 const u32 local_y{std::max(program.workgroup_size[1], 1u)};
307 const u32 local_z{std::max(program.workgroup_size[2], 1u)};
305 header += fmt::format("layout(local_size_x={},local_size_y={},local_size_z={}) in;", 308 header += fmt::format("layout(local_size_x={},local_size_y={},local_size_z={}) in;",
306 program.workgroup_size[0], program.workgroup_size[1], 309 local_x, local_y, local_z);
307 program.workgroup_size[2]);
308 break; 310 break;
309 } 311 }
310 SetupOutPerVertex(*this, header); 312 SetupOutPerVertex(*this, header);
@@ -346,7 +348,7 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
346} 348}
347 349
348void EmitContext::SetupExtensions() { 350void EmitContext::SetupExtensions() {
349 if (profile.support_gl_texture_shadow_lod) { 351 if (info.uses_shadow_lod && profile.support_gl_texture_shadow_lod) {
350 header += "#extension GL_EXT_texture_shadow_lod : enable\n"; 352 header += "#extension GL_EXT_texture_shadow_lod : enable\n";
351 } 353 }
352 if (info.uses_int64) { 354 if (info.uses_int64) {
diff --git a/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp b/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp
index 10d2822ae..47933df97 100644
--- a/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp
+++ b/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp
@@ -636,7 +636,6 @@ void VisitUsages(Info& info, IR::Inst& inst) {
636 case IR::Opcode::ImageGatherDref: 636 case IR::Opcode::ImageGatherDref:
637 case IR::Opcode::ImageFetch: 637 case IR::Opcode::ImageFetch:
638 case IR::Opcode::ImageQueryDimensions: 638 case IR::Opcode::ImageQueryDimensions:
639 case IR::Opcode::ImageQueryLod:
640 case IR::Opcode::ImageGradient: { 639 case IR::Opcode::ImageGradient: {
641 const TextureType type{inst.Flags<IR::TextureInstInfo>().type}; 640 const TextureType type{inst.Flags<IR::TextureInstInfo>().type};
642 info.uses_sampled_1d |= type == TextureType::Color1D || type == TextureType::ColorArray1D; 641 info.uses_sampled_1d |= type == TextureType::Color1D || type == TextureType::ColorArray1D;
@@ -644,6 +643,15 @@ void VisitUsages(Info& info, IR::Inst& inst) {
644 inst.GetAssociatedPseudoOperation(IR::Opcode::GetSparseFromOp) != nullptr; 643 inst.GetAssociatedPseudoOperation(IR::Opcode::GetSparseFromOp) != nullptr;
645 break; 644 break;
646 } 645 }
646 case IR::Opcode::ImageQueryLod: {
647 const auto flags{inst.Flags<IR::TextureInstInfo>()};
648 const TextureType type{flags.type};
649 info.uses_sampled_1d |= type == TextureType::Color1D || type == TextureType::ColorArray1D;
650 info.uses_shadow_lod |= flags.is_depth != 0;
651 info.uses_sparse_residency |=
652 inst.GetAssociatedPseudoOperation(IR::Opcode::GetSparseFromOp) != nullptr;
653 break;
654 }
647 case IR::Opcode::ImageRead: { 655 case IR::Opcode::ImageRead: {
648 const auto flags{inst.Flags<IR::TextureInstInfo>()}; 656 const auto flags{inst.Flags<IR::TextureInstInfo>()};
649 info.uses_typeless_image_reads |= flags.image_format == ImageFormat::Typeless; 657 info.uses_typeless_image_reads |= flags.image_format == ImageFormat::Typeless;
diff --git a/src/shader_recompiler/shader_info.h b/src/shader_recompiler/shader_info.h
index 7536c9caf..74d7a6a94 100644
--- a/src/shader_recompiler/shader_info.h
+++ b/src/shader_recompiler/shader_info.h
@@ -196,6 +196,7 @@ struct Info {
196 bool uses_int64_bit_atomics{}; 196 bool uses_int64_bit_atomics{};
197 bool uses_global_memory{}; 197 bool uses_global_memory{};
198 bool uses_atomic_image_u32{}; 198 bool uses_atomic_image_u32{};
199 bool uses_shadow_lod{};
199 200
200 IR::Type used_constant_buffer_types{}; 201 IR::Type used_constant_buffer_types{};
201 IR::Type used_storage_buffer_types{}; 202 IR::Type used_storage_buffer_types{};