2015-11-18 22:58:40 +00:00
|
|
|
/*
|
|
|
|
* Copyright © 2015 Intel Corporation
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
* IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
2016-08-25 01:14:11 +01:00
|
|
|
#include "util/mesa-sha1.h"
|
|
|
|
|
2015-11-18 22:58:40 +00:00
|
|
|
#include "anv_private.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Descriptor set layouts.
|
|
|
|
*/
|
|
|
|
|
|
|
|
VkResult anv_CreateDescriptorSetLayout(
|
|
|
|
VkDevice _device,
|
|
|
|
const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
|
2015-12-02 11:28:27 +00:00
|
|
|
const VkAllocationCallbacks* pAllocator,
|
2015-11-18 22:58:40 +00:00
|
|
|
VkDescriptorSetLayout* pSetLayout)
|
|
|
|
{
|
|
|
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
|
|
|
struct anv_descriptor_set_layout *set_layout;
|
|
|
|
|
|
|
|
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO);
|
|
|
|
|
2015-12-01 20:05:21 +00:00
|
|
|
uint32_t max_binding = 0;
|
2015-11-18 22:58:40 +00:00
|
|
|
uint32_t immutable_sampler_count = 0;
|
2015-12-01 20:05:21 +00:00
|
|
|
for (uint32_t j = 0; j < pCreateInfo->bindingCount; j++) {
|
2016-01-05 19:44:16 +00:00
|
|
|
max_binding = MAX2(max_binding, pCreateInfo->pBindings[j].binding);
|
|
|
|
if (pCreateInfo->pBindings[j].pImmutableSamplers)
|
|
|
|
immutable_sampler_count += pCreateInfo->pBindings[j].descriptorCount;
|
2015-11-18 22:58:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
size_t size = sizeof(struct anv_descriptor_set_layout) +
|
2015-12-01 20:05:21 +00:00
|
|
|
(max_binding + 1) * sizeof(set_layout->binding[0]) +
|
2015-11-18 22:58:40 +00:00
|
|
|
immutable_sampler_count * sizeof(struct anv_sampler *);
|
|
|
|
|
2016-10-14 04:31:35 +01:00
|
|
|
set_layout = vk_alloc2(&device->alloc, pAllocator, size, 8,
|
2015-12-02 11:28:27 +00:00
|
|
|
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
2015-11-18 22:58:40 +00:00
|
|
|
if (!set_layout)
|
|
|
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
|
|
|
|
|
|
|
/* We just allocate all the samplers at the end of the struct */
|
|
|
|
struct anv_sampler **samplers =
|
2015-12-01 20:05:21 +00:00
|
|
|
(struct anv_sampler **)&set_layout->binding[max_binding + 1];
|
2015-11-18 22:58:40 +00:00
|
|
|
|
2016-08-25 10:37:19 +01:00
|
|
|
memset(set_layout, 0, sizeof(*set_layout));
|
2015-12-01 20:05:21 +00:00
|
|
|
set_layout->binding_count = max_binding + 1;
|
2015-11-18 22:58:40 +00:00
|
|
|
|
2015-12-16 00:24:19 +00:00
|
|
|
for (uint32_t b = 0; b <= max_binding; b++) {
|
|
|
|
/* Initialize all binding_layout entries to -1 */
|
|
|
|
memset(&set_layout->binding[b], -1, sizeof(set_layout->binding[b]));
|
|
|
|
|
2016-06-06 17:12:20 +01:00
|
|
|
set_layout->binding[b].array_size = 0;
|
2015-12-16 00:24:19 +00:00
|
|
|
set_layout->binding[b].immutable_samplers = NULL;
|
|
|
|
}
|
2015-11-18 22:58:40 +00:00
|
|
|
|
|
|
|
/* Initialize all samplers to 0 */
|
|
|
|
memset(samplers, 0, immutable_sampler_count * sizeof(*samplers));
|
|
|
|
|
2015-12-03 00:08:13 +00:00
|
|
|
uint32_t sampler_count[MESA_SHADER_STAGES] = { 0, };
|
|
|
|
uint32_t surface_count[MESA_SHADER_STAGES] = { 0, };
|
2015-11-17 06:26:03 +00:00
|
|
|
uint32_t image_count[MESA_SHADER_STAGES] = { 0, };
|
2015-12-21 08:03:28 +00:00
|
|
|
uint32_t buffer_count = 0;
|
2015-11-18 22:58:40 +00:00
|
|
|
uint32_t dynamic_offset_count = 0;
|
|
|
|
|
2015-12-01 20:05:21 +00:00
|
|
|
for (uint32_t j = 0; j < pCreateInfo->bindingCount; j++) {
|
2016-01-05 19:44:16 +00:00
|
|
|
const VkDescriptorSetLayoutBinding *binding = &pCreateInfo->pBindings[j];
|
2015-12-01 20:05:21 +00:00
|
|
|
uint32_t b = binding->binding;
|
2016-06-06 17:15:03 +01:00
|
|
|
/* We temporarily store the pointer to the binding in the
|
|
|
|
* immutable_samplers pointer. This provides us with a quick-and-dirty
|
|
|
|
* way to sort the bindings by binding number.
|
|
|
|
*/
|
|
|
|
set_layout->binding[b].immutable_samplers = (void *)binding;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (uint32_t b = 0; b <= max_binding; b++) {
|
|
|
|
const VkDescriptorSetLayoutBinding *binding =
|
|
|
|
(void *)set_layout->binding[b].immutable_samplers;
|
|
|
|
|
|
|
|
if (binding == NULL)
|
|
|
|
continue;
|
2015-12-01 20:05:21 +00:00
|
|
|
|
|
|
|
assert(binding->descriptorCount > 0);
|
2016-06-06 17:12:50 +01:00
|
|
|
#ifndef NDEBUG
|
|
|
|
set_layout->binding[b].type = binding->descriptorType;
|
|
|
|
#endif
|
2015-12-01 20:05:21 +00:00
|
|
|
set_layout->binding[b].array_size = binding->descriptorCount;
|
2015-11-18 22:58:40 +00:00
|
|
|
set_layout->binding[b].descriptor_index = set_layout->size;
|
2015-12-01 20:05:21 +00:00
|
|
|
set_layout->size += binding->descriptorCount;
|
2015-11-18 22:58:40 +00:00
|
|
|
|
2015-12-01 20:05:21 +00:00
|
|
|
switch (binding->descriptorType) {
|
2015-11-18 22:58:40 +00:00
|
|
|
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
|
|
|
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
|
2015-12-23 19:25:35 +00:00
|
|
|
anv_foreach_stage(s, binding->stageFlags) {
|
2015-11-18 22:58:40 +00:00
|
|
|
set_layout->binding[b].stage[s].sampler_index = sampler_count[s];
|
2015-12-01 20:05:21 +00:00
|
|
|
sampler_count[s] += binding->descriptorCount;
|
2015-11-18 22:58:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-12-01 20:05:21 +00:00
|
|
|
switch (binding->descriptorType) {
|
2015-12-21 08:03:28 +00:00
|
|
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
|
|
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
|
|
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
|
|
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
|
|
|
|
set_layout->binding[b].buffer_index = buffer_count;
|
|
|
|
buffer_count += binding->descriptorCount;
|
|
|
|
/* fall through */
|
|
|
|
|
2015-11-18 22:58:40 +00:00
|
|
|
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
|
|
|
|
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
|
|
|
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
|
|
|
|
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
|
|
|
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
|
|
|
|
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
|
2015-12-23 19:25:35 +00:00
|
|
|
anv_foreach_stage(s, binding->stageFlags) {
|
2015-11-18 22:58:40 +00:00
|
|
|
set_layout->binding[b].stage[s].surface_index = surface_count[s];
|
2015-12-01 20:05:21 +00:00
|
|
|
surface_count[s] += binding->descriptorCount;
|
2015-11-18 22:58:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-12-01 20:05:21 +00:00
|
|
|
switch (binding->descriptorType) {
|
2015-11-18 22:58:40 +00:00
|
|
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
|
|
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
|
|
|
|
set_layout->binding[b].dynamic_offset_index = dynamic_offset_count;
|
2015-12-01 20:05:21 +00:00
|
|
|
dynamic_offset_count += binding->descriptorCount;
|
2015-11-18 22:58:40 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-12-15 00:51:12 +00:00
|
|
|
switch (binding->descriptorType) {
|
|
|
|
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
|
|
|
|
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
|
2015-12-23 19:25:35 +00:00
|
|
|
anv_foreach_stage(s, binding->stageFlags) {
|
2015-11-17 06:26:03 +00:00
|
|
|
set_layout->binding[b].stage[s].image_index = image_count[s];
|
|
|
|
image_count[s] += binding->descriptorCount;
|
|
|
|
}
|
2015-12-15 00:51:12 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2015-11-17 06:26:03 +00:00
|
|
|
}
|
|
|
|
|
2015-12-01 20:05:21 +00:00
|
|
|
if (binding->pImmutableSamplers) {
|
2015-11-18 22:58:40 +00:00
|
|
|
set_layout->binding[b].immutable_samplers = samplers;
|
2015-12-01 20:05:21 +00:00
|
|
|
samplers += binding->descriptorCount;
|
2015-11-18 22:58:40 +00:00
|
|
|
|
2015-12-01 20:05:21 +00:00
|
|
|
for (uint32_t i = 0; i < binding->descriptorCount; i++)
|
2015-11-18 22:58:40 +00:00
|
|
|
set_layout->binding[b].immutable_samplers[i] =
|
2015-12-01 20:05:21 +00:00
|
|
|
anv_sampler_from_handle(binding->pImmutableSamplers[i]);
|
2015-11-18 22:58:40 +00:00
|
|
|
} else {
|
|
|
|
set_layout->binding[b].immutable_samplers = NULL;
|
|
|
|
}
|
|
|
|
|
2015-12-01 20:05:21 +00:00
|
|
|
set_layout->shader_stages |= binding->stageFlags;
|
2015-11-18 22:58:40 +00:00
|
|
|
}
|
|
|
|
|
2015-12-21 08:03:28 +00:00
|
|
|
set_layout->buffer_count = buffer_count;
|
2015-11-18 22:58:40 +00:00
|
|
|
set_layout->dynamic_offset_count = dynamic_offset_count;
|
|
|
|
|
|
|
|
*pSetLayout = anv_descriptor_set_layout_to_handle(set_layout);
|
|
|
|
|
|
|
|
return VK_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
void anv_DestroyDescriptorSetLayout(
|
|
|
|
VkDevice _device,
|
2015-12-02 11:28:27 +00:00
|
|
|
VkDescriptorSetLayout _set_layout,
|
|
|
|
const VkAllocationCallbacks* pAllocator)
|
2015-11-18 22:58:40 +00:00
|
|
|
{
|
|
|
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
|
|
|
ANV_FROM_HANDLE(anv_descriptor_set_layout, set_layout, _set_layout);
|
|
|
|
|
2016-11-11 05:32:32 +00:00
|
|
|
if (!set_layout)
|
|
|
|
return;
|
|
|
|
|
2016-10-14 04:31:35 +01:00
|
|
|
vk_free2(&device->alloc, pAllocator, set_layout);
|
2015-11-18 22:58:40 +00:00
|
|
|
}
|
|
|
|
|
2016-08-25 01:14:11 +01:00
|
|
|
static void
|
|
|
|
sha1_update_descriptor_set_layout(struct mesa_sha1 *ctx,
|
|
|
|
const struct anv_descriptor_set_layout *layout)
|
|
|
|
{
|
|
|
|
size_t size = sizeof(*layout) +
|
|
|
|
sizeof(layout->binding[0]) * layout->binding_count;
|
|
|
|
_mesa_sha1_update(ctx, layout, size);
|
|
|
|
}
|
|
|
|
|
2015-11-18 22:58:40 +00:00
|
|
|
/*
|
|
|
|
* Pipeline layouts. These have nothing to do with the pipeline. They are
|
2017-01-16 16:05:07 +00:00
|
|
|
* just multiple descriptor set layouts pasted together
|
2015-11-18 22:58:40 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
VkResult anv_CreatePipelineLayout(
|
|
|
|
VkDevice _device,
|
|
|
|
const VkPipelineLayoutCreateInfo* pCreateInfo,
|
2015-12-02 11:28:27 +00:00
|
|
|
const VkAllocationCallbacks* pAllocator,
|
2015-11-18 22:58:40 +00:00
|
|
|
VkPipelineLayout* pPipelineLayout)
|
|
|
|
{
|
|
|
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
2016-02-18 02:03:21 +00:00
|
|
|
struct anv_pipeline_layout *layout;
|
2015-11-18 22:58:40 +00:00
|
|
|
|
|
|
|
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO);
|
|
|
|
|
2016-10-14 04:31:35 +01:00
|
|
|
layout = vk_alloc2(&device->alloc, pAllocator, sizeof(*layout), 8,
|
2016-02-18 02:03:21 +00:00
|
|
|
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
|
|
|
if (layout == NULL)
|
|
|
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
|
|
|
|
|
|
|
layout->num_sets = pCreateInfo->setLayoutCount;
|
2015-11-18 22:58:40 +00:00
|
|
|
|
|
|
|
unsigned dynamic_offset_count = 0;
|
|
|
|
|
2016-02-18 02:03:21 +00:00
|
|
|
memset(layout->stage, 0, sizeof(layout->stage));
|
2015-12-01 20:05:21 +00:00
|
|
|
for (uint32_t set = 0; set < pCreateInfo->setLayoutCount; set++) {
|
2015-11-18 22:58:40 +00:00
|
|
|
ANV_FROM_HANDLE(anv_descriptor_set_layout, set_layout,
|
|
|
|
pCreateInfo->pSetLayouts[set]);
|
2016-02-18 02:03:21 +00:00
|
|
|
layout->set[set].layout = set_layout;
|
2015-11-18 22:58:40 +00:00
|
|
|
|
2016-02-18 02:03:21 +00:00
|
|
|
layout->set[set].dynamic_offset_start = dynamic_offset_count;
|
2015-11-18 22:58:40 +00:00
|
|
|
for (uint32_t b = 0; b < set_layout->binding_count; b++) {
|
2016-02-23 01:13:46 +00:00
|
|
|
if (set_layout->binding[b].dynamic_offset_index < 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
dynamic_offset_count += set_layout->binding[b].array_size;
|
2016-02-18 02:03:21 +00:00
|
|
|
for (gl_shader_stage s = 0; s < MESA_SHADER_STAGES; s++) {
|
|
|
|
if (set_layout->binding[b].stage[s].surface_index >= 0)
|
|
|
|
layout->stage[s].has_dynamic_offsets = true;
|
2015-11-18 22:58:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-25 01:14:11 +01:00
|
|
|
struct mesa_sha1 *ctx = _mesa_sha1_init();
|
|
|
|
for (unsigned s = 0; s < layout->num_sets; s++) {
|
|
|
|
sha1_update_descriptor_set_layout(ctx, layout->set[s].layout);
|
|
|
|
_mesa_sha1_update(ctx, &layout->set[s].dynamic_offset_start,
|
|
|
|
sizeof(layout->set[s].dynamic_offset_start));
|
|
|
|
}
|
|
|
|
_mesa_sha1_update(ctx, &layout->num_sets, sizeof(layout->num_sets));
|
|
|
|
for (unsigned s = 0; s < MESA_SHADER_STAGES; s++) {
|
|
|
|
_mesa_sha1_update(ctx, &layout->stage[s].has_dynamic_offsets,
|
|
|
|
sizeof(layout->stage[s].has_dynamic_offsets));
|
|
|
|
}
|
|
|
|
_mesa_sha1_final(ctx, layout->sha1);
|
|
|
|
|
2015-11-18 22:58:40 +00:00
|
|
|
*pPipelineLayout = anv_pipeline_layout_to_handle(layout);
|
|
|
|
|
|
|
|
return VK_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
void anv_DestroyPipelineLayout(
|
|
|
|
VkDevice _device,
|
2015-12-02 11:28:27 +00:00
|
|
|
VkPipelineLayout _pipelineLayout,
|
|
|
|
const VkAllocationCallbacks* pAllocator)
|
2015-11-18 22:58:40 +00:00
|
|
|
{
|
|
|
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
|
|
|
ANV_FROM_HANDLE(anv_pipeline_layout, pipeline_layout, _pipelineLayout);
|
|
|
|
|
2016-11-11 05:32:32 +00:00
|
|
|
if (!pipeline_layout)
|
|
|
|
return;
|
|
|
|
|
2016-10-14 04:31:35 +01:00
|
|
|
vk_free2(&device->alloc, pAllocator, pipeline_layout);
|
2015-11-18 22:58:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2016-02-12 06:46:28 +00:00
|
|
|
* Descriptor pools.
|
|
|
|
*
|
|
|
|
* These are implemented using a big pool of memory and a free-list for the
|
|
|
|
* host memory allocations and a state_stream and a free list for the buffer
|
|
|
|
* view surface state. The spec allows us to fail to allocate due to
|
|
|
|
* fragmentation in all cases but two: 1) after pool reset, allocating up
|
|
|
|
* until the pool size with no freeing must succeed and 2) allocating and
|
|
|
|
* freeing only descriptor sets with the same layout. Case 1) is easy enogh,
|
|
|
|
* and the free lists lets us recycle blocks for case 2).
|
2015-11-18 22:58:40 +00:00
|
|
|
*/
|
|
|
|
|
2016-02-12 06:46:28 +00:00
|
|
|
#define EMPTY 1
|
|
|
|
|
2015-11-18 22:58:40 +00:00
|
|
|
VkResult anv_CreateDescriptorPool(
|
2016-02-12 06:46:28 +00:00
|
|
|
VkDevice _device,
|
2015-11-18 22:58:40 +00:00
|
|
|
const VkDescriptorPoolCreateInfo* pCreateInfo,
|
2015-12-02 11:28:27 +00:00
|
|
|
const VkAllocationCallbacks* pAllocator,
|
2015-11-18 22:58:40 +00:00
|
|
|
VkDescriptorPool* pDescriptorPool)
|
|
|
|
{
|
2016-02-12 06:46:28 +00:00
|
|
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
|
|
|
struct anv_descriptor_pool *pool;
|
|
|
|
|
|
|
|
uint32_t descriptor_count = 0;
|
|
|
|
uint32_t buffer_count = 0;
|
|
|
|
for (uint32_t i = 0; i < pCreateInfo->poolSizeCount; i++) {
|
|
|
|
switch (pCreateInfo->pPoolSizes[i].type) {
|
|
|
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
|
|
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
|
|
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
|
|
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
|
|
|
|
buffer_count += pCreateInfo->pPoolSizes[i].descriptorCount;
|
|
|
|
default:
|
|
|
|
descriptor_count += pCreateInfo->pPoolSizes[i].descriptorCount;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const size_t size =
|
|
|
|
sizeof(*pool) +
|
2016-02-24 05:23:06 +00:00
|
|
|
pCreateInfo->maxSets * sizeof(struct anv_descriptor_set) +
|
|
|
|
descriptor_count * sizeof(struct anv_descriptor) +
|
|
|
|
buffer_count * sizeof(struct anv_buffer_view);
|
2016-02-12 06:46:28 +00:00
|
|
|
|
2016-10-14 04:31:35 +01:00
|
|
|
pool = vk_alloc2(&device->alloc, pAllocator, size, 8,
|
2016-02-12 06:46:28 +00:00
|
|
|
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
|
|
|
if (!pool)
|
|
|
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
|
|
|
|
|
|
|
pool->size = size;
|
|
|
|
pool->next = 0;
|
|
|
|
pool->free_list = EMPTY;
|
|
|
|
|
|
|
|
anv_state_stream_init(&pool->surface_state_stream,
|
|
|
|
&device->surface_state_block_pool);
|
|
|
|
pool->surface_state_free_list = NULL;
|
|
|
|
|
|
|
|
*pDescriptorPool = anv_descriptor_pool_to_handle(pool);
|
|
|
|
|
2015-11-18 22:58:40 +00:00
|
|
|
return VK_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
void anv_DestroyDescriptorPool(
|
|
|
|
VkDevice _device,
|
2015-12-02 11:28:27 +00:00
|
|
|
VkDescriptorPool _pool,
|
|
|
|
const VkAllocationCallbacks* pAllocator)
|
2015-11-18 22:58:40 +00:00
|
|
|
{
|
2016-02-12 06:46:28 +00:00
|
|
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
|
|
|
ANV_FROM_HANDLE(anv_descriptor_pool, pool, _pool);
|
|
|
|
|
2016-11-11 05:32:32 +00:00
|
|
|
if (!pool)
|
|
|
|
return;
|
|
|
|
|
2016-02-12 06:46:28 +00:00
|
|
|
anv_state_stream_finish(&pool->surface_state_stream);
|
2016-10-14 04:31:35 +01:00
|
|
|
vk_free2(&device->alloc, pAllocator, pool);
|
2015-11-18 22:58:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VkResult anv_ResetDescriptorPool(
|
2016-02-12 06:46:28 +00:00
|
|
|
VkDevice _device,
|
2015-12-01 20:05:21 +00:00
|
|
|
VkDescriptorPool descriptorPool,
|
|
|
|
VkDescriptorPoolResetFlags flags)
|
2015-11-18 22:58:40 +00:00
|
|
|
{
|
2016-02-12 06:46:28 +00:00
|
|
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
|
|
|
ANV_FROM_HANDLE(anv_descriptor_pool, pool, descriptorPool);
|
|
|
|
|
|
|
|
pool->next = 0;
|
|
|
|
pool->free_list = EMPTY;
|
|
|
|
anv_state_stream_finish(&pool->surface_state_stream);
|
|
|
|
anv_state_stream_init(&pool->surface_state_stream,
|
|
|
|
&device->surface_state_block_pool);
|
|
|
|
pool->surface_state_free_list = NULL;
|
|
|
|
|
2015-11-18 22:58:40 +00:00
|
|
|
return VK_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2016-02-12 06:46:28 +00:00
|
|
|
struct pool_free_list_entry {
|
|
|
|
uint32_t next;
|
|
|
|
uint32_t size;
|
|
|
|
};
|
|
|
|
|
|
|
|
static size_t
|
|
|
|
layout_size(const struct anv_descriptor_set_layout *layout)
|
|
|
|
{
|
|
|
|
return
|
|
|
|
sizeof(struct anv_descriptor_set) +
|
|
|
|
layout->size * sizeof(struct anv_descriptor) +
|
|
|
|
layout->buffer_count * sizeof(struct anv_buffer_view);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct surface_state_free_list_entry {
|
|
|
|
void *next;
|
2016-11-11 00:27:47 +00:00
|
|
|
struct anv_state state;
|
2016-02-12 06:46:28 +00:00
|
|
|
};
|
|
|
|
|
2015-11-18 22:58:40 +00:00
|
|
|
VkResult
|
|
|
|
anv_descriptor_set_create(struct anv_device *device,
|
2016-02-12 06:46:28 +00:00
|
|
|
struct anv_descriptor_pool *pool,
|
2015-11-18 22:58:40 +00:00
|
|
|
const struct anv_descriptor_set_layout *layout,
|
|
|
|
struct anv_descriptor_set **out_set)
|
|
|
|
{
|
|
|
|
struct anv_descriptor_set *set;
|
2016-02-12 06:46:28 +00:00
|
|
|
const size_t size = layout_size(layout);
|
|
|
|
|
|
|
|
set = NULL;
|
|
|
|
if (size <= pool->size - pool->next) {
|
|
|
|
set = (struct anv_descriptor_set *) (pool->data + pool->next);
|
|
|
|
pool->next += size;
|
|
|
|
} else {
|
|
|
|
struct pool_free_list_entry *entry;
|
|
|
|
uint32_t *link = &pool->free_list;
|
|
|
|
for (uint32_t f = pool->free_list; f != EMPTY; f = entry->next) {
|
|
|
|
entry = (struct pool_free_list_entry *) (pool->data + f);
|
|
|
|
if (size <= entry->size) {
|
|
|
|
*link = entry->next;
|
|
|
|
set = (struct anv_descriptor_set *) entry;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
link = &entry->next;
|
|
|
|
}
|
|
|
|
}
|
2015-11-18 22:58:40 +00:00
|
|
|
|
2017-01-21 15:40:22 +00:00
|
|
|
if (set == NULL) {
|
|
|
|
if (pool->free_list != EMPTY) {
|
|
|
|
return vk_error(VK_ERROR_FRAGMENTED_POOL);
|
|
|
|
} else {
|
|
|
|
return vk_error(VK_ERROR_OUT_OF_POOL_MEMORY_KHR);
|
|
|
|
}
|
|
|
|
}
|
2015-11-18 22:58:40 +00:00
|
|
|
|
2016-02-12 06:46:28 +00:00
|
|
|
set->size = size;
|
2015-11-18 22:58:40 +00:00
|
|
|
set->layout = layout;
|
2016-02-12 06:46:28 +00:00
|
|
|
set->buffer_views =
|
|
|
|
(struct anv_buffer_view *) &set->descriptors[layout->size];
|
|
|
|
set->buffer_count = layout->buffer_count;
|
2015-11-18 22:58:40 +00:00
|
|
|
|
2016-07-12 01:33:24 +01:00
|
|
|
/* By defining the descriptors to be zero now, we can later verify that
|
|
|
|
* a descriptor has not been populated with user data.
|
|
|
|
*/
|
|
|
|
memset(set->descriptors, 0, sizeof(struct anv_descriptor) * layout->size);
|
|
|
|
|
2015-11-18 22:58:40 +00:00
|
|
|
/* Go through and fill out immutable samplers if we have any */
|
|
|
|
struct anv_descriptor *desc = set->descriptors;
|
|
|
|
for (uint32_t b = 0; b < layout->binding_count; b++) {
|
|
|
|
if (layout->binding[b].immutable_samplers) {
|
2016-02-23 05:39:14 +00:00
|
|
|
for (uint32_t i = 0; i < layout->binding[b].array_size; i++) {
|
|
|
|
/* The type will get changed to COMBINED_IMAGE_SAMPLER in
|
|
|
|
* UpdateDescriptorSets if needed. However, if the descriptor
|
|
|
|
* set has an immutable sampler, UpdateDescriptorSets may never
|
|
|
|
* touch it, so we need to make sure it's 100% valid now.
|
|
|
|
*/
|
|
|
|
desc[i] = (struct anv_descriptor) {
|
|
|
|
.type = VK_DESCRIPTOR_TYPE_SAMPLER,
|
|
|
|
.sampler = layout->binding[b].immutable_samplers[i],
|
|
|
|
};
|
|
|
|
}
|
2015-11-18 22:58:40 +00:00
|
|
|
}
|
|
|
|
desc += layout->binding[b].array_size;
|
|
|
|
}
|
|
|
|
|
2016-02-12 06:46:28 +00:00
|
|
|
/* Allocate surface state for the buffer views. */
|
2015-12-21 08:03:28 +00:00
|
|
|
for (uint32_t b = 0; b < layout->buffer_count; b++) {
|
2016-02-12 06:46:28 +00:00
|
|
|
struct surface_state_free_list_entry *entry =
|
|
|
|
pool->surface_state_free_list;
|
|
|
|
struct anv_state state;
|
|
|
|
|
|
|
|
if (entry) {
|
2016-11-11 00:27:47 +00:00
|
|
|
state = entry->state;
|
2016-02-12 06:46:28 +00:00
|
|
|
pool->surface_state_free_list = entry->next;
|
2016-11-11 00:27:47 +00:00
|
|
|
assert(state.alloc_size == 64);
|
2016-02-12 06:46:28 +00:00
|
|
|
} else {
|
|
|
|
state = anv_state_stream_alloc(&pool->surface_state_stream, 64, 64);
|
|
|
|
}
|
|
|
|
|
|
|
|
set->buffer_views[b].surface_state = state;
|
2015-12-21 08:03:28 +00:00
|
|
|
}
|
2016-02-12 06:46:28 +00:00
|
|
|
|
2015-11-18 22:58:40 +00:00
|
|
|
*out_set = set;
|
|
|
|
|
|
|
|
return VK_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
anv_descriptor_set_destroy(struct anv_device *device,
|
2016-02-12 06:46:28 +00:00
|
|
|
struct anv_descriptor_pool *pool,
|
2015-11-18 22:58:40 +00:00
|
|
|
struct anv_descriptor_set *set)
|
|
|
|
{
|
2016-02-12 06:46:28 +00:00
|
|
|
/* Put the buffer view surface state back on the free list. */
|
|
|
|
for (uint32_t b = 0; b < set->buffer_count; b++) {
|
|
|
|
struct surface_state_free_list_entry *entry =
|
|
|
|
set->buffer_views[b].surface_state.map;
|
|
|
|
entry->next = pool->surface_state_free_list;
|
2016-11-11 00:27:47 +00:00
|
|
|
entry->state = set->buffer_views[b].surface_state;
|
2016-02-12 06:46:28 +00:00
|
|
|
pool->surface_state_free_list = entry;
|
|
|
|
}
|
2015-12-21 08:03:28 +00:00
|
|
|
|
2016-02-12 06:46:28 +00:00
|
|
|
/* Put the descriptor set allocation back on the free list. */
|
|
|
|
const uint32_t index = (char *) set - pool->data;
|
|
|
|
if (index + set->size == pool->next) {
|
|
|
|
pool->next = index;
|
|
|
|
} else {
|
|
|
|
struct pool_free_list_entry *entry = (struct pool_free_list_entry *) set;
|
|
|
|
entry->next = pool->free_list;
|
|
|
|
entry->size = set->size;
|
|
|
|
pool->free_list = (char *) entry - pool->data;
|
|
|
|
}
|
2015-11-18 22:58:40 +00:00
|
|
|
}
|
|
|
|
|
2015-12-01 20:05:21 +00:00
|
|
|
VkResult anv_AllocateDescriptorSets(
|
2015-11-18 22:58:40 +00:00
|
|
|
VkDevice _device,
|
2015-12-01 20:05:21 +00:00
|
|
|
const VkDescriptorSetAllocateInfo* pAllocateInfo,
|
2015-11-18 22:58:40 +00:00
|
|
|
VkDescriptorSet* pDescriptorSets)
|
|
|
|
{
|
|
|
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
2016-02-12 06:46:28 +00:00
|
|
|
ANV_FROM_HANDLE(anv_descriptor_pool, pool, pAllocateInfo->descriptorPool);
|
2015-11-18 22:58:40 +00:00
|
|
|
|
|
|
|
VkResult result = VK_SUCCESS;
|
|
|
|
struct anv_descriptor_set *set;
|
|
|
|
uint32_t i;
|
|
|
|
|
2016-01-14 15:41:45 +00:00
|
|
|
for (i = 0; i < pAllocateInfo->descriptorSetCount; i++) {
|
2015-12-01 20:05:21 +00:00
|
|
|
ANV_FROM_HANDLE(anv_descriptor_set_layout, layout,
|
|
|
|
pAllocateInfo->pSetLayouts[i]);
|
2015-11-18 22:58:40 +00:00
|
|
|
|
2016-02-12 06:46:28 +00:00
|
|
|
result = anv_descriptor_set_create(device, pool, layout, &set);
|
2015-11-18 22:58:40 +00:00
|
|
|
if (result != VK_SUCCESS)
|
|
|
|
break;
|
|
|
|
|
|
|
|
pDescriptorSets[i] = anv_descriptor_set_to_handle(set);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result != VK_SUCCESS)
|
2015-12-01 20:05:21 +00:00
|
|
|
anv_FreeDescriptorSets(_device, pAllocateInfo->descriptorPool,
|
|
|
|
i, pDescriptorSets);
|
2015-11-18 22:58:40 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
VkResult anv_FreeDescriptorSets(
|
|
|
|
VkDevice _device,
|
|
|
|
VkDescriptorPool descriptorPool,
|
|
|
|
uint32_t count,
|
|
|
|
const VkDescriptorSet* pDescriptorSets)
|
|
|
|
{
|
|
|
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
2016-02-12 06:46:28 +00:00
|
|
|
ANV_FROM_HANDLE(anv_descriptor_pool, pool, descriptorPool);
|
2015-11-18 22:58:40 +00:00
|
|
|
|
|
|
|
for (uint32_t i = 0; i < count; i++) {
|
|
|
|
ANV_FROM_HANDLE(anv_descriptor_set, set, pDescriptorSets[i]);
|
|
|
|
|
2016-11-11 05:32:32 +00:00
|
|
|
if (!set)
|
|
|
|
continue;
|
|
|
|
|
2016-02-12 06:46:28 +00:00
|
|
|
anv_descriptor_set_destroy(device, pool, set);
|
2015-11-18 22:58:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return VK_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
void anv_UpdateDescriptorSets(
|
2015-12-21 08:03:28 +00:00
|
|
|
VkDevice _device,
|
2015-12-01 20:05:21 +00:00
|
|
|
uint32_t descriptorWriteCount,
|
2015-11-18 22:58:40 +00:00
|
|
|
const VkWriteDescriptorSet* pDescriptorWrites,
|
2015-12-01 20:05:21 +00:00
|
|
|
uint32_t descriptorCopyCount,
|
2015-11-18 22:58:40 +00:00
|
|
|
const VkCopyDescriptorSet* pDescriptorCopies)
|
|
|
|
{
|
2015-12-21 08:03:28 +00:00
|
|
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
|
|
|
|
2015-12-01 20:05:21 +00:00
|
|
|
for (uint32_t i = 0; i < descriptorWriteCount; i++) {
|
2015-11-18 22:58:40 +00:00
|
|
|
const VkWriteDescriptorSet *write = &pDescriptorWrites[i];
|
2015-12-01 20:05:21 +00:00
|
|
|
ANV_FROM_HANDLE(anv_descriptor_set, set, write->dstSet);
|
2015-11-18 22:58:40 +00:00
|
|
|
const struct anv_descriptor_set_binding_layout *bind_layout =
|
2015-12-01 20:05:21 +00:00
|
|
|
&set->layout->binding[write->dstBinding];
|
2015-11-18 22:58:40 +00:00
|
|
|
struct anv_descriptor *desc =
|
|
|
|
&set->descriptors[bind_layout->descriptor_index];
|
2016-01-12 19:43:48 +00:00
|
|
|
desc += write->dstArrayElement;
|
2015-11-18 22:58:40 +00:00
|
|
|
|
2016-06-06 17:12:50 +01:00
|
|
|
assert(write->descriptorType == bind_layout->type);
|
|
|
|
|
2015-11-18 22:58:40 +00:00
|
|
|
switch (write->descriptorType) {
|
|
|
|
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
2015-12-01 20:05:21 +00:00
|
|
|
for (uint32_t j = 0; j < write->descriptorCount; j++) {
|
2017-01-18 12:00:49 +00:00
|
|
|
/* If this descriptor has an immutable sampler, we don't want to
|
|
|
|
* stomp on it.
|
|
|
|
*/
|
|
|
|
struct anv_sampler *sampler =
|
|
|
|
bind_layout->immutable_samplers ?
|
|
|
|
bind_layout->immutable_samplers[j] :
|
|
|
|
anv_sampler_from_handle(write->pImageInfo[j].sampler);
|
2015-11-18 22:58:40 +00:00
|
|
|
|
|
|
|
desc[j] = (struct anv_descriptor) {
|
|
|
|
.type = VK_DESCRIPTOR_TYPE_SAMPLER,
|
|
|
|
.sampler = sampler,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
|
2015-12-01 20:05:21 +00:00
|
|
|
for (uint32_t j = 0; j < write->descriptorCount; j++) {
|
2015-11-18 22:58:40 +00:00
|
|
|
ANV_FROM_HANDLE(anv_image_view, iview,
|
2015-12-01 20:05:21 +00:00
|
|
|
write->pImageInfo[j].imageView);
|
2017-01-18 12:00:49 +00:00
|
|
|
/* If this descriptor has an immutable sampler, we don't want to
|
|
|
|
* stomp on it.
|
2015-11-18 22:58:40 +00:00
|
|
|
*/
|
2017-01-18 12:00:49 +00:00
|
|
|
struct anv_sampler *sampler =
|
|
|
|
bind_layout->immutable_samplers ?
|
|
|
|
bind_layout->immutable_samplers[j] :
|
|
|
|
anv_sampler_from_handle(write->pImageInfo[j].sampler);
|
|
|
|
|
|
|
|
desc[j] = (struct anv_descriptor) {
|
|
|
|
.type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
|
|
|
|
.image_view = iview,
|
|
|
|
.sampler = sampler,
|
|
|
|
};
|
2015-11-18 22:58:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
|
|
|
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
|
2016-11-15 23:25:55 +00:00
|
|
|
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
|
2015-12-01 20:05:21 +00:00
|
|
|
for (uint32_t j = 0; j < write->descriptorCount; j++) {
|
2015-11-18 22:58:40 +00:00
|
|
|
ANV_FROM_HANDLE(anv_image_view, iview,
|
2015-12-01 20:05:21 +00:00
|
|
|
write->pImageInfo[j].imageView);
|
2015-11-18 22:58:40 +00:00
|
|
|
|
|
|
|
desc[j] = (struct anv_descriptor) {
|
|
|
|
.type = write->descriptorType,
|
|
|
|
.image_view = iview,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
|
|
|
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
|
2015-12-13 00:11:23 +00:00
|
|
|
for (uint32_t j = 0; j < write->descriptorCount; j++) {
|
|
|
|
ANV_FROM_HANDLE(anv_buffer_view, bview,
|
|
|
|
write->pTexelBufferView[j]);
|
|
|
|
|
|
|
|
desc[j] = (struct anv_descriptor) {
|
|
|
|
.type = write->descriptorType,
|
|
|
|
.buffer_view = bview,
|
|
|
|
};
|
|
|
|
}
|
2015-11-18 22:58:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
|
|
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
|
|
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
|
|
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
|
2015-12-01 20:05:21 +00:00
|
|
|
for (uint32_t j = 0; j < write->descriptorCount; j++) {
|
|
|
|
assert(write->pBufferInfo[j].buffer);
|
|
|
|
ANV_FROM_HANDLE(anv_buffer, buffer, write->pBufferInfo[j].buffer);
|
2015-11-18 22:58:40 +00:00
|
|
|
assert(buffer);
|
|
|
|
|
2015-12-21 08:03:28 +00:00
|
|
|
struct anv_buffer_view *view =
|
2016-01-12 19:43:48 +00:00
|
|
|
&set->buffer_views[bind_layout->buffer_index];
|
|
|
|
view += write->dstArrayElement + j;
|
2015-12-21 08:03:28 +00:00
|
|
|
|
2016-05-13 20:38:12 +01:00
|
|
|
view->format =
|
|
|
|
anv_isl_format_for_descriptor_type(write->descriptorType);
|
2015-12-21 08:03:28 +00:00
|
|
|
view->bo = buffer->bo;
|
|
|
|
view->offset = buffer->offset + write->pBufferInfo[j].offset;
|
2015-11-18 22:58:40 +00:00
|
|
|
|
|
|
|
/* For buffers with dynamic offsets, we use the full possible
|
|
|
|
* range in the surface state and do the actual range-checking
|
|
|
|
* in the shader.
|
|
|
|
*/
|
2016-01-19 23:01:10 +00:00
|
|
|
if (bind_layout->dynamic_offset_index >= 0 ||
|
|
|
|
write->pBufferInfo[j].range == VK_WHOLE_SIZE)
|
2015-12-21 08:03:28 +00:00
|
|
|
view->range = buffer->size - write->pBufferInfo[j].offset;
|
|
|
|
else
|
|
|
|
view->range = write->pBufferInfo[j].range;
|
|
|
|
|
2016-01-26 22:50:52 +00:00
|
|
|
anv_fill_buffer_surface_state(device, view->surface_state,
|
2015-12-21 08:03:28 +00:00
|
|
|
view->format,
|
|
|
|
view->offset, view->range, 1);
|
|
|
|
|
|
|
|
desc[j] = (struct anv_descriptor) {
|
|
|
|
.type = write->descriptorType,
|
|
|
|
.buffer_view = view,
|
|
|
|
};
|
|
|
|
|
2015-11-18 22:58:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-01 20:05:21 +00:00
|
|
|
for (uint32_t i = 0; i < descriptorCopyCount; i++) {
|
2015-11-18 22:58:40 +00:00
|
|
|
const VkCopyDescriptorSet *copy = &pDescriptorCopies[i];
|
2015-12-01 20:05:21 +00:00
|
|
|
ANV_FROM_HANDLE(anv_descriptor_set, src, copy->dstSet);
|
2016-02-03 10:50:06 +00:00
|
|
|
ANV_FROM_HANDLE(anv_descriptor_set, dst, copy->dstSet);
|
|
|
|
|
|
|
|
const struct anv_descriptor_set_binding_layout *src_layout =
|
|
|
|
&src->layout->binding[copy->srcBinding];
|
|
|
|
struct anv_descriptor *src_desc =
|
|
|
|
&src->descriptors[src_layout->descriptor_index];
|
|
|
|
src_desc += copy->srcArrayElement;
|
|
|
|
|
|
|
|
const struct anv_descriptor_set_binding_layout *dst_layout =
|
|
|
|
&dst->layout->binding[copy->dstBinding];
|
|
|
|
struct anv_descriptor *dst_desc =
|
|
|
|
&dst->descriptors[dst_layout->descriptor_index];
|
|
|
|
dst_desc += copy->dstArrayElement;
|
|
|
|
|
|
|
|
for (uint32_t j = 0; j < copy->descriptorCount; j++)
|
|
|
|
dst_desc[j] = src_desc[j];
|
2015-11-18 22:58:40 +00:00
|
|
|
}
|
|
|
|
}
|