case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
/* These are remapped to the special driver-managed descriptor set,
* hence they don't take up any space in the original descriptor set:
+ * Input attachment doesn't use descriptor sets at all
*/
return 0;
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
}
}
- uint32_t samplers_offset = sizeof(struct tu_descriptor_set_layout) +
- (max_binding + 1) * sizeof(set_layout->binding[0]);
+ uint32_t samplers_offset =
+ offsetof(struct tu_descriptor_set_layout, binding[max_binding + 1]);
+
/* note: only need to store TEX_SAMP_DWORDS for immutable samples,
* but using struct tu_sampler makes things simpler */
uint32_t size = samplers_offset +
immutable_sampler_count * sizeof(struct tu_sampler) +
ycbcr_sampler_count * sizeof(struct tu_sampler_ycbcr_conversion);
- set_layout = vk_alloc2(&device->alloc, pAllocator, size, 8,
+ set_layout = vk_zalloc2(&device->alloc, pAllocator, size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!set_layout)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
set_layout->size = 0;
set_layout->dynamic_ubo = 0;
- memset(set_layout->binding, 0,
- size - sizeof(struct tu_descriptor_set_layout));
-
uint32_t dynamic_offset_count = 0;
- uint32_t input_attachment_count = 0;
uint32_t buffer_count = 0;
for (uint32_t j = 0; j < pCreateInfo->bindingCount; j++) {
set_layout->binding[b].offset = set_layout->size;
set_layout->binding[b].buffer_offset = buffer_count;
set_layout->binding[b].dynamic_offset_offset = dynamic_offset_count;
- set_layout->binding[b].input_attachment_offset = input_attachment_count;
set_layout->binding[b].size = descriptor_size(binding->descriptorType);
set_layout->binding[b].shader_stages = binding->stageFlags;
dynamic_offset_count += binding->descriptorCount;
}
- if (binding->descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT)
- input_attachment_count += binding->descriptorCount;
+
set_layout->shader_stages |= binding->stageFlags;
}
free(bindings);
set_layout->dynamic_offset_count = dynamic_offset_count;
- set_layout->input_attachment_count = input_attachment_count;
set_layout->buffer_count = buffer_count;
*pSetLayout = tu_descriptor_set_layout_to_handle(set_layout);
uint64_t descriptor_sz = descriptor_size(binding->descriptorType);
uint64_t descriptor_alignment = 8;
- if (size && !align_u64(size, descriptor_alignment)) {
+ if (size && !ALIGN_POT(size, descriptor_alignment)) {
supported = false;
}
- size = align_u64(size, descriptor_alignment);
+ size = ALIGN_POT(size, descriptor_alignment);
uint64_t max_count = UINT64_MAX;
if (descriptor_sz)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
layout->num_sets = pCreateInfo->setLayoutCount;
- layout->input_attachment_count = 0;
layout->dynamic_offset_count = 0;
- unsigned dynamic_offset_count = 0, input_attachment_count = 0;
+ unsigned dynamic_offset_count = 0;
_mesa_sha1_init(&ctx);
for (uint32_t set = 0; set < pCreateInfo->setLayoutCount; set++) {
pCreateInfo->pSetLayouts[set]);
layout->set[set].layout = set_layout;
layout->set[set].dynamic_offset_start = dynamic_offset_count;
- layout->set[set].input_attachment_start = input_attachment_count;
dynamic_offset_count += set_layout->dynamic_offset_count;
- input_attachment_count += set_layout->input_attachment_count;
for (uint32_t b = 0; b < set_layout->binding_count; b++) {
if (set_layout->binding[b].immutable_samplers_offset)
}
layout->dynamic_offset_count = dynamic_offset_count;
- layout->input_attachment_count = input_attachment_count;
layout->push_constant_size = 0;
for (unsigned i = 0; i < pCreateInfo->pushConstantRangeCount; ++i) {
unsigned dynamic_offset = sizeof(struct tu_descriptor_set) +
sizeof(struct tu_bo *) * buffer_count;
unsigned mem_size = dynamic_offset +
- A6XX_TEX_CONST_DWORDS * 4 * (layout->dynamic_offset_count +
- layout->input_attachment_count);;
+ A6XX_TEX_CONST_DWORDS * 4 * layout->dynamic_offset_count;
if (pool->host_memory_base) {
if (pool->host_memory_end - pool->host_memory_ptr < mem_size)
memset(set, 0, mem_size);
- if (layout->dynamic_offset_count + layout->input_attachment_count > 0) {
+ if (layout->dynamic_offset_count) {
set->dynamic_descriptors = (uint32_t *)((uint8_t*)set + dynamic_offset);
}
switch(pCreateInfo->pPoolSizes[i].type) {
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
- case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
dynamic_count += pCreateInfo->pPoolSizes[i].descriptorCount;
default:
break;
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: {
assert(!(set->layout->flags & VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR));
unsigned idx = writeset->dstArrayElement + j;
- idx += set->layout->input_attachment_count + binding_layout->dynamic_offset_offset;
+ idx += binding_layout->dynamic_offset_offset;
write_ubo_descriptor(device, cmd_buffer,
set->dynamic_descriptors + A6XX_TEX_CONST_DWORDS * idx,
buffer_list, writeset->pBufferInfo + j);
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: {
assert(!(set->layout->flags & VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR));
unsigned idx = writeset->dstArrayElement + j;
- idx += set->layout->input_attachment_count + binding_layout->dynamic_offset_offset;
+ idx += binding_layout->dynamic_offset_offset;
write_buffer_descriptor(device, cmd_buffer,
set->dynamic_descriptors + A6XX_TEX_CONST_DWORDS * idx,
buffer_list, writeset->pBufferInfo + j);
writeset->descriptorType,
writeset->pImageInfo + j);
break;
- case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: {
- unsigned idx = writeset->dstArrayElement + j;
- idx += binding_layout->input_attachment_offset;
- write_image_descriptor(device, cmd_buffer,
- set->dynamic_descriptors + A6XX_TEX_CONST_DWORDS * idx,
- buffer_list, writeset->descriptorType,
- writeset->pImageInfo + j);
- break;
- }
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
write_combined_image_sampler_descriptor(device, cmd_buffer,
A6XX_TEX_CONST_DWORDS * 4,
case VK_DESCRIPTOR_TYPE_SAMPLER:
write_sampler_descriptor(device, ptr, writeset->pImageInfo + j);
break;
+ case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
+ /* nothing in descriptor set - framebuffer state is used instead */
+ break;
default:
unreachable("unimplemented descriptor type");
break;
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: {
unsigned src_idx = copyset->srcArrayElement + j;
unsigned dst_idx = copyset->dstArrayElement + j;
- src_idx += src_set->layout->input_attachment_count;
- dst_idx += dst_set->layout->input_attachment_count;
src_idx += src_binding_layout->dynamic_offset_offset;
dst_idx += dst_binding_layout->dynamic_offset_offset;
memcpy(dst_dynamic, src_dynamic, A6XX_TEX_CONST_DWORDS * 4);
break;
}
- case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: {
- unsigned src_idx = copyset->srcArrayElement + j;
- unsigned dst_idx = copyset->dstArrayElement + j;
- src_idx += src_binding_layout->input_attachment_offset;
- dst_idx += dst_binding_layout->input_attachment_offset;
-
- uint32_t *src_dynamic, *dst_dynamic;
- src_dynamic = src_set->dynamic_descriptors + src_idx * A6XX_TEX_CONST_DWORDS;
- dst_dynamic = dst_set->dynamic_descriptors + dst_idx * A6XX_TEX_CONST_DWORDS;
- memcpy(dst_dynamic, src_dynamic, A6XX_TEX_CONST_DWORDS * 4);
- break;
- }
default:
memcpy(dst_ptr, src_ptr, src_binding_layout->size);
}
switch (entry->descriptorType) {
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
- dst_offset = (set_layout->input_attachment_count +
- binding_layout->dynamic_offset_offset +
- entry->dstArrayElement) * A6XX_TEX_CONST_DWORDS;
- dst_stride = A6XX_TEX_CONST_DWORDS;
- break;
- case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
- dst_offset = (binding_layout->input_attachment_offset +
+ dst_offset = (binding_layout->dynamic_offset_offset +
entry->dstArrayElement) * A6XX_TEX_CONST_DWORDS;
dst_stride = A6XX_TEX_CONST_DWORDS;
break;
break;
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
+ case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: {
write_image_descriptor(device, cmd_buffer, ptr, buffer_list,
templ->entry[i].descriptor_type,
src);
break;
- case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: {
- write_image_descriptor(device, cmd_buffer,
- set->dynamic_descriptors + dst_offset,
- buffer_list, templ->entry[i].descriptor_type,
- src);
- break;
}
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
write_combined_image_sampler_descriptor(device, cmd_buffer,