diff options
Diffstat (limited to 'src/shader_recompiler/backend/spirv')
3 files changed, 15 insertions, 10 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_atomic.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_atomic.cpp index d3cbb14a9..cb47d253c 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_atomic.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_atomic.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <bit> | ||
| 6 | |||
| 5 | #include "shader_recompiler/backend/spirv/emit_spirv.h" | 7 | #include "shader_recompiler/backend/spirv/emit_spirv.h" |
| 6 | #include "shader_recompiler/backend/spirv/emit_spirv_instructions.h" | 8 | #include "shader_recompiler/backend/spirv/emit_spirv_instructions.h" |
| 7 | #include "shader_recompiler/backend/spirv/spirv_emit_context.h" | 9 | #include "shader_recompiler/backend/spirv/spirv_emit_context.h" |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp index 3c2a5e16f..aa7082978 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <bit> | ||
| 5 | #include <tuple> | 6 | #include <tuple> |
| 6 | #include <utility> | 7 | #include <utility> |
| 7 | 8 | ||
diff --git a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp index 53be98ced..9c83cd2e4 100644 --- a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <array> | 6 | #include <array> |
| 7 | #include <bit> | ||
| 7 | #include <climits> | 8 | #include <climits> |
| 8 | 9 | ||
| 9 | #include <boost/container/static_vector.hpp> | 10 | #include <boost/container/static_vector.hpp> |
| @@ -1042,15 +1043,15 @@ void EmitContext::DefineConstantBufferIndirectFunctions(const Info& info) { | |||
| 1042 | const Id merge_label{OpLabel()}; | 1043 | const Id merge_label{OpLabel()}; |
| 1043 | const Id uniform_type{uniform_types.*member_ptr}; | 1044 | const Id uniform_type{uniform_types.*member_ptr}; |
| 1044 | 1045 | ||
| 1045 | std::array<Id, Info::MAX_CBUFS> buf_labels; | 1046 | std::array<Id, Info::MAX_INDIRECT_CBUFS> buf_labels; |
| 1046 | std::array<Sirit::Literal, Info::MAX_CBUFS> buf_literals; | 1047 | std::array<Sirit::Literal, Info::MAX_INDIRECT_CBUFS> buf_literals; |
| 1047 | for (u32 i = 0; i < Info::MAX_CBUFS; i++) { | 1048 | for (u32 i = 0; i < Info::MAX_INDIRECT_CBUFS; i++) { |
| 1048 | buf_labels[i] = OpLabel(); | 1049 | buf_labels[i] = OpLabel(); |
| 1049 | buf_literals[i] = Sirit::Literal{i}; | 1050 | buf_literals[i] = Sirit::Literal{i}; |
| 1050 | } | 1051 | } |
| 1051 | OpSelectionMerge(merge_label, spv::SelectionControlMask::MaskNone); | 1052 | OpSelectionMerge(merge_label, spv::SelectionControlMask::MaskNone); |
| 1052 | OpSwitch(binding, buf_labels[0], buf_literals, buf_labels); | 1053 | OpSwitch(binding, buf_labels[0], buf_literals, buf_labels); |
| 1053 | for (u32 i = 0; i < Info::MAX_CBUFS; i++) { | 1054 | for (u32 i = 0; i < Info::MAX_INDIRECT_CBUFS; i++) { |
| 1054 | AddLabel(buf_labels[i]); | 1055 | AddLabel(buf_labels[i]); |
| 1055 | const Id cbuf{cbufs[i].*member_ptr}; | 1056 | const Id cbuf{cbufs[i].*member_ptr}; |
| 1056 | const Id access_chain{OpAccessChain(uniform_type, cbuf, u32_zero_value, offset)}; | 1057 | const Id access_chain{OpAccessChain(uniform_type, cbuf, u32_zero_value, offset)}; |
| @@ -1063,22 +1064,23 @@ void EmitContext::DefineConstantBufferIndirectFunctions(const Info& info) { | |||
| 1063 | return func; | 1064 | return func; |
| 1064 | }}; | 1065 | }}; |
| 1065 | IR::Type types{info.used_indirect_cbuf_types}; | 1066 | IR::Type types{info.used_indirect_cbuf_types}; |
| 1066 | if (True(types & IR::Type::U8)) { | 1067 | bool supports_aliasing = profile.support_descriptor_aliasing; |
| 1068 | if (supports_aliasing && True(types & IR::Type::U8)) { | ||
| 1067 | load_const_func_u8 = make_accessor(U8, &UniformDefinitions::U8); | 1069 | load_const_func_u8 = make_accessor(U8, &UniformDefinitions::U8); |
| 1068 | } | 1070 | } |
| 1069 | if (True(types & IR::Type::U16)) { | 1071 | if (supports_aliasing && True(types & IR::Type::U16)) { |
| 1070 | load_const_func_u16 = make_accessor(U16, &UniformDefinitions::U16); | 1072 | load_const_func_u16 = make_accessor(U16, &UniformDefinitions::U16); |
| 1071 | } | 1073 | } |
| 1072 | if (True(types & IR::Type::F32)) { | 1074 | if (supports_aliasing && True(types & IR::Type::F32)) { |
| 1073 | load_const_func_f32 = make_accessor(F32[1], &UniformDefinitions::F32); | 1075 | load_const_func_f32 = make_accessor(F32[1], &UniformDefinitions::F32); |
| 1074 | } | 1076 | } |
| 1075 | if (True(types & IR::Type::U32)) { | 1077 | if (supports_aliasing && True(types & IR::Type::U32)) { |
| 1076 | load_const_func_u32 = make_accessor(U32[1], &UniformDefinitions::U32); | 1078 | load_const_func_u32 = make_accessor(U32[1], &UniformDefinitions::U32); |
| 1077 | } | 1079 | } |
| 1078 | if (True(types & IR::Type::U32x2)) { | 1080 | if (supports_aliasing && True(types & IR::Type::U32x2)) { |
| 1079 | load_const_func_u32x2 = make_accessor(U32[2], &UniformDefinitions::U32x2); | 1081 | load_const_func_u32x2 = make_accessor(U32[2], &UniformDefinitions::U32x2); |
| 1080 | } | 1082 | } |
| 1081 | if (True(types & IR::Type::U32x4)) { | 1083 | if (!supports_aliasing || True(types & IR::Type::U32x4)) { |
| 1082 | load_const_func_u32x4 = make_accessor(U32[4], &UniformDefinitions::U32x4); | 1084 | load_const_func_u32x4 = make_accessor(U32[4], &UniformDefinitions::U32x4); |
| 1083 | } | 1085 | } |
| 1084 | } | 1086 | } |