mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 20:28:56 +00:00
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:
parent
80d8173d29
commit
149a97e396
12 changed files with 37 additions and 54 deletions
|
@ -2,7 +2,7 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cstring>
|
||||
#include "VideoCommon/VertexShaderGen.h"
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
|
@ -10,20 +10,17 @@
|
|||
#include "VideoCommon/LightingShaderGen.h"
|
||||
#include "VideoCommon/NativeVertexFormat.h"
|
||||
#include "VideoCommon/VertexLoaderManager.h"
|
||||
#include "VideoCommon/VertexShaderGen.h"
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
#include "VideoCommon/XFMemory.h"
|
||||
|
||||
VertexShaderUid GetVertexShaderUid()
|
||||
{
|
||||
VertexShaderUid out;
|
||||
vertex_shader_uid_data* uid_data = out.GetUidData<vertex_shader_uid_data>();
|
||||
memset(uid_data, 0, sizeof(*uid_data));
|
||||
|
||||
ASSERT(bpmem.genMode.numtexgens == xfmem.numTexGen.numTexGens);
|
||||
ASSERT(bpmem.genMode.numcolchans == xfmem.numChan.numColorChans);
|
||||
|
||||
VertexShaderUid out;
|
||||
vertex_shader_uid_data* const uid_data = out.GetUidData();
|
||||
uid_data->numTexGens = xfmem.numTexGen.numTexGens;
|
||||
uid_data->components = VertexLoaderManager::g_current_components;
|
||||
uid_data->numColorChans = xfmem.numChan.numColorChans;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue