summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/spirv
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-03-15 08:54:43 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:23 +0200
commit17a82b56d74afcebaad78ce4754d8ee99ea66f93 (patch)
tree5a4a29a65ee09599daa3b9c4a005070286d6b901 /src/shader_recompiler/backend/spirv
parentshader: Implement CAL inlining function calls (diff)
downloadyuzu-17a82b56d74afcebaad78ce4754d8ee99ea66f93.tar
yuzu-17a82b56d74afcebaad78ce4754d8ee99ea66f93.tar.gz
yuzu-17a82b56d74afcebaad78ce4754d8ee99ea66f93.tar.bz2
yuzu-17a82b56d74afcebaad78ce4754d8ee99ea66f93.tar.lz
yuzu-17a82b56d74afcebaad78ce4754d8ee99ea66f93.tar.xz
yuzu-17a82b56d74afcebaad78ce4754d8ee99ea66f93.tar.zst
yuzu-17a82b56d74afcebaad78ce4754d8ee99ea66f93.zip
Diffstat (limited to 'src/shader_recompiler/backend/spirv')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_image.cpp11
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) {
throw NotImplementedException("Indirect texture sample");
}
+Id Decorate(EmitContext& ctx, IR::Inst* inst, Id sample) {
+ const auto info{inst->Flags<IR::TextureInstInfo>()};
+ if (info.relaxed_precision != 0) {
+ ctx.Decorate(sample, spv::Decoration::RelaxedPrecision);
+ }
+ return sample;
+}
+
template <typename MethodPtrType, typename... Args>
Id Emit(MethodPtrType sparse_ptr, MethodPtrType non_sparse_ptr, EmitContext& ctx, IR::Inst* inst,
Id result_type, Args&&... args) {
IR::Inst* const sparse{inst->GetAssociatedPseudoOperation(IR::Opcode::GetSparseFromOp)};
if (!sparse) {
- return (ctx.*non_sparse_ptr)(result_type, std::forward<Args>(args)...);
+ return Decorate(ctx, inst, (ctx.*non_sparse_ptr)(result_type, std::forward<Args>(args)...));
}
const Id struct_type{ctx.TypeStruct(ctx.U32[1], result_type)};
const Id sample{(ctx.*sparse_ptr)(struct_type, std::forward<Args>(args)...)};
const Id resident_code{ctx.OpCompositeExtract(ctx.U32[1], sample, 0U)};
sparse->SetDefinition(ctx.OpImageSparseTexelsResident(ctx.U1, resident_code));
sparse->Invalidate();
+ Decorate(ctx, inst, sample);
return ctx.OpCompositeExtract(result_type, sample, 1U);
}
} // Anonymous namespace