diff options
| author | 2023-01-28 14:39:27 -0500 | |
|---|---|---|
| committer | 2023-01-28 14:39:27 -0500 | |
| commit | c0cedbae94a5c21297c369ed799458526cbf56c2 (patch) | |
| tree | e77b668713a312c08a17c03ecffa028be8fa6fc7 /src/shader_recompiler/backend/glsl | |
| parent | glasm: Add MS sampler types (diff) | |
| download | yuzu-c0cedbae94a5c21297c369ed799458526cbf56c2.tar.gz yuzu-c0cedbae94a5c21297c369ed799458526cbf56c2.tar.xz yuzu-c0cedbae94a5c21297c369ed799458526cbf56c2.zip | |
emit_glsl_image: Fix ImageFetch for MSAA textures
Diffstat (limited to 'src/shader_recompiler/backend/glsl')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | 17 |
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 | ||
| 415 | void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 415 | void 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, |