diff options
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 { | |||
| 64 | Id F32{}; | 64 | Id F32{}; |
| 65 | Id U32x2{}; | 65 | Id U32x2{}; |
| 66 | Id U32x4{}; | 66 | Id U32x4{}; |
| 67 | |||
| 68 | constexpr static size_t NumElements(Id UniformDefinitions::*member_ptr) { | ||
| 69 | if (member_ptr == &UniformDefinitions::U8) { | ||
| 70 | return 1; | ||
| 71 | } | ||
| 72 | if (member_ptr == &UniformDefinitions::S8) { | ||
| 73 | return 1; | ||
| 74 | } | ||
| 75 | if (member_ptr == &UniformDefinitions::U16) { | ||
| 76 | return 1; | ||
| 77 | } | ||
| 78 | if (member_ptr == &UniformDefinitions::S16) { | ||
| 79 | return 1; | ||
| 80 | } | ||
| 81 | if (member_ptr == &UniformDefinitions::U32) { | ||
| 82 | return 1; | ||
| 83 | } | ||
| 84 | if (member_ptr == &UniformDefinitions::F32) { | ||
| 85 | return 1; | ||
| 86 | } | ||
| 87 | if (member_ptr == &UniformDefinitions::U32x2) { | ||
| 88 | return 2; | ||
| 89 | } | ||
| 90 | if (member_ptr == &UniformDefinitions::U32x4) { | ||
| 91 | return 4; | ||
| 92 | } | ||
| 93 | ASSERT(false); | ||
| 94 | return 1; | ||
| 95 | } | ||
| 96 | |||
| 97 | constexpr static bool IsFloat(Id UniformDefinitions::*member_ptr) { | ||
| 98 | if (member_ptr == &UniformDefinitions::F32) { | ||
| 99 | return true; | ||
| 100 | } | ||
| 101 | return false; | ||
| 102 | } | ||
| 67 | }; | 103 | }; |
| 68 | 104 | ||
| 69 | struct StorageTypeDefinition { | 105 | struct StorageTypeDefinition { |