2 * Copyright © 2015 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 #include "anv_private.h"
33 * Descriptor set layouts.
36 VkResult
anv_CreateDescriptorSetLayout(
38 const VkDescriptorSetLayoutCreateInfo
* pCreateInfo
,
39 const VkAllocationCallbacks
* pAllocator
,
40 VkDescriptorSetLayout
* pSetLayout
)
42 ANV_FROM_HANDLE(anv_device
, device
, _device
);
43 struct anv_descriptor_set_layout
*set_layout
;
45 assert(pCreateInfo
->sType
== VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
);
47 uint32_t max_binding
= 0;
48 uint32_t immutable_sampler_count
= 0;
49 for (uint32_t j
= 0; j
< pCreateInfo
->bindingCount
; j
++) {
50 max_binding
= MAX2(max_binding
, pCreateInfo
->pBindings
[j
].binding
);
51 if (pCreateInfo
->pBindings
[j
].pImmutableSamplers
)
52 immutable_sampler_count
+= pCreateInfo
->pBindings
[j
].descriptorCount
;
55 size_t size
= sizeof(struct anv_descriptor_set_layout
) +
56 (max_binding
+ 1) * sizeof(set_layout
->binding
[0]) +
57 immutable_sampler_count
* sizeof(struct anv_sampler
*);
59 set_layout
= anv_alloc2(&device
->alloc
, pAllocator
, size
, 8,
60 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
62 return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY
);
64 /* We just allocate all the samplers at the end of the struct */
65 struct anv_sampler
**samplers
=
66 (struct anv_sampler
**)&set_layout
->binding
[max_binding
+ 1];
68 set_layout
->binding_count
= max_binding
+ 1;
69 set_layout
->shader_stages
= 0;
72 for (uint32_t b
= 0; b
<= max_binding
; b
++) {
73 /* Initialize all binding_layout entries to -1 */
74 memset(&set_layout
->binding
[b
], -1, sizeof(set_layout
->binding
[b
]));
76 set_layout
->binding
[b
].immutable_samplers
= NULL
;
79 /* Initialize all samplers to 0 */
80 memset(samplers
, 0, immutable_sampler_count
* sizeof(*samplers
));
82 uint32_t sampler_count
[MESA_SHADER_STAGES
] = { 0, };
83 uint32_t surface_count
[MESA_SHADER_STAGES
] = { 0, };
84 uint32_t image_count
[MESA_SHADER_STAGES
] = { 0, };
85 uint32_t buffer_count
= 0;
86 uint32_t dynamic_offset_count
= 0;
88 for (uint32_t j
= 0; j
< pCreateInfo
->bindingCount
; j
++) {
89 const VkDescriptorSetLayoutBinding
*binding
= &pCreateInfo
->pBindings
[j
];
90 uint32_t b
= binding
->binding
;
92 assert(binding
->descriptorCount
> 0);
93 set_layout
->binding
[b
].array_size
= binding
->descriptorCount
;
94 set_layout
->binding
[b
].descriptor_index
= set_layout
->size
;
95 set_layout
->size
+= binding
->descriptorCount
;
97 switch (binding
->descriptorType
) {
98 case VK_DESCRIPTOR_TYPE_SAMPLER
:
99 case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
:
100 anv_foreach_stage(s
, binding
->stageFlags
) {
101 set_layout
->binding
[b
].stage
[s
].sampler_index
= sampler_count
[s
];
102 sampler_count
[s
] += binding
->descriptorCount
;
109 switch (binding
->descriptorType
) {
110 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
:
111 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
:
112 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
113 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
:
114 set_layout
->binding
[b
].buffer_index
= buffer_count
;
115 buffer_count
+= binding
->descriptorCount
;
118 case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
:
119 case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
:
120 case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
:
121 case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
:
122 case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
:
123 case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT
:
124 anv_foreach_stage(s
, binding
->stageFlags
) {
125 set_layout
->binding
[b
].stage
[s
].surface_index
= surface_count
[s
];
126 surface_count
[s
] += binding
->descriptorCount
;
133 switch (binding
->descriptorType
) {
134 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
135 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
:
136 set_layout
->binding
[b
].dynamic_offset_index
= dynamic_offset_count
;
137 dynamic_offset_count
+= binding
->descriptorCount
;
143 switch (binding
->descriptorType
) {
144 case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
:
145 case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
:
146 anv_foreach_stage(s
, binding
->stageFlags
) {
147 set_layout
->binding
[b
].stage
[s
].image_index
= image_count
[s
];
148 image_count
[s
] += binding
->descriptorCount
;
155 if (binding
->pImmutableSamplers
) {
156 set_layout
->binding
[b
].immutable_samplers
= samplers
;
157 samplers
+= binding
->descriptorCount
;
159 for (uint32_t i
= 0; i
< binding
->descriptorCount
; i
++)
160 set_layout
->binding
[b
].immutable_samplers
[i
] =
161 anv_sampler_from_handle(binding
->pImmutableSamplers
[i
]);
163 set_layout
->binding
[b
].immutable_samplers
= NULL
;
166 set_layout
->shader_stages
|= binding
->stageFlags
;
169 set_layout
->buffer_count
= buffer_count
;
170 set_layout
->dynamic_offset_count
= dynamic_offset_count
;
172 *pSetLayout
= anv_descriptor_set_layout_to_handle(set_layout
);
177 void anv_DestroyDescriptorSetLayout(
179 VkDescriptorSetLayout _set_layout
,
180 const VkAllocationCallbacks
* pAllocator
)
182 ANV_FROM_HANDLE(anv_device
, device
, _device
);
183 ANV_FROM_HANDLE(anv_descriptor_set_layout
, set_layout
, _set_layout
);
185 anv_free2(&device
->alloc
, pAllocator
, set_layout
);
189 * Pipeline layouts. These have nothing to do with the pipeline. They are
190 * just muttiple descriptor set layouts pasted together
193 VkResult
anv_CreatePipelineLayout(
195 const VkPipelineLayoutCreateInfo
* pCreateInfo
,
196 const VkAllocationCallbacks
* pAllocator
,
197 VkPipelineLayout
* pPipelineLayout
)
199 ANV_FROM_HANDLE(anv_device
, device
, _device
);
200 struct anv_pipeline_layout
*layout
;
202 assert(pCreateInfo
->sType
== VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
);
204 layout
= anv_alloc2(&device
->alloc
, pAllocator
, sizeof(*layout
), 8,
205 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
207 return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY
);
209 layout
->num_sets
= pCreateInfo
->setLayoutCount
;
211 unsigned dynamic_offset_count
= 0;
213 memset(layout
->stage
, 0, sizeof(layout
->stage
));
214 for (uint32_t set
= 0; set
< pCreateInfo
->setLayoutCount
; set
++) {
215 ANV_FROM_HANDLE(anv_descriptor_set_layout
, set_layout
,
216 pCreateInfo
->pSetLayouts
[set
]);
217 layout
->set
[set
].layout
= set_layout
;
219 layout
->set
[set
].dynamic_offset_start
= dynamic_offset_count
;
220 for (uint32_t b
= 0; b
< set_layout
->binding_count
; b
++) {
221 if (set_layout
->binding
[b
].dynamic_offset_index
< 0)
224 dynamic_offset_count
+= set_layout
->binding
[b
].array_size
;
225 for (gl_shader_stage s
= 0; s
< MESA_SHADER_STAGES
; s
++) {
226 if (set_layout
->binding
[b
].stage
[s
].surface_index
>= 0)
227 layout
->stage
[s
].has_dynamic_offsets
= true;
232 *pPipelineLayout
= anv_pipeline_layout_to_handle(layout
);
237 void anv_DestroyPipelineLayout(
239 VkPipelineLayout _pipelineLayout
,
240 const VkAllocationCallbacks
* pAllocator
)
242 ANV_FROM_HANDLE(anv_device
, device
, _device
);
243 ANV_FROM_HANDLE(anv_pipeline_layout
, pipeline_layout
, _pipelineLayout
);
245 anv_free2(&device
->alloc
, pAllocator
, pipeline_layout
);
251 * These are implemented using a big pool of memory and a free-list for the
252 * host memory allocations and a state_stream and a free list for the buffer
253 * view surface state. The spec allows us to fail to allocate due to
254 * fragmentation in all cases but two: 1) after pool reset, allocating up
255 * until the pool size with no freeing must succeed and 2) allocating and
256 * freeing only descriptor sets with the same layout. Case 1) is easy enogh,
257 * and the free lists lets us recycle blocks for case 2).
262 VkResult
anv_CreateDescriptorPool(
264 const VkDescriptorPoolCreateInfo
* pCreateInfo
,
265 const VkAllocationCallbacks
* pAllocator
,
266 VkDescriptorPool
* pDescriptorPool
)
268 ANV_FROM_HANDLE(anv_device
, device
, _device
);
269 struct anv_descriptor_pool
*pool
;
271 uint32_t descriptor_count
= 0;
272 uint32_t buffer_count
= 0;
273 for (uint32_t i
= 0; i
< pCreateInfo
->poolSizeCount
; i
++) {
274 switch (pCreateInfo
->pPoolSizes
[i
].type
) {
275 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
:
276 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
:
277 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
278 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
:
279 buffer_count
+= pCreateInfo
->pPoolSizes
[i
].descriptorCount
;
281 descriptor_count
+= pCreateInfo
->pPoolSizes
[i
].descriptorCount
;
286 const size_t set_size
=
287 sizeof(struct anv_descriptor_set
) +
288 descriptor_count
* sizeof(struct anv_descriptor
) +
289 buffer_count
* sizeof(struct anv_buffer_view
);
293 pCreateInfo
->maxSets
* set_size
;
295 pool
= anv_alloc2(&device
->alloc
, pAllocator
, size
, 8,
296 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
298 return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY
);
302 pool
->free_list
= EMPTY
;
304 anv_state_stream_init(&pool
->surface_state_stream
,
305 &device
->surface_state_block_pool
);
306 pool
->surface_state_free_list
= NULL
;
308 *pDescriptorPool
= anv_descriptor_pool_to_handle(pool
);
313 void anv_DestroyDescriptorPool(
315 VkDescriptorPool _pool
,
316 const VkAllocationCallbacks
* pAllocator
)
318 ANV_FROM_HANDLE(anv_device
, device
, _device
);
319 ANV_FROM_HANDLE(anv_descriptor_pool
, pool
, _pool
);
321 anv_state_stream_finish(&pool
->surface_state_stream
);
322 anv_free2(&device
->alloc
, pAllocator
, pool
);
325 VkResult
anv_ResetDescriptorPool(
327 VkDescriptorPool descriptorPool
,
328 VkDescriptorPoolResetFlags flags
)
330 ANV_FROM_HANDLE(anv_device
, device
, _device
);
331 ANV_FROM_HANDLE(anv_descriptor_pool
, pool
, descriptorPool
);
334 pool
->free_list
= EMPTY
;
335 anv_state_stream_finish(&pool
->surface_state_stream
);
336 anv_state_stream_init(&pool
->surface_state_stream
,
337 &device
->surface_state_block_pool
);
338 pool
->surface_state_free_list
= NULL
;
343 struct pool_free_list_entry
{
349 layout_size(const struct anv_descriptor_set_layout
*layout
)
352 sizeof(struct anv_descriptor_set
) +
353 layout
->size
* sizeof(struct anv_descriptor
) +
354 layout
->buffer_count
* sizeof(struct anv_buffer_view
);
357 struct surface_state_free_list_entry
{
363 anv_descriptor_set_create(struct anv_device
*device
,
364 struct anv_descriptor_pool
*pool
,
365 const struct anv_descriptor_set_layout
*layout
,
366 struct anv_descriptor_set
**out_set
)
368 struct anv_descriptor_set
*set
;
369 const size_t size
= layout_size(layout
);
372 if (size
<= pool
->size
- pool
->next
) {
373 set
= (struct anv_descriptor_set
*) (pool
->data
+ pool
->next
);
376 struct pool_free_list_entry
*entry
;
377 uint32_t *link
= &pool
->free_list
;
378 for (uint32_t f
= pool
->free_list
; f
!= EMPTY
; f
= entry
->next
) {
379 entry
= (struct pool_free_list_entry
*) (pool
->data
+ f
);
380 if (size
<= entry
->size
) {
382 set
= (struct anv_descriptor_set
*) entry
;
390 return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY
);
393 set
->layout
= layout
;
395 (struct anv_buffer_view
*) &set
->descriptors
[layout
->size
];
396 set
->buffer_count
= layout
->buffer_count
;
398 /* Go through and fill out immutable samplers if we have any */
399 struct anv_descriptor
*desc
= set
->descriptors
;
400 for (uint32_t b
= 0; b
< layout
->binding_count
; b
++) {
401 if (layout
->binding
[b
].immutable_samplers
) {
402 for (uint32_t i
= 0; i
< layout
->binding
[b
].array_size
; i
++) {
403 /* The type will get changed to COMBINED_IMAGE_SAMPLER in
404 * UpdateDescriptorSets if needed. However, if the descriptor
405 * set has an immutable sampler, UpdateDescriptorSets may never
406 * touch it, so we need to make sure it's 100% valid now.
408 desc
[i
] = (struct anv_descriptor
) {
409 .type
= VK_DESCRIPTOR_TYPE_SAMPLER
,
410 .sampler
= layout
->binding
[b
].immutable_samplers
[i
],
414 desc
+= layout
->binding
[b
].array_size
;
417 /* Allocate surface state for the buffer views. */
418 for (uint32_t b
= 0; b
< layout
->buffer_count
; b
++) {
419 struct surface_state_free_list_entry
*entry
=
420 pool
->surface_state_free_list
;
421 struct anv_state state
;
425 state
.offset
= entry
->offset
;
426 state
.alloc_size
= 64;
427 pool
->surface_state_free_list
= entry
->next
;
429 state
= anv_state_stream_alloc(&pool
->surface_state_stream
, 64, 64);
432 set
->buffer_views
[b
].surface_state
= state
;
441 anv_descriptor_set_destroy(struct anv_device
*device
,
442 struct anv_descriptor_pool
*pool
,
443 struct anv_descriptor_set
*set
)
445 /* Put the buffer view surface state back on the free list. */
446 for (uint32_t b
= 0; b
< set
->buffer_count
; b
++) {
447 struct surface_state_free_list_entry
*entry
=
448 set
->buffer_views
[b
].surface_state
.map
;
449 entry
->next
= pool
->surface_state_free_list
;
450 pool
->surface_state_free_list
= entry
;
453 /* Put the descriptor set allocation back on the free list. */
454 const uint32_t index
= (char *) set
- pool
->data
;
455 if (index
+ set
->size
== pool
->next
) {
458 struct pool_free_list_entry
*entry
= (struct pool_free_list_entry
*) set
;
459 entry
->next
= pool
->free_list
;
460 entry
->size
= set
->size
;
461 pool
->free_list
= (char *) entry
- pool
->data
;
465 VkResult
anv_AllocateDescriptorSets(
467 const VkDescriptorSetAllocateInfo
* pAllocateInfo
,
468 VkDescriptorSet
* pDescriptorSets
)
470 ANV_FROM_HANDLE(anv_device
, device
, _device
);
471 ANV_FROM_HANDLE(anv_descriptor_pool
, pool
, pAllocateInfo
->descriptorPool
);
473 VkResult result
= VK_SUCCESS
;
474 struct anv_descriptor_set
*set
;
477 for (i
= 0; i
< pAllocateInfo
->descriptorSetCount
; i
++) {
478 ANV_FROM_HANDLE(anv_descriptor_set_layout
, layout
,
479 pAllocateInfo
->pSetLayouts
[i
]);
481 result
= anv_descriptor_set_create(device
, pool
, layout
, &set
);
482 if (result
!= VK_SUCCESS
)
485 pDescriptorSets
[i
] = anv_descriptor_set_to_handle(set
);
488 if (result
!= VK_SUCCESS
)
489 anv_FreeDescriptorSets(_device
, pAllocateInfo
->descriptorPool
,
495 VkResult
anv_FreeDescriptorSets(
497 VkDescriptorPool descriptorPool
,
499 const VkDescriptorSet
* pDescriptorSets
)
501 ANV_FROM_HANDLE(anv_device
, device
, _device
);
502 ANV_FROM_HANDLE(anv_descriptor_pool
, pool
, descriptorPool
);
504 for (uint32_t i
= 0; i
< count
; i
++) {
505 ANV_FROM_HANDLE(anv_descriptor_set
, set
, pDescriptorSets
[i
]);
507 anv_descriptor_set_destroy(device
, pool
, set
);
513 void anv_UpdateDescriptorSets(
515 uint32_t descriptorWriteCount
,
516 const VkWriteDescriptorSet
* pDescriptorWrites
,
517 uint32_t descriptorCopyCount
,
518 const VkCopyDescriptorSet
* pDescriptorCopies
)
520 ANV_FROM_HANDLE(anv_device
, device
, _device
);
522 for (uint32_t i
= 0; i
< descriptorWriteCount
; i
++) {
523 const VkWriteDescriptorSet
*write
= &pDescriptorWrites
[i
];
524 ANV_FROM_HANDLE(anv_descriptor_set
, set
, write
->dstSet
);
525 const struct anv_descriptor_set_binding_layout
*bind_layout
=
526 &set
->layout
->binding
[write
->dstBinding
];
527 struct anv_descriptor
*desc
=
528 &set
->descriptors
[bind_layout
->descriptor_index
];
529 desc
+= write
->dstArrayElement
;
531 switch (write
->descriptorType
) {
532 case VK_DESCRIPTOR_TYPE_SAMPLER
:
533 for (uint32_t j
= 0; j
< write
->descriptorCount
; j
++) {
534 ANV_FROM_HANDLE(anv_sampler
, sampler
,
535 write
->pImageInfo
[j
].sampler
);
537 desc
[j
] = (struct anv_descriptor
) {
538 .type
= VK_DESCRIPTOR_TYPE_SAMPLER
,
544 case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
:
545 for (uint32_t j
= 0; j
< write
->descriptorCount
; j
++) {
546 ANV_FROM_HANDLE(anv_image_view
, iview
,
547 write
->pImageInfo
[j
].imageView
);
548 ANV_FROM_HANDLE(anv_sampler
, sampler
,
549 write
->pImageInfo
[j
].sampler
);
551 desc
[j
].type
= VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
;
552 desc
[j
].image_view
= iview
;
554 /* If this descriptor has an immutable sampler, we don't want
558 desc
[j
].sampler
= sampler
;
562 case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
:
563 case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
:
564 for (uint32_t j
= 0; j
< write
->descriptorCount
; j
++) {
565 ANV_FROM_HANDLE(anv_image_view
, iview
,
566 write
->pImageInfo
[j
].imageView
);
568 desc
[j
] = (struct anv_descriptor
) {
569 .type
= write
->descriptorType
,
575 case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
:
576 case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
:
577 for (uint32_t j
= 0; j
< write
->descriptorCount
; j
++) {
578 ANV_FROM_HANDLE(anv_buffer_view
, bview
,
579 write
->pTexelBufferView
[j
]);
581 desc
[j
] = (struct anv_descriptor
) {
582 .type
= write
->descriptorType
,
583 .buffer_view
= bview
,
588 case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT
:
589 anv_finishme("input attachments not implemented");
592 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
:
593 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
:
594 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
:
595 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
:
596 for (uint32_t j
= 0; j
< write
->descriptorCount
; j
++) {
597 assert(write
->pBufferInfo
[j
].buffer
);
598 ANV_FROM_HANDLE(anv_buffer
, buffer
, write
->pBufferInfo
[j
].buffer
);
601 struct anv_buffer_view
*view
=
602 &set
->buffer_views
[bind_layout
->buffer_index
];
603 view
+= write
->dstArrayElement
+ j
;
605 const struct anv_format
*format
=
606 anv_format_for_descriptor_type(write
->descriptorType
);
608 view
->format
= format
->isl_format
;
609 view
->bo
= buffer
->bo
;
610 view
->offset
= buffer
->offset
+ write
->pBufferInfo
[j
].offset
;
612 /* For buffers with dynamic offsets, we use the full possible
613 * range in the surface state and do the actual range-checking
616 if (bind_layout
->dynamic_offset_index
>= 0 ||
617 write
->pBufferInfo
[j
].range
== VK_WHOLE_SIZE
)
618 view
->range
= buffer
->size
- write
->pBufferInfo
[j
].offset
;
620 view
->range
= write
->pBufferInfo
[j
].range
;
622 anv_fill_buffer_surface_state(device
, view
->surface_state
,
624 view
->offset
, view
->range
, 1);
626 desc
[j
] = (struct anv_descriptor
) {
627 .type
= write
->descriptorType
,
638 for (uint32_t i
= 0; i
< descriptorCopyCount
; i
++) {
639 const VkCopyDescriptorSet
*copy
= &pDescriptorCopies
[i
];
640 ANV_FROM_HANDLE(anv_descriptor_set
, src
, copy
->dstSet
);
641 ANV_FROM_HANDLE(anv_descriptor_set
, dst
, copy
->dstSet
);
643 const struct anv_descriptor_set_binding_layout
*src_layout
=
644 &src
->layout
->binding
[copy
->srcBinding
];
645 struct anv_descriptor
*src_desc
=
646 &src
->descriptors
[src_layout
->descriptor_index
];
647 src_desc
+= copy
->srcArrayElement
;
649 const struct anv_descriptor_set_binding_layout
*dst_layout
=
650 &dst
->layout
->binding
[copy
->dstBinding
];
651 struct anv_descriptor
*dst_desc
=
652 &dst
->descriptors
[dst_layout
->descriptor_index
];
653 dst_desc
+= copy
->dstArrayElement
;
655 for (uint32_t j
= 0; j
< copy
->descriptorCount
; j
++)
656 dst_desc
[j
] = src_desc
[j
];