From 149a97e396fd1ac22df8ad9d47d4a23e3ef46d25 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 30 May 2019 01:05:06 -0400 Subject: VideoCommon: Remove unnecessary memset on ShaderUid instances. Zero-initialization zeroes out all members and padding bits, so this is safe to do. While we're at it, also add static assertions that enforce the necessary requirements of a UID type explicitly within the ShaderUid class. This way, we can remove several memset calls around the shader generation code that makes sure the underlying UID data is zeroed out. Now our ShaderUid class enforces this for us, so we don't need to care about it at the usage sites. --- Source/Core/VideoCommon/PixelShaderGen.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Source/Core/VideoCommon/PixelShaderGen.cpp') diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index 314eab9995..72402ab4c8 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -6,7 +6,6 @@ #include #include -#include #include "Common/Assert.h" #include "Common/CommonTypes.h" @@ -162,9 +161,8 @@ static const char* tevAOutputTable[] = {"prev.a", "c0.a", "c1.a", "c2.a"}; PixelShaderUid GetPixelShaderUid() { PixelShaderUid out; - pixel_shader_uid_data* uid_data = out.GetUidData(); - memset(uid_data, 0, sizeof(*uid_data)); + pixel_shader_uid_data* const uid_data = out.GetUidData(); uid_data->useDstAlpha = bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24; @@ -340,7 +338,7 @@ PixelShaderUid GetPixelShaderUid() void ClearUnusedPixelShaderUidBits(APIType ApiType, const ShaderHostConfig& host_config, PixelShaderUid* uid) { - pixel_shader_uid_data* uid_data = uid->GetUidData(); + pixel_shader_uid_data* const uid_data = uid->GetUidData(); // OpenGL and Vulkan convert implicitly normalized color outputs to their uint representation. // Therefore, it is not necessary to use a uint output on these backends. We also disable the -- cgit v1.2.3