71 {
74 uint32_t numBindings = visibilities.
size();
75 std::unique_ptr<VkDescriptorSetLayoutBinding[]> dsSamplerBindings(
77 *descCountPerSet = 0;
78 for (uint32_t
i = 0;
i < numBindings; ++
i) {
79 uint32_t visibility = visibilities[
i];
80 dsSamplerBindings[
i].binding =
i;
81 dsSamplerBindings[
i].descriptorType =
type;
82 dsSamplerBindings[
i].descriptorCount = 1;
85 if (immutableSamplers[
i]) {
87 dsSamplerBindings[
i].pImmutableSamplers = immutableSamplers[
i]->samplerPtr();
88 } else {
89 (*descCountPerSet)++;
90 dsSamplerBindings[
i].pImmutableSamplers =
nullptr;
91 }
92 }
93 }
94
98 dsSamplerLayoutCreateInfo.
pNext =
nullptr;
99 dsSamplerLayoutCreateInfo.
flags = 0;
101
102
103
104 dsSamplerLayoutCreateInfo.
pBindings = numBindings ? dsSamplerBindings.get() :
nullptr;
105
106#if defined(SK_ENABLE_SCOPED_LSAN_SUPPRESSIONS)
107
108 __lsan::ScopedDisabler lsanDisabler;
109#endif
112 CreateDescriptorSetLayout(gpu->
device(),
113 &dsSamplerLayoutCreateInfo,
114 nullptr,
115 descSetLayout));
117 return false;
118 }
120 static constexpr int kUniformDescPerSet = 1;
122
129
132 uniformLayoutCreateInfo.
pNext =
nullptr;
133 uniformLayoutCreateInfo.
flags = 0;
135 uniformLayoutCreateInfo.
pBindings = &dsUniBinding;
136
137#if defined(SK_ENABLE_SCOPED_LSAN_SUPPRESSIONS)
138
139 __lsan::ScopedDisabler lsanDisabler;
140#endif
143 &uniformLayoutCreateInfo,
144 nullptr,
145 descSetLayout));
147 return false;
148 }
149
150 *descCountPerSet = kUniformDescPerSet;
151 } else {
153 static constexpr int kInputDescPerSet = 1;
155
156
164
167 inputLayoutCreateInfo.
pNext =
nullptr;
168 inputLayoutCreateInfo.
flags = 0;
170 inputLayoutCreateInfo.
pBindings = &dsInpuBinding;
171
172#if defined(SK_ENABLE_SCOPED_LSAN_SUPPRESSIONS)
173
174 __lsan::ScopedDisabler lsanDisabler;
175#endif
178 &inputLayoutCreateInfo,
179 nullptr, descSetLayout));
181 return false;
182 }
183
184 *descCountPerSet = kInputDescPerSet;
185 }
186 return true;
187}
VkShaderStageFlags visibility_to_vk_stage_flags(uint32_t visibility)
#define GR_VK_CALL_RESULT(GPU, RESULT, X)
uint32_t ycbcrCombinedImageSamplerDescriptorCount() const
const GrVkCaps & vkCaps() const
VkDescriptorType descriptorType
const VkSampler * pImmutableSamplers
VkShaderStageFlags stageFlags
const VkDescriptorSetLayoutBinding * pBindings
VkDescriptorSetLayoutCreateFlags flags
@ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
@ VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
@ VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT
@ VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
@ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO