mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
Move shader caches to VideoCommon
This commit is contained in:
@ -19,16 +19,7 @@ class PixelShaderCache
|
||||
{
|
||||
public:
|
||||
static void Init();
|
||||
static void Reload();
|
||||
static void Clear();
|
||||
static void Shutdown();
|
||||
static bool SetShader();
|
||||
static bool SetUberShader();
|
||||
static bool InsertByteCode(const PixelShaderUid& uid, const u8* data, size_t len);
|
||||
static bool InsertByteCode(const UberShader::PixelShaderUid& uid, const u8* data, size_t len);
|
||||
static bool InsertShader(const PixelShaderUid& uid, ID3D11PixelShader* shader);
|
||||
static bool InsertShader(const UberShader::PixelShaderUid& uid, ID3D11PixelShader* shader);
|
||||
static void QueueUberShaderCompiles();
|
||||
|
||||
static ID3D11Buffer* GetConstantBuffer();
|
||||
|
||||
@ -40,58 +31,6 @@ public:
|
||||
static ID3D11PixelShader* ReinterpRGB8ToRGBA6(bool multisampled);
|
||||
|
||||
static void InvalidateMSAAShaders();
|
||||
|
||||
private:
|
||||
struct PSCacheEntry
|
||||
{
|
||||
ID3D11PixelShader* shader;
|
||||
bool pending;
|
||||
|
||||
PSCacheEntry() : shader(nullptr), pending(false) {}
|
||||
void Destroy() { SAFE_RELEASE(shader); }
|
||||
};
|
||||
|
||||
class PixelShaderCompilerWorkItem : public VideoCommon::AsyncShaderCompiler::WorkItem
|
||||
{
|
||||
public:
|
||||
explicit PixelShaderCompilerWorkItem(const PixelShaderUid& uid);
|
||||
~PixelShaderCompilerWorkItem() override;
|
||||
|
||||
bool Compile() override;
|
||||
void Retrieve() override;
|
||||
|
||||
private:
|
||||
PixelShaderUid m_uid;
|
||||
ID3D11PixelShader* m_shader = nullptr;
|
||||
D3DBlob* m_bytecode = nullptr;
|
||||
};
|
||||
|
||||
class UberPixelShaderCompilerWorkItem : public VideoCommon::AsyncShaderCompiler::WorkItem
|
||||
{
|
||||
public:
|
||||
explicit UberPixelShaderCompilerWorkItem(const UberShader::PixelShaderUid& uid);
|
||||
~UberPixelShaderCompilerWorkItem() override;
|
||||
|
||||
bool Compile() override;
|
||||
void Retrieve() override;
|
||||
|
||||
private:
|
||||
UberShader::PixelShaderUid m_uid;
|
||||
ID3D11PixelShader* m_shader = nullptr;
|
||||
D3DBlob* m_bytecode = nullptr;
|
||||
};
|
||||
|
||||
typedef std::map<PixelShaderUid, PSCacheEntry> PSCache;
|
||||
typedef std::map<UberShader::PixelShaderUid, PSCacheEntry> UberPSCache;
|
||||
|
||||
static void LoadShaderCache();
|
||||
|
||||
static PSCache PixelShaders;
|
||||
static UberPSCache UberPixelShaders;
|
||||
static const PSCacheEntry* last_entry;
|
||||
static const PSCacheEntry* last_uber_entry;
|
||||
static PixelShaderUid last_uid;
|
||||
static UberShader::PixelShaderUid last_uber_uid;
|
||||
};
|
||||
|
||||
} // namespace DX11
|
||||
|
Reference in New Issue
Block a user