diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv_image.cpp | 14 |
1 files changed, 9 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 a6cb67b97..6680cf1b3 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp | |||
| @@ -94,6 +94,10 @@ public: | |||
| 94 | return std::span{operands.data(), operands.size()}; | 94 | return std::span{operands.data(), operands.size()}; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | std::optional<spv::ImageOperandsMask> MaskOptional() const noexcept { | ||
| 98 | return mask != spv::ImageOperandsMask{} ? std::make_optional(mask) : std::nullopt; | ||
| 99 | } | ||
| 100 | |||
| 97 | spv::ImageOperandsMask Mask() const noexcept { | 101 | spv::ImageOperandsMask Mask() const noexcept { |
| 98 | return mask; | 102 | return mask; |
| 99 | } | 103 | } |
| @@ -318,7 +322,7 @@ Id EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& | |||
| 318 | bias_lc, offset); | 322 | bias_lc, offset); |
| 319 | return Emit(&EmitContext::OpImageSparseSampleImplicitLod, | 323 | return Emit(&EmitContext::OpImageSparseSampleImplicitLod, |
| 320 | &EmitContext::OpImageSampleImplicitLod, ctx, inst, ctx.F32[4], | 324 | &EmitContext::OpImageSampleImplicitLod, ctx, inst, ctx.F32[4], |
| 321 | Texture(ctx, info, index), coords, operands.Mask(), operands.Span()); | 325 | Texture(ctx, info, index), coords, operands.MaskOptional(), operands.Span()); |
| 322 | } else { | 326 | } else { |
| 323 | // We can't use implicit lods on non-fragment stages on SPIR-V. Maxwell hardware behaves as | 327 | // We can't use implicit lods on non-fragment stages on SPIR-V. Maxwell hardware behaves as |
| 324 | // if the lod was explicitly zero. This may change on Turing with implicit compute | 328 | // if the lod was explicitly zero. This may change on Turing with implicit compute |
| @@ -347,7 +351,7 @@ Id EmitImageSampleDrefImplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Va | |||
| 347 | offset); | 351 | offset); |
| 348 | return Emit(&EmitContext::OpImageSparseSampleDrefImplicitLod, | 352 | return Emit(&EmitContext::OpImageSparseSampleDrefImplicitLod, |
| 349 | &EmitContext::OpImageSampleDrefImplicitLod, ctx, inst, ctx.F32[1], | 353 | &EmitContext::OpImageSampleDrefImplicitLod, ctx, inst, ctx.F32[1], |
| 350 | Texture(ctx, info, index), coords, dref, operands.Mask(), operands.Span()); | 354 | Texture(ctx, info, index), coords, dref, operands.MaskOptional(), operands.Span()); |
| 351 | } | 355 | } |
| 352 | 356 | ||
| 353 | Id EmitImageSampleDrefExplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, | 357 | Id EmitImageSampleDrefExplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, |
| @@ -365,7 +369,7 @@ Id EmitImageGather(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id | |||
| 365 | const ImageOperands operands(ctx, offset, offset2); | 369 | const ImageOperands operands(ctx, offset, offset2); |
| 366 | return Emit(&EmitContext::OpImageSparseGather, &EmitContext::OpImageGather, ctx, inst, | 370 | return Emit(&EmitContext::OpImageSparseGather, &EmitContext::OpImageGather, ctx, inst, |
| 367 | ctx.F32[4], Texture(ctx, info, index), coords, ctx.Const(info.gather_component), | 371 | ctx.F32[4], Texture(ctx, info, index), coords, ctx.Const(info.gather_component), |
| 368 | operands.Mask(), operands.Span()); | 372 | operands.MaskOptional(), operands.Span()); |
| 369 | } | 373 | } |
| 370 | 374 | ||
| 371 | Id EmitImageGatherDref(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, | 375 | Id EmitImageGatherDref(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, |
| @@ -373,7 +377,7 @@ Id EmitImageGatherDref(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, | |||
| 373 | const auto info{inst->Flags<IR::TextureInstInfo>()}; | 377 | const auto info{inst->Flags<IR::TextureInstInfo>()}; |
| 374 | const ImageOperands operands(ctx, offset, offset2); | 378 | const ImageOperands operands(ctx, offset, offset2); |
| 375 | return Emit(&EmitContext::OpImageSparseDrefGather, &EmitContext::OpImageDrefGather, ctx, inst, | 379 | return Emit(&EmitContext::OpImageSparseDrefGather, &EmitContext::OpImageDrefGather, ctx, inst, |
| 376 | ctx.F32[4], Texture(ctx, info, index), coords, dref, operands.Mask(), | 380 | ctx.F32[4], Texture(ctx, info, index), coords, dref, operands.MaskOptional(), |
| 377 | operands.Span()); | 381 | operands.Span()); |
| 378 | } | 382 | } |
| 379 | 383 | ||
| @@ -385,7 +389,7 @@ Id EmitImageFetch(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id c | |||
| 385 | } | 389 | } |
| 386 | const ImageOperands operands(offset, lod, ms); | 390 | const ImageOperands operands(offset, lod, ms); |
| 387 | return Emit(&EmitContext::OpImageSparseFetch, &EmitContext::OpImageFetch, ctx, inst, ctx.F32[4], | 391 | return Emit(&EmitContext::OpImageSparseFetch, &EmitContext::OpImageFetch, ctx, inst, ctx.F32[4], |
| 388 | TextureImage(ctx, info, index), coords, operands.Mask(), operands.Span()); | 392 | TextureImage(ctx, info, index), coords, operands.MaskOptional(), operands.Span()); |
| 389 | } | 393 | } |
| 390 | 394 | ||
| 391 | Id EmitImageQueryDimensions(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id lod) { | 395 | Id EmitImageQueryDimensions(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id lod) { |