mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 12:30:09 +01:00
gallium: use a packed enum to make pipe_prim_mode 1-byte large with __GNUC__
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12480>
This commit is contained in:
parent
06ca0fc3b1
commit
8886bf9a47
3 changed files with 13 additions and 1 deletions
|
|
@ -27,6 +27,11 @@
|
|||
const char *
|
||||
u_prim_name(enum pipe_prim_type prim)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
/* Check that the enum is packed: */
|
||||
STATIC_ASSERT(sizeof(enum pipe_prim_type) == 1);
|
||||
#endif
|
||||
|
||||
static const struct debug_named_value names[] = {
|
||||
DEBUG_NAMED_VALUE(PIPE_PRIM_POINTS),
|
||||
DEBUG_NAMED_VALUE(PIPE_PRIM_LINES),
|
||||
|
|
|
|||
|
|
@ -575,7 +575,7 @@ enum pipe_prim_type {
|
|||
PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY,
|
||||
PIPE_PRIM_PATCHES,
|
||||
PIPE_PRIM_MAX,
|
||||
};
|
||||
} ENUM_PACKED;
|
||||
|
||||
/**
|
||||
* Tessellator spacing types
|
||||
|
|
|
|||
|
|
@ -327,6 +327,13 @@ do { \
|
|||
#define ATTRIBUTE_NOINLINE
|
||||
#endif
|
||||
|
||||
/* Use as: enum name { X, Y } ENUM_PACKED; */
|
||||
#if defined(__GNUC__)
|
||||
#define ENUM_PACKED __attribute__((packed))
|
||||
#else
|
||||
#define ENUM_PACKED
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Check that STRUCT::FIELD can hold MAXVAL. We use a lot of bitfields
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue