summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glsl/emit_context.cpp
diff options
context:
space:
mode:
authorGravatar ameerj2021-06-05 02:41:29 -0400
committerGravatar ameerj2021-07-22 21:51:37 -0400
commit421847cf1e33d5b95c9aa272bf3cf69afda3d964 (patch)
treea7fd72bf902697a9a32c18f023b0fb282a7029bf /src/shader_recompiler/backend/glsl/emit_context.cpp
parentglsl: Fix image gather logic (diff)
downloadyuzu-421847cf1e33d5b95c9aa272bf3cf69afda3d964.tar.gz
yuzu-421847cf1e33d5b95c9aa272bf3cf69afda3d964.tar.xz
yuzu-421847cf1e33d5b95c9aa272bf3cf69afda3d964.zip
glsl: Implement image atomics and set layer
along with some more cleanup/oversight fixes
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_context.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_context.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp
index 76cf0bdf0..50a7a7447 100644
--- a/src/shader_recompiler/backend/glsl/emit_context.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_context.cpp
@@ -197,7 +197,7 @@ void SetupOutPerVertex(EmitContext& ctx, std::string& header) {
197 if (ctx.info.stores_clip_distance) { 197 if (ctx.info.stores_clip_distance) {
198 header += "float gl_ClipDistance[];"; 198 header += "float gl_ClipDistance[];";
199 } 199 }
200 if (ctx.info.stores_viewport_index && ctx.profile.support_gl_vertex_viewport_layer && 200 if (ctx.info.stores_viewport_index && ctx.profile.support_viewport_index_layer_non_geometry &&
201 ctx.stage != Stage::Geometry) { 201 ctx.stage != Stage::Geometry) {
202 header += "int gl_ViewportIndex;"; 202 header += "int gl_ViewportIndex;";
203 } 203 }
@@ -314,7 +314,7 @@ void EmitContext::SetupExtensions(std::string&) {
314 header += "#extension GL_ARB_gpu_shader_int64 : enable\n"; 314 header += "#extension GL_ARB_gpu_shader_int64 : enable\n";
315 } 315 }
316 } 316 }
317 if (info.stores_viewport_index && profile.support_gl_vertex_viewport_layer && 317 if (info.stores_viewport_index && profile.support_viewport_index_layer_non_geometry &&
318 stage != Stage::Geometry) { 318 stage != Stage::Geometry) {
319 header += "#extension GL_ARB_shader_viewport_layer_array : enable\n"; 319 header += "#extension GL_ARB_shader_viewport_layer_array : enable\n";
320 } 320 }
@@ -497,12 +497,13 @@ std::string EmitContext::DefineGlobalMemoryFunctions() {
497void EmitContext::SetupImages(Bindings& bindings) { 497void EmitContext::SetupImages(Bindings& bindings) {
498 image_buffer_bindings.reserve(info.image_buffer_descriptors.size()); 498 image_buffer_bindings.reserve(info.image_buffer_descriptors.size());
499 for (const auto& desc : info.image_buffer_descriptors) { 499 for (const auto& desc : info.image_buffer_descriptors) {
500 image_buffer_bindings.push_back(bindings.image);
500 const auto indices{bindings.image + desc.count}; 501 const auto indices{bindings.image + desc.count};
502 const auto format{ImageFormatString(desc.format)};
501 for (u32 index = bindings.image; index < indices; ++index) { 503 for (u32 index = bindings.image; index < indices; ++index) {
502 header += fmt::format("layout(binding={}) uniform uimageBuffer img{};", bindings.image, 504 header += fmt::format("layout(binding={}{}) uniform uimageBuffer img{};",
503 index); 505 bindings.image, format, index);
504 } 506 }
505 image_buffer_bindings.push_back(bindings.image);
506 bindings.image += desc.count; 507 bindings.image += desc.count;
507 } 508 }
508 image_bindings.reserve(info.image_descriptors.size()); 509 image_bindings.reserve(info.image_descriptors.size());