D3D12: Additions to VideoCommon to support D3D12 backend.

This commit is contained in:
hdcmeta 2016-01-07 19:38:00 -08:00
parent 98f74d3479
commit a2e2e36745
4 changed files with 16 additions and 4 deletions

View File

@ -138,7 +138,7 @@ public:
static TCacheEntryBase* Load(const u32 stage); static TCacheEntryBase* Load(const u32 stage);
static void UnbindTextures(); static void UnbindTextures();
static void BindTextures(); virtual void BindTextures();
static void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, u32 dstStride, static void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, u32 dstStride,
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf); PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf);
@ -150,6 +150,8 @@ protected:
alignas(16) static u8* temp; alignas(16) static u8* temp;
static size_t temp_size; static size_t temp_size;
static TCacheEntryBase* bound_textures[8];
private: private:
typedef std::multimap<u64, TCacheEntryBase*> TexCache; typedef std::multimap<u64, TCacheEntryBase*> TexCache;
typedef std::unordered_multimap<TCacheEntryConfig, TCacheEntryBase*, TCacheEntryConfig::Hasher> TexPool; typedef std::unordered_multimap<TCacheEntryConfig, TCacheEntryBase*, TCacheEntryConfig::Hasher> TexPool;
@ -165,7 +167,6 @@ private:
static TexCache textures_by_address; static TexCache textures_by_address;
static TexCache textures_by_hash; static TexCache textures_by_hash;
static TexPool texture_pool; static TexPool texture_pool;
static TCacheEntryBase* bound_textures[8];
// Backup configuration values // Backup configuration values
static struct BackupConfig static struct BackupConfig

View File

@ -31,7 +31,6 @@ namespace VertexLoaderManager
float position_cache[3][4]; float position_cache[3][4];
u32 position_matrix_index[3]; u32 position_matrix_index[3];
typedef std::unordered_map<PortableVertexDeclaration, std::unique_ptr<NativeVertexFormat>> NativeVertexFormatMap;
static NativeVertexFormatMap s_native_vertex_map; static NativeVertexFormatMap s_native_vertex_map;
static NativeVertexFormat* s_current_vtx_fmt; static NativeVertexFormat* s_current_vtx_fmt;
u32 g_current_components; u32 g_current_components;
@ -43,6 +42,12 @@ static VertexLoaderMap s_vertex_loader_map;
u8 *cached_arraybases[12]; u8 *cached_arraybases[12];
// Used in D3D12 backend, to populate input layouts used by cached-to-disk PSOs.
NativeVertexFormatMap* GetNativeVertexFormatMap()
{
return &s_native_vertex_map;
}
void Init() void Init()
{ {
MarkAllDirty(); MarkAllDirty();

View File

@ -5,19 +5,25 @@
#pragma once #pragma once
#include <string> #include <string>
#include <unordered_map>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
class DataReader; class DataReader;
class NativeVertexFormat; class NativeVertexFormat;
struct PortableVertexDeclaration;
namespace VertexLoaderManager namespace VertexLoaderManager
{ {
using NativeVertexFormatMap = std::unordered_map<PortableVertexDeclaration, std::unique_ptr<NativeVertexFormat>>;
void Init(); void Init();
void Shutdown(); void Shutdown();
void MarkAllDirty(); void MarkAllDirty();
NativeVertexFormatMap* GetNativeVertexFormatMap();
// Returns -1 if buf_size is insufficient, else the amount of bytes consumed // Returns -1 if buf_size is insufficient, else the amount of bytes consumed
int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bool skip_drawing, bool is_preprocess); int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bool skip_drawing, bool is_preprocess);

View File

@ -230,7 +230,7 @@ void VertexManagerBase::Flush()
ERROR_LOG(VIDEO, "error loading texture"); ERROR_LOG(VIDEO, "error loading texture");
} }
} }
TextureCacheBase::BindTextures(); g_texture_cache->BindTextures();
} }
// set global vertex constants // set global vertex constants