diff options
author | Bas Nieuwenhuizen <[email protected]> | 2019-08-02 14:42:50 +0200 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2019-08-02 22:35:19 +0200 |
commit | 9475782eac8e81633e584c788b28f9cf531defdb (patch) | |
tree | 4c4c491e0a0e60cef2a9a4fe1a17d8a5ea180d97 /src | |
parent | a7041f3b4e1997e2660d779268d828d59943cc1f (diff) |
radv: Implement VK_KHR_imageless_framebuffer.
Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/vulkan/radv_cmd_buffer.c | 16 | ||||
-rw-r--r-- | src/amd/vulkan/radv_device.c | 32 |
2 files changed, 38 insertions, 10 deletions
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index e46c3ee9c47..645e0155510 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -3008,6 +3008,13 @@ radv_cmd_state_setup_attachments(struct radv_cmd_buffer *cmd_buffer, const VkRenderPassBeginInfo *info) { struct radv_cmd_state *state = &cmd_buffer->state; + const struct VkRenderPassAttachmentBeginInfoKHR *attachment_info = NULL; + + if (info) { + attachment_info = vk_find_struct_const(info->pNext, + RENDER_PASS_ATTACHMENT_BEGIN_INFO_KHR); + } + if (pass->attachment_count == 0) { state->attachments = NULL; @@ -3058,7 +3065,14 @@ radv_cmd_state_setup_attachments(struct radv_cmd_buffer *cmd_buffer, state->attachments[i].current_layout = att->initial_layout; state->attachments[i].sample_location.count = 0; - struct radv_image_view *iview = state->framebuffer->attachments[i]; + struct radv_image_view *iview; + if (attachment_info && attachment_info->attachmentCount > i) { + iview = radv_image_view_from_handle(attachment_info->pAttachments[i]); + } else { + iview = state->framebuffer->attachments[i]; + } + + state->attachments[i].iview = iview; if (iview->aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) { radv_initialise_ds_surface(cmd_buffer->device, &state->attachments[i].ds, iview); } else { diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 0d4b25c6969..280b297f4df 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -4806,11 +4806,15 @@ VkResult radv_CreateFramebuffer( { RADV_FROM_HANDLE(radv_device, device, _device); struct radv_framebuffer *framebuffer; + const VkFramebufferAttachmentsCreateInfoKHR *imageless_create_info = + vk_find_struct_const(pCreateInfo->pNext, + FRAMEBUFFER_ATTACHMENTS_CREATE_INFO_KHR); assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO); - size_t size = sizeof(*framebuffer) + - sizeof(struct radv_image_view*) * pCreateInfo->attachmentCount; + size_t size = sizeof(*framebuffer); + if (!imageless_create_info) + size += sizeof(struct radv_image_view*) * pCreateInfo->attachmentCount; framebuffer = vk_alloc2(&device->alloc, pAllocator, size, 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (framebuffer == NULL) @@ -4820,13 +4824,23 @@ VkResult radv_CreateFramebuffer( framebuffer->width = pCreateInfo->width; framebuffer->height = pCreateInfo->height; framebuffer->layers = pCreateInfo->layers; - for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) { - VkImageView _iview = pCreateInfo->pAttachments[i]; - struct radv_image_view *iview = radv_image_view_from_handle(_iview); - framebuffer->attachments[i] = iview; - framebuffer->width = MIN2(framebuffer->width, iview->extent.width); - framebuffer->height = MIN2(framebuffer->height, iview->extent.height); - framebuffer->layers = MIN2(framebuffer->layers, radv_surface_max_layer_count(iview)); + if (imageless_create_info) { + for (unsigned i = 0; i < imageless_create_info->attachmentImageInfoCount; ++i) { + const VkFramebufferAttachmentImageInfoKHR *attachment = + imageless_create_info->pAttachmentImageInfos + i; + framebuffer->width = MIN2(framebuffer->width, attachment->width); + framebuffer->height = MIN2(framebuffer->height, attachment->height); + framebuffer->layers = MIN2(framebuffer->layers, attachment->layerCount); + } + } else { + for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) { + VkImageView _iview = pCreateInfo->pAttachments[i]; + struct radv_image_view *iview = radv_image_view_from_handle(_iview); + framebuffer->attachments[i] = iview; + framebuffer->width = MIN2(framebuffer->width, iview->extent.width); + framebuffer->height = MIN2(framebuffer->height, iview->extent.height); + framebuffer->layers = MIN2(framebuffer->layers, radv_surface_max_layer_count(iview)); + } } *pFramebuffer = radv_framebuffer_to_handle(framebuffer); |