@@ -30,7 +30,7 @@ using RefCountedPipelineLayout = RefCounted<PipelineLayout>;
30
30
31
31
// Packed Vk resource descriptions.
32
32
// Most Vk types use many more bits than required to represent the underlying data.
33
- // Since ANGLE wants cache things like RenderPasses and Pipeline State Objects using
33
+ // Since ANGLE wants to cache things like RenderPasses and Pipeline State Objects using
34
34
// hashing (and also needs to check equality) we can optimize these operations by
35
35
// using fewer bits. Hence the packed types.
36
36
//
@@ -86,19 +86,21 @@ bool operator==(const RenderPassDesc &lhs, const RenderPassDesc &rhs);
86
86
constexpr size_t kRenderPassDescSize = sizeof (RenderPassDesc);
87
87
static_assert (kRenderPassDescSize == 12 , " Size check failed" );
88
88
89
- struct alignas ( 8 ) PackedAttachmentOpsDesc final
89
+ struct PackedAttachmentOpsDesc final
90
90
{
91
- uint8_t loadOp;
92
- uint8_t storeOp;
93
- uint8_t stencilLoadOp;
94
- uint8_t stencilStoreOp;
91
+ // VkAttachmentLoadOp is in range [0, 2], and VkAttachmentStoreOp is in range [0, 1].
92
+ uint16_t loadOp : 2 ;
93
+ uint16_t storeOp : 1 ;
94
+ uint16_t stencilLoadOp : 2 ;
95
+ uint16_t stencilStoreOp : 1 ;
95
96
96
- // 16-bits to force pad the structure to exactly 8 bytes.
97
- uint16_t initialLayout;
98
- uint16_t finalLayout;
97
+ // 5-bits to force pad the structure to exactly 2 bytes. Note that we currently don't support
98
+ // any of the extension layouts, whose values start at 1'000'000'000.
99
+ uint16_t initialLayout : 5 ;
100
+ uint16_t finalLayout : 5 ;
99
101
};
100
102
101
- static_assert (sizeof (PackedAttachmentOpsDesc) == 8 , " Size check failed" );
103
+ static_assert (sizeof (PackedAttachmentOpsDesc) == 2 , " Size check failed" );
102
104
103
105
class AttachmentOpsArray final
104
106
{
@@ -122,7 +124,7 @@ class AttachmentOpsArray final
122
124
123
125
bool operator ==(const AttachmentOpsArray &lhs, const AttachmentOpsArray &rhs);
124
126
125
- static_assert (sizeof (AttachmentOpsArray) == 80 , " Size check failed" );
127
+ static_assert (sizeof (AttachmentOpsArray) == 20 , " Size check failed" );
126
128
127
129
struct PackedAttribDesc final
128
130
{
0 commit comments