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 const uint32_t *variable_count
,
396 struct radv_descriptor_set
**out_set
)
398 struct radv_descriptor_set
*set
;
399 unsigned range_offset
= sizeof(struct radv_descriptor_set
);
400 unsigned mem_size
= range_offset
+
401 sizeof(struct radv_descriptor_range
) * layout
->dynamic_offset_count
;
403 if (pool
->host_memory_base
) {
404 if (pool
->host_memory_end
- pool
->host_memory_ptr
< mem_size
)
405 return vk_error(VK_ERROR_OUT_OF_POOL_MEMORY_KHR
);
407 set
= (struct radv_descriptor_set
*)pool
->host_memory_ptr
;
408 pool
->host_memory_ptr
+= mem_size
;
410 set
= vk_alloc2(&device
->alloc
, NULL
, mem_size
, 8,
411 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
414 return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY
);
417 memset(set
, 0, mem_size
);
419 if (layout
->dynamic_offset_count
) {
420 set
->dynamic_descriptors
= (struct radv_descriptor_range
*)((uint8_t*)set
+ range_offset
);
423 set
->layout
= layout
;
424 uint32_t layout_size
= align_u32(layout
->size
, 32);
426 set
->size
= layout_size
;
428 if (!pool
->host_memory_base
&& pool
->entry_count
== pool
->max_entry_count
) {
429 vk_free2(&device
->alloc
, NULL
, set
);
430 return vk_error(VK_ERROR_OUT_OF_POOL_MEMORY_KHR
);
433 /* try to allocate linearly first, so that we don't spend
434 * time looking for gaps if the app only allocates &
435 * resets via the pool. */
436 if (pool
->current_offset
+ layout_size
<= pool
->size
) {
438 set
->mapped_ptr
= (uint32_t*)(pool
->mapped_ptr
+ pool
->current_offset
);
439 set
->va
= radv_buffer_get_va(set
->bo
) + pool
->current_offset
;
440 if (!pool
->host_memory_base
) {
441 pool
->entries
[pool
->entry_count
].offset
= pool
->current_offset
;
442 pool
->entries
[pool
->entry_count
].size
= layout_size
;
443 pool
->entries
[pool
->entry_count
].set
= set
;
446 pool
->current_offset
+= layout_size
;
447 } else if (!pool
->host_memory_base
) {
451 for (index
= 0; index
< pool
->entry_count
; ++index
) {
452 if (pool
->entries
[index
].offset
- offset
>= layout_size
)
454 offset
= pool
->entries
[index
].offset
+ pool
->entries
[index
].size
;
457 if (pool
->size
- offset
< layout_size
) {
458 vk_free2(&device
->alloc
, NULL
, set
);
459 return vk_error(VK_ERROR_OUT_OF_POOL_MEMORY_KHR
);
462 set
->mapped_ptr
= (uint32_t*)(pool
->mapped_ptr
+ offset
);
463 set
->va
= radv_buffer_get_va(set
->bo
) + offset
;
464 memmove(&pool
->entries
[index
+ 1], &pool
->entries
[index
],
465 sizeof(pool
->entries
[0]) * (pool
->entry_count
- index
));
466 pool
->entries
[index
].offset
= offset
;
467 pool
->entries
[index
].size
= layout_size
;
468 pool
->entries
[index
].set
= set
;
471 return vk_error(VK_ERROR_OUT_OF_POOL_MEMORY_KHR
);
474 if (layout
->has_immutable_samplers
) {
475 for (unsigned i
= 0; i
< layout
->binding_count
; ++i
) {
476 if (!layout
->binding
[i
].immutable_samplers_offset
||
477 layout
->binding
[i
].immutable_samplers_equal
)
480 unsigned offset
= layout
->binding
[i
].offset
/ 4;
481 if (layout
->binding
[i
].type
== VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
)
484 const uint32_t *samplers
= (const uint32_t*)((const char*)layout
+ layout
->binding
[i
].immutable_samplers_offset
);
485 for (unsigned j
= 0; j
< layout
->binding
[i
].array_size
; ++j
) {
486 memcpy(set
->mapped_ptr
+ offset
, samplers
+ 4 * j
, 16);
487 offset
+= layout
->binding
[i
].size
/ 4;
497 radv_descriptor_set_destroy(struct radv_device
*device
,
498 struct radv_descriptor_pool
*pool
,
499 struct radv_descriptor_set
*set
,
502 assert(!pool
->host_memory_base
);
504 if (free_bo
&& set
->size
&& !pool
->host_memory_base
) {
505 uint32_t offset
= (uint8_t*)set
->mapped_ptr
- pool
->mapped_ptr
;
506 for (int i
= 0; i
< pool
->entry_count
; ++i
) {
507 if (pool
->entries
[i
].offset
== offset
) {
508 memmove(&pool
->entries
[i
], &pool
->entries
[i
+1],
509 sizeof(pool
->entries
[i
]) * (pool
->entry_count
- i
- 1));
515 vk_free2(&device
->alloc
, NULL
, set
);
518 VkResult
radv_CreateDescriptorPool(
520 const VkDescriptorPoolCreateInfo
* pCreateInfo
,
521 const VkAllocationCallbacks
* pAllocator
,
522 VkDescriptorPool
* pDescriptorPool
)
524 RADV_FROM_HANDLE(radv_device
, device
, _device
);
525 struct radv_descriptor_pool
*pool
;
526 int size
= sizeof(struct radv_descriptor_pool
);
527 uint64_t bo_size
= 0, bo_count
= 0, range_count
= 0;
530 for (unsigned i
= 0; i
< pCreateInfo
->poolSizeCount
; ++i
) {
531 if (pCreateInfo
->pPoolSizes
[i
].type
!= VK_DESCRIPTOR_TYPE_SAMPLER
)
532 bo_count
+= pCreateInfo
->pPoolSizes
[i
].descriptorCount
;
534 switch(pCreateInfo
->pPoolSizes
[i
].type
) {
535 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
536 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
:
537 range_count
+= pCreateInfo
->pPoolSizes
[i
].descriptorCount
;
539 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
:
540 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
:
541 case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
:
542 case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
:
543 case VK_DESCRIPTOR_TYPE_SAMPLER
:
544 /* 32 as we may need to align for images */
545 bo_size
+= 32 * pCreateInfo
->pPoolSizes
[i
].descriptorCount
;
547 case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
:
548 case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
:
549 case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT
:
550 bo_size
+= 64 * pCreateInfo
->pPoolSizes
[i
].descriptorCount
;
552 case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
:
553 bo_size
+= 96 * pCreateInfo
->pPoolSizes
[i
].descriptorCount
;
556 unreachable("unknown descriptor type\n");
561 if (!(pCreateInfo
->flags
& VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT
)) {
562 uint64_t host_size
= pCreateInfo
->maxSets
* sizeof(struct radv_descriptor_set
);
563 host_size
+= sizeof(struct radeon_winsys_bo
*) * bo_count
;
564 host_size
+= sizeof(struct radv_descriptor_range
) * range_count
;
567 size
+= sizeof(struct radv_descriptor_pool_entry
) * pCreateInfo
->maxSets
;
570 pool
= vk_alloc2(&device
->alloc
, pAllocator
, size
, 8,
571 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
573 return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY
);
575 memset(pool
, 0, sizeof(*pool
));
577 if (!(pCreateInfo
->flags
& VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT
)) {
578 pool
->host_memory_base
= (uint8_t*)pool
+ sizeof(struct radv_descriptor_pool
);
579 pool
->host_memory_ptr
= pool
->host_memory_base
;
580 pool
->host_memory_end
= (uint8_t*)pool
+ size
;
584 pool
->bo
= device
->ws
->buffer_create(device
->ws
, bo_size
, 32,
586 RADEON_FLAG_NO_INTERPROCESS_SHARING
|
587 RADEON_FLAG_READ_ONLY
);
588 pool
->mapped_ptr
= (uint8_t*)device
->ws
->buffer_map(pool
->bo
);
590 pool
->size
= bo_size
;
591 pool
->max_entry_count
= pCreateInfo
->maxSets
;
593 *pDescriptorPool
= radv_descriptor_pool_to_handle(pool
);
597 void radv_DestroyDescriptorPool(
599 VkDescriptorPool _pool
,
600 const VkAllocationCallbacks
* pAllocator
)
602 RADV_FROM_HANDLE(radv_device
, device
, _device
);
603 RADV_FROM_HANDLE(radv_descriptor_pool
, pool
, _pool
);
608 if (!pool
->host_memory_base
) {
609 for(int i
= 0; i
< pool
->entry_count
; ++i
) {
610 radv_descriptor_set_destroy(device
, pool
, pool
->entries
[i
].set
, false);
615 device
->ws
->buffer_destroy(pool
->bo
);
616 vk_free2(&device
->alloc
, pAllocator
, pool
);
619 VkResult
radv_ResetDescriptorPool(
621 VkDescriptorPool descriptorPool
,
622 VkDescriptorPoolResetFlags flags
)
624 RADV_FROM_HANDLE(radv_device
, device
, _device
);
625 RADV_FROM_HANDLE(radv_descriptor_pool
, pool
, descriptorPool
);
627 if (!pool
->host_memory_base
) {
628 for(int i
= 0; i
< pool
->entry_count
; ++i
) {
629 radv_descriptor_set_destroy(device
, pool
, pool
->entries
[i
].set
, false);
631 pool
->entry_count
= 0;
634 pool
->current_offset
= 0;
635 pool
->host_memory_ptr
= pool
->host_memory_base
;
640 VkResult
radv_AllocateDescriptorSets(
642 const VkDescriptorSetAllocateInfo
* pAllocateInfo
,
643 VkDescriptorSet
* pDescriptorSets
)
645 RADV_FROM_HANDLE(radv_device
, device
, _device
);
646 RADV_FROM_HANDLE(radv_descriptor_pool
, pool
, pAllocateInfo
->descriptorPool
);
648 VkResult result
= VK_SUCCESS
;
650 struct radv_descriptor_set
*set
= NULL
;
652 const VkDescriptorSetVariableDescriptorCountAllocateInfoEXT
*variable_counts
=
653 vk_find_struct_const(pAllocateInfo
->pNext
, DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO_EXT
);
654 const uint32_t zero
= 0;
656 /* allocate a set of buffers for each shader to contain descriptors */
657 for (i
= 0; i
< pAllocateInfo
->descriptorSetCount
; i
++) {
658 RADV_FROM_HANDLE(radv_descriptor_set_layout
, layout
,
659 pAllocateInfo
->pSetLayouts
[i
]);
661 const uint32_t *variable_count
= NULL
;
662 if (variable_counts
) {
663 if (i
< variable_counts
->descriptorSetCount
)
664 variable_count
= variable_counts
->pDescriptorCounts
+ i
;
666 variable_count
= &zero
;
669 assert(!(layout
->flags
& VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR
));
671 result
= radv_descriptor_set_create(device
, pool
, layout
, variable_count
, &set
);
672 if (result
!= VK_SUCCESS
)
675 pDescriptorSets
[i
] = radv_descriptor_set_to_handle(set
);
678 if (result
!= VK_SUCCESS
)
679 radv_FreeDescriptorSets(_device
, pAllocateInfo
->descriptorPool
,
684 VkResult
radv_FreeDescriptorSets(
686 VkDescriptorPool descriptorPool
,
688 const VkDescriptorSet
* pDescriptorSets
)
690 RADV_FROM_HANDLE(radv_device
, device
, _device
);
691 RADV_FROM_HANDLE(radv_descriptor_pool
, pool
, descriptorPool
);
693 for (uint32_t i
= 0; i
< count
; i
++) {
694 RADV_FROM_HANDLE(radv_descriptor_set
, set
, pDescriptorSets
[i
]);
696 if (set
&& !pool
->host_memory_base
)
697 radv_descriptor_set_destroy(device
, pool
, set
, true);
702 static void write_texel_buffer_descriptor(struct radv_device
*device
,
704 const VkBufferView _buffer_view
)
706 RADV_FROM_HANDLE(radv_buffer_view
, buffer_view
, _buffer_view
);
708 memcpy(dst
, buffer_view
->state
, 4 * 4);
711 static void write_buffer_descriptor(struct radv_device
*device
,
713 const VkDescriptorBufferInfo
*buffer_info
)
715 RADV_FROM_HANDLE(radv_buffer
, buffer
, buffer_info
->buffer
);
716 uint64_t va
= radv_buffer_get_va(buffer
->bo
);
717 uint32_t range
= buffer_info
->range
;
719 if (buffer_info
->range
== VK_WHOLE_SIZE
)
720 range
= buffer
->size
- buffer_info
->offset
;
722 va
+= buffer_info
->offset
+ buffer
->offset
;
724 dst
[1] = S_008F04_BASE_ADDRESS_HI(va
>> 32);
726 dst
[3] = S_008F0C_DST_SEL_X(V_008F0C_SQ_SEL_X
) |
727 S_008F0C_DST_SEL_Y(V_008F0C_SQ_SEL_Y
) |
728 S_008F0C_DST_SEL_Z(V_008F0C_SQ_SEL_Z
) |
729 S_008F0C_DST_SEL_W(V_008F0C_SQ_SEL_W
) |
730 S_008F0C_NUM_FORMAT(V_008F0C_BUF_NUM_FORMAT_FLOAT
) |
731 S_008F0C_DATA_FORMAT(V_008F0C_BUF_DATA_FORMAT_32
);
735 static void write_dynamic_buffer_descriptor(struct radv_device
*device
,
736 struct radv_descriptor_range
*range
,
737 const VkDescriptorBufferInfo
*buffer_info
)
739 RADV_FROM_HANDLE(radv_buffer
, buffer
, buffer_info
->buffer
);
740 uint64_t va
= radv_buffer_get_va(buffer
->bo
);
741 unsigned size
= buffer_info
->range
;
743 if (buffer_info
->range
== VK_WHOLE_SIZE
)
744 size
= buffer
->size
- buffer_info
->offset
;
746 va
+= buffer_info
->offset
+ buffer
->offset
;
752 write_image_descriptor(struct radv_device
*device
,
754 VkDescriptorType descriptor_type
,
755 const VkDescriptorImageInfo
*image_info
)
757 RADV_FROM_HANDLE(radv_image_view
, iview
, image_info
->imageView
);
758 uint32_t *descriptor
;
760 if (descriptor_type
== VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
) {
761 descriptor
= iview
->storage_descriptor
;
763 descriptor
= iview
->descriptor
;
766 memcpy(dst
, descriptor
, 16 * 4);
770 write_combined_image_sampler_descriptor(struct radv_device
*device
,
772 VkDescriptorType descriptor_type
,
773 const VkDescriptorImageInfo
*image_info
,
776 RADV_FROM_HANDLE(radv_sampler
, sampler
, image_info
->sampler
);
778 write_image_descriptor(device
, dst
, descriptor_type
, image_info
);
779 /* copy over sampler state */
781 memcpy(dst
+ 16, sampler
->state
, 16);
785 write_sampler_descriptor(struct radv_device
*device
,
787 const VkDescriptorImageInfo
*image_info
)
789 RADV_FROM_HANDLE(radv_sampler
, sampler
, image_info
->sampler
);
791 memcpy(dst
, sampler
->state
, 16);
794 void radv_update_descriptor_sets(
795 struct radv_device
* device
,
796 struct radv_cmd_buffer
* cmd_buffer
,
797 VkDescriptorSet dstSetOverride
,
798 uint32_t descriptorWriteCount
,
799 const VkWriteDescriptorSet
* pDescriptorWrites
,
800 uint32_t descriptorCopyCount
,
801 const VkCopyDescriptorSet
* pDescriptorCopies
)
804 for (i
= 0; i
< descriptorWriteCount
; i
++) {
805 const VkWriteDescriptorSet
*writeset
= &pDescriptorWrites
[i
];
806 RADV_FROM_HANDLE(radv_descriptor_set
, set
,
807 dstSetOverride
? dstSetOverride
: writeset
->dstSet
);
808 const struct radv_descriptor_set_binding_layout
*binding_layout
=
809 set
->layout
->binding
+ writeset
->dstBinding
;
810 uint32_t *ptr
= set
->mapped_ptr
;
812 /* Immutable samplers are not copied into push descriptors when they are
813 * allocated, so if we are writing push descriptors we have to copy the
814 * immutable samplers into them now.
816 const bool copy_immutable_samplers
= cmd_buffer
&&
817 binding_layout
->immutable_samplers_offset
&& !binding_layout
->immutable_samplers_equal
;
818 const uint32_t *samplers
= radv_immutable_samplers(set
->layout
, binding_layout
);
820 ptr
+= binding_layout
->offset
/ 4;
821 ptr
+= binding_layout
->size
* writeset
->dstArrayElement
/ 4;
822 for (j
= 0; j
< writeset
->descriptorCount
; ++j
) {
823 switch(writeset
->descriptorType
) {
824 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
825 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
: {
826 unsigned idx
= writeset
->dstArrayElement
+ j
;
827 idx
+= binding_layout
->dynamic_offset_offset
;
828 assert(!(set
->layout
->flags
& VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR
));
829 write_dynamic_buffer_descriptor(device
, set
->dynamic_descriptors
+ idx
,
830 writeset
->pBufferInfo
+ j
);
833 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
:
834 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
:
835 write_buffer_descriptor(device
, ptr
, writeset
->pBufferInfo
+ j
);
837 case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
:
838 case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
:
839 write_texel_buffer_descriptor(device
, ptr
, writeset
->pTexelBufferView
[j
]);
841 case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
:
842 case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
:
843 case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT
:
844 write_image_descriptor(device
, ptr
, writeset
->descriptorType
,
845 writeset
->pImageInfo
+ j
);
847 case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
:
848 write_combined_image_sampler_descriptor(device
, ptr
,
849 writeset
->descriptorType
,
850 writeset
->pImageInfo
+ j
,
851 !binding_layout
->immutable_samplers_offset
);
852 if (copy_immutable_samplers
) {
853 const unsigned idx
= writeset
->dstArrayElement
+ j
;
854 memcpy(ptr
+ 16, samplers
+ 4 * idx
, 16);
857 case VK_DESCRIPTOR_TYPE_SAMPLER
:
858 if (!binding_layout
->immutable_samplers_offset
) {
859 write_sampler_descriptor(device
, ptr
,
860 writeset
->pImageInfo
+ j
);
861 } else if (copy_immutable_samplers
) {
862 unsigned idx
= writeset
->dstArrayElement
+ j
;
863 memcpy(ptr
, samplers
+ 4 * idx
, 16);
867 unreachable("unimplemented descriptor type");
870 ptr
+= binding_layout
->size
/ 4;
875 for (i
= 0; i
< descriptorCopyCount
; i
++) {
876 const VkCopyDescriptorSet
*copyset
= &pDescriptorCopies
[i
];
877 RADV_FROM_HANDLE(radv_descriptor_set
, src_set
,
879 RADV_FROM_HANDLE(radv_descriptor_set
, dst_set
,
881 const struct radv_descriptor_set_binding_layout
*src_binding_layout
=
882 src_set
->layout
->binding
+ copyset
->srcBinding
;
883 const struct radv_descriptor_set_binding_layout
*dst_binding_layout
=
884 dst_set
->layout
->binding
+ copyset
->dstBinding
;
885 uint32_t *src_ptr
= src_set
->mapped_ptr
;
886 uint32_t *dst_ptr
= dst_set
->mapped_ptr
;
888 src_ptr
+= src_binding_layout
->offset
/ 4;
889 dst_ptr
+= dst_binding_layout
->offset
/ 4;
891 src_ptr
+= src_binding_layout
->size
* copyset
->srcArrayElement
/ 4;
892 dst_ptr
+= dst_binding_layout
->size
* copyset
->dstArrayElement
/ 4;
894 for (j
= 0; j
< copyset
->descriptorCount
; ++j
) {
895 switch (src_binding_layout
->type
) {
896 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
897 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
: {
898 unsigned src_idx
= copyset
->srcArrayElement
+ j
;
899 unsigned dst_idx
= copyset
->dstArrayElement
+ j
;
900 struct radv_descriptor_range
*src_range
, *dst_range
;
901 src_idx
+= src_binding_layout
->dynamic_offset_offset
;
902 dst_idx
+= dst_binding_layout
->dynamic_offset_offset
;
904 src_range
= src_set
->dynamic_descriptors
+ src_idx
;
905 dst_range
= dst_set
->dynamic_descriptors
+ dst_idx
;
906 *dst_range
= *src_range
;
910 memcpy(dst_ptr
, src_ptr
, src_binding_layout
->size
);
912 src_ptr
+= src_binding_layout
->size
/ 4;
913 dst_ptr
+= dst_binding_layout
->size
/ 4;
918 void radv_UpdateDescriptorSets(
920 uint32_t descriptorWriteCount
,
921 const VkWriteDescriptorSet
* pDescriptorWrites
,
922 uint32_t descriptorCopyCount
,
923 const VkCopyDescriptorSet
* pDescriptorCopies
)
925 RADV_FROM_HANDLE(radv_device
, device
, _device
);
927 radv_update_descriptor_sets(device
, NULL
, VK_NULL_HANDLE
, descriptorWriteCount
, pDescriptorWrites
,
928 descriptorCopyCount
, pDescriptorCopies
);
931 VkResult
radv_CreateDescriptorUpdateTemplate(VkDevice _device
,
932 const VkDescriptorUpdateTemplateCreateInfoKHR
*pCreateInfo
,
933 const VkAllocationCallbacks
*pAllocator
,
934 VkDescriptorUpdateTemplateKHR
*pDescriptorUpdateTemplate
)
936 RADV_FROM_HANDLE(radv_device
, device
, _device
);
937 RADV_FROM_HANDLE(radv_descriptor_set_layout
, set_layout
, pCreateInfo
->descriptorSetLayout
);
938 const uint32_t entry_count
= pCreateInfo
->descriptorUpdateEntryCount
;
939 const size_t size
= sizeof(struct radv_descriptor_update_template
) +
940 sizeof(struct radv_descriptor_update_template_entry
) * entry_count
;
941 struct radv_descriptor_update_template
*templ
;
944 templ
= vk_alloc2(&device
->alloc
, pAllocator
, size
, 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
946 return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY
);
948 templ
->entry_count
= entry_count
;
949 templ
->bind_point
= pCreateInfo
->pipelineBindPoint
;
951 for (i
= 0; i
< entry_count
; i
++) {
952 const VkDescriptorUpdateTemplateEntryKHR
*entry
= &pCreateInfo
->pDescriptorUpdateEntries
[i
];
953 const struct radv_descriptor_set_binding_layout
*binding_layout
=
954 set_layout
->binding
+ entry
->dstBinding
;
955 const uint32_t *immutable_samplers
= NULL
;
959 /* dst_offset is an offset into dynamic_descriptors when the descriptor
960 is dynamic, and an offset into mapped_ptr otherwise */
961 switch (entry
->descriptorType
) {
962 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
963 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
:
964 assert(pCreateInfo
->templateType
== VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR
);
965 dst_offset
= binding_layout
->dynamic_offset_offset
+ entry
->dstArrayElement
;
966 dst_stride
= 0; /* Not used */
969 switch (entry
->descriptorType
) {
970 case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
:
971 case VK_DESCRIPTOR_TYPE_SAMPLER
:
972 /* Immutable samplers are copied into push descriptors when they are pushed */
973 if (pCreateInfo
->templateType
== VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR
&&
974 binding_layout
->immutable_samplers_offset
&& !binding_layout
->immutable_samplers_equal
) {
975 immutable_samplers
= radv_immutable_samplers(set_layout
, binding_layout
) + entry
->dstArrayElement
* 4;
981 dst_offset
= binding_layout
->offset
/ 4 + binding_layout
->size
* entry
->dstArrayElement
/ 4;
982 dst_stride
= binding_layout
->size
/ 4;
986 templ
->entry
[i
] = (struct radv_descriptor_update_template_entry
) {
987 .descriptor_type
= entry
->descriptorType
,
988 .descriptor_count
= entry
->descriptorCount
,
989 .src_offset
= entry
->offset
,
990 .src_stride
= entry
->stride
,
991 .dst_offset
= dst_offset
,
992 .dst_stride
= dst_stride
,
993 .has_sampler
= !binding_layout
->immutable_samplers_offset
,
994 .immutable_samplers
= immutable_samplers
998 *pDescriptorUpdateTemplate
= radv_descriptor_update_template_to_handle(templ
);
1002 void radv_DestroyDescriptorUpdateTemplate(VkDevice _device
,
1003 VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate
,
1004 const VkAllocationCallbacks
*pAllocator
)
1006 RADV_FROM_HANDLE(radv_device
, device
, _device
);
1007 RADV_FROM_HANDLE(radv_descriptor_update_template
, templ
, descriptorUpdateTemplate
);
1012 vk_free2(&device
->alloc
, pAllocator
, templ
);
1015 void radv_update_descriptor_set_with_template(struct radv_device
*device
,
1016 struct radv_cmd_buffer
*cmd_buffer
,
1017 struct radv_descriptor_set
*set
,
1018 VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate
,
1021 RADV_FROM_HANDLE(radv_descriptor_update_template
, templ
, descriptorUpdateTemplate
);
1024 for (i
= 0; i
< templ
->entry_count
; ++i
) {
1025 uint32_t *pDst
= set
->mapped_ptr
+ templ
->entry
[i
].dst_offset
;
1026 const uint8_t *pSrc
= ((const uint8_t *) pData
) + templ
->entry
[i
].src_offset
;
1029 for (j
= 0; j
< templ
->entry
[i
].descriptor_count
; ++j
) {
1030 switch (templ
->entry
[i
].descriptor_type
) {
1031 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
1032 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
: {
1033 const unsigned idx
= templ
->entry
[i
].dst_offset
+ j
;
1034 assert(!(set
->layout
->flags
& VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR
));
1035 write_dynamic_buffer_descriptor(device
, set
->dynamic_descriptors
+ idx
,
1036 (struct VkDescriptorBufferInfo
*) pSrc
);
1039 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
:
1040 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
:
1041 write_buffer_descriptor(device
, pDst
,
1042 (struct VkDescriptorBufferInfo
*) pSrc
);
1044 case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
:
1045 case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
:
1046 write_texel_buffer_descriptor(device
, pDst
,
1047 *(VkBufferView
*) pSrc
);
1049 case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
:
1050 case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
:
1051 case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT
:
1052 write_image_descriptor(device
, pDst
,
1053 templ
->entry
[i
].descriptor_type
,
1054 (struct VkDescriptorImageInfo
*) pSrc
);
1056 case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
:
1057 write_combined_image_sampler_descriptor(device
, pDst
,
1058 templ
->entry
[i
].descriptor_type
,
1059 (struct VkDescriptorImageInfo
*) pSrc
,
1060 templ
->entry
[i
].has_sampler
);
1061 if (templ
->entry
[i
].immutable_samplers
)
1062 memcpy(pDst
+ 16, templ
->entry
[i
].immutable_samplers
+ 4 * j
, 16);
1064 case VK_DESCRIPTOR_TYPE_SAMPLER
:
1065 if (templ
->entry
[i
].has_sampler
)
1066 write_sampler_descriptor(device
, pDst
,
1067 (struct VkDescriptorImageInfo
*) pSrc
);
1068 else if (templ
->entry
[i
].immutable_samplers
)
1069 memcpy(pDst
, templ
->entry
[i
].immutable_samplers
+ 4 * j
, 16);
1072 unreachable("unimplemented descriptor type");
1075 pSrc
+= templ
->entry
[i
].src_stride
;
1076 pDst
+= templ
->entry
[i
].dst_stride
;
1081 void radv_UpdateDescriptorSetWithTemplate(VkDevice _device
,
1082 VkDescriptorSet descriptorSet
,
1083 VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate
,
1086 RADV_FROM_HANDLE(radv_device
, device
, _device
);
1087 RADV_FROM_HANDLE(radv_descriptor_set
, set
, descriptorSet
);
1089 radv_update_descriptor_set_with_template(device
, NULL
, set
, descriptorUpdateTemplate
, pData
);
1093 VkResult
radv_CreateSamplerYcbcrConversion(VkDevice device
,
1094 const VkSamplerYcbcrConversionCreateInfo
* pCreateInfo
,
1095 const VkAllocationCallbacks
* pAllocator
,
1096 VkSamplerYcbcrConversion
* pYcbcrConversion
)
1098 *pYcbcrConversion
= VK_NULL_HANDLE
;
1103 void radv_DestroySamplerYcbcrConversion(VkDevice device
,
1104 VkSamplerYcbcrConversion ycbcrConversion
,
1105 const VkAllocationCallbacks
* pAllocator
)