# VkRenderPassCreateInfo2(3) Manual Page

## Name

VkRenderPassCreateInfo2 - Structure specifying parameters of a newly created render pass

## C Specification

The `VkRenderPassCreateInfo2` structure is defined as:

    typedef struct VkRenderPassCreateInfo2 {
        VkStructureType                    sType;
        const void*                        pNext;
        VkRenderPassCreateFlags            flags;
        uint32_t                           attachmentCount;
        const VkAttachmentDescription2*    pAttachments;
        uint32_t                           subpassCount;
        const VkSubpassDescription2*       pSubpasses;
        uint32_t                           dependencyCount;
        const VkSubpassDependency2*        pDependencies;
        uint32_t                           correlatedViewMaskCount;
        const uint32_t*                    pCorrelatedViewMasks;
    } VkRenderPassCreateInfo2;

or the equivalent

    typedef VkRenderPassCreateInfo2 VkRenderPassCreateInfo2KHR;

## Members

- `sType` is the type of this structure.

- `pNext` is `NULL` or a pointer to an extension-specific structure.

- `flags` is reserved for future use.

- `attachmentCount` is the number of attachments used by this render pass.

- `pAttachments` is a pointer to an array of `attachmentCount` VkAttachmentDescription2 structures describing the attachments used by the render pass.

- `subpassCount` is the number of subpasses to create.

- `pSubpasses` is a pointer to an array of `subpassCount` VkSubpassDescription2 structures describing each subpass.

- `dependencyCount` is the number of dependencies between pairs of subpasses.

- `pDependencies` is a pointer to an array of `dependencyCount` VkSubpassDependency structures describing dependencies between pairs of subpasses.

- `correlatedViewMaskCount` is the number of correlation masks.

- `pCorrelatedViewMasks` is a pointer to an array of view masks indicating sets of views that may be more efficient to render concurrently.

## Description

Parameters defined by this structure with the same name as those in VkRenderPassCreateInfo have the identical effect to those parameters; the child structures are variants of those used in VkRenderPassCreateInfo which add `sType` and `pNext` parameters, allowing them to be extended.

If the VkSubpassDescription2::`viewMask` member of any element of `pSubpasses` is not zero, multiview functionality is considered to be enabled for this render pass.

`correlatedViewMaskCount` and `pCorrelatedViewMasks` have the same effect as VkRenderPassMultiviewCreateInfo::`correlationMaskCount` and VkRenderPassMultiviewCreateInfo::`pCorrelationMasks`, respectively.

Valid Usage

- If any two subpasses operate on attachments with overlapping ranges of the same `VkDeviceMemory` object, and at least one subpass writes to that area of `VkDeviceMemory`, a subpass dependency must be included (either directly or via some intermediate subpasses) between them

- If the `attachment` member of any element of `pInputAttachments`, `pColorAttachments`, `pResolveAttachments` or `pDepthStencilAttachment`, or the attachment indexed by any element of `pPreserveAttachments` in any given element of `pSubpasses` is bound to a range of a `VkDeviceMemory` object that overlaps with any other attachment in any subpass (including the same subpass), the `VkAttachmentDescription2` structures describing them must include `VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT` in `flags`

- If the `attachment` member of any element of `pInputAttachments`, `pColorAttachments`, `pResolveAttachments` or `pDepthStencilAttachment`, or any element of `pPreserveAttachments` in any given element of `pSubpasses` is not `VK_ATTACHMENT_UNUSED`, it must be less than `attachmentCount`

- For any member of `pAttachments` with a `loadOp` equal to `VK_ATTACHMENT_LOAD_OP_CLEAR`, the first use of that attachment must not specify a `layout` equal to `VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL`, `VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL`, or `VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL`

- For any member of `pAttachments` with a `stencilLoadOp` equal to `VK_ATTACHMENT_LOAD_OP_CLEAR`, the first use of that attachment must not specify a `layout` equal to `VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL`, `VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL`, or `VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL`.

- For any element of `pDependencies`, if the `srcSubpass` is not `VK_SUBPASS_EXTERNAL`, all stage flags included in the `srcStageMask` member of that dependency must be a pipeline stage supported by the pipeline identified by the `pipelineBindPoint` member of the source subpass

- For any element of `pDependencies`, if the `dstSubpass` is not `VK_SUBPASS_EXTERNAL`, all stage flags included in the `dstStageMask` member of that dependency must be a pipeline stage supported by the pipeline identified by the `pipelineBindPoint` member of the destination subpass

- The set of bits included in any element of `pCorrelatedViewMasks` must not overlap with the set of bits included in any other element of `pCorrelatedViewMasks`

- If the VkSubpassDescription2::`viewMask` member of all elements of `pSubpasses` is `0`, `correlatedViewMaskCount` must be `0`

- The VkSubpassDescription2::`viewMask` member of all elements of `pSubpasses` must either all be `0`, or all not be `0`

- If the VkSubpassDescription2::`viewMask` member of all elements of `pSubpasses` is `0`, the `dependencyFlags` member of any element of `pDependencies` must not include `VK_DEPENDENCY_VIEW_LOCAL_BIT`

- For any element of `pDependencies` where its `srcSubpass` member equals its `dstSubpass` member, if the `viewMask` member of the corresponding element of `pSubpasses` includes more than one bit, its `dependencyFlags` member must include `VK_DEPENDENCY_VIEW_LOCAL_BIT`

- The `viewMask` member must not have a bit set at an index greater than or equal to VkPhysicalDeviceLimits::`maxFramebufferLayers`

- If the `attachment` member of any element of the `pInputAttachments` member of any element of `pSubpasses` is not `VK_ATTACHMENT_UNUSED`, the `aspectMask` member of that element of `pInputAttachments` must only include aspects that are present in images of the format specified by the element of `pAttachments` specified by `attachment`

- The `srcSubpass` member of each element of `pDependencies` must be less than `subpassCount`

- The `dstSubpass` member of each element of `pDependencies` must be less than `subpassCount`

Valid Usage (Implicit)

- `sType` must be `VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2`

- `pNext` must be `NULL` or a pointer to a valid instance of VkRenderPassFragmentDensityMapCreateInfoEXT

- The `sType` value of each struct in the `pNext` chain must be unique

- `flags` must be a valid combination of VkRenderPassCreateFlagBits values

- If `attachmentCount` is not `0`, `pAttachments` must be a valid pointer to an array of `attachmentCount` valid VkAttachmentDescription2 structures

- `pSubpasses` must be a valid pointer to an array of `subpassCount` valid VkSubpassDescription2 structures

- If `dependencyCount` is not `0`, `pDependencies` must be a valid pointer to an array of `dependencyCount` valid VkSubpassDependency2 structures

- If `correlatedViewMaskCount` is not `0`, `pCorrelatedViewMasks` must be a valid pointer to an array of `correlatedViewMaskCount` `uint32_t` values

- `subpassCount` must be greater than `0`

## See Also

VkAttachmentDescription2, VkRenderPassCreateFlags, VkStructureType, VkSubpassDependency2, VkSubpassDescription2, vkCreateRenderPass2, vkCreateRenderPass2KHR

## Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

## Copyright

Copyright (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.