GS: Fix alignment crash with constant buffers

This commit is contained in:
Stenzek 2023-09-16 15:00:04 +10:00 committed by Connor McLaughlin
parent 14cf008a19
commit 6123ef12bd
1 changed files with 6 additions and 10 deletions

View File

@ -164,11 +164,8 @@ enum ChannelFetch
ChannelFetch_GXBY = 6, ChannelFetch_GXBY = 6,
}; };
#pragma pack(push, 1) struct alignas(16) DisplayConstantBuffer
class DisplayConstantBuffer
{ {
public:
GSVector4 SourceRect; // +0,xyzw GSVector4 SourceRect; // +0,xyzw
GSVector4 TargetRect; // +16,xyzw GSVector4 TargetRect; // +16,xyzw
GSVector2 SourceSize; // +32,xy GSVector2 SourceSize; // +32,xy
@ -200,24 +197,23 @@ public:
TimeAndPad = GSVector4(time); TimeAndPad = GSVector4(time);
} }
}; };
static_assert(sizeof(DisplayConstantBuffer) == 96, "DisplayConstantBuffer is correct size");
class MergeConstantBuffer struct alignas(16) MergeConstantBuffer
{ {
public:
GSVector4 BGColor; GSVector4 BGColor;
u32 EMODA; u32 EMODA;
u32 EMODC; u32 EMODC;
u32 DOFFSET; u32 DOFFSET;
float ScaleFactor; float ScaleFactor;
}; };
static_assert(sizeof(MergeConstantBuffer) == 32, "MergeConstantBuffer is correct size");
class InterlaceConstantBuffer struct alignas(16) InterlaceConstantBuffer
{ {
public:
GSVector4 ZrH; // data passed to the shader GSVector4 ZrH; // data passed to the shader
}; };
static_assert(sizeof(InterlaceConstantBuffer) == 16, "InterlaceConstantBuffer is correct size");
#pragma pack(pop)
enum HWBlendFlags enum HWBlendFlags
{ {