ShaderGen: Remove virtual methods from ShaderGeneratorInterface, move string buffer to ShaderCode

This fixes the crashes occuring at startup with a non-empty shader cache.
Because LinearDiskCache reads/writes to the storage of ShaderUid, ShaderUid must be trivially copyable.
Additionally, adds a static assert to LinearDiskCache to ensure this doesn't happen in the future.

The initialization of ShaderUid data has been moved to the code generation functions, so the above condition holds true.
This commit is contained in:
Stenzek
2016-01-02 16:20:01 +10:00
parent 066af14272
commit 617f9d9532
6 changed files with 35 additions and 32 deletions

View File

@ -19,7 +19,9 @@ static T GenerateVertexShader(API_TYPE api_type)
// Non-uid template parameters will write to the dummy data (=> gets optimized out)
vertex_shader_uid_data dummy_data;
vertex_shader_uid_data* uid_data = out.template GetUidData<vertex_shader_uid_data>();
if (uid_data == nullptr)
if (uid_data != nullptr)
memset(uid_data, 0, sizeof(*uid_data));
else
uid_data = &dummy_data;
_assert_(bpmem.genMode.numtexgens == xfmem.numTexGen.numTexGens);