Permalink
Browse files

VideoCommon: Clean up class-memaccess warnings

  • Loading branch information...
Techjar committed Oct 14, 2018
1 parent dace56c commit 8560eecd494482146d289a06d8bd4c6033a6fa14
@@ -90,7 +90,7 @@ void SWVertexLoader::vFlush()
for (u32 i = 0; i < IndexGenerator::GetIndexLen(); 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.
m_vertex.color = {};
@@ -35,11 +35,14 @@ struct GXPipelineUid
// 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
// any padding bytes, we have to ensure these are zeroed out.
GXPipelineUid() { std::memset(this, 0, sizeof(*this)); }
GXPipelineUid(const GXPipelineUid& rhs) { std::memcpy(this, &rhs, sizeof(*this)); }
GXPipelineUid() { std::memset(static_cast<void*>(this), 0, sizeof(*this)); }
GXPipelineUid(const GXPipelineUid& rhs)
{
std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
}
GXPipelineUid& operator=(const GXPipelineUid& rhs)
{
std::memcpy(this, &rhs, sizeof(*this));
std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
return *this;
}
bool operator<(const GXPipelineUid& rhs) const
@@ -62,11 +65,14 @@ struct GXUberPipelineUid
DepthState depth_state;
BlendingState blending_state;
GXUberPipelineUid() { std::memset(this, 0, sizeof(*this)); }
GXUberPipelineUid(const GXUberPipelineUid& rhs) { std::memcpy(this, &rhs, sizeof(*this)); }
GXUberPipelineUid() { std::memset(static_cast<void*>(this), 0, sizeof(*this)); }
GXUberPipelineUid(const GXUberPipelineUid& rhs)
{
std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
}
GXUberPipelineUid& operator=(const GXUberPipelineUid& rhs)
{
std::memcpy(this, &rhs, sizeof(*this));
std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
return *this;
}
bool operator<(const GXUberPipelineUid& rhs) const
@@ -116,7 +116,7 @@ void VertexShaderManager::Init()
bTexMtxInfoChanged = false;
bLightingConfigChanged = false;
std::memset(&xfmem, 0, sizeof(xfmem));
std::memset(static_cast<void*>(&xfmem), 0, sizeof(xfmem));
constants = {};
ResetView();

0 comments on commit 8560eec

Please sign in to comment.