diff options
| author | 2021-06-17 20:34:58 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:38 -0400 | |
| commit | 59fead3a47227b513c0ca35090919823f44faecf (patch) | |
| tree | 0e80ab3e37cb6dd6d350b9e582268085a5c52a99 /src/shader_recompiler/backend/spirv/emit_context.cpp | |
| parent | spirv: Handle small storage buffer loads on devices with no support (diff) | |
| download | yuzu-59fead3a47227b513c0ca35090919823f44faecf.tar.gz yuzu-59fead3a47227b513c0ca35090919823f44faecf.tar.xz yuzu-59fead3a47227b513c0ca35090919823f44faecf.zip | |
spirv: Properly handle devices without int8 and int16
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_context.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_context.cpp | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp index 32c21f3b4..4c6501129 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/emit_context.cpp | |||
| @@ -911,37 +911,45 @@ void EmitContext::DefineConstantBuffers(const Info& info, u32& binding) { | |||
| 911 | if (info.constant_buffer_descriptors.empty()) { | 911 | if (info.constant_buffer_descriptors.empty()) { |
| 912 | return; | 912 | return; |
| 913 | } | 913 | } |
| 914 | if (profile.support_descriptor_aliasing) { | 914 | IR::Type types{info.used_constant_buffer_types}; |
| 915 | if (True(info.used_constant_buffer_types & IR::Type::U8)) { | 915 | if (!profile.support_descriptor_aliasing) { |
| 916 | DefineConstBuffers(*this, info, &UniformDefinitions::U32x4, binding, U32[4], 'u', | ||
| 917 | sizeof(u32[4])); | ||
| 918 | for (const ConstantBufferDescriptor& desc : info.constant_buffer_descriptors) { | ||
| 919 | binding += desc.count; | ||
| 920 | } | ||
| 921 | } | ||
| 922 | if (True(types & IR::Type::U8)) { | ||
| 923 | if (profile.support_int8) { | ||
| 916 | DefineConstBuffers(*this, info, &UniformDefinitions::U8, binding, U8, 'u', sizeof(u8)); | 924 | DefineConstBuffers(*this, info, &UniformDefinitions::U8, binding, U8, 'u', sizeof(u8)); |
| 917 | DefineConstBuffers(*this, info, &UniformDefinitions::S8, binding, S8, 's', sizeof(s8)); | 925 | DefineConstBuffers(*this, info, &UniformDefinitions::S8, binding, S8, 's', sizeof(s8)); |
| 926 | } else { | ||
| 927 | types |= IR::Type::U32; | ||
| 918 | } | 928 | } |
| 919 | if (True(info.used_constant_buffer_types & IR::Type::U16)) { | 929 | } |
| 930 | if (True(types & IR::Type::U16)) { | ||
| 931 | if (profile.support_int16) { | ||
| 920 | DefineConstBuffers(*this, info, &UniformDefinitions::U16, binding, U16, 'u', | 932 | DefineConstBuffers(*this, info, &UniformDefinitions::U16, binding, U16, 'u', |
| 921 | sizeof(u16)); | 933 | sizeof(u16)); |
| 922 | DefineConstBuffers(*this, info, &UniformDefinitions::S16, binding, S16, 's', | 934 | DefineConstBuffers(*this, info, &UniformDefinitions::S16, binding, S16, 's', |
| 923 | sizeof(s16)); | 935 | sizeof(s16)); |
| 936 | } else { | ||
| 937 | types |= IR::Type::U32; | ||
| 924 | } | 938 | } |
| 925 | if (True(info.used_constant_buffer_types & IR::Type::U32)) { | ||
| 926 | DefineConstBuffers(*this, info, &UniformDefinitions::U32, binding, U32[1], 'u', | ||
| 927 | sizeof(u32)); | ||
| 928 | } | ||
| 929 | if (True(info.used_constant_buffer_types & IR::Type::F32)) { | ||
| 930 | DefineConstBuffers(*this, info, &UniformDefinitions::F32, binding, F32[1], 'f', | ||
| 931 | sizeof(f32)); | ||
| 932 | } | ||
| 933 | if (True(info.used_constant_buffer_types & IR::Type::U32x2)) { | ||
| 934 | DefineConstBuffers(*this, info, &UniformDefinitions::U32x2, binding, U32[2], 'u', | ||
| 935 | sizeof(u32[2])); | ||
| 936 | } | ||
| 937 | binding += static_cast<u32>(info.constant_buffer_descriptors.size()); | ||
| 938 | } else { | ||
| 939 | DefineConstBuffers(*this, info, &UniformDefinitions::U32x4, binding, U32[4], 'u', | ||
| 940 | sizeof(u32[4])); | ||
| 941 | for (const ConstantBufferDescriptor& desc : info.constant_buffer_descriptors) { | ||
| 942 | binding += desc.count; | ||
| 943 | } | ||
| 944 | } | 939 | } |
| 940 | if (True(types & IR::Type::U32)) { | ||
| 941 | DefineConstBuffers(*this, info, &UniformDefinitions::U32, binding, U32[1], 'u', | ||
| 942 | sizeof(u32)); | ||
| 943 | } | ||
| 944 | if (True(types & IR::Type::F32)) { | ||
| 945 | DefineConstBuffers(*this, info, &UniformDefinitions::F32, binding, F32[1], 'f', | ||
| 946 | sizeof(f32)); | ||
| 947 | } | ||
| 948 | if (True(types & IR::Type::U32x2)) { | ||
| 949 | DefineConstBuffers(*this, info, &UniformDefinitions::U32x2, binding, U32[2], 'u', | ||
| 950 | sizeof(u32[2])); | ||
| 951 | } | ||
| 952 | binding += static_cast<u32>(info.constant_buffer_descriptors.size()); | ||
| 945 | } | 953 | } |
| 946 | 954 | ||
| 947 | void EmitContext::DefineStorageBuffers(const Info& info, u32& binding) { | 955 | void EmitContext::DefineStorageBuffers(const Info& info, u32& binding) { |