217 std::condition_variable_any new_pipeline_added_;
234 VkPipelineCache vk_pipeline_cache,
235 VkPipeline vk_pipeline_base,
239 bool do_wait_for_pipeline =
false;
240 bool do_compile_pipeline =
false;
243 std::scoped_lock
lock(mutex_);
244 const VkPipeline *found_pipeline = pipelines_.lookup_ptr(pipeline_info);
245 if (found_pipeline) {
246 if (*found_pipeline == VK_NULL_HANDLE) {
247 do_wait_for_pipeline =
true;
251 return *found_pipeline;
255 pipelines_.add_new(pipeline_info, VK_NULL_HANDLE);
256 do_compile_pipeline =
true;
259 if (do_wait_for_pipeline) {
260 return wait_for_completion(pipeline_info);
262 if (do_compile_pipeline) {
263 VkPipeline pipeline = create(pipeline_info, vk_pipeline_cache, vk_pipeline_base, name);
267 std::scoped_lock
lock(mutex_);
268 VkPipeline &pipeline_item = pipelines_.lookup(pipeline_info);
269 pipeline_item = pipeline;
273 new_pipeline_added_.notify_all();
278 return VK_NULL_HANDLE;
286 std::scoped_lock
lock(mutex_);
287 pipelines_.remove_if([&](
auto item) {
288 if (item.key.vk_pipeline_layout_get() == vk_pipeline_layout) {
300 void free_data(VkDevice vk_device,
const volk::VolkDeviceTable &functions)
302 std::scoped_lock
lock(mutex_);
303 for (VkPipeline &vk_pipeline : pipelines_.values()) {
304 functions.vkDestroyPipeline(vk_device, vk_pipeline,
nullptr);
313 return pipelines_.size();
330 VkPipeline create(
const PipelineInfo &pipeline_info,
331 VkPipelineCache vk_pipeline_cache,
332 VkPipeline vk_pipeline_base,
339 VkPipeline wait_for_completion(
const PipelineInfo &pipeline_info)
341 std::unique_lock<Mutex>
lock(mutex_);
342 const VkPipeline *pipeline =
nullptr;
343 new_pipeline_added_.wait(
lock, [&]() {
344 pipeline = pipelines_.
lookup_ptr(pipeline_info);
346 return *pipeline != VK_NULL_HANDLE;
384 VkPipelineCache vk_pipeline_cache_static_;
385 VkPipelineCache vk_pipeline_cache_non_static_;
416 bool is_static_shader,
417 VkPipeline vk_pipeline_base,
438 bool is_static_shader,
439 VkPipeline vk_pipeline_base,
#define BLI_assert_unreachable()
const Value * lookup_ptr(const Key &key) const
NonCopyable(const NonCopyable &other)=delete
void discard_pipeline(VkPipeline vk_pipeline)
void free_data(VkDevice vk_device, const volk::VolkDeviceTable &functions)
void discard(VKDiscardPool &discard_pool, VkPipelineLayout vk_pipeline_layout)
VkPipeline get_or_create(const PipelineInfo &pipeline_info, VkPipelineCache vk_pipeline_cache, VkPipeline vk_pipeline_base, StringRefNull name, bool &r_created)
VkPipeline get_or_create_vertex_input_lib(const VKGraphicsInfo::VertexIn &vertex_input_info)
VkPipeline get_or_create_compute_pipeline(const VKComputeInfo &compute_info, bool is_static_shader, VkPipeline vk_pipeline_base, StringRefNull name)
void free_data(const VKDevice &device)
VkPipeline get_or_create_fragment_output_lib(const VKGraphicsInfo::FragmentOut &fragment_output_info)
void discard(VKDiscardPool &discard_pool, VkPipelineLayout vk_pipeline_layout)
VkPipeline get_or_create_graphics_pipeline(const VKGraphicsInfo &graphics_info, bool is_static_shader, VkPipeline vk_pipeline_base, StringRefNull name, bool &r_created)
VkPipeline get_or_create_shaders_lib(const VKGraphicsInfo::Shaders &shaders_info)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
unsigned __int64 uint64_t
Vector< shader::SpecializationConstant::Value > specialization_constants
VkPipelineLayout vk_pipeline_layout_get() const
VkShaderModule vk_shader_module
VkPipelineLayout vk_pipeline_layout
bool operator==(const VKComputeInfo &other) const
VkFormat stencil_attachment_format
Vector< VkFormat, GPU_FB_MAX_COLOR_ATTACHMENT > color_attachment_formats
bool operator==(const FragmentOut &other) const
VkFormat depth_attachment_format
VkShaderModule vk_geometry_module
uint32_t color_attachment_count
VkShaderModule vk_vertex_module
Vector< VkRect2D, GPU_MAX_VIEWPORTS > scissors
Vector< VkViewport, GPU_MAX_VIEWPORTS > viewports
bool operator==(const Shaders &other) const
VkPrimitiveTopology vk_topology
VkPipelineLayout vk_pipeline_layout_get() const
VkPipelineLayout vk_pipeline_layout
VkShaderModule vk_fragment_module
uint32_t max_input_attachment_index
Vector< shader::SpecializationConstant::Value > specialization_constants
VKVertexInputDescriptionPool::Key vertex_input_key
VkPrimitiveTopology vk_topology
bool operator==(const VertexIn &other) const
bool operator==(const VKGraphicsInfo &other) const
VkPipelineLayout vk_pipeline_layout_get() const
std::string pipeline_info_source() const