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/TextureConverterShaderGen.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'Source/Core/VideoCommon/TextureConverterShaderGen.cpp') diff --git a/Source/Core/VideoCommon/TextureConverterShaderGen.cpp b/Source/Core/VideoCommon/TextureConverterShaderGen.cpp index df46254d91..9bbb4e2892 100644 --- a/Source/Core/VideoCommon/TextureConverterShaderGen.cpp +++ b/Source/Core/VideoCommon/TextureConverterShaderGen.cpp @@ -2,13 +2,11 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. -#include -#include +#include "VideoCommon/TextureConverterShaderGen.h" #include "Common/Assert.h" #include "Common/CommonTypes.h" #include "VideoCommon/BPMemory.h" -#include "VideoCommon/TextureConverterShaderGen.h" #include "VideoCommon/VideoCommon.h" #include "VideoCommon/VideoConfig.h" @@ -18,9 +16,8 @@ TCShaderUid GetShaderUid(EFBCopyFormat dst_format, bool is_depth_copy, bool is_i bool scale_by_half, bool copy_filter) { TCShaderUid out; - UidData* uid_data = out.GetUidData(); - memset(uid_data, 0, sizeof(*uid_data)); + UidData* const uid_data = out.GetUidData(); uid_data->dst_format = dst_format; uid_data->efb_has_alpha = bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24; uid_data->is_depth_copy = is_depth_copy; -- cgit v1.2.3