Merge pull request #101560 from darksylinc/matias-union-order

Fix union order to simplify empty initializers
This commit is contained in:
Thaddeus Crews
2025-01-16 17:17:53 -06:00
6 changed files with 19 additions and 19 deletions

View File

@ -35,12 +35,12 @@
struct HashMapData { struct HashMapData {
union { union {
uint64_t data;
struct struct
{ {
uint32_t hash; uint32_t hash;
uint32_t hash_to_key; uint32_t hash_to_key;
}; };
uint64_t data;
}; };
}; };

View File

@ -250,6 +250,10 @@ private:
}; };
union { union {
struct {
uint64_t sort_key1;
uint64_t sort_key2;
};
struct { struct {
uint64_t lod_index : 8; uint64_t lod_index : 8;
uint64_t surface_index : 8; uint64_t surface_index : 8;
@ -265,10 +269,6 @@ private:
uint64_t depth_layer : 4; uint64_t depth_layer : 4;
uint64_t priority : 8; uint64_t priority : 8;
}; };
struct {
uint64_t sort_key1;
uint64_t sort_key2;
};
} sort; } sort;
RS::PrimitiveType primitive = RS::PRIMITIVE_MAX; RS::PrimitiveType primitive = RS::PRIMITIVE_MAX;

View File

@ -72,13 +72,13 @@ private:
struct CellSort { struct CellSort {
union { union {
uint64_t key = 0;
struct { struct {
uint64_t z : 16; uint64_t z : 16;
uint64_t y : 16; uint64_t y : 16;
uint64_t x : 16; uint64_t x : 16;
uint64_t level : 16; uint64_t level : 16;
}; };
uint64_t key = 0;
}; };
int32_t index = 0; int32_t index = 0;

View File

@ -150,11 +150,11 @@ public:
private: private:
struct ConnectionType { struct ConnectionType {
union { union {
uint64_t key = 0;
struct { struct {
uint32_t type_a; uint32_t type_a;
uint32_t type_b; uint32_t type_b;
}; };
uint64_t key = 0;
}; };
static uint32_t hash(const ConnectionType &p_conn) { static uint32_t hash(const ConnectionType &p_conn) {

View File

@ -428,6 +428,10 @@ private:
}; };
union { union {
struct {
uint64_t sort_key1;
uint64_t sort_key2;
};
struct { struct {
uint64_t lod_index : 8; uint64_t lod_index : 8;
uint64_t surface_index : 8; uint64_t surface_index : 8;
@ -443,10 +447,6 @@ private:
uint64_t depth_layer : 4; uint64_t depth_layer : 4;
uint64_t priority : 8; uint64_t priority : 8;
}; };
struct {
uint64_t sort_key1;
uint64_t sort_key2;
};
} sort; } sort;
RS::PrimitiveType primitive = RS::PRIMITIVE_MAX; RS::PrimitiveType primitive = RS::PRIMITIVE_MAX;
@ -541,6 +541,8 @@ private:
struct GlobalPipelineData { struct GlobalPipelineData {
union { union {
uint32_t key;
struct { struct {
uint32_t texture_samples : 3; uint32_t texture_samples : 3;
uint32_t use_reflection_probes : 1; uint32_t use_reflection_probes : 1;
@ -556,8 +558,6 @@ private:
uint32_t use_shadow_cubemaps : 1; uint32_t use_shadow_cubemaps : 1;
uint32_t use_shadow_dual_paraboloid : 1; uint32_t use_shadow_dual_paraboloid : 1;
}; };
uint32_t key;
}; };
}; };

View File

@ -397,6 +397,10 @@ protected:
}; };
union { union {
struct {
uint64_t sort_key1;
uint64_t sort_key2;
};
struct { struct {
// !BAS! CHECK BITS!!! // !BAS! CHECK BITS!!!
@ -413,10 +417,6 @@ protected:
// uint64_t lod_index : 8; // no need to sort on LOD // uint64_t lod_index : 8; // no need to sort on LOD
// uint64_t uses_forward_gi : 1; // no GI here, remove // uint64_t uses_forward_gi : 1; // no GI here, remove
}; };
struct {
uint64_t sort_key1;
uint64_t sort_key2;
};
} sort; } sort;
RS::PrimitiveType primitive = RS::PRIMITIVE_MAX; RS::PrimitiveType primitive = RS::PRIMITIVE_MAX;
@ -575,6 +575,8 @@ public:
struct GlobalPipelineData { struct GlobalPipelineData {
union { union {
uint32_t key;
struct { struct {
uint32_t texture_samples : 3; uint32_t texture_samples : 3;
uint32_t target_samples : 3; uint32_t target_samples : 3;
@ -586,8 +588,6 @@ public:
uint32_t use_shadow_cubemaps : 1; uint32_t use_shadow_cubemaps : 1;
uint32_t use_shadow_dual_paraboloid : 1; uint32_t use_shadow_dual_paraboloid : 1;
}; };
uint32_t key;
}; };
}; };