Merge pull request #7501 from Techjar/class-memaccess-cleanup

VideoCommon: Clean up class-memaccess warnings
This commit is contained in:
Pierre Bourdon 2018-10-28 23:59:51 +01:00 committed by GitHub
commit f1413dbbf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 8 deletions

View File

@ -90,7 +90,7 @@ void SWVertexLoader::vFlush()
for (u32 i = 0; i < IndexGenerator::GetIndexLen(); i++) for (u32 i = 0; i < IndexGenerator::GetIndexLen(); i++)
{ {
const u16 index = m_local_index_buffer[i]; const u16 index = m_local_index_buffer[i];
memset(&m_vertex, 0, sizeof(m_vertex)); memset(static_cast<void*>(&m_vertex), 0, sizeof(m_vertex));
// Super Mario Sunshine requires those to be zero for those debug boxes. // Super Mario Sunshine requires those to be zero for those debug boxes.
m_vertex.color = {}; m_vertex.color = {};

View File

@ -35,11 +35,14 @@ struct GXPipelineUid
// We use memcmp() for comparing pipelines as std::tie generates a large number of instructions, // We use memcmp() for comparing pipelines as std::tie generates a large number of instructions,
// 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(this, 0, sizeof(*this)); } GXPipelineUid() { std::memset(static_cast<void*>(this), 0, sizeof(*this)); }
GXPipelineUid(const GXPipelineUid& rhs) { std::memcpy(this, &rhs, sizeof(*this)); } GXPipelineUid(const GXPipelineUid& rhs)
{
std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
}
GXPipelineUid& operator=(const GXPipelineUid& rhs) GXPipelineUid& operator=(const GXPipelineUid& rhs)
{ {
std::memcpy(this, &rhs, sizeof(*this)); std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
return *this; return *this;
} }
bool operator<(const GXPipelineUid& rhs) const bool operator<(const GXPipelineUid& rhs) const
@ -62,11 +65,14 @@ struct GXUberPipelineUid
DepthState depth_state; DepthState depth_state;
BlendingState blending_state; BlendingState blending_state;
GXUberPipelineUid() { std::memset(this, 0, sizeof(*this)); } GXUberPipelineUid() { std::memset(static_cast<void*>(this), 0, sizeof(*this)); }
GXUberPipelineUid(const GXUberPipelineUid& rhs) { std::memcpy(this, &rhs, sizeof(*this)); } GXUberPipelineUid(const GXUberPipelineUid& rhs)
{
std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
}
GXUberPipelineUid& operator=(const GXUberPipelineUid& rhs) GXUberPipelineUid& operator=(const GXUberPipelineUid& rhs)
{ {
std::memcpy(this, &rhs, sizeof(*this)); std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
return *this; return *this;
} }
bool operator<(const GXUberPipelineUid& rhs) const bool operator<(const GXUberPipelineUid& rhs) const

View File

@ -116,7 +116,7 @@ void VertexShaderManager::Init()
bTexMtxInfoChanged = false; bTexMtxInfoChanged = false;
bLightingConfigChanged = false; bLightingConfigChanged = false;
std::memset(&xfmem, 0, sizeof(xfmem)); std::memset(static_cast<void*>(&xfmem), 0, sizeof(xfmem));
constants = {}; constants = {};
ResetView(); ResetView();