mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
include: Add STATIC_ASSERT() macro.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
be462a932f
commit
41ca2469b2
@ -26,6 +26,8 @@
|
||||
|
||||
#define DIV_ROUND_UP(a, b) ((a) % (b) == 0 ? (a) / (b) : (a) / (b) + 1)
|
||||
|
||||
#define STATIC_ASSERT(e) extern void __VKD3D_STATIC_ASSERT__(int [(e) ? 1 : -1])
|
||||
|
||||
static inline size_t align(size_t addr, size_t alignment)
|
||||
{
|
||||
return (addr + (alignment - 1)) & ~(alignment - 1);
|
||||
|
@ -1788,7 +1788,7 @@ static void read_dword(const char **ptr, DWORD *d)
|
||||
|
||||
static void read_float(const char **ptr, float *f)
|
||||
{
|
||||
assert(sizeof(float) == sizeof(DWORD)); /* FIXME: use static assert */
|
||||
STATIC_ASSERT(sizeof(float) == sizeof(DWORD));
|
||||
read_dword(ptr, (DWORD *)f);
|
||||
}
|
||||
|
||||
|
@ -6897,10 +6897,10 @@ static void vkd3d_dxbc_compiler_emit_shader_epilogue_function(struct vkd3d_dxbc_
|
||||
unsigned int i, count;
|
||||
DWORD variable_idx;
|
||||
|
||||
function_id = compiler->epilogue_function_id;
|
||||
STATIC_ASSERT(ARRAY_SIZE(compiler->private_output_variable) == ARRAY_SIZE(param_id));
|
||||
STATIC_ASSERT(ARRAY_SIZE(compiler->private_output_variable) == ARRAY_SIZE(param_type_id));
|
||||
|
||||
assert(ARRAY_SIZE(compiler->private_output_variable) == ARRAY_SIZE(param_id));
|
||||
assert(ARRAY_SIZE(compiler->private_output_variable) == ARRAY_SIZE(param_type_id));
|
||||
function_id = compiler->epilogue_function_id;
|
||||
|
||||
void_id = vkd3d_spirv_get_op_type_void(builder);
|
||||
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_TYPE_FLOAT, 4);
|
||||
|
@ -7786,7 +7786,7 @@ static void test_shader_instructions(void)
|
||||
},
|
||||
};
|
||||
|
||||
assert(sizeof(tests->input) == sizeof(uint_tests->input));
|
||||
STATIC_ASSERT(sizeof(tests->input) == sizeof(uint_tests->input));
|
||||
|
||||
memset(&desc, 0, sizeof(desc));
|
||||
desc.rt_format = DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
|
Loading…
x
Reference in New Issue
Block a user