From aac66a1b61a0e4c1c2b85d89bc818a8b521bcffa Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 13 Nov 2016 18:39:06 +1000 Subject: Vulkan: Implement a pipeline UID cache This stores enough information to recreate the pipeline, including the shader UIDs, blend/depth/rasterization state, primitive and vertex format. --- Source/Core/VideoBackends/Vulkan/VertexFormat.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Source/Core/VideoBackends/Vulkan/VertexFormat.cpp') diff --git a/Source/Core/VideoBackends/Vulkan/VertexFormat.cpp b/Source/Core/VideoBackends/Vulkan/VertexFormat.cpp index 27c1d06199..ba67472394 100644 --- a/Source/Core/VideoBackends/Vulkan/VertexFormat.cpp +++ b/Source/Core/VideoBackends/Vulkan/VertexFormat.cpp @@ -53,6 +53,19 @@ VertexFormat::VertexFormat(const PortableVertexDeclaration& in_vtx_decl) SetupInputState(); } +VertexFormat* VertexFormat::GetOrCreateMatchingFormat(const PortableVertexDeclaration& decl) +{ + auto vertex_format_map = VertexLoaderManager::GetNativeVertexFormatMap(); + auto iter = vertex_format_map->find(decl); + if (iter == vertex_format_map->end()) + { + auto ipair = vertex_format_map->emplace(decl, std::make_unique(decl)); + iter = ipair.first; + } + + return static_cast(iter->second.get()); +} + void VertexFormat::MapAttributes() { m_num_attributes = 0; -- cgit v1.2.3