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.
This commit is contained in:
Lioncash
2019-05-30 01:05:06 -04:00
parent 80d8173d29
commit 149a97e396
12 changed files with 37 additions and 54 deletions

View File

@ -12,7 +12,6 @@
enum class APIType;
#pragma pack(1)
struct geometry_shader_uid_data
{
u32 NumValues() const { return sizeof(geometry_shader_uid_data); }
@ -21,10 +20,9 @@ struct geometry_shader_uid_data
u32 numTexGens : 4;
u32 primitive_type : 2;
};
#pragma pack()
typedef ShaderUid<geometry_shader_uid_data> GeometryShaderUid;
using GeometryShaderUid = ShaderUid<geometry_shader_uid_data>;
ShaderCode GenerateGeometryShaderCode(APIType ApiType, const ShaderHostConfig& host_config,
const geometry_shader_uid_data* uid_data);