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_glsl_image.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
index cecdbb9d6..d8874b0cc 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
@@ -414,7 +414,7 @@ void EmitImageGatherDref(EmitContext& ctx, IR::Inst& inst, const IR::Value& inde
414 414
415void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 415void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
416 std::string_view coords, std::string_view offset, std::string_view lod, 416 std::string_view coords, std::string_view offset, std::string_view lod,
417 [[maybe_unused]] std::string_view ms) { 417 std::string_view ms) {
418 const auto info{inst.Flags<IR::TextureInstInfo>()}; 418 const auto info{inst.Flags<IR::TextureInstInfo>()};
419 if (info.has_bias) { 419 if (info.has_bias) {
420 throw NotImplementedException("EmitImageFetch Bias texture samples"); 420 throw NotImplementedException("EmitImageFetch Bias texture samples");
@@ -431,19 +431,24 @@ void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
431 ctx.AddU1("{}=true;", *sparse_inst); 431 ctx.AddU1("{}=true;", *sparse_inst);
432 } 432 }
433 if (!sparse_inst || !supports_sparse) { 433 if (!sparse_inst || !supports_sparse) {
434 if (!offset.empty()) { 434 const auto int_coords{CoordsCastToInt(coords, info)};
435 ctx.Add("{}=texelFetchOffset({},{},int({}),{});", texel, texture, 435 if (!ms.empty()) {
436 CoordsCastToInt(coords, info), lod, CoordsCastToInt(offset, info)); 436 ctx.Add("{}=texelFetch({},{},int({}));", texel, texture, int_coords, ms);
437 } else if (!offset.empty()) {
438 ctx.Add("{}=texelFetchOffset({},{},int({}),{});", texel, texture, int_coords, lod,
439 CoordsCastToInt(offset, info));
437 } else { 440 } else {
438 if (info.type == TextureType::Buffer) { 441 if (info.type == TextureType::Buffer) {
439 ctx.Add("{}=texelFetch({},int({}));", texel, texture, coords); 442 ctx.Add("{}=texelFetch({},int({}));", texel, texture, coords);
440 } else { 443 } else {
441 ctx.Add("{}=texelFetch({},{},int({}));", texel, texture, 444 ctx.Add("{}=texelFetch({},{},int({}));", texel, texture, int_coords, lod);
442 CoordsCastToInt(coords, info), lod);
443 } 445 }
444 } 446 }
445 return; 447 return;
446 } 448 }
449 if (!ms.empty()) {
450 throw NotImplementedException("EmitImageFetch Sparse MSAA samples");
451 }
447 if (!offset.empty()) { 452 if (!offset.empty()) {
448 ctx.AddU1("{}=sparseTexelsResidentARB(sparseTexelFetchOffsetARB({},{},int({}),{},{}));", 453 ctx.AddU1("{}=sparseTexelsResidentARB(sparseTexelFetchOffsetARB({},{},int({}),{},{}));",
449 *sparse_inst, texture, CastToIntVec(coords, info), lod, 454 *sparse_inst, texture, CastToIntVec(coords, info), lod,