util/treewide: Use alignas(x) instead __attribute__((aligned(x)))
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24571>
This commit is contained in:
@@ -58,7 +58,7 @@ struct tu_memory_heap {
|
|||||||
*
|
*
|
||||||
* Align it to 64 bits to make atomic operations faster on 32 bit platforms.
|
* Align it to 64 bits to make atomic operations faster on 32 bit platforms.
|
||||||
*/
|
*/
|
||||||
VkDeviceSize used __attribute__ ((aligned (8)));
|
alignas(8) VkDeviceSize used;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tu_physical_device
|
struct tu_physical_device
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "tu_common.h"
|
#include "tu_common.h"
|
||||||
|
|
||||||
|
#include "util/macros.h"
|
||||||
#include "util/u_math.h"
|
#include "util/u_math.h"
|
||||||
#include "util/format/u_format_pack.h"
|
#include "util/format/u_format_pack.h"
|
||||||
#include "util/format/u_format_zs.h"
|
#include "util/format/u_format_zs.h"
|
||||||
@@ -356,7 +357,7 @@ tu6_polygon_mode(VkPolygonMode mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct bcolor_entry {
|
struct bcolor_entry {
|
||||||
uint32_t fp32[4];
|
alignas(128) uint32_t fp32[4];
|
||||||
uint64_t ui16;
|
uint64_t ui16;
|
||||||
uint64_t si16;
|
uint64_t si16;
|
||||||
uint64_t fp16;
|
uint64_t fp16;
|
||||||
@@ -370,7 +371,8 @@ struct bcolor_entry {
|
|||||||
uint32_t z24; /* also s8? */
|
uint32_t z24; /* also s8? */
|
||||||
uint64_t srgb;
|
uint64_t srgb;
|
||||||
uint8_t __pad1[56];
|
uint8_t __pad1[56];
|
||||||
} __attribute__((aligned(128)));
|
};
|
||||||
|
static_assert(alignof(struct bcolor_entry) == 128, "");
|
||||||
|
|
||||||
/* vulkan does not want clamping of integer clear values, differs from u_format
|
/* vulkan does not want clamping of integer clear values, differs from u_format
|
||||||
* see spec for VkClearColorValue
|
* see spec for VkClearColorValue
|
||||||
|
@@ -234,7 +234,7 @@ struct iris_bo {
|
|||||||
* Also align it to 64 bits. This will make atomic operations faster on 32
|
* Also align it to 64 bits. This will make atomic operations faster on 32
|
||||||
* bit platforms.
|
* bit platforms.
|
||||||
*/
|
*/
|
||||||
uint64_t last_seqnos[NUM_IRIS_DOMAINS] __attribute__ ((aligned (8)));
|
alignas(8) uint64_t last_seqnos[NUM_IRIS_DOMAINS];
|
||||||
|
|
||||||
/** Up to one per screen, may need realloc. */
|
/** Up to one per screen, may need realloc. */
|
||||||
struct iris_bo_screen_deps *deps;
|
struct iris_bo_screen_deps *deps;
|
||||||
|
@@ -564,7 +564,7 @@ union anv_free_list {
|
|||||||
/* Make sure it's aligned to 64 bits. This will make atomic operations
|
/* Make sure it's aligned to 64 bits. This will make atomic operations
|
||||||
* faster on 32 bit platforms.
|
* faster on 32 bit platforms.
|
||||||
*/
|
*/
|
||||||
uint64_t u64 __attribute__ ((aligned (8)));
|
alignas(8) uint64_t u64;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ANV_FREE_LIST_EMPTY ((union anv_free_list) { { UINT32_MAX, 0 } })
|
#define ANV_FREE_LIST_EMPTY ((union anv_free_list) { { UINT32_MAX, 0 } })
|
||||||
@@ -578,7 +578,7 @@ struct anv_block_state {
|
|||||||
/* Make sure it's aligned to 64 bits. This will make atomic operations
|
/* Make sure it's aligned to 64 bits. This will make atomic operations
|
||||||
* faster on 32 bit platforms.
|
* faster on 32 bit platforms.
|
||||||
*/
|
*/
|
||||||
uint64_t u64 __attribute__ ((aligned (8)));
|
alignas(8) uint64_t u64;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -845,7 +845,7 @@ struct anv_memory_heap {
|
|||||||
*
|
*
|
||||||
* Align it to 64 bits to make atomic operations faster on 32 bit platforms.
|
* Align it to 64 bits to make atomic operations faster on 32 bit platforms.
|
||||||
*/
|
*/
|
||||||
VkDeviceSize used __attribute__ ((aligned (8)));
|
alignas(8) VkDeviceSize used;
|
||||||
|
|
||||||
bool is_local_mem;
|
bool is_local_mem;
|
||||||
};
|
};
|
||||||
|
@@ -536,7 +536,7 @@ union anv_free_list {
|
|||||||
/* Make sure it's aligned to 64 bits. This will make atomic operations
|
/* Make sure it's aligned to 64 bits. This will make atomic operations
|
||||||
* faster on 32 bit platforms.
|
* faster on 32 bit platforms.
|
||||||
*/
|
*/
|
||||||
uint64_t u64 __attribute__ ((aligned (8)));
|
alignas(8) uint64_t u64;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ANV_FREE_LIST_EMPTY ((union anv_free_list) { { UINT32_MAX, 0 } })
|
#define ANV_FREE_LIST_EMPTY ((union anv_free_list) { { UINT32_MAX, 0 } })
|
||||||
@@ -550,7 +550,7 @@ struct anv_block_state {
|
|||||||
/* Make sure it's aligned to 64 bits. This will make atomic operations
|
/* Make sure it's aligned to 64 bits. This will make atomic operations
|
||||||
* faster on 32 bit platforms.
|
* faster on 32 bit platforms.
|
||||||
*/
|
*/
|
||||||
uint64_t u64 __attribute__ ((aligned (8)));
|
alignas(8) uint64_t u64;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -836,7 +836,7 @@ struct anv_memory_heap {
|
|||||||
*
|
*
|
||||||
* Align it to 64 bits to make atomic operations faster on 32 bit platforms.
|
* Align it to 64 bits to make atomic operations faster on 32 bit platforms.
|
||||||
*/
|
*/
|
||||||
VkDeviceSize used __attribute__ ((aligned (8)));
|
alignas(8) VkDeviceSize used;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct anv_memregion {
|
struct anv_memregion {
|
||||||
|
@@ -151,11 +151,11 @@ vn_ring_get_layout(size_t buf_size,
|
|||||||
{
|
{
|
||||||
/* this can be changed/extended quite freely */
|
/* this can be changed/extended quite freely */
|
||||||
struct layout {
|
struct layout {
|
||||||
uint32_t head __attribute__((aligned(64)));
|
alignas(64) uint32_t head;
|
||||||
uint32_t tail __attribute__((aligned(64)));
|
alignas(64) uint32_t tail;
|
||||||
uint32_t status __attribute__((aligned(64)));
|
alignas(64) uint32_t status;
|
||||||
|
|
||||||
uint8_t buffer[] __attribute__((aligned(64)));
|
alignas(64) uint8_t buffer[];
|
||||||
};
|
};
|
||||||
|
|
||||||
assert(buf_size && util_is_power_of_two_or_zero(buf_size));
|
assert(buf_size && util_is_power_of_two_or_zero(buf_size));
|
||||||
|
Reference in New Issue
Block a user