diff options
| author | 2021-09-24 20:38:43 -0400 | |
|---|---|---|
| committer | 2021-10-17 17:09:11 -0400 | |
| commit | 06894b0711aa883773b1e6f62eba70931cda876f (patch) | |
| tree | b9a1344115817cdb77ea1d9d16fc015d71405829 /src/shader_recompiler/backend/spirv/emit_spirv_image.cpp | |
| parent | Merge pull request #7077 from FernandoS27/face-down (diff) | |
| download | yuzu-06894b0711aa883773b1e6f62eba70931cda876f.tar.gz yuzu-06894b0711aa883773b1e6f62eba70931cda876f.tar.xz yuzu-06894b0711aa883773b1e6f62eba70931cda876f.zip | |
emit_spirv_image: Fix depth image implicit lod sample in compute
Ensures all drivers behave the same way in this case.
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_spirv_image.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv_image.cpp | 21 |
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& | |||
| 355 | Id EmitImageSampleDrefImplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, | 355 | Id EmitImageSampleDrefImplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, |
| 356 | Id coords, Id dref, Id bias_lc, const IR::Value& offset) { | 356 | Id coords, Id dref, Id bias_lc, const IR::Value& offset) { |
| 357 | const auto info{inst->Flags<IR::TextureInstInfo>()}; | 357 | const auto info{inst->Flags<IR::TextureInstInfo>()}; |
| 358 | const ImageOperands operands(ctx, info.has_bias != 0, false, info.has_lod_clamp != 0, bias_lc, | 358 | if (ctx.stage == Stage::Fragment) { |
| 359 | offset); | 359 | const ImageOperands operands(ctx, info.has_bias != 0, false, info.has_lod_clamp != 0, |
| 360 | return Emit(&EmitContext::OpImageSparseSampleDrefImplicitLod, | 360 | bias_lc, offset); |
| 361 | &EmitContext::OpImageSampleDrefImplicitLod, ctx, inst, ctx.F32[1], | 361 | return Emit(&EmitContext::OpImageSparseSampleDrefImplicitLod, |
| 362 | Texture(ctx, info, index), coords, dref, operands.MaskOptional(), operands.Span()); | 362 | &EmitContext::OpImageSampleDrefImplicitLod, ctx, inst, ctx.F32[1], |
| 363 | Texture(ctx, info, index), coords, dref, operands.MaskOptional(), | ||
| 364 | operands.Span()); | ||
| 365 | } else { | ||
| 366 | // Implicit lods in compute behave on hardware as if sampling from LOD 0. | ||
| 367 | // This check is to ensure all drivers behave this way. | ||
| 368 | const Id lod{ctx.Const(0.0f)}; | ||
| 369 | const ImageOperands operands(ctx, false, true, false, lod, offset); | ||
| 370 | return Emit(&EmitContext::OpImageSparseSampleDrefExplicitLod, | ||
| 371 | &EmitContext::OpImageSampleDrefExplicitLod, ctx, inst, ctx.F32[1], | ||
| 372 | Texture(ctx, info, index), coords, dref, operands.Mask(), operands.Span()); | ||
| 373 | } | ||
| 363 | } | 374 | } |
| 364 | 375 | ||
| 365 | Id EmitImageSampleDrefExplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, | 376 | Id EmitImageSampleDrefExplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, |