2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2014 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2014-12-03 21:17:56 +00:00
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <d3d11.h>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#include "VideoCommon/GeometryShaderGen.h"
|
|
|
|
|
|
|
|
namespace DX11
|
|
|
|
{
|
|
|
|
class GeometryShaderCache
|
|
|
|
{
|
|
|
|
public:
|
2016-06-24 08:43:46 +00:00
|
|
|
static void Init();
|
2017-06-24 09:29:03 +00:00
|
|
|
static void Reload();
|
2016-06-24 08:43:46 +00:00
|
|
|
static void Clear();
|
|
|
|
static void Shutdown();
|
2017-04-30 08:07:57 +00:00
|
|
|
static bool SetShader(PrimitiveType primitive_type);
|
2017-07-20 05:25:31 +00: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 21:17:56 +00:00
|
|
|
|
2017-02-16 04:37:04 +00:00
|
|
|
static ID3D11GeometryShader* GetClearGeometryShader();
|
|
|
|
static ID3D11GeometryShader* GetCopyGeometryShader();
|
2014-11-23 01:13:25 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
static ID3D11Buffer*& GetConstantBuffer();
|
2014-12-03 21:17:56 +00:00
|
|
|
|
|
|
|
private:
|
2016-06-24 08:43:46 +00:00
|
|
|
struct GSCacheEntry
|
|
|
|
{
|
|
|
|
ID3D11GeometryShader* shader;
|
2014-12-03 21:17:56 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
GSCacheEntry() : shader(nullptr) {}
|
|
|
|
void Destroy() { SAFE_RELEASE(shader); }
|
|
|
|
};
|
2014-12-03 21:17:56 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
typedef std::map<GeometryShaderUid, GSCacheEntry> GSCache;
|
2014-12-03 21:17:56 +00:00
|
|
|
|
2017-06-24 09:29:03 +00:00
|
|
|
static void LoadShaderCache();
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
static GSCache GeometryShaders;
|
|
|
|
static const GSCacheEntry* last_entry;
|
|
|
|
static GeometryShaderUid last_uid;
|
|
|
|
static const GSCacheEntry pass_entry;
|
2014-12-03 21:17:56 +00:00
|
|
|
};
|
|
|
|
|
2014-12-12 16:25:16 +00:00
|
|
|
} // namespace DX11
|