summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando S <fsahmkow27@gmail.com>2021-10-30 16:45:58 +0200
committerGitHub <noreply@github.com>2021-10-30 16:45:58 +0200
commit7aa0d97eed750602f7c0745995889f7f00dcb875 (patch)
tree59d43dd5adc1805113544678f02693d518b9f874
parentMerge pull request #6702 from lat9nq/disable-screensaver (diff)
parentemit_spirv_image: Fix depth image implicit lod sample in compute (diff)
downloadyuzu-7aa0d97eed750602f7c0745995889f7f00dcb875.tar
yuzu-7aa0d97eed750602f7c0745995889f7f00dcb875.tar.gz
yuzu-7aa0d97eed750602f7c0745995889f7f00dcb875.tar.bz2
yuzu-7aa0d97eed750602f7c0745995889f7f00dcb875.tar.lz
yuzu-7aa0d97eed750602f7c0745995889f7f00dcb875.tar.xz
yuzu-7aa0d97eed750602f7c0745995889f7f00dcb875.tar.zst
yuzu-7aa0d97eed750602f7c0745995889f7f00dcb875.zip
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_image.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
index 3588f052b..1d5364309 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
@@ -355,11 +355,22 @@ Id EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value&
Id EmitImageSampleDrefImplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index,
Id coords, Id dref, Id bias_lc, const IR::Value& offset) {
const auto info{inst->Flags<IR::TextureInstInfo>()};
- const ImageOperands operands(ctx, info.has_bias != 0, false, info.has_lod_clamp != 0, bias_lc,
- offset);
- return Emit(&EmitContext::OpImageSparseSampleDrefImplicitLod,
- &EmitContext::OpImageSampleDrefImplicitLod, ctx, inst, ctx.F32[1],
- Texture(ctx, info, index), coords, dref, operands.MaskOptional(), operands.Span());
+ if (ctx.stage == Stage::Fragment) {
+ const ImageOperands operands(ctx, info.has_bias != 0, false, info.has_lod_clamp != 0,
+ bias_lc, offset);
+ return Emit(&EmitContext::OpImageSparseSampleDrefImplicitLod,
+ &EmitContext::OpImageSampleDrefImplicitLod, ctx, inst, ctx.F32[1],
+ Texture(ctx, info, index), coords, dref, operands.MaskOptional(),
+ operands.Span());
+ } else {
+ // Implicit lods in compute behave on hardware as if sampling from LOD 0.
+ // This check is to ensure all drivers behave this way.
+ const Id lod{ctx.Const(0.0f)};
+ const ImageOperands operands(ctx, false, true, false, lod, offset);
+ return Emit(&EmitContext::OpImageSparseSampleDrefExplicitLod,
+ &EmitContext::OpImageSampleDrefExplicitLod, ctx, inst, ctx.F32[1],
+ Texture(ctx, info, index), coords, dref, operands.Mask(), operands.Span());
+ }
}
Id EmitImageSampleDrefExplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index,