Blender V4.3
vk_descriptor_set_layouts.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
18#pragma once
19
20#include <mutex>
21
22#include "BLI_map.hh"
23#include "BLI_utility_mixins.hh"
24#include "BLI_vector.hh"
25
26#include "vk_common.hh"
27
28namespace blender::gpu {
36
38 VkShaderStageFlags vk_shader_stage_flags;
39
40 bool operator==(const VKDescriptorSetLayoutInfo &other) const
41 {
42 return vk_shader_stage_flags == other.vk_shader_stage_flags && bindings == other.bindings;
43 };
44};
45
46}; // namespace blender::gpu
47
48namespace blender {
54template<> struct DefaultHash<gpu::VKDescriptorSetLayoutInfo> {
56 {
58 for (VkDescriptorType vk_descriptor_type : key.bindings) {
59 hash = hash * 33 ^ uint64_t(vk_descriptor_type);
60 }
61 return hash;
62 }
63};
64} // namespace blender
65
66namespace blender::gpu {
71 friend class VKDevice;
72
73 private:
78
82 VkDescriptorSetLayoutCreateInfo vk_descriptor_set_layout_create_info_;
83 Vector<VkDescriptorSetLayoutBinding> vk_descriptor_set_layout_bindings_;
84 std::mutex mutex_;
85
86 public:
89
96 VkDescriptorSetLayout get_or_create(const VKDescriptorSetLayoutInfo &info,
97 bool &r_created,
98 [[deprecated]] bool &r_needed);
99
105 void deinit();
106
110 int64_t size() const
111 {
112 return vk_descriptor_set_layouts_.size();
113 }
114
115 private:
116 void update_layout_bindings(const VKDescriptorSetLayoutInfo &info);
117};
118
119} // namespace blender::gpu
int64_t size() const
Definition BLI_map.hh:927
VkDescriptorSetLayout get_or_create(const VKDescriptorSetLayoutInfo &info, bool &r_created, bool &r_needed)
#define hash
Definition noise.c:154
__int64 int64_t
Definition stdint.h:89
unsigned __int64 uint64_t
Definition stdint.h:90
uint64_t operator()(const gpu::VKDescriptorSetLayoutInfo &key) const
bool operator==(const VKDescriptorSetLayoutInfo &other) const