diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2022-11-06 18:54:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-06 18:54:21 +0100 |
| commit | 134833727770a519d3061dbbbb0c8a7f9c1a3ab7 (patch) | |
| tree | 47dc72f00db40c91778d6652e6047740ee003355 /Source | |
| parent | c75b53c7ed24d1be59901c9bd15904376e79056e (diff) | |
| parent | d9ed9ae33193c9db1ee7616363848d5b0b65196c (diff) | |
Merge pull request #11246 from tellowkrinkle/PVDMemset
VideoCommon: Zero PortableVertexDeclarations on initialization
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/VideoCommon/NativeVertexFormat.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/NativeVertexFormat.h b/Source/Core/VideoCommon/NativeVertexFormat.h index 89f3a06db5..c2761c9514 100644 --- a/Source/Core/VideoCommon/NativeVertexFormat.h +++ b/Source/Core/VideoCommon/NativeVertexFormat.h @@ -63,6 +63,9 @@ struct PortableVertexDeclaration std::array<AttributeFormat, 8> texcoords; AttributeFormat posmtx; + // Make sure we initialize padding to 0 since padding is included in the == memcmp + PortableVertexDeclaration() { memset(this, 0, sizeof(*this)); } + inline bool operator<(const PortableVertexDeclaration& b) const { return memcmp(this, &b, sizeof(PortableVertexDeclaration)) < 0; @@ -73,6 +76,9 @@ struct PortableVertexDeclaration } }; +static_assert(std::is_trivially_copyable_v<PortableVertexDeclaration>, + "Make sure we can memset-initialize"); + namespace std { template <> |
