Class VkSubpassDescription

  • All Implemented Interfaces:
    java.lang.AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer

    public class VkSubpassDescription
    extends org.lwjgl.system.Struct
    implements org.lwjgl.system.NativeResource
    Structure specifying a subpass description.
    Description

    Each element of the pInputAttachments array corresponds to an input attachment index in a fragment shader, i.e. if a shader declares an image variable decorated with a InputAttachmentIndex value of X, then it uses the attachment provided in pInputAttachments[X]. Input attachments must also be bound to the pipeline in a descriptor set. If the attachment member of any element of pInputAttachments is ATTACHMENT_UNUSED, the application must not read from the corresponding input attachment index. Fragment shaders can use subpass input variables to access the contents of an input attachment at the fragment's (x, y, layer) framebuffer coordinates.

    Each element of the pColorAttachments array corresponds to an output location in the shader, i.e. if the shader declares an output variable decorated with a Location value of X, then it uses the attachment provided in pColorAttachments[X]. If the attachment member of any element of pColorAttachments is ATTACHMENT_UNUSED, writes to the corresponding location by a fragment are discarded.

    If pResolveAttachments is not NULL, each of its elements corresponds to a color attachment (the element in pColorAttachments at the same index), and a multisample resolve operation is defined for each attachment. At the end of each subpass, multisample resolve operations read the subpass's color attachments, and resolve the samples for each pixel to the same pixel location in the corresponding resolve attachments, unless the resolve attachment index is ATTACHMENT_UNUSED.

    Similarly, if VkSubpassDescriptionDepthStencilResolveKHR::pDepthStencilResolveAttachment is not NULL and does not have the value ATTACHMENT_UNUSED, it corresponds to the depth/stencil attachment in pDepthStencilAttachment, and multisample resolve operations for depth and stencil are defined by VkSubpassDescriptionDepthStencilResolveKHR::depthResolveMode and VkSubpassDescriptionDepthStencilResolveKHR::stencilResolveMode, respectively. At the end of each subpass, multisample resolve operations read the subpass's depth/stencil attachment, and resolve the samples for each pixel to the same pixel location in the corresponding resolve attachment. If VkSubpassDescriptionDepthStencilResolveKHR::depthResolveMode is RESOLVE_MODE_NONE_KHR, then the depth component of the resolve attachment is not written to and its contents are preserved. Similarly, if VkSubpassDescriptionDepthStencilResolveKHR::stencilResolveMode is RESOLVE_MODE_NONE_KHR, then the stencil component of the resolve attachment is not written to and its contents are preserved. VkSubpassDescriptionDepthStencilResolveKHR::depthResolveMode is ignored if the VkFormat of the pDepthStencilResolveAttachment does not have a depth component. Similarly, VkSubpassDescriptionDepthStencilResolveKHR::stencilResolveMode is ignored if the VkFormat of the pDepthStencilResolveAttachment does not have a stencil component.

    If the image subresource range referenced by the depth/stencil attachment is created with IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT, then the multisample resolve operation uses the sample locations state specified in the sampleLocationsInfo member of the element of the VkRenderPassSampleLocationsBeginInfoEXT::pPostSubpassSampleLocations for the subpass.

    If pDepthStencilAttachment is NULL, or if its attachment index is ATTACHMENT_UNUSED, it indicates that no depth/stencil attachment will be used in the subpass.

    The contents of an attachment within the render area become undefined at the start of a subpass S if all of the following conditions are true:

    • The attachment is used as a color, depth/stencil, or resolve attachment in any subpass in the render pass.
    • There is a subpass S1 that uses or preserves the attachment, and a subpass dependency from S1 to S.
    • The attachment is not used or preserved in subpass S.

    Once the contents of an attachment become undefined in subpass S, they remain undefined for subpasses in subpass dependency chains starting with subpass S until they are written again. However, they remain valid for subpasses in other subpass dependency chains starting with subpass S1 if those subpasses use or preserve the attachment.

    Valid Usage
    Valid Usage (Implicit)
    • flags must be a valid combination of VkSubpassDescriptionFlagBits values
    • pipelineBindPoint must be a valid VkPipelineBindPoint value
    • If inputAttachmentCount is not 0, pInputAttachments must be a valid pointer to an array of inputAttachmentCount valid VkAttachmentReference structures
    • If colorAttachmentCount is not 0, pColorAttachments must be a valid pointer to an array of colorAttachmentCount valid VkAttachmentReference structures
    • If colorAttachmentCount is not 0, and pResolveAttachments is not NULL, pResolveAttachments must be a valid pointer to an array of colorAttachmentCount valid VkAttachmentReference structures
    • If pDepthStencilAttachment is not NULL, pDepthStencilAttachment must be a valid pointer to a valid VkAttachmentReference structure
    • If preserveAttachmentCount is not 0, pPreserveAttachments must be a valid pointer to an array of preserveAttachmentCount uint32_t values
    See Also

    VkAttachmentReference, VkRenderPassCreateInfo

    Member documentation

    • flags – a bitmask of VkSubpassDescriptionFlagBits specifying usage of the subpass.
    • pipelineBindPoint – a VkPipelineBindPoint value specifying the pipeline type supported for this subpass.
    • inputAttachmentCount – the number of input attachments.
    • pInputAttachments – an array of VkAttachmentReference structures defining the input attachments for this subpass and their layouts.
    • colorAttachmentCount – the number of color attachments.
    • pColorAttachments – an array of VkAttachmentReference structures defining the color attachments for this subpass and their layouts.
    • pResolveAttachments – an optional array of colorAttachmentCount VkAttachmentReference structures defining the resolve attachments for this subpass and their layouts.
    • pDepthStencilAttachment – a pointer to a VkAttachmentReference specifying the depth/stencil attachment for this subpass and its layout.
    • preserveAttachmentCount – the number of preserved attachments.
    • pPreserveAttachments – an array of preserveAttachmentCount render pass attachment indices identifying attachments that are not used by this subpass, but whose contents must be preserved throughout the subpass.

    Layout

    
     struct VkSubpassDescription {
         VkSubpassDescriptionFlags flags;
         VkPipelineBindPoint pipelineBindPoint;
         uint32_t inputAttachmentCount;
         VkAttachmentReference const * pInputAttachments;
         uint32_t colorAttachmentCount;
         VkAttachmentReference const * pColorAttachments;
         VkAttachmentReference const * pResolveAttachments;
         VkAttachmentReference const * pDepthStencilAttachment;
         uint32_t preserveAttachmentCount;
         uint32_t const * pPreserveAttachments;
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • FLAGS, PIPELINEBINDPOINT, INPUTATTACHMENTCOUNT, PINPUTATTACHMENTS, COLORATTACHMENTCOUNT, PCOLORATTACHMENTS, PRESOLVEATTACHMENTS, PDEPTHSTENCILATTACHMENT, PRESERVEATTACHMENTCOUNT, PPRESERVEATTACHMENTS

        The struct member offsets.
    • Constructor Detail

      • VkSubpassDescription

        public VkSubpassDescription​(java.nio.ByteBuffer container)
        Creates a VkSubpassDescription instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

        The created instance holds a strong reference to the container object.

    • Method Detail

      • sizeof

        public int sizeof()
        Specified by:
        sizeof in class org.lwjgl.system.Struct
      • flags

        public int flags()
        Returns the value of the flags field.
      • pipelineBindPoint

        public int pipelineBindPoint()
        Returns the value of the pipelineBindPoint field.
      • inputAttachmentCount

        public int inputAttachmentCount()
        Returns the value of the inputAttachmentCount field.
      • colorAttachmentCount

        public int colorAttachmentCount()
        Returns the value of the colorAttachmentCount field.
      • preserveAttachmentCount

        public int preserveAttachmentCount()
        Returns the value of the preserveAttachmentCount field.
      • pPreserveAttachments

        @Nullable
        public java.nio.IntBuffer pPreserveAttachments()
        Returns a IntBuffer view of the data pointed to by the pPreserveAttachments field.
      • flags

        public VkSubpassDescription flags​(int value)
        Sets the specified value to the flags field.
      • pipelineBindPoint

        public VkSubpassDescription pipelineBindPoint​(int value)
        Sets the specified value to the pipelineBindPoint field.
      • colorAttachmentCount

        public VkSubpassDescription colorAttachmentCount​(int value)
        Sets the specified value to the colorAttachmentCount field.
      • pPreserveAttachments

        public VkSubpassDescription pPreserveAttachments​(@Nullable
                                                         java.nio.IntBuffer value)
        Sets the address of the specified IntBuffer to the pPreserveAttachments field.
      • malloc

        public static VkSubpassDescription malloc()
        Returns a new VkSubpassDescription instance allocated with memAlloc. The instance must be explicitly freed.
      • calloc

        public static VkSubpassDescription calloc()
        Returns a new VkSubpassDescription instance allocated with memCalloc. The instance must be explicitly freed.
      • create

        public static VkSubpassDescription create()
        Returns a new VkSubpassDescription instance allocated with BufferUtils.
      • create

        public static VkSubpassDescription create​(long address)
        Returns a new VkSubpassDescription instance for the specified memory address.
      • createSafe

        @Nullable
        public static VkSubpassDescription createSafe​(long address)
        Like create, but returns null if address is NULL.
      • mallocStack

        public static VkSubpassDescription mallocStack()
        Returns a new VkSubpassDescription instance allocated on the thread-local MemoryStack.
      • callocStack

        public static VkSubpassDescription callocStack()
        Returns a new VkSubpassDescription instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

        public static VkSubpassDescription mallocStack​(org.lwjgl.system.MemoryStack stack)
        Returns a new VkSubpassDescription instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

        public static VkSubpassDescription callocStack​(org.lwjgl.system.MemoryStack stack)
        Returns a new VkSubpassDescription instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
      • mallocStack

        public static VkSubpassDescription.Buffer mallocStack​(int capacity,
                                                              org.lwjgl.system.MemoryStack stack)
        Returns a new VkSubpassDescription.Buffer instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • callocStack

        public static VkSubpassDescription.Buffer callocStack​(int capacity,
                                                              org.lwjgl.system.MemoryStack stack)
        Returns a new VkSubpassDescription.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • nflags

        public static int nflags​(long struct)
        Unsafe version of flags().
      • npipelineBindPoint

        public static int npipelineBindPoint​(long struct)
        Unsafe version of pipelineBindPoint().
      • ninputAttachmentCount

        public static int ninputAttachmentCount​(long struct)
        Unsafe version of inputAttachmentCount().
      • ncolorAttachmentCount

        public static int ncolorAttachmentCount​(long struct)
        Unsafe version of colorAttachmentCount().
      • npreserveAttachmentCount

        public static int npreserveAttachmentCount​(long struct)
        Unsafe version of preserveAttachmentCount().
      • npPreserveAttachments

        @Nullable
        public static java.nio.IntBuffer npPreserveAttachments​(long struct)
        Unsafe version of pPreserveAttachments.
      • nflags

        public static void nflags​(long struct,
                                  int value)
        Unsafe version of flags.
      • npipelineBindPoint

        public static void npipelineBindPoint​(long struct,
                                              int value)
        Unsafe version of pipelineBindPoint.
      • ninputAttachmentCount

        public static void ninputAttachmentCount​(long struct,
                                                 int value)
        Sets the specified value to the inputAttachmentCount field of the specified struct.
      • ncolorAttachmentCount

        public static void ncolorAttachmentCount​(long struct,
                                                 int value)
        Sets the specified value to the colorAttachmentCount field of the specified struct.
      • npreserveAttachmentCount

        public static void npreserveAttachmentCount​(long struct,
                                                    int value)
        Sets the specified value to the preserveAttachmentCount field of the specified struct.
      • npPreserveAttachments

        public static void npPreserveAttachments​(long struct,
                                                 @Nullable
                                                 java.nio.IntBuffer value)
        Unsafe version of pPreserveAttachments.
      • validate

        public static void validate​(long struct)
        Validates pointer members that should not be NULL.
        Parameters:
        struct - the struct to validate
      • validate

        public static void validate​(long array,
                                    int count)
        Calls validate(long) for each struct contained in the specified struct array.
        Parameters:
        array - the struct array to validate
        count - the number of structs in array