Merge pull request #10376 from shuffle2/uidctor

GXPipelineUid: remove explicit shallow copy where it's the default
This commit is contained in:
Léo Lam 2022-02-18 18:39:59 +01:00 committed by GitHub
commit 067fbe8f86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 35 deletions

View File

@ -35,24 +35,6 @@ struct GXPipelineUid
// and this map lookup can happen every draw call. However, as using memcmp() will also compare // and this map lookup can happen every draw call. However, as using memcmp() will also compare
// any padding bytes, we have to ensure these are zeroed out. // any padding bytes, we have to ensure these are zeroed out.
GXPipelineUid() { std::memset(static_cast<void*>(this), 0, sizeof(*this)); } GXPipelineUid() { std::memset(static_cast<void*>(this), 0, sizeof(*this)); }
#ifdef _MSC_VER
#pragma warning(push)
// Disable warning for uninitialized member variables, as MSVC doesn't recognise that memcpy
// performs this initialization.
#pragma warning(disable : 26495)
#endif
GXPipelineUid(const GXPipelineUid& rhs)
{
std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
GXPipelineUid& operator=(const GXPipelineUid& rhs)
{
std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
return *this;
}
bool operator<(const GXPipelineUid& rhs) const bool operator<(const GXPipelineUid& rhs) const
{ {
return std::memcmp(this, &rhs, sizeof(*this)) < 0; return std::memcmp(this, &rhs, sizeof(*this)) < 0;
@ -74,23 +56,6 @@ struct GXUberPipelineUid
BlendingState blending_state; BlendingState blending_state;
GXUberPipelineUid() { std::memset(static_cast<void*>(this), 0, sizeof(*this)); } GXUberPipelineUid() { std::memset(static_cast<void*>(this), 0, sizeof(*this)); }
#ifdef _MSC_VER
#pragma warning(push)
// Disable warning for uninitialized member variables
#pragma warning(disable : 26495)
#endif
GXUberPipelineUid(const GXUberPipelineUid& rhs)
{
std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
GXUberPipelineUid& operator=(const GXUberPipelineUid& rhs)
{
std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
return *this;
}
bool operator<(const GXUberPipelineUid& rhs) const bool operator<(const GXUberPipelineUid& rhs) const
{ {
return std::memcmp(this, &rhs, sizeof(*this)) < 0; return std::memcmp(this, &rhs, sizeof(*this)) < 0;