From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- include/private/vkd3d_common.h | 2 ++ include/vkd3d_shader.h | 7 ++++--- libs/vkd3d-shader/vkd3d_shader_main.c | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/include/private/vkd3d_common.h b/include/private/vkd3d_common.h index d097f3d925ef..d942acf2b74b 100644 --- a/include/private/vkd3d_common.h +++ b/include/private/vkd3d_common.h @@ -28,6 +28,8 @@
#define STATIC_ASSERT(e) extern void __VKD3D_STATIC_ASSERT__(int [(e) ? 1 : -1])
+#define MEMBER_SIZE(t, m) sizeof(((t *)0)->m) + static inline size_t align(size_t addr, size_t alignment) { return (addr + (alignment - 1)) & ~(alignment - 1); diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h index 20ed0fb29b9f..c0d1f65af2f9 100644 --- a/include/vkd3d_shader.h +++ b/include/vkd3d_shader.h @@ -365,6 +365,7 @@ enum vkd3d_root_signature_version int vkd3d_shader_serialize_root_signature(const struct vkd3d_root_signature_desc *root_signature, enum vkd3d_root_signature_version version, struct vkd3d_shader_code *dxbc);
+/* FIXME: Add support for 64 UAV bind slots. */ #define VKD3D_SHADER_MAX_UNORDERED_ACCESS_VIEWS 8
struct vkd3d_shader_scan_info @@ -372,9 +373,9 @@ struct vkd3d_shader_scan_info enum vkd3d_shader_structure_type type; void *next;
- unsigned int uav_read_mask : VKD3D_SHADER_MAX_UNORDERED_ACCESS_VIEWS; - unsigned int uav_counter_mask : VKD3D_SHADER_MAX_UNORDERED_ACCESS_VIEWS; - unsigned int sampler_comparison_mode_mask; + unsigned int uav_read_mask; /* VKD3D_SHADER_MAX_UNORDERED_ACCESS_VIEWS */ + unsigned int uav_counter_mask; /* VKD3D_SHADER_MAX_UNORDERED_ACCESS_VIEWS */ + unsigned int sampler_comparison_mode_mask; /* 16 */ };
int vkd3d_shader_scan_dxbc(const struct vkd3d_shader_code *dxbc, diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index 5e292c7eccd9..37aee0f6fce4 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -18,6 +18,9 @@
#include "vkd3d_shader_private.h"
+STATIC_ASSERT(MEMBER_SIZE(struct vkd3d_shader_scan_info, uav_counter_mask) * CHAR_BIT >= VKD3D_SHADER_MAX_UNORDERED_ACCESS_VIEWS); +STATIC_ASSERT(MEMBER_SIZE(struct vkd3d_shader_scan_info, uav_read_mask) * CHAR_BIT >= VKD3D_SHADER_MAX_UNORDERED_ACCESS_VIEWS); + struct vkd3d_shader_parser { struct vkd3d_shader_desc shader_desc;