diff options
| author | Stenzek <stenzek@gmail.com> | 2016-11-13 18:39:06 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2016-11-28 21:21:53 +1000 |
| commit | aac66a1b61a0e4c1c2b85d89bc818a8b521bcffa (patch) | |
| tree | cbbb42db7954f3468c288c30dce169d5b5fb2753 /Source/Core/VideoBackends/Vulkan/VertexFormat.cpp | |
| parent | 681294586b3267f12d4c1632d9ff07e1298b58a6 (diff) | |
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.
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/VertexFormat.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Vulkan/VertexFormat.cpp | 13 |
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; |
