From 8dcb05802b8f16e84169e4e3b64789707a939787 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 10 Dec 2016 17:07:28 -0500 Subject: [PATCH] ShaderManagers: Use aggregate initialization for some variables. These provide the same semantics, however aggregate initialization doesn't force the structs to be trivially copyable. memset, on the other hand, does. --- Source/Core/VideoCommon/GeometryShaderManager.cpp | 2 +- Source/Core/VideoCommon/PixelShaderManager.cpp | 2 +- Source/Core/VideoCommon/VertexShaderManager.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/VideoCommon/GeometryShaderManager.cpp b/Source/Core/VideoCommon/GeometryShaderManager.cpp index 1bb841459d..8a687d70d0 100644 --- a/Source/Core/VideoCommon/GeometryShaderManager.cpp +++ b/Source/Core/VideoCommon/GeometryShaderManager.cpp @@ -21,7 +21,7 @@ static bool s_viewport_changed; void GeometryShaderManager::Init() { - memset(&constants, 0, sizeof(constants)); + constants = {}; // Init any intial constants which aren't zero when bpmem is zero. SetViewportChanged(); diff --git a/Source/Core/VideoCommon/PixelShaderManager.cpp b/Source/Core/VideoCommon/PixelShaderManager.cpp index 0560ecc60a..f029751363 100644 --- a/Source/Core/VideoCommon/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/PixelShaderManager.cpp @@ -21,7 +21,7 @@ bool PixelShaderManager::dirty; void PixelShaderManager::Init() { - memset(&constants, 0, sizeof(constants)); + constants = {}; // Init any intial constants which aren't zero when bpmem is zero. s_bFogRangeAdjustChanged = true; diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp index aa7ea1c2a6..c7331fe446 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/VertexShaderManager.cpp @@ -203,8 +203,8 @@ void VertexShaderManager::Init() bProjectionChanged = true; bViewportChanged = false; - memset(&xfmem, 0, sizeof(xfmem)); - memset(&constants, 0, sizeof(constants)); + xfmem = {}; + constants = {}; ResetView(); // TODO: should these go inside ResetView()?