mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-28 11:49:06 +00:00
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:
parent
066af14272
commit
617f9d9532
6 changed files with 35 additions and 32 deletions
|
@ -7,6 +7,7 @@
|
|||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
|
@ -53,6 +54,15 @@ public:
|
|||
{
|
||||
using std::ios_base;
|
||||
|
||||
// Since we're reading/writing directly to the storage of K instances,
|
||||
// K must be trivially copyable. TODO: Remove #if once GCC 5.0 is a
|
||||
// minimum requirement.
|
||||
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 5
|
||||
static_assert(std::has_trivial_copy_constructor<K>::value, "K must be a trivially copyable type");
|
||||
#else
|
||||
static_assert(std::is_trivially_copyable<K>::value, "K must be a trivially copyable type");
|
||||
#endif
|
||||
|
||||
// close any currently opened file
|
||||
Close();
|
||||
m_num_entries = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue