diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index b753fab1f9..6ec95544df 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -138,7 +138,7 @@ public: static TCacheEntryBase* Load(const u32 stage); static void UnbindTextures(); - static void BindTextures(); + virtual void BindTextures(); static void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, u32 dstStride, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf); @@ -150,6 +150,8 @@ protected: alignas(16) static u8* temp; static size_t temp_size; + static TCacheEntryBase* bound_textures[8]; + private: typedef std::multimap TexCache; typedef std::unordered_multimap TexPool; @@ -165,7 +167,6 @@ private: static TexCache textures_by_address; static TexCache textures_by_hash; static TexPool texture_pool; - static TCacheEntryBase* bound_textures[8]; // Backup configuration values static struct BackupConfig diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp index 5de1eb63b7..f04112e184 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp @@ -31,7 +31,6 @@ namespace VertexLoaderManager float position_cache[3][4]; u32 position_matrix_index[3]; -typedef std::unordered_map> NativeVertexFormatMap; static NativeVertexFormatMap s_native_vertex_map; static NativeVertexFormat* s_current_vtx_fmt; u32 g_current_components; @@ -43,6 +42,12 @@ static VertexLoaderMap s_vertex_loader_map; 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() { MarkAllDirty(); diff --git a/Source/Core/VideoCommon/VertexLoaderManager.h b/Source/Core/VideoCommon/VertexLoaderManager.h index 4bb180cf88..cc37750ffd 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.h +++ b/Source/Core/VideoCommon/VertexLoaderManager.h @@ -5,19 +5,25 @@ #pragma once #include +#include #include "Common/CommonTypes.h" class DataReader; class NativeVertexFormat; +struct PortableVertexDeclaration; namespace VertexLoaderManager { + using NativeVertexFormatMap = std::unordered_map>; + void Init(); void Shutdown(); void MarkAllDirty(); + NativeVertexFormatMap* GetNativeVertexFormatMap(); + // 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); diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp index 0816618f38..faee28c545 100644 --- a/Source/Core/VideoCommon/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/VertexManagerBase.cpp @@ -230,7 +230,7 @@ void VertexManagerBase::Flush() ERROR_LOG(VIDEO, "error loading texture"); } } - TextureCacheBase::BindTextures(); + g_texture_cache->BindTextures(); } // set global vertex constants