dolphin/Source/Core/VideoBackends/D3D/GeometryShaderCache.h

51 lines
1.2 KiB
C
Raw Normal View History

// Copyright 2014 Dolphin Emulator Project
2015-05-17 17:08:10 -06:00
// Licensed under GPLv2+
2014-12-03 14:17:56 -07:00
// Refer to the license.txt file included.
#pragma once
#include <d3d11.h>
#include <map>
#include "VideoCommon/GeometryShaderGen.h"
namespace DX11
{
class GeometryShaderCache
{
public:
static void Init();
static void Reload();
static void Clear();
static void Shutdown();
static bool SetShader(PrimitiveType primitive_type);
2017-07-19 23:25:31 -06:00
static bool CompileShader(const GeometryShaderUid& uid);
static bool InsertByteCode(const GeometryShaderUid& uid, const u8* bytecode, size_t len);
static void PrecompileShaders();
2014-12-03 14:17:56 -07:00
static ID3D11GeometryShader* GetClearGeometryShader();
static ID3D11GeometryShader* GetCopyGeometryShader();
static ID3D11Buffer*& GetConstantBuffer();
2014-12-03 14:17:56 -07:00
private:
struct GSCacheEntry
{
ID3D11GeometryShader* shader;
2014-12-03 14:17:56 -07:00
GSCacheEntry() : shader(nullptr) {}
void Destroy() { SAFE_RELEASE(shader); }
};
2014-12-03 14:17:56 -07:00
typedef std::map<GeometryShaderUid, GSCacheEntry> GSCache;
2014-12-03 14:17:56 -07:00
static void LoadShaderCache();
static GSCache GeometryShaders;
static const GSCacheEntry* last_entry;
static GeometryShaderUid last_uid;
static const GSCacheEntry pass_entry;
2014-12-03 14:17:56 -07:00
};
2014-12-12 09:25:16 -07:00
} // namespace DX11