diff options
| author | 2022-03-17 14:45:38 -0400 | |
|---|---|---|
| committer | 2022-03-17 14:48:18 -0400 | |
| commit | 3009d0bd7d30b341a8697d85d9d42a9ee4910d19 (patch) | |
| tree | c00cb183d00f673185e69fa0d4094b34bcabbe12 /src/shader_recompiler/backend/spirv/spirv_emit_context.cpp | |
| parent | shader_recompiler: Use functions for indirect const buffer accesses (diff) | |
| download | yuzu-3009d0bd7d30b341a8697d85d9d42a9ee4910d19.tar.gz yuzu-3009d0bd7d30b341a8697d85d9d42a9ee4910d19.tar.xz yuzu-3009d0bd7d30b341a8697d85d9d42a9ee4910d19.zip | |
Address review comments
Diffstat (limited to 'src/shader_recompiler/backend/spirv/spirv_emit_context.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/spirv_emit_context.cpp | 11 |
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) { | |||
| 994 | } | 994 | } |
| 995 | return; | 995 | return; |
| 996 | } | 996 | } |
| 997 | IR::Type types{info.used_constant_buffer_types}; | 997 | IR::Type types{info.used_constant_buffer_types | info.used_indirect_cbuf_types}; |
| 998 | if (True(types & IR::Type::U8)) { | 998 | if (True(types & IR::Type::U8)) { |
| 999 | if (profile.support_int8) { | 999 | if (profile.support_int8) { |
| 1000 | DefineConstBuffers(*this, info, &UniformDefinitions::U8, binding, U8, 'u', sizeof(u8)); | 1000 | DefineConstBuffers(*this, info, &UniformDefinitions::U8, binding, U8, 'u', sizeof(u8)); |
| @@ -1032,7 +1032,6 @@ void EmitContext::DefineConstantBufferIndirectFunctions(const Info& info) { | |||
| 1032 | if (!info.uses_cbuf_indirect) { | 1032 | if (!info.uses_cbuf_indirect) { |
| 1033 | return; | 1033 | return; |
| 1034 | } | 1034 | } |
| 1035 | |||
| 1036 | const auto make_accessor{[&](Id buffer_type, Id UniformDefinitions::*member_ptr) { | 1035 | const auto make_accessor{[&](Id buffer_type, Id UniformDefinitions::*member_ptr) { |
| 1037 | const Id func_type{TypeFunction(buffer_type, U32[1], U32[1])}; | 1036 | const Id func_type{TypeFunction(buffer_type, U32[1], U32[1])}; |
| 1038 | const Id func{OpFunction(buffer_type, spv::FunctionControlMask::MaskNone, func_type)}; | 1037 | const Id func{OpFunction(buffer_type, spv::FunctionControlMask::MaskNone, func_type)}; |
| @@ -1050,10 +1049,8 @@ void EmitContext::DefineConstantBufferIndirectFunctions(const Info& info) { | |||
| 1050 | buf_labels[i] = OpLabel(); | 1049 | buf_labels[i] = OpLabel(); |
| 1051 | buf_literals[i] = Sirit::Literal{i}; | 1050 | buf_literals[i] = Sirit::Literal{i}; |
| 1052 | } | 1051 | } |
| 1053 | |||
| 1054 | OpSelectionMerge(merge_label, spv::SelectionControlMask::MaskNone); | 1052 | OpSelectionMerge(merge_label, spv::SelectionControlMask::MaskNone); |
| 1055 | OpSwitch(binding, buf_labels[0], buf_literals, buf_labels); | 1053 | OpSwitch(binding, buf_labels[0], buf_literals, buf_labels); |
| 1056 | |||
| 1057 | for (u32 i = 0; i < Info::MAX_CBUFS; i++) { | 1054 | for (u32 i = 0; i < Info::MAX_CBUFS; i++) { |
| 1058 | AddLabel(buf_labels[i]); | 1055 | AddLabel(buf_labels[i]); |
| 1059 | const Id cbuf{cbufs[i].*member_ptr}; | 1056 | const Id cbuf{cbufs[i].*member_ptr}; |
| @@ -1061,16 +1058,12 @@ void EmitContext::DefineConstantBufferIndirectFunctions(const Info& info) { | |||
| 1061 | const Id result{OpLoad(buffer_type, access_chain)}; | 1058 | const Id result{OpLoad(buffer_type, access_chain)}; |
| 1062 | OpReturnValue(result); | 1059 | OpReturnValue(result); |
| 1063 | } | 1060 | } |
| 1064 | |||
| 1065 | AddLabel(merge_label); | 1061 | AddLabel(merge_label); |
| 1066 | OpUnreachable(); | 1062 | OpUnreachable(); |
| 1067 | OpFunctionEnd(); | 1063 | OpFunctionEnd(); |
| 1068 | |||
| 1069 | return func; | 1064 | return func; |
| 1070 | }}; | 1065 | }}; |
| 1071 | 1066 | IR::Type types{info.used_indirect_cbuf_types}; | |
| 1072 | IR::Type types{info.used_constant_buffer_types}; | ||
| 1073 | |||
| 1074 | if (True(types & IR::Type::U8)) { | 1067 | if (True(types & IR::Type::U8)) { |
| 1075 | load_const_func_u8 = make_accessor(U8, &UniformDefinitions::U8); | 1068 | load_const_func_u8 = make_accessor(U8, &UniformDefinitions::U8); |
| 1076 | } | 1069 | } |