Collapse typed_memcpy definitions into one header.
Use do/while(0) pattern to fix MSVC compilation.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7830>
#include "radv_meta.h"
+#include "vk_util.h"
+
#include <fcntl.h>
#include <limits.h>
#include <pwd.h>
(b) = __builtin_ffs(__dword) - 1, __dword; \
__dword &= ~(1 << (b)))
-#define typed_memcpy(dest, src, count) ({ \
- STATIC_ASSERT(sizeof(*src) == sizeof(*dest)); \
- memcpy((dest), (src), (count) * sizeof(*(src))); \
- })
-
/* Whenever we generate an error, pass it through this function. Useful for
* debugging, where we can break on it. Only call at error site, not when
* propagating errors. Might be useful to plug in a stack trace here.
#include "util/half_float.h"
#include "util/u_pack_color.h"
#include "vk_format_info.h"
+#include "vk_util.h"
const struct v3dv_dynamic_state default_dynamic_state = {
.viewport = {
for (uint32_t __dword = (dword); \
(b) = __builtin_ffs(__dword) - 1, __dword; __dword &= ~(1 << (b)))
-#define typed_memcpy(dest, src, count) ({ \
- STATIC_ASSERT(sizeof(*src) == sizeof(*dest)); \
- memcpy((dest), (src), (count) * sizeof(*(src))); \
- })
-
struct v3dv_instance;
#ifdef USE_V3D_SIMULATOR
#define lvp_printflike(a, b) __attribute__((__format__(__printf__, a, b)))
-#define typed_memcpy(dest, src, count) ({ \
- memcpy((dest), (src), (count) * sizeof(*(src))); \
-})
-
int lvp_get_instance_entrypoint_index(const char *name);
int lvp_get_device_entrypoint_index(const char *name);
int lvp_get_physical_device_entrypoint_index(const char *name);
(b) = __builtin_ffs(__dword) - 1, __dword; \
__dword &= ~(1 << (b)))
-#define typed_memcpy(dest, src, count) ({ \
- STATIC_ASSERT(sizeof(*src) == sizeof(*dest)); \
- memcpy((dest), (src), (count) * sizeof(*(src))); \
-})
-
/* Mapping from anv object to VkDebugReportObjectTypeEXT. New types need
* to be added here in order to utilize mapping in debug/error/perf macros.
*/
#ifndef VK_UTIL_H
#define VK_UTIL_H
+#include "util/macros.h"
+#include <string.h>
+
#ifdef __cplusplus
extern "C" {
#endif
#define VK_ENUM_OFFSET(__enum) \
((__enum) >= VK_EXT_OFFSET ? ((__enum) % 1000) : (__enum))
+#define typed_memcpy(dest, src, count) do { \
+ STATIC_ASSERT(sizeof(*(src)) == sizeof(*(dest))); \
+ memcpy((dest), (src), (count) * sizeof(*(src))); \
+} while (0)
+
#ifdef __cplusplus
}
#endif
#include <xf86drm.h>
#include <xf86drmMode.h>
-#define typed_memcpy(dest, src, count) ({ \
- STATIC_ASSERT(sizeof(*src) == sizeof(*dest)); \
- memcpy((dest), (src), (count) * sizeof(*(src))); \
-})
-
VkResult
wsi_display_get_physical_device_display_properties(
VkPhysicalDevice physical_device,
#include <util/timespec.h>
#include <util/u_vector.h>
-#define typed_memcpy(dest, src, count) ({ \
- STATIC_ASSERT(sizeof(*src) == sizeof(*dest)); \
- memcpy((dest), (src), (count) * sizeof(*(src))); \
-})
-
struct wsi_wayland;
struct wsi_wl_display_drm {
#include "wsi_common_x11.h"
#include "wsi_common_queue.h"
-#define typed_memcpy(dest, src, count) ({ \
- STATIC_ASSERT(sizeof(*src) == sizeof(*dest)); \
- memcpy((dest), (src), (count) * sizeof(*(src))); \
-})
-
struct wsi_x11_connection {
bool has_dri3;
bool has_dri3_modifiers;