summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/ObjectCache.h
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/ObjectCache.h
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/ObjectCache.h')
-rw-r--r--Source/Core/VideoBackends/Vulkan/ObjectCache.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/ObjectCache.h b/Source/Core/VideoBackends/Vulkan/ObjectCache.h
index b991b8a3b8..26593d139d 100644
--- a/Source/Core/VideoBackends/Vulkan/ObjectCache.h
+++ b/Source/Core/VideoBackends/Vulkan/ObjectCache.h
@@ -111,12 +111,17 @@ public:
// Perform at startup, create descriptor layouts, compiles all static shaders.
bool Initialize();
- // Find a pipeline by the specified description, if not found, attempts to create it
+ // Creates a pipeline for the specified description. The resulting pipeline, if successful
+ // is not stored anywhere, this is left up to the caller.
+ VkPipeline CreatePipeline(const PipelineInfo& info);
+
+ // Find a pipeline by the specified description, if not found, attempts to create it.
VkPipeline GetPipeline(const PipelineInfo& info);
- // Wipes out the pipeline cache, use when MSAA modes change, for example
- // Also destroys the data that would be stored in the disk cache.
- void ClearPipelineCache();
+ // Find a pipeline by the specified description, if not found, attempts to create it. If this
+ // resulted in a pipeline being created, the second field of the return value will be false,
+ // otherwise for a cache hit it will be true.
+ std::pair<VkPipeline, bool> GetPipelineWithCacheResult(const PipelineInfo& info);
// Saves the pipeline cache to disk. Call when shutting down.
void SavePipelineCache();
@@ -133,8 +138,12 @@ public:
VkShaderModule GetPassthroughVertexShader() const { return m_passthrough_vertex_shader; }
VkShaderModule GetScreenQuadGeometryShader() const { return m_screen_quad_geometry_shader; }
VkShaderModule GetPassthroughGeometryShader() const { return m_passthrough_geometry_shader; }
+ // Gets the filename of the specified type of cache object (e.g. vertex shader, pipeline).
+ std::string GetDiskCacheFileName(const char* type);
+
private:
bool CreatePipelineCache(bool load_from_disk);
+ bool ValidatePipelineCache(const u8* data, size_t data_length);
void DestroyPipelineCache();
void LoadShaderCaches();
void DestroyShaderCaches();
@@ -148,8 +157,6 @@ private:
void DestroySharedShaders();
void DestroySamplers();
- std::string GetDiskCacheFileName(const char* type);
-
std::array<VkDescriptorSetLayout, NUM_DESCRIPTOR_SETS> m_descriptor_set_layouts = {};
VkPipelineLayout m_standard_pipeline_layout = VK_NULL_HANDLE;