mirror of
https://git.citron-emu.org/Citron/Citron.git
synced 2025-01-22 08:36:32 +01:00
nvdrv: Add MSVC compatibility for packed structs
Add conditional compilation directives to handle packed struct definitions differently between MSVC and other compilers. MSVC uses #pragma pack while GCC/Clang use __attribute__((packed)). This change affects: - ZBCColorEntry - ZBCDepthEntry - IoctlZbcSetTable The functionality remains the same, but ensures proper struct packing across different compiler environments.
This commit is contained in:
parent
c65c8ac45e
commit
3f151c5111
1 changed files with 20 additions and 1 deletions
|
@ -45,11 +45,19 @@ private:
|
|||
|
||||
struct ZBCColorEntry {
|
||||
u32 color_ds[4];
|
||||
#ifdef _MSC_VER
|
||||
};
|
||||
#else
|
||||
} __attribute__((packed));
|
||||
#endif
|
||||
|
||||
struct ZBCDepthEntry {
|
||||
u32 depth[4];
|
||||
#ifdef _MSC_VER
|
||||
};
|
||||
#else
|
||||
} __attribute__((packed));
|
||||
#endif
|
||||
|
||||
std::array<ZBCColorEntry, MaxZBCTableSize> zbc_color_table{};
|
||||
std::array<ZBCDepthEntry, MaxZBCTableSize> zbc_depth_table{};
|
||||
|
@ -139,6 +147,7 @@ private:
|
|||
static_assert(sizeof(IoctlNvgpuGpuZcullGetInfoArgs) == 40,
|
||||
"IoctlNvgpuGpuZcullGetInfoArgs is incorrect size");
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(push, 1)
|
||||
struct IoctlZbcSetTable {
|
||||
u32 color_ds_table_index;
|
||||
|
@ -147,8 +156,18 @@ private:
|
|||
u32 color_ds[4]; // 16 bytes
|
||||
u32 color_l2[4]; // 16 bytes
|
||||
u32 depth; // 4 bytes
|
||||
} __attribute__((packed)); // Use GCC's packed attribute
|
||||
};
|
||||
#pragma pack(pop)
|
||||
#else
|
||||
struct IoctlZbcSetTable {
|
||||
u32 color_ds_table_index;
|
||||
u32 format;
|
||||
u32 mode;
|
||||
u32 color_ds[4]; // 16 bytes
|
||||
u32 color_l2[4]; // 16 bytes
|
||||
u32 depth; // 4 bytes
|
||||
} __attribute__((packed));
|
||||
#endif
|
||||
|
||||
static_assert(sizeof(IoctlZbcSetTable) == 48, "IoctlZbcSetTable is incorrect size");
|
||||
|
||||
|
|
Loading…
Reference in a new issue