2014-12-03 14:17:56 -07:00
|
|
|
// Copyright 2013 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 Clear();
|
|
|
|
static void Shutdown();
|
2014-12-14 11:41:16 -07:00
|
|
|
static bool SetShader(u32 primitive_type); // TODO: Should be renamed to LoadShader
|
2014-12-03 14:17:56 -07:00
|
|
|
static bool InsertByteCode(const GeometryShaderUid &uid, const void* bytecode, unsigned int bytecodelen);
|
|
|
|
|
2014-11-22 18:13:25 -07:00
|
|
|
static ID3D11GeometryShader* GeometryShaderCache::GetClearGeometryShader();
|
2014-11-29 13:31:30 -07:00
|
|
|
static ID3D11GeometryShader* GeometryShaderCache::GetCopyGeometryShader();
|
2014-11-22 18:13:25 -07:00
|
|
|
|
2014-12-03 14:17:56 -07:00
|
|
|
static ID3D11GeometryShader* GetActiveShader() { return last_entry->shader; }
|
2014-12-14 13:23:13 -07:00
|
|
|
static ID3D11Buffer* &GetConstantBuffer();
|
2014-12-03 14:17:56 -07: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;
|
2014-12-16 09:28:35 -07:00
|
|
|
static const GSCacheEntry pass_entry;
|
2014-12-03 14:17:56 -07:00
|
|
|
|
|
|
|
static UidChecker<GeometryShaderUid, ShaderCode> geometry_uid_checker;
|
|
|
|
};
|
|
|
|
|
2014-12-12 09:25:16 -07:00
|
|
|
} // namespace DX11
|