summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/VertexFormat.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@users.noreply.github.com>2016-11-28 22:03:49 +1000
committerGitHub <noreply@github.com>2016-11-28 22:03:49 +1000
commitda87580dc1c8eb63dac783f0e50e9bd3cfe4b3a1 (patch)
tree3875647817c8ef5e0f8843f02bba13fc1f12e91d /Source/Core/VideoBackends/Vulkan/VertexFormat.cpp
parent681294586b3267f12d4c1632d9ff07e1298b58a6 (diff)
parent8d48319414d7e3f348e4ef38e976121e9a1fce6a (diff)
Merge pull request #4449 from stenzek/vulkan-pipeline-cache
Vulkan: Implement pipeline UID cache
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/VertexFormat.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/VertexFormat.cpp13
1 files changed, 13 insertions, 0 deletions
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<VertexFormat>(decl));
+ iter = ipair.first;
+ }
+
+ return static_cast<VertexFormat*>(iter->second.get());
+}
+
void VertexFormat::MapAttributes()
{
m_num_attributes = 0;