diff options
author | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2023-10-14 23:20:28 +0200 |
---|---|---|
committer | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2023-10-19 20:54:31 +0200 |
commit | e02ee8e59d099692678bed09332b7d8aad1ce271 (patch) | |
tree | 8ea0de01f31cee80075441fab4c746e0615a7ff7 /src/shader_recompiler/backend/spirv/spirv_emit_context.h | |
parent | Merge pull request #11810 from liamwhite/clang-17 (diff) | |
download | yuzu-e02ee8e59d099692678bed09332b7d8aad1ce271.tar yuzu-e02ee8e59d099692678bed09332b7d8aad1ce271.tar.gz yuzu-e02ee8e59d099692678bed09332b7d8aad1ce271.tar.bz2 yuzu-e02ee8e59d099692678bed09332b7d8aad1ce271.tar.lz yuzu-e02ee8e59d099692678bed09332b7d8aad1ce271.tar.xz yuzu-e02ee8e59d099692678bed09332b7d8aad1ce271.tar.zst yuzu-e02ee8e59d099692678bed09332b7d8aad1ce271.zip |
Diffstat (limited to 'src/shader_recompiler/backend/spirv/spirv_emit_context.h')
-rw-r--r-- | src/shader_recompiler/backend/spirv/spirv_emit_context.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/spirv/spirv_emit_context.h b/src/shader_recompiler/backend/spirv/spirv_emit_context.h index 7c49fd504..1aa79863d 100644 --- a/src/shader_recompiler/backend/spirv/spirv_emit_context.h +++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.h @@ -64,6 +64,42 @@ struct UniformDefinitions { Id F32{}; Id U32x2{}; Id U32x4{}; + + constexpr static size_t NumElements(Id UniformDefinitions::*member_ptr) { + if (member_ptr == &UniformDefinitions::U8) { + return 1; + } + if (member_ptr == &UniformDefinitions::S8) { + return 1; + } + if (member_ptr == &UniformDefinitions::U16) { + return 1; + } + if (member_ptr == &UniformDefinitions::S16) { + return 1; + } + if (member_ptr == &UniformDefinitions::U32) { + return 1; + } + if (member_ptr == &UniformDefinitions::F32) { + return 1; + } + if (member_ptr == &UniformDefinitions::U32x2) { + return 2; + } + if (member_ptr == &UniformDefinitions::U32x4) { + return 4; + } + ASSERT(false); + return 1; + } + + constexpr static bool IsFloat(Id UniformDefinitions::*member_ptr) { + if (member_ptr == &UniformDefinitions::F32) { + return true; + } + return false; + } }; struct StorageTypeDefinition { |