mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-13 15:59:23 +01:00
VideoCommon: Zero PortableVertexDeclarations on initialization
Fixes an issue where the default initializer wouldn't initialize padding, making for fun non-determinism
This commit is contained in:
parent
1d07332657
commit
d9ed9ae331
@ -63,6 +63,9 @@ struct PortableVertexDeclaration
|
|||||||
std::array<AttributeFormat, 8> texcoords;
|
std::array<AttributeFormat, 8> texcoords;
|
||||||
AttributeFormat posmtx;
|
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
|
inline bool operator<(const PortableVertexDeclaration& b) const
|
||||||
{
|
{
|
||||||
return memcmp(this, &b, sizeof(PortableVertexDeclaration)) < 0;
|
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
|
namespace std
|
||||||
{
|
{
|
||||||
template <>
|
template <>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user