Monado OpenXR Runtime
Loading...
Searching...
No Matches
ComputePipelineCache< Key > Class Template Reference

Get-or-create cache of specialized compute pipelines that share one shader module and pipeline layout and differ only in specialization constant values. More...

#include <render/cache/render_compute_pipeline_cache.hpp>

Public Member Functions

 ComputePipelineCache (std::string_view name)
 
void init (VkShaderModule shader, VkPipelineLayout layout, VkPipelineCache pipelineCache)
 Sets the borrowed Vulkan objects used to create pipelines.
 
XRT_CHECK_RESULT VkResult get (struct vk_bundle *vk, const Key &key, VkPipeline &out)
 
XRT_CHECK_RESULT VkResult prewarm (struct vk_bundle *vk, std::span< const Key > keys)
 
void destroy (struct vk_bundle *vk)
 

Detailed Description

template<typename Key>
class ComputePipelineCache< Key >

Get-or-create cache of specialized compute pipelines that share one shader module and pipeline layout and differ only in specialization constant values.

Owns the pipelines it creates. The shader module, pipeline layout, and Vulkan pipeline cache supplied to init are borrowed and are never destroyed by this object.

Compute-only: creation needs just those borrowed objects plus specialization constants. Graphics pipelines need far more create-info (render pass or dynamic rendering formats, vertex input, rasterization, blend, and so on), so they cannot use this cache as-is.

Template Parameters
KeyA trivially-copyable, padding-free POD (see notes above).
Note
Not thread-safe; the render path is serialized.

Member Function Documentation

◆ init()

template<typename Key >
void ComputePipelineCache< Key >::init ( VkShaderModule  shader,
VkPipelineLayout  layout,
VkPipelineCache  pipelineCache 
)

Sets the borrowed Vulkan objects used to create pipelines.

The caller retains ownership and must keep these objects valid during calls to get and prewarm that may create a pipeline.


The documentation for this class was generated from the following files: