2 * Copyright © 2016 Red Hat.
3 * Copyright © 2016 Bas Nieuwenhuizen
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 #include "util/mesa-sha1.h"
31 #include "radv_private.h"
36 static bool has_equal_immutable_samplers(const VkSampler
*samplers
, uint32_t count
)
40 for(uint32_t i
= 1; i
< count
; ++i
) {
41 if (memcmp(radv_sampler_from_handle(samplers
[0])->state
,
42 radv_sampler_from_handle(samplers
[i
])->state
, 16)) {
49 static int binding_compare(const void* av
, const void *bv
)
51 const VkDescriptorSetLayoutBinding
*a
= (const VkDescriptorSetLayoutBinding
*)av
;
52 const VkDescriptorSetLayoutBinding
*b
= (const VkDescriptorSetLayoutBinding
*)bv
;
54 return (a
->binding
< b
->binding
) ? -1 : (a
->binding
> b
->binding
) ? 1 : 0;
57 static VkDescriptorSetLayoutBinding
*
58 create_sorted_bindings(const VkDescriptorSetLayoutBinding
*bindings
, unsigned count
) {
59 VkDescriptorSetLayoutBinding
*sorted_bindings
= malloc(count
* sizeof(VkDescriptorSetLayoutBinding
));
63 memcpy(sorted_bindings
, bindings
, count
* sizeof(VkDescriptorSetLayoutBinding
));
65 qsort(sorted_bindings
, count
, sizeof(VkDescriptorSetLayoutBinding
), binding_compare
);
67 return sorted_bindings
;
70 VkResult
radv_CreateDescriptorSetLayout(
72 const VkDescriptorSetLayoutCreateInfo
* pCreateInfo
,
73 const VkAllocationCallbacks
* pAllocator
,
74 VkDescriptorSetLayout
* pSetLayout
)
76 RADV_FROM_HANDLE(radv_device
, device
, _device
);
77 struct radv_descriptor_set_layout
*set_layout
;
79 assert(pCreateInfo
->sType
== VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
);
80 const VkDescriptorSetLayoutBindingFlagsCreateInfoEXT
*variable_flags
=
81 vk_find_struct_const(pCreateInfo
->pNext
, DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO_EXT
);
83 uint32_t max_binding
= 0;
84 uint32_t immutable_sampler_count
= 0;
85 for (uint32_t j
= 0; j
< pCreateInfo
->bindingCount
; j
++) {
86 max_binding
= MAX2(max_binding
, pCreateInfo
->pBindings
[j
].binding
);
87 if (pCreateInfo
->pBindings
[j
].pImmutableSamplers
)
88 immutable_sampler_count
+= pCreateInfo
->pBindings
[j
].descriptorCount
;
91 uint32_t samplers_offset
= sizeof(struct radv_descriptor_set_layout
) +
92 (max_binding
+ 1) * sizeof(set_layout
->binding
[0]);
93 size_t size
= samplers_offset
+ immutable_sampler_count
* 4 * sizeof(uint32_t);
95 set_layout
= vk_alloc2(&device
->alloc
, pAllocator
, size
, 8,
96 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
98 return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY
);
100 set_layout
->flags
= pCreateInfo
->flags
;
102 /* We just allocate all the samplers at the end of the struct */
103 uint32_t *samplers
= (uint32_t*)&set_layout
->binding
[max_binding
+ 1];
105 VkDescriptorSetLayoutBinding
*bindings
= create_sorted_bindings(pCreateInfo
->pBindings
,
106 pCreateInfo
->bindingCount
);
108 vk_free2(&device
->alloc
, pAllocator
, set_layout
);
109 return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY
);
112 set_layout
->binding_count
= max_binding
+ 1;
113 set_layout
->shader_stages
= 0;
114 set_layout
->dynamic_shader_stages
= 0;
115 set_layout
->has_immutable_samplers
= false;
116 set_layout
->size
= 0;
118 memset(set_layout
->binding
, 0, size
- sizeof(struct radv_descriptor_set_layout
));
120 uint32_t dynamic_offset_count
= 0;
122 for (uint32_t j
= 0; j
< pCreateInfo
->bindingCount
; j
++) {
123 const VkDescriptorSetLayoutBinding
*binding
= bindings
+ j
;
124 uint32_t b
= binding
->binding
;
127 switch (binding
->descriptorType
) {
128 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
129 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
:
130 assert(!(pCreateInfo
->flags
& VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR
));
131 set_layout
->binding
[b
].dynamic_offset_count
= 1;
132 set_layout
->dynamic_shader_stages
|= binding
->stageFlags
;
133 set_layout
->binding
[b
].size
= 0;
136 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
:
137 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
:
138 case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
:
139 case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
:
140 set_layout
->binding
[b
].size
= 16;
143 case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
:
144 case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
:
145 case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT
:
146 /* main descriptor + fmask descriptor */
147 set_layout
->binding
[b
].size
= 64;
150 case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
:
151 /* main descriptor + fmask descriptor + sampler */
152 set_layout
->binding
[b
].size
= 96;
155 case VK_DESCRIPTOR_TYPE_SAMPLER
:
156 set_layout
->binding
[b
].size
= 16;
160 unreachable("unknown descriptor type\n");
164 set_layout
->size
= align(set_layout
->size
, alignment
);
165 set_layout
->binding
[b
].type
= binding
->descriptorType
;
166 set_layout
->binding
[b
].array_size
= binding
->descriptorCount
;
167 set_layout
->binding
[b
].offset
= set_layout
->size
;
168 set_layout
->binding
[b
].dynamic_offset_offset
= dynamic_offset_count
;
170 if (variable_flags
&& binding
->binding
< variable_flags
->bindingCount
&&
171 (variable_flags
->pBindingFlags
[binding
->binding
] & VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT
)) {
172 assert(!binding
->pImmutableSamplers
); /* Terribly ill defined how many samplers are valid */
173 assert(binding
->binding
== max_binding
);
175 set_layout
->has_variable_descriptors
= true;
178 if (binding
->pImmutableSamplers
) {
179 set_layout
->binding
[b
].immutable_samplers_offset
= samplers_offset
;
180 set_layout
->binding
[b
].immutable_samplers_equal
=
181 has_equal_immutable_samplers(binding
->pImmutableSamplers
, binding
->descriptorCount
);
182 set_layout
->has_immutable_samplers
= true;
185 for (uint32_t i
= 0; i
< binding
->descriptorCount
; i
++)
186 memcpy(samplers
+ 4 * i
, &radv_sampler_from_handle(binding
->pImmutableSamplers
[i
])->state
, 16);
188 /* Don't reserve space for the samplers if they're not accessed. */
189 if (set_layout
->binding
[b
].immutable_samplers_equal
) {
190 if (binding
->descriptorType
== VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
)
191 set_layout
->binding
[b
].size
-= 32;
192 else if (binding
->descriptorType
== VK_DESCRIPTOR_TYPE_SAMPLER
)
193 set_layout
->binding
[b
].size
-= 16;
195 samplers
+= 4 * binding
->descriptorCount
;
196 samplers_offset
+= 4 * sizeof(uint32_t) * binding
->descriptorCount
;
199 set_layout
->size
+= binding
->descriptorCount
* set_layout
->binding
[b
].size
;
200 dynamic_offset_count
+= binding
->descriptorCount
*
201 set_layout
->binding
[b
].dynamic_offset_count
;
202 set_layout
->shader_stages
|= binding
->stageFlags
;
207 set_layout
->dynamic_offset_count
= dynamic_offset_count
;
209 *pSetLayout
= radv_descriptor_set_layout_to_handle(set_layout
);
214 void radv_DestroyDescriptorSetLayout(
216 VkDescriptorSetLayout _set_layout
,
217 const VkAllocationCallbacks
* pAllocator
)
219 RADV_FROM_HANDLE(radv_device
, device
, _device
);
220 RADV_FROM_HANDLE(radv_descriptor_set_layout
, set_layout
, _set_layout
);
225 vk_free2(&device
->alloc
, pAllocator
, set_layout
);
228 void radv_GetDescriptorSetLayoutSupport(VkDevice device
,
229 const VkDescriptorSetLayoutCreateInfo
* pCreateInfo
,
230 VkDescriptorSetLayoutSupport
* pSupport
)
232 VkDescriptorSetLayoutBinding
*bindings
= create_sorted_bindings(pCreateInfo
->pBindings
,
233 pCreateInfo
->bindingCount
);
235 pSupport
->supported
= false;
239 const VkDescriptorSetLayoutBindingFlagsCreateInfoEXT
*variable_flags
=
240 vk_find_struct_const(pCreateInfo
->pNext
, DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO_EXT
);
241 VkDescriptorSetVariableDescriptorCountLayoutSupportEXT
*variable_count
=
242 vk_find_struct((void*)pCreateInfo
->pNext
, DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT_EXT
);
243 if (variable_count
) {
244 variable_count
->maxVariableDescriptorCount
= 0;
247 bool supported
= true;
249 for (uint32_t i
= 0; i
< pCreateInfo
->bindingCount
; i
++) {
250 const VkDescriptorSetLayoutBinding
*binding
= bindings
+ i
;
252 uint64_t descriptor_size
= 0;
253 uint64_t descriptor_alignment
= 1;
254 switch (binding
->descriptorType
) {
255 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
256 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
:
258 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
:
259 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
:
260 case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
:
261 case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
:
262 descriptor_size
= 16;
263 descriptor_alignment
= 16;
265 case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
:
266 case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
:
267 case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT
:
268 descriptor_size
= 64;
269 descriptor_alignment
= 32;
271 case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
:
272 if (!has_equal_immutable_samplers(binding
->pImmutableSamplers
, binding
->descriptorCount
)) {
273 descriptor_size
= 64;
275 descriptor_size
= 96;
277 descriptor_alignment
= 32;
279 case VK_DESCRIPTOR_TYPE_SAMPLER
:
280 if (!has_equal_immutable_samplers(binding
->pImmutableSamplers
, binding
->descriptorCount
)) {
281 descriptor_size
= 16;
282 descriptor_alignment
= 16;
286 unreachable("unknown descriptor type\n");
290 if (size
&& !align_u64(size
, descriptor_alignment
)) {
293 size
= align_u64(size
, descriptor_alignment
);
295 uint64_t max_count
= UINT64_MAX
;
297 max_count
= (UINT64_MAX
- size
) / descriptor_size
;
299 if (max_count
< binding
->descriptorCount
) {
302 if (variable_flags
&& binding
->binding
<variable_flags
->bindingCount
&& variable_count
&&
303 (variable_flags
->pBindingFlags
[binding
->binding
] & VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT
)) {
304 variable_count
->maxVariableDescriptorCount
= MIN2(UINT32_MAX
, max_count
);
306 size
+= binding
->descriptorCount
* descriptor_size
;
311 pSupport
->supported
= supported
;
315 * Pipeline layouts. These have nothing to do with the pipeline. They are
316 * just muttiple descriptor set layouts pasted together
319 VkResult
radv_CreatePipelineLayout(
321 const VkPipelineLayoutCreateInfo
* pCreateInfo
,
322 const VkAllocationCallbacks
* pAllocator
,
323 VkPipelineLayout
* pPipelineLayout
)
325 RADV_FROM_HANDLE(radv_device
, device
, _device
);
326 struct radv_pipeline_layout
*layout
;
327 struct mesa_sha1 ctx
;
329 assert(pCreateInfo
->sType
== VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
);
331 layout
= vk_alloc2(&device
->alloc
, pAllocator
, sizeof(*layout
), 8,
332 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
334 return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY
);
336 layout
->num_sets
= pCreateInfo
->setLayoutCount
;
338 unsigned dynamic_offset_count
= 0;
341 _mesa_sha1_init(&ctx
);
342 for (uint32_t set
= 0; set
< pCreateInfo
->setLayoutCount
; set
++) {
343 RADV_FROM_HANDLE(radv_descriptor_set_layout
, set_layout
,
344 pCreateInfo
->pSetLayouts
[set
]);
345 layout
->set
[set
].layout
= set_layout
;
347 layout
->set
[set
].dynamic_offset_start
= dynamic_offset_count
;
348 for (uint32_t b
= 0; b
< set_layout
->binding_count
; b
++) {
349 dynamic_offset_count
+= set_layout
->binding
[b
].array_size
* set_layout
->binding
[b
].dynamic_offset_count
;
350 if (set_layout
->binding
[b
].immutable_samplers_offset
)
351 _mesa_sha1_update(&ctx
, radv_immutable_samplers(set_layout
, set_layout
->binding
+ b
),
352 set_layout
->binding
[b
].array_size
* 4 * sizeof(uint32_t));
354 _mesa_sha1_update(&ctx
, set_layout
->binding
,
355 sizeof(set_layout
->binding
[0]) * set_layout
->binding_count
);
358 layout
->dynamic_offset_count
= dynamic_offset_count
;
359 layout
->push_constant_size
= 0;
361 for (unsigned i
= 0; i
< pCreateInfo
->pushConstantRangeCount
; ++i
) {
362 const VkPushConstantRange
*range
= pCreateInfo
->pPushConstantRanges
+ i
;
363 layout
->push_constant_size
= MAX2(layout
->push_constant_size
,
364 range
->offset
+ range
->size
);
367 layout
->push_constant_size
= align(layout
->push_constant_size
, 16);
368 _mesa_sha1_update(&ctx
, &layout
->push_constant_size
,
369 sizeof(layout
->push_constant_size
));
370 _mesa_sha1_final(&ctx
, layout
->sha1
);
371 *pPipelineLayout
= radv_pipeline_layout_to_handle(layout
);
376 void radv_DestroyPipelineLayout(
378 VkPipelineLayout _pipelineLayout
,
379 const VkAllocationCallbacks
* pAllocator
)
381 RADV_FROM_HANDLE(radv_device
, device
, _device
);
382 RADV_FROM_HANDLE(radv_pipeline_layout
, pipeline_layout
, _pipelineLayout
);
384 if (!pipeline_layout
)
386 vk_free2(&device
->alloc
, pAllocator
, pipeline_layout
);
392 radv_descriptor_set_create(struct radv_device
*device
,
393 struct radv_descriptor_pool
*pool
,
394 const struct radv_descriptor_set_layout
*layout
,
395 struct radv_descriptor_set
**out_set
)
397 struct radv_descriptor_set
*set
;
398 unsigned range_offset
= sizeof(struct radv_descriptor_set
);
399 unsigned mem_size
= range_offset
+
400 sizeof(struct radv_descriptor_range
) * layout
->dynamic_offset_count
;
402 if (pool
->host_memory_base
) {
403 if (pool
->host_memory_end
- pool
->host_memory_ptr
< mem_size
)
404 return vk_error(VK_ERROR_OUT_OF_POOL_MEMORY_KHR
);
406 set
= (struct radv_descriptor_set
*)pool
->host_memory_ptr
;
407 pool
->host_memory_ptr
+= mem_size
;
409 set
= vk_alloc2(&device
->alloc
, NULL
, mem_size
, 8,
410 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
413 return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY
);
416 memset(set
, 0, mem_size
);
418 if (layout
->dynamic_offset_count
) {
419 set
->dynamic_descriptors
= (struct radv_descriptor_range
*)((uint8_t*)set
+ range_offset
);
422 set
->layout
= layout
;
424 uint32_t layout_size
= align_u32(layout
->size
, 32);
425 set
->size
= layout
->size
;
427 if (!pool
->host_memory_base
&& pool
->entry_count
== pool
->max_entry_count
) {
428 vk_free2(&device
->alloc
, NULL
, set
);
429 return vk_error(VK_ERROR_OUT_OF_POOL_MEMORY_KHR
);
432 /* try to allocate linearly first, so that we don't spend
433 * time looking for gaps if the app only allocates &
434 * resets via the pool. */
435 if (pool
->current_offset
+ layout_size
<= pool
->size
) {
437 set
->mapped_ptr
= (uint32_t*)(pool
->mapped_ptr
+ pool
->current_offset
);
438 set
->va
= radv_buffer_get_va(set
->bo
) + pool
->current_offset
;
439 if (!pool
->host_memory_base
) {
440 pool
->entries
[pool
->entry_count
].offset
= pool
->current_offset
;
441 pool
->entries
[pool
->entry_count
].size
= layout_size
;
442 pool
->entries
[pool
->entry_count
].set
= set
;
445 pool
->current_offset
+= layout_size
;
446 } else if (!pool
->host_memory_base
) {
450 for (index
= 0; index
< pool
->entry_count
; ++index
) {
451 if (pool
->entries
[index
].offset
- offset
>= layout_size
)
453 offset
= pool
->entries
[index
].offset
+ pool
->entries
[index
].size
;
456 if (pool
->size
- offset
< layout_size
) {
457 vk_free2(&device
->alloc
, NULL
, set
);
458 return vk_error(VK_ERROR_OUT_OF_POOL_MEMORY_KHR
);
461 set
->mapped_ptr
= (uint32_t*)(pool
->mapped_ptr
+ offset
);
462 set
->va
= radv_buffer_get_va(set
->bo
) + offset
;
463 memmove(&pool
->entries
[index
+ 1], &pool
->entries
[index
],
464 sizeof(pool
->entries
[0]) * (pool
->entry_count
- index
));
465 pool
->entries
[index
].offset
= offset
;
466 pool
->entries
[index
].size
= layout_size
;
467 pool
->entries
[index
].set
= set
;
470 return vk_error(VK_ERROR_OUT_OF_POOL_MEMORY_KHR
);
473 if (layout
->has_immutable_samplers
) {
474 for (unsigned i
= 0; i
< layout
->binding_count
; ++i
) {
475 if (!layout
->binding
[i
].immutable_samplers_offset
||
476 layout
->binding
[i
].immutable_samplers_equal
)
479 unsigned offset
= layout
->binding
[i
].offset
/ 4;
480 if (layout
->binding
[i
].type
== VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
)
483 const uint32_t *samplers
= (const uint32_t*)((const char*)layout
+ layout
->binding
[i
].immutable_samplers_offset
);
484 for (unsigned j
= 0; j
< layout
->binding
[i
].array_size
; ++j
) {
485 memcpy(set
->mapped_ptr
+ offset
, samplers
+ 4 * j
, 16);
486 offset
+= layout
->binding
[i
].size
/ 4;
496 radv_descriptor_set_destroy(struct radv_device
*device
,
497 struct radv_descriptor_pool
*pool
,
498 struct radv_descriptor_set
*set
,
501 assert(!pool
->host_memory_base
);
503 if (free_bo
&& set
->size
&& !pool
->host_memory_base
) {
504 uint32_t offset
= (uint8_t*)set
->mapped_ptr
- pool
->mapped_ptr
;
505 for (int i
= 0; i
< pool
->entry_count
; ++i
) {
506 if (pool
->entries
[i
].offset
== offset
) {
507 memmove(&pool
->entries
[i
], &pool
->entries
[i
+1],
508 sizeof(pool
->entries
[i
]) * (pool
->entry_count
- i
- 1));
514 vk_free2(&device
->alloc
, NULL
, set
);
517 VkResult
radv_CreateDescriptorPool(
519 const VkDescriptorPoolCreateInfo
* pCreateInfo
,
520 const VkAllocationCallbacks
* pAllocator
,
521 VkDescriptorPool
* pDescriptorPool
)
523 RADV_FROM_HANDLE(radv_device
, device
, _device
);
524 struct radv_descriptor_pool
*pool
;
525 int size
= sizeof(struct radv_descriptor_pool
);
526 uint64_t bo_size
= 0, bo_count
= 0, range_count
= 0;
529 for (unsigned i
= 0; i
< pCreateInfo
->poolSizeCount
; ++i
) {
530 if (pCreateInfo
->pPoolSizes
[i
].type
!= VK_DESCRIPTOR_TYPE_SAMPLER
)
531 bo_count
+= pCreateInfo
->pPoolSizes
[i
].descriptorCount
;
533 switch(pCreateInfo
->pPoolSizes
[i
].type
) {
534 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
535 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
:
536 range_count
+= pCreateInfo
->pPoolSizes
[i
].descriptorCount
;
538 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
:
539 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
:
540 case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
:
541 case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
:
542 case VK_DESCRIPTOR_TYPE_SAMPLER
:
543 /* 32 as we may need to align for images */
544 bo_size
+= 32 * pCreateInfo
->pPoolSizes
[i
].descriptorCount
;
546 case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
:
547 case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
:
548 case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT
:
549 bo_size
+= 64 * pCreateInfo
->pPoolSizes
[i
].descriptorCount
;
551 case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
:
552 bo_size
+= 96 * pCreateInfo
->pPoolSizes
[i
].descriptorCount
;
555 unreachable("unknown descriptor type\n");
560 if (!(pCreateInfo
->flags
& VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT
)) {
561 uint64_t host_size
= pCreateInfo
->maxSets
* sizeof(struct radv_descriptor_set
);
562 host_size
+= sizeof(struct radeon_winsys_bo
*) * bo_count
;
563 host_size
+= sizeof(struct radv_descriptor_range
) * range_count
;
566 size
+= sizeof(struct radv_descriptor_pool_entry
) * pCreateInfo
->maxSets
;
569 pool
= vk_alloc2(&device
->alloc
, pAllocator
, size
, 8,
570 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
572 return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY
);
574 memset(pool
, 0, sizeof(*pool
));
576 if (!(pCreateInfo
->flags
& VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT
)) {
577 pool
->host_memory_base
= (uint8_t*)pool
+ sizeof(struct radv_descriptor_pool
);
578 pool
->host_memory_ptr
= pool
->host_memory_base
;
579 pool
->host_memory_end
= (uint8_t*)pool
+ size
;
583 pool
->bo
= device
->ws
->buffer_create(device
->ws
, bo_size
, 32,
585 RADEON_FLAG_NO_INTERPROCESS_SHARING
|
586 RADEON_FLAG_READ_ONLY
);
587 pool
->mapped_ptr
= (uint8_t*)device
->ws
->buffer_map(pool
->bo
);
589 pool
->size
= bo_size
;
590 pool
->max_entry_count
= pCreateInfo
->maxSets
;
592 *pDescriptorPool
= radv_descriptor_pool_to_handle(pool
);
596 void radv_DestroyDescriptorPool(
598 VkDescriptorPool _pool
,
599 const VkAllocationCallbacks
* pAllocator
)
601 RADV_FROM_HANDLE(radv_device
, device
, _device
);
602 RADV_FROM_HANDLE(radv_descriptor_pool
, pool
, _pool
);
607 if (!pool
->host_memory_base
) {
608 for(int i
= 0; i
< pool
->entry_count
; ++i
) {
609 radv_descriptor_set_destroy(device
, pool
, pool
->entries
[i
].set
, false);
614 device
->ws
->buffer_destroy(pool
->bo
);
615 vk_free2(&device
->alloc
, pAllocator
, pool
);
618 VkResult
radv_ResetDescriptorPool(
620 VkDescriptorPool descriptorPool
,
621 VkDescriptorPoolResetFlags flags
)
623 RADV_FROM_HANDLE(radv_device
, device
, _device
);
624 RADV_FROM_HANDLE(radv_descriptor_pool
, pool
, descriptorPool
);
626 if (!pool
->host_memory_base
) {
627 for(int i
= 0; i
< pool
->entry_count
; ++i
) {
628 radv_descriptor_set_destroy(device
, pool
, pool
->entries
[i
].set
, false);
630 pool
->entry_count
= 0;
633 pool
->current_offset
= 0;
634 pool
->host_memory_ptr
= pool
->host_memory_base
;
639 VkResult
radv_AllocateDescriptorSets(
641 const VkDescriptorSetAllocateInfo
* pAllocateInfo
,
642 VkDescriptorSet
* pDescriptorSets
)
644 RADV_FROM_HANDLE(radv_device
, device
, _device
);
645 RADV_FROM_HANDLE(radv_descriptor_pool
, pool
, pAllocateInfo
->descriptorPool
);
647 VkResult result
= VK_SUCCESS
;
649 struct radv_descriptor_set
*set
= NULL
;
651 /* allocate a set of buffers for each shader to contain descriptors */
652 for (i
= 0; i
< pAllocateInfo
->descriptorSetCount
; i
++) {
653 RADV_FROM_HANDLE(radv_descriptor_set_layout
, layout
,
654 pAllocateInfo
->pSetLayouts
[i
]);
656 assert(!(layout
->flags
& VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR
));
658 result
= radv_descriptor_set_create(device
, pool
, layout
, &set
);
659 if (result
!= VK_SUCCESS
)
662 pDescriptorSets
[i
] = radv_descriptor_set_to_handle(set
);
665 if (result
!= VK_SUCCESS
)
666 radv_FreeDescriptorSets(_device
, pAllocateInfo
->descriptorPool
,
671 VkResult
radv_FreeDescriptorSets(
673 VkDescriptorPool descriptorPool
,
675 const VkDescriptorSet
* pDescriptorSets
)
677 RADV_FROM_HANDLE(radv_device
, device
, _device
);
678 RADV_FROM_HANDLE(radv_descriptor_pool
, pool
, descriptorPool
);
680 for (uint32_t i
= 0; i
< count
; i
++) {
681 RADV_FROM_HANDLE(radv_descriptor_set
, set
, pDescriptorSets
[i
]);
683 if (set
&& !pool
->host_memory_base
)
684 radv_descriptor_set_destroy(device
, pool
, set
, true);
689 static void write_texel_buffer_descriptor(struct radv_device
*device
,
691 const VkBufferView _buffer_view
)
693 RADV_FROM_HANDLE(radv_buffer_view
, buffer_view
, _buffer_view
);
695 memcpy(dst
, buffer_view
->state
, 4 * 4);
698 static void write_buffer_descriptor(struct radv_device
*device
,
700 const VkDescriptorBufferInfo
*buffer_info
)
702 RADV_FROM_HANDLE(radv_buffer
, buffer
, buffer_info
->buffer
);
703 uint64_t va
= radv_buffer_get_va(buffer
->bo
);
704 uint32_t range
= buffer_info
->range
;
706 if (buffer_info
->range
== VK_WHOLE_SIZE
)
707 range
= buffer
->size
- buffer_info
->offset
;
709 va
+= buffer_info
->offset
+ buffer
->offset
;
711 dst
[1] = S_008F04_BASE_ADDRESS_HI(va
>> 32);
713 dst
[3] = S_008F0C_DST_SEL_X(V_008F0C_SQ_SEL_X
) |
714 S_008F0C_DST_SEL_Y(V_008F0C_SQ_SEL_Y
) |
715 S_008F0C_DST_SEL_Z(V_008F0C_SQ_SEL_Z
) |
716 S_008F0C_DST_SEL_W(V_008F0C_SQ_SEL_W
) |
717 S_008F0C_NUM_FORMAT(V_008F0C_BUF_NUM_FORMAT_FLOAT
) |
718 S_008F0C_DATA_FORMAT(V_008F0C_BUF_DATA_FORMAT_32
);
722 static void write_dynamic_buffer_descriptor(struct radv_device
*device
,
723 struct radv_descriptor_range
*range
,
724 const VkDescriptorBufferInfo
*buffer_info
)
726 RADV_FROM_HANDLE(radv_buffer
, buffer
, buffer_info
->buffer
);
727 uint64_t va
= radv_buffer_get_va(buffer
->bo
);
728 unsigned size
= buffer_info
->range
;
730 if (buffer_info
->range
== VK_WHOLE_SIZE
)
731 size
= buffer
->size
- buffer_info
->offset
;
733 va
+= buffer_info
->offset
+ buffer
->offset
;
739 write_image_descriptor(struct radv_device
*device
,
741 VkDescriptorType descriptor_type
,
742 const VkDescriptorImageInfo
*image_info
)
744 RADV_FROM_HANDLE(radv_image_view
, iview
, image_info
->imageView
);
745 uint32_t *descriptor
;
747 if (descriptor_type
== VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
) {
748 descriptor
= iview
->storage_descriptor
;
750 descriptor
= iview
->descriptor
;
753 memcpy(dst
, descriptor
, 16 * 4);
757 write_combined_image_sampler_descriptor(struct radv_device
*device
,
759 VkDescriptorType descriptor_type
,
760 const VkDescriptorImageInfo
*image_info
,
763 RADV_FROM_HANDLE(radv_sampler
, sampler
, image_info
->sampler
);
765 write_image_descriptor(device
, dst
, descriptor_type
, image_info
);
766 /* copy over sampler state */
768 memcpy(dst
+ 16, sampler
->state
, 16);
772 write_sampler_descriptor(struct radv_device
*device
,
774 const VkDescriptorImageInfo
*image_info
)
776 RADV_FROM_HANDLE(radv_sampler
, sampler
, image_info
->sampler
);
778 memcpy(dst
, sampler
->state
, 16);
781 void radv_update_descriptor_sets(
782 struct radv_device
* device
,
783 struct radv_cmd_buffer
* cmd_buffer
,
784 VkDescriptorSet dstSetOverride
,
785 uint32_t descriptorWriteCount
,
786 const VkWriteDescriptorSet
* pDescriptorWrites
,
787 uint32_t descriptorCopyCount
,
788 const VkCopyDescriptorSet
* pDescriptorCopies
)
791 for (i
= 0; i
< descriptorWriteCount
; i
++) {
792 const VkWriteDescriptorSet
*writeset
= &pDescriptorWrites
[i
];
793 RADV_FROM_HANDLE(radv_descriptor_set
, set
,
794 dstSetOverride
? dstSetOverride
: writeset
->dstSet
);
795 const struct radv_descriptor_set_binding_layout
*binding_layout
=
796 set
->layout
->binding
+ writeset
->dstBinding
;
797 uint32_t *ptr
= set
->mapped_ptr
;
799 /* Immutable samplers are not copied into push descriptors when they are
800 * allocated, so if we are writing push descriptors we have to copy the
801 * immutable samplers into them now.
803 const bool copy_immutable_samplers
= cmd_buffer
&&
804 binding_layout
->immutable_samplers_offset
&& !binding_layout
->immutable_samplers_equal
;
805 const uint32_t *samplers
= radv_immutable_samplers(set
->layout
, binding_layout
);
807 ptr
+= binding_layout
->offset
/ 4;
808 ptr
+= binding_layout
->size
* writeset
->dstArrayElement
/ 4;
809 for (j
= 0; j
< writeset
->descriptorCount
; ++j
) {
810 switch(writeset
->descriptorType
) {
811 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
812 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
: {
813 unsigned idx
= writeset
->dstArrayElement
+ j
;
814 idx
+= binding_layout
->dynamic_offset_offset
;
815 assert(!(set
->layout
->flags
& VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR
));
816 write_dynamic_buffer_descriptor(device
, set
->dynamic_descriptors
+ idx
,
817 writeset
->pBufferInfo
+ j
);
820 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
:
821 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
:
822 write_buffer_descriptor(device
, ptr
, writeset
->pBufferInfo
+ j
);
824 case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
:
825 case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
:
826 write_texel_buffer_descriptor(device
, ptr
, writeset
->pTexelBufferView
[j
]);
828 case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
:
829 case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
:
830 case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT
:
831 write_image_descriptor(device
, ptr
, writeset
->descriptorType
,
832 writeset
->pImageInfo
+ j
);
834 case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
:
835 write_combined_image_sampler_descriptor(device
, ptr
,
836 writeset
->descriptorType
,
837 writeset
->pImageInfo
+ j
,
838 !binding_layout
->immutable_samplers_offset
);
839 if (copy_immutable_samplers
) {
840 const unsigned idx
= writeset
->dstArrayElement
+ j
;
841 memcpy(ptr
+ 16, samplers
+ 4 * idx
, 16);
844 case VK_DESCRIPTOR_TYPE_SAMPLER
:
845 if (!binding_layout
->immutable_samplers_offset
) {
846 write_sampler_descriptor(device
, ptr
,
847 writeset
->pImageInfo
+ j
);
848 } else if (copy_immutable_samplers
) {
849 unsigned idx
= writeset
->dstArrayElement
+ j
;
850 memcpy(ptr
, samplers
+ 4 * idx
, 16);
854 unreachable("unimplemented descriptor type");
857 ptr
+= binding_layout
->size
/ 4;
862 for (i
= 0; i
< descriptorCopyCount
; i
++) {
863 const VkCopyDescriptorSet
*copyset
= &pDescriptorCopies
[i
];
864 RADV_FROM_HANDLE(radv_descriptor_set
, src_set
,
866 RADV_FROM_HANDLE(radv_descriptor_set
, dst_set
,
868 const struct radv_descriptor_set_binding_layout
*src_binding_layout
=
869 src_set
->layout
->binding
+ copyset
->srcBinding
;
870 const struct radv_descriptor_set_binding_layout
*dst_binding_layout
=
871 dst_set
->layout
->binding
+ copyset
->dstBinding
;
872 uint32_t *src_ptr
= src_set
->mapped_ptr
;
873 uint32_t *dst_ptr
= dst_set
->mapped_ptr
;
875 src_ptr
+= src_binding_layout
->offset
/ 4;
876 dst_ptr
+= dst_binding_layout
->offset
/ 4;
878 src_ptr
+= src_binding_layout
->size
* copyset
->srcArrayElement
/ 4;
879 dst_ptr
+= dst_binding_layout
->size
* copyset
->dstArrayElement
/ 4;
881 for (j
= 0; j
< copyset
->descriptorCount
; ++j
) {
882 switch (src_binding_layout
->type
) {
883 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
884 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
: {
885 unsigned src_idx
= copyset
->srcArrayElement
+ j
;
886 unsigned dst_idx
= copyset
->dstArrayElement
+ j
;
887 struct radv_descriptor_range
*src_range
, *dst_range
;
888 src_idx
+= src_binding_layout
->dynamic_offset_offset
;
889 dst_idx
+= dst_binding_layout
->dynamic_offset_offset
;
891 src_range
= src_set
->dynamic_descriptors
+ src_idx
;
892 dst_range
= dst_set
->dynamic_descriptors
+ dst_idx
;
893 *dst_range
= *src_range
;
897 memcpy(dst_ptr
, src_ptr
, src_binding_layout
->size
);
899 src_ptr
+= src_binding_layout
->size
/ 4;
900 dst_ptr
+= dst_binding_layout
->size
/ 4;
905 void radv_UpdateDescriptorSets(
907 uint32_t descriptorWriteCount
,
908 const VkWriteDescriptorSet
* pDescriptorWrites
,
909 uint32_t descriptorCopyCount
,
910 const VkCopyDescriptorSet
* pDescriptorCopies
)
912 RADV_FROM_HANDLE(radv_device
, device
, _device
);
914 radv_update_descriptor_sets(device
, NULL
, VK_NULL_HANDLE
, descriptorWriteCount
, pDescriptorWrites
,
915 descriptorCopyCount
, pDescriptorCopies
);
918 VkResult
radv_CreateDescriptorUpdateTemplate(VkDevice _device
,
919 const VkDescriptorUpdateTemplateCreateInfoKHR
*pCreateInfo
,
920 const VkAllocationCallbacks
*pAllocator
,
921 VkDescriptorUpdateTemplateKHR
*pDescriptorUpdateTemplate
)
923 RADV_FROM_HANDLE(radv_device
, device
, _device
);
924 RADV_FROM_HANDLE(radv_descriptor_set_layout
, set_layout
, pCreateInfo
->descriptorSetLayout
);
925 const uint32_t entry_count
= pCreateInfo
->descriptorUpdateEntryCount
;
926 const size_t size
= sizeof(struct radv_descriptor_update_template
) +
927 sizeof(struct radv_descriptor_update_template_entry
) * entry_count
;
928 struct radv_descriptor_update_template
*templ
;
931 templ
= vk_alloc2(&device
->alloc
, pAllocator
, size
, 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
933 return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY
);
935 templ
->entry_count
= entry_count
;
936 templ
->bind_point
= pCreateInfo
->pipelineBindPoint
;
938 for (i
= 0; i
< entry_count
; i
++) {
939 const VkDescriptorUpdateTemplateEntryKHR
*entry
= &pCreateInfo
->pDescriptorUpdateEntries
[i
];
940 const struct radv_descriptor_set_binding_layout
*binding_layout
=
941 set_layout
->binding
+ entry
->dstBinding
;
942 const uint32_t *immutable_samplers
= NULL
;
946 /* dst_offset is an offset into dynamic_descriptors when the descriptor
947 is dynamic, and an offset into mapped_ptr otherwise */
948 switch (entry
->descriptorType
) {
949 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
950 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
:
951 assert(pCreateInfo
->templateType
== VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR
);
952 dst_offset
= binding_layout
->dynamic_offset_offset
+ entry
->dstArrayElement
;
953 dst_stride
= 0; /* Not used */
956 switch (entry
->descriptorType
) {
957 case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
:
958 case VK_DESCRIPTOR_TYPE_SAMPLER
:
959 /* Immutable samplers are copied into push descriptors when they are pushed */
960 if (pCreateInfo
->templateType
== VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR
&&
961 binding_layout
->immutable_samplers_offset
&& !binding_layout
->immutable_samplers_equal
) {
962 immutable_samplers
= radv_immutable_samplers(set_layout
, binding_layout
) + entry
->dstArrayElement
* 4;
968 dst_offset
= binding_layout
->offset
/ 4 + binding_layout
->size
* entry
->dstArrayElement
/ 4;
969 dst_stride
= binding_layout
->size
/ 4;
973 templ
->entry
[i
] = (struct radv_descriptor_update_template_entry
) {
974 .descriptor_type
= entry
->descriptorType
,
975 .descriptor_count
= entry
->descriptorCount
,
976 .src_offset
= entry
->offset
,
977 .src_stride
= entry
->stride
,
978 .dst_offset
= dst_offset
,
979 .dst_stride
= dst_stride
,
980 .has_sampler
= !binding_layout
->immutable_samplers_offset
,
981 .immutable_samplers
= immutable_samplers
985 *pDescriptorUpdateTemplate
= radv_descriptor_update_template_to_handle(templ
);
989 void radv_DestroyDescriptorUpdateTemplate(VkDevice _device
,
990 VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate
,
991 const VkAllocationCallbacks
*pAllocator
)
993 RADV_FROM_HANDLE(radv_device
, device
, _device
);
994 RADV_FROM_HANDLE(radv_descriptor_update_template
, templ
, descriptorUpdateTemplate
);
999 vk_free2(&device
->alloc
, pAllocator
, templ
);
1002 void radv_update_descriptor_set_with_template(struct radv_device
*device
,
1003 struct radv_cmd_buffer
*cmd_buffer
,
1004 struct radv_descriptor_set
*set
,
1005 VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate
,
1008 RADV_FROM_HANDLE(radv_descriptor_update_template
, templ
, descriptorUpdateTemplate
);
1011 for (i
= 0; i
< templ
->entry_count
; ++i
) {
1012 uint32_t *pDst
= set
->mapped_ptr
+ templ
->entry
[i
].dst_offset
;
1013 const uint8_t *pSrc
= ((const uint8_t *) pData
) + templ
->entry
[i
].src_offset
;
1016 for (j
= 0; j
< templ
->entry
[i
].descriptor_count
; ++j
) {
1017 switch (templ
->entry
[i
].descriptor_type
) {
1018 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
1019 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
: {
1020 const unsigned idx
= templ
->entry
[i
].dst_offset
+ j
;
1021 assert(!(set
->layout
->flags
& VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR
));
1022 write_dynamic_buffer_descriptor(device
, set
->dynamic_descriptors
+ idx
,
1023 (struct VkDescriptorBufferInfo
*) pSrc
);
1026 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
:
1027 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
:
1028 write_buffer_descriptor(device
, pDst
,
1029 (struct VkDescriptorBufferInfo
*) pSrc
);
1031 case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
:
1032 case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
:
1033 write_texel_buffer_descriptor(device
, pDst
,
1034 *(VkBufferView
*) pSrc
);
1036 case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
:
1037 case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
:
1038 case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT
:
1039 write_image_descriptor(device
, pDst
,
1040 templ
->entry
[i
].descriptor_type
,
1041 (struct VkDescriptorImageInfo
*) pSrc
);
1043 case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
:
1044 write_combined_image_sampler_descriptor(device
, pDst
,
1045 templ
->entry
[i
].descriptor_type
,
1046 (struct VkDescriptorImageInfo
*) pSrc
,
1047 templ
->entry
[i
].has_sampler
);
1048 if (templ
->entry
[i
].immutable_samplers
)
1049 memcpy(pDst
+ 16, templ
->entry
[i
].immutable_samplers
+ 4 * j
, 16);
1051 case VK_DESCRIPTOR_TYPE_SAMPLER
:
1052 if (templ
->entry
[i
].has_sampler
)
1053 write_sampler_descriptor(device
, pDst
,
1054 (struct VkDescriptorImageInfo
*) pSrc
);
1055 else if (templ
->entry
[i
].immutable_samplers
)
1056 memcpy(pDst
, templ
->entry
[i
].immutable_samplers
+ 4 * j
, 16);
1059 unreachable("unimplemented descriptor type");
1062 pSrc
+= templ
->entry
[i
].src_stride
;
1063 pDst
+= templ
->entry
[i
].dst_stride
;
1068 void radv_UpdateDescriptorSetWithTemplate(VkDevice _device
,
1069 VkDescriptorSet descriptorSet
,
1070 VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate
,
1073 RADV_FROM_HANDLE(radv_device
, device
, _device
);
1074 RADV_FROM_HANDLE(radv_descriptor_set
, set
, descriptorSet
);
1076 radv_update_descriptor_set_with_template(device
, NULL
, set
, descriptorUpdateTemplate
, pData
);
1080 VkResult
radv_CreateSamplerYcbcrConversion(VkDevice device
,
1081 const VkSamplerYcbcrConversionCreateInfo
* pCreateInfo
,
1082 const VkAllocationCallbacks
* pAllocator
,
1083 VkSamplerYcbcrConversion
* pYcbcrConversion
)
1085 *pYcbcrConversion
= VK_NULL_HANDLE
;
1090 void radv_DestroySamplerYcbcrConversion(VkDevice device
,
1091 VkSamplerYcbcrConversion ycbcrConversion
,
1092 const VkAllocationCallbacks
* pAllocator
)