summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2022-03-17 19:45:38 +0100
committerLiam <byteslice@airmail.cc>2022-03-17 19:48:18 +0100
commit3009d0bd7d30b341a8697d85d9d42a9ee4910d19 (patch)
treec00cb183d00f673185e69fa0d4094b34bcabbe12 /src/shader_recompiler/backend/spirv/spirv_emit_context.cpp
parentshader_recompiler: Use functions for indirect const buffer accesses (diff)
downloadyuzu-3009d0bd7d30b341a8697d85d9d42a9ee4910d19.tar
yuzu-3009d0bd7d30b341a8697d85d9d42a9ee4910d19.tar.gz
yuzu-3009d0bd7d30b341a8697d85d9d42a9ee4910d19.tar.bz2
yuzu-3009d0bd7d30b341a8697d85d9d42a9ee4910d19.tar.lz
yuzu-3009d0bd7d30b341a8697d85d9d42a9ee4910d19.tar.xz
yuzu-3009d0bd7d30b341a8697d85d9d42a9ee4910d19.tar.zst
yuzu-3009d0bd7d30b341a8697d85d9d42a9ee4910d19.zip
Diffstat (limited to 'src/shader_recompiler/backend/spirv/spirv_emit_context.cpp')
-rw-r--r--src/shader_recompiler/backend/spirv/spirv_emit_context.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp
index f85541a2e..aa5b6c9b7 100644
--- a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp
+++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp
@@ -994,7 +994,7 @@ void EmitContext::DefineConstantBuffers(const Info& info, u32& binding) {
}
return;
}
- IR::Type types{info.used_constant_buffer_types};
+ IR::Type types{info.used_constant_buffer_types | info.used_indirect_cbuf_types};
if (True(types & IR::Type::U8)) {
if (profile.support_int8) {
DefineConstBuffers(*this, info, &UniformDefinitions::U8, binding, U8, 'u', sizeof(u8));
@@ -1032,7 +1032,6 @@ void EmitContext::DefineConstantBufferIndirectFunctions(const Info& info) {
if (!info.uses_cbuf_indirect) {
return;
}
-
const auto make_accessor{[&](Id buffer_type, Id UniformDefinitions::*member_ptr) {
const Id func_type{TypeFunction(buffer_type, U32[1], U32[1])};
const Id func{OpFunction(buffer_type, spv::FunctionControlMask::MaskNone, func_type)};
@@ -1050,10 +1049,8 @@ void EmitContext::DefineConstantBufferIndirectFunctions(const Info& info) {
buf_labels[i] = OpLabel();
buf_literals[i] = Sirit::Literal{i};
}
-
OpSelectionMerge(merge_label, spv::SelectionControlMask::MaskNone);
OpSwitch(binding, buf_labels[0], buf_literals, buf_labels);
-
for (u32 i = 0; i < Info::MAX_CBUFS; i++) {
AddLabel(buf_labels[i]);
const Id cbuf{cbufs[i].*member_ptr};
@@ -1061,16 +1058,12 @@ void EmitContext::DefineConstantBufferIndirectFunctions(const Info& info) {
const Id result{OpLoad(buffer_type, access_chain)};
OpReturnValue(result);
}
-
AddLabel(merge_label);
OpUnreachable();
OpFunctionEnd();
-
return func;
}};
-
- IR::Type types{info.used_constant_buffer_types};
-
+ IR::Type types{info.used_indirect_cbuf_types};
if (True(types & IR::Type::U8)) {
load_const_func_u8 = make_accessor(U8, &UniformDefinitions::U8);
}