2014-12-03 21:17:56 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// 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 Clear();
|
|
|
|
static void Shutdown();
|
|
|
|
static bool SetShader(u32 components); // TODO: Should be renamed to LoadShader
|
|
|
|
static bool InsertByteCode(const GeometryShaderUid &uid, const void* bytecode, unsigned int bytecodelen);
|
|
|
|
|
2014-11-23 01:13:25 +00:00
|
|
|
static ID3D11GeometryShader* GeometryShaderCache::GetClearGeometryShader();
|
2014-11-29 20:31:30 +00:00
|
|
|
static ID3D11GeometryShader* GeometryShaderCache::GetCopyGeometryShader();
|
2014-11-23 01:13:25 +00:00
|
|
|
|
2014-12-03 21:17:56 +00:00
|
|
|
static ID3D11GeometryShader* GetActiveShader() { return last_entry->shader; }
|
2014-12-14 20:23:13 +00:00
|
|
|
static ID3D11Buffer* &GetConstantBuffer();
|
2014-12-03 21:17:56 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
struct GSCacheEntry
|
|
|
|
{
|
|
|
|
ID3D11GeometryShader* shader;
|
|
|
|
|
|
|
|
std::string code;
|
|
|
|
|
|
|
|
GSCacheEntry() : shader(nullptr) {}
|
|
|
|
void Destroy() { SAFE_RELEASE(shader); }
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::map<GeometryShaderUid, GSCacheEntry> GSCache;
|
|
|
|
|
|
|
|
static GSCache GeometryShaders;
|
|
|
|
static const GSCacheEntry* last_entry;
|
|
|
|
static GeometryShaderUid last_uid;
|
|
|
|
|
|
|
|
static UidChecker<GeometryShaderUid, ShaderCode> geometry_uid_checker;
|
|
|
|
};
|
|
|
|
|
2014-12-12 16:25:16 +00:00
|
|
|
} // namespace DX11
|