diff options
| author | 2021-03-15 04:54:43 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:23 -0400 | |
| commit | 17a82b56d74afcebaad78ce4754d8ee99ea66f93 (patch) | |
| tree | 5a4a29a65ee09599daa3b9c4a005070286d6b901 /src/shader_recompiler/backend | |
| parent | shader: Implement CAL inlining function calls (diff) | |
| download | yuzu-17a82b56d74afcebaad78ce4754d8ee99ea66f93.tar.gz yuzu-17a82b56d74afcebaad78ce4754d8ee99ea66f93.tar.xz yuzu-17a82b56d74afcebaad78ce4754d8ee99ea66f93.zip | |
shader: Implement TEXS
Diffstat (limited to 'src/shader_recompiler/backend')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv_image.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp index 5f4783c95..f75152911 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp | |||
| @@ -57,18 +57,27 @@ Id Texture(EmitContext& ctx, const IR::Value& index) { | |||
| 57 | throw NotImplementedException("Indirect texture sample"); | 57 | throw NotImplementedException("Indirect texture sample"); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | Id Decorate(EmitContext& ctx, IR::Inst* inst, Id sample) { | ||
| 61 | const auto info{inst->Flags<IR::TextureInstInfo>()}; | ||
| 62 | if (info.relaxed_precision != 0) { | ||
| 63 | ctx.Decorate(sample, spv::Decoration::RelaxedPrecision); | ||
| 64 | } | ||
| 65 | return sample; | ||
| 66 | } | ||
| 67 | |||
| 60 | template <typename MethodPtrType, typename... Args> | 68 | template <typename MethodPtrType, typename... Args> |
| 61 | Id Emit(MethodPtrType sparse_ptr, MethodPtrType non_sparse_ptr, EmitContext& ctx, IR::Inst* inst, | 69 | Id Emit(MethodPtrType sparse_ptr, MethodPtrType non_sparse_ptr, EmitContext& ctx, IR::Inst* inst, |
| 62 | Id result_type, Args&&... args) { | 70 | Id result_type, Args&&... args) { |
| 63 | IR::Inst* const sparse{inst->GetAssociatedPseudoOperation(IR::Opcode::GetSparseFromOp)}; | 71 | IR::Inst* const sparse{inst->GetAssociatedPseudoOperation(IR::Opcode::GetSparseFromOp)}; |
| 64 | if (!sparse) { | 72 | if (!sparse) { |
| 65 | return (ctx.*non_sparse_ptr)(result_type, std::forward<Args>(args)...); | 73 | return Decorate(ctx, inst, (ctx.*non_sparse_ptr)(result_type, std::forward<Args>(args)...)); |
| 66 | } | 74 | } |
| 67 | const Id struct_type{ctx.TypeStruct(ctx.U32[1], result_type)}; | 75 | const Id struct_type{ctx.TypeStruct(ctx.U32[1], result_type)}; |
| 68 | const Id sample{(ctx.*sparse_ptr)(struct_type, std::forward<Args>(args)...)}; | 76 | const Id sample{(ctx.*sparse_ptr)(struct_type, std::forward<Args>(args)...)}; |
| 69 | const Id resident_code{ctx.OpCompositeExtract(ctx.U32[1], sample, 0U)}; | 77 | const Id resident_code{ctx.OpCompositeExtract(ctx.U32[1], sample, 0U)}; |
| 70 | sparse->SetDefinition(ctx.OpImageSparseTexelsResident(ctx.U1, resident_code)); | 78 | sparse->SetDefinition(ctx.OpImageSparseTexelsResident(ctx.U1, resident_code)); |
| 71 | sparse->Invalidate(); | 79 | sparse->Invalidate(); |
| 80 | Decorate(ctx, inst, sample); | ||
| 72 | return ctx.OpCompositeExtract(result_type, sample, 1U); | 81 | return ctx.OpCompositeExtract(result_type, sample, 1U); |
| 73 | } | 82 | } |
| 74 | } // Anonymous namespace | 83 | } // Anonymous namespace |