summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-09-25 02:38:43 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-10-17 23:09:11 +0200
commit06894b0711aa883773b1e6f62eba70931cda876f (patch)
treeb9a1344115817cdb77ea1d9d16fc015d71405829
parentMerge pull request #7077 from FernandoS27/face-down (diff)
downloadyuzu-06894b0711aa883773b1e6f62eba70931cda876f.tar
yuzu-06894b0711aa883773b1e6f62eba70931cda876f.tar.gz
yuzu-06894b0711aa883773b1e6f62eba70931cda876f.tar.bz2
yuzu-06894b0711aa883773b1e6f62eba70931cda876f.tar.lz
yuzu-06894b0711aa883773b1e6f62eba70931cda876f.tar.xz
yuzu-06894b0711aa883773b1e6f62eba70931cda876f.tar.zst
yuzu-06894b0711aa883773b1e6f62eba70931cda876f.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,