Files
dolphin/Source/Core/VideoBackends/D3D/PixelShaderCache.h
T

57 lines
1.5 KiB
C++
Raw Normal View History

// Copyright 2008 Dolphin Emulator Project
2015-05-18 01:08:10 +02:00
// Licensed under GPLv2+
// Refer to the license.txt file included.
2010-06-13 19:50:06 +00:00
#pragma once
2011-01-25 16:43:08 +00:00
#include <d3d11.h>
#include <map>
2011-01-25 16:43:08 +00:00
2014-02-17 05:18:15 -05:00
#include "VideoCommon/PixelShaderGen.h"
2011-09-08 02:09:44 +02:00
enum DSTALPHA_MODE;
2010-06-13 19:50:06 +00:00
namespace DX11
{
2010-06-13 19:50:06 +00:00
class PixelShaderCache
{
public:
static void Init();
static void Clear();
static void Shutdown();
static bool SetShader(DSTALPHA_MODE dstAlphaMode); // TODO: Should be renamed to LoadShader
static bool InsertByteCode(const PixelShaderUid& uid, const void* bytecode,
unsigned int bytecodelen);
2010-06-13 19:50:06 +00:00
static ID3D11PixelShader* GetActiveShader() { return last_entry->shader; }
static ID3D11Buffer*& GetConstantBuffer();
2011-01-24 11:57:17 +00:00
static ID3D11PixelShader* GetColorMatrixProgram(bool multisampled);
static ID3D11PixelShader* GetColorCopyProgram(bool multisampled);
static ID3D11PixelShader* GetDepthMatrixProgram(bool multisampled);
static ID3D11PixelShader* GetClearProgram();
static ID3D11PixelShader* GetAnaglyphProgram();
static ID3D11PixelShader* GetDepthResolveProgram();
static ID3D11PixelShader* ReinterpRGBA6ToRGB8(bool multisampled);
static ID3D11PixelShader* ReinterpRGB8ToRGBA6(bool multisampled);
2010-06-13 19:50:06 +00:00
static void InvalidateMSAAShaders();
2010-11-27 11:11:05 +00:00
2010-06-13 19:50:06 +00:00
private:
struct PSCacheEntry
{
ID3D11PixelShader* shader;
2010-06-13 19:50:06 +00:00
PSCacheEntry() : shader(nullptr) {}
void Destroy() { SAFE_RELEASE(shader); }
};
2010-06-13 19:50:06 +00:00
typedef std::map<PixelShaderUid, PSCacheEntry> PSCache;
2010-06-13 19:50:06 +00:00
static PSCache PixelShaders;
static const PSCacheEntry* last_entry;
static PixelShaderUid last_uid;
2010-06-13 19:50:06 +00:00
};
} // namespace DX11