summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend/glsl')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_context.cpp10
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp3
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_image.cpp6
3 files changed, 14 insertions, 5 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp
index 8de33b582..2a5ec7414 100644
--- a/src/shader_recompiler/backend/glsl/emit_context.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_context.cpp
@@ -126,6 +126,8 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
126void EmitContext::SetupExtensions(std::string&) { 126void EmitContext::SetupExtensions(std::string&) {
127 // TODO: track this usage 127 // TODO: track this usage
128 header += "#extension GL_ARB_sparse_texture2 : enable\n"; 128 header += "#extension GL_ARB_sparse_texture2 : enable\n";
129 header += "#extension GL_ARB_shader_viewport_layer_array : enable\n";
130 header += "#extension GL_NV_viewport_array2 : enable\n";
129 header += "#extension GL_EXT_texture_shadow_lod : enable\n"; 131 header += "#extension GL_EXT_texture_shadow_lod : enable\n";
130 if (info.uses_int64) { 132 if (info.uses_int64) {
131 header += "#extension GL_ARB_gpu_shader_int64 : enable\n"; 133 header += "#extension GL_ARB_gpu_shader_int64 : enable\n";
@@ -243,9 +245,13 @@ void EmitContext::SetupImages(Bindings& bindings) {
243 } 245 }
244 texture_buffer_bindings.reserve(info.texture_buffer_descriptors.size()); 246 texture_buffer_bindings.reserve(info.texture_buffer_descriptors.size());
245 for (const auto& desc : info.texture_buffer_descriptors) { 247 for (const auto& desc : info.texture_buffer_descriptors) {
246 throw NotImplementedException("TextureType::Buffer");
247
248 texture_buffer_bindings.push_back(bindings.texture); 248 texture_buffer_bindings.push_back(bindings.texture);
249 const auto sampler_type{SamplerType(TextureType::Buffer, false)};
250 const auto indices{bindings.texture + desc.count};
251 for (u32 index = bindings.texture; index < indices; ++index) {
252 header += fmt::format("layout(binding={}) uniform {} tex{};", bindings.texture,
253 sampler_type, index);
254 }
249 bindings.texture += desc.count; 255 bindings.texture += desc.count;
250 } 256 }
251 texture_bindings.reserve(info.texture_descriptors.size()); 257 texture_bindings.reserve(info.texture_descriptors.size());
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
index 8d2abdd94..5f58e781e 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
@@ -186,6 +186,9 @@ void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, std::string_view val
186 case IR::Attribute::PositionW: 186 case IR::Attribute::PositionW:
187 ctx.Add("gl_Position.{}={};", swizzle, value); 187 ctx.Add("gl_Position.{}={};", swizzle, value);
188 break; 188 break;
189 case IR::Attribute::ViewportIndex:
190 ctx.Add("gl_ViewportIndex=floatBitsToInt({});", value);
191 break;
189 case IR::Attribute::ClipDistance0: 192 case IR::Attribute::ClipDistance0:
190 case IR::Attribute::ClipDistance1: 193 case IR::Attribute::ClipDistance1:
191 case IR::Attribute::ClipDistance2: 194 case IR::Attribute::ClipDistance2:
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
index eb427d8b5..f339f4ade 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
@@ -71,7 +71,7 @@ std::string PtpOffsets(const IR::Value& offset, const IR::Value& offset2) {
71 const std::array values{offset.InstRecursive(), offset2.InstRecursive()}; 71 const std::array values{offset.InstRecursive(), offset2.InstRecursive()};
72 if (!values[0]->AreAllArgsImmediates() || !values[1]->AreAllArgsImmediates()) { 72 if (!values[0]->AreAllArgsImmediates() || !values[1]->AreAllArgsImmediates()) {
73 // LOG_WARNING("Not all arguments in PTP are immediate, STUBBING"); 73 // LOG_WARNING("Not all arguments in PTP are immediate, STUBBING");
74 return ""; 74 return "ivec2[](ivec2(0), ivec2(1), ivec2(2), ivec2(3))";
75 } 75 }
76 const IR::Opcode opcode{values[0]->GetOpcode()}; 76 const IR::Opcode opcode{values[0]->GetOpcode()};
77 if (opcode != values[1]->GetOpcode() || opcode != IR::Opcode::CompositeConstructU32x4) { 77 if (opcode != values[1]->GetOpcode() || opcode != IR::Opcode::CompositeConstructU32x4) {
@@ -340,8 +340,8 @@ void EmitImageFetch([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst
340 *sparse_inst, texture, CastToIntVec(coords, info), lod, 340 *sparse_inst, texture, CastToIntVec(coords, info), lod,
341 CastToIntVec(offset, info), texel); 341 CastToIntVec(offset, info), texel);
342 } else { 342 } else {
343 ctx.AddU1("{}=sparseTexelsResidentARB(sparseTexelFetchARB({},{},{},{}));", *sparse_inst, 343 ctx.AddU1("{}=sparseTexelsResidentARB(sparseTexelFetchARB({},{},int({}),{}));",
344 texture, CastToIntVec(coords, info), lod, texel); 344 *sparse_inst, texture, CastToIntVec(coords, info), lod, texel);
345 } 345 }
346} 346}
347 347