Class VkClearAttachment

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

    public class VkClearAttachment
    extends org.lwjgl.system.Struct
    implements org.lwjgl.system.NativeResource
    Structure specifying a clear attachment.
    Description

    No memory barriers are needed between vkCmdClearAttachments and preceding or subsequent draw or attachment clear commands in the same subpass.

    The vkCmdClearAttachments command is not affected by the bound pipeline state.

    Attachments can also be cleared at the beginning of a render pass instance by setting loadOp (or stencilLoadOp) of VkAttachmentDescription to ATTACHMENT_LOAD_OP_CLEAR, as described for CreateRenderPass.

    Valid Usage
    Valid Usage (Implicit)
    • aspectMask must be a valid combination of VkImageAspectFlagBits values
    • aspectMask must not be 0
    See Also

    VkClearValue, CmdClearAttachments

    Member documentation

    • aspectMask – a mask selecting the color, depth and/or stencil aspects of the attachment to be cleared.
    • colorAttachment – only meaningful if IMAGE_ASPECT_COLOR_BIT is set in aspectMask, in which case it is an index to the pColorAttachments array in the VkSubpassDescription structure of the current subpass which selects the color attachment to clear.
    • clearValue – the color or depth/stencil value to clear the attachment to, as described in Clear Values below.

    Layout

    
     struct VkClearAttachment {
         VkImageAspectFlags aspectMask;
         uint32_t colorAttachment;
         VkClearValue clearValue;
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • ASPECTMASK, COLORATTACHMENT, CLEARVALUE

        The struct member offsets.
    • Constructor Detail

      • VkClearAttachment

        public VkClearAttachment​(java.nio.ByteBuffer container)
        Creates a VkClearAttachment 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
      • aspectMask

        public int aspectMask()
        Returns the value of the aspectMask field.
      • colorAttachment

        public int colorAttachment()
        Returns the value of the colorAttachment field.
      • aspectMask

        public VkClearAttachment aspectMask​(int value)
        Sets the specified value to the aspectMask field.
      • colorAttachment

        public VkClearAttachment colorAttachment​(int value)
        Sets the specified value to the colorAttachment field.
      • clearValue

        public VkClearAttachment clearValue​(java.util.function.Consumer<VkClearValue> consumer)
        Passes the clearValue field to the specified Consumer.
      • set

        public VkClearAttachment set​(int aspectMask,
                                     int colorAttachment,
                                     VkClearValue clearValue)
        Initializes this struct with the specified values.
      • malloc

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

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

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

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

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

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

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

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

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

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

        public static VkClearAttachment.Buffer callocStack​(int capacity)
        Returns a new VkClearAttachment.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
        Parameters:
        capacity - the buffer capacity
      • mallocStack

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

        public static VkClearAttachment.Buffer callocStack​(int capacity,
                                                           org.lwjgl.system.MemoryStack stack)
        Returns a new VkClearAttachment.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
      • naspectMask

        public static int naspectMask​(long struct)
        Unsafe version of aspectMask().
      • ncolorAttachment

        public static int ncolorAttachment​(long struct)
        Unsafe version of colorAttachment().
      • naspectMask

        public static void naspectMask​(long struct,
                                       int value)
        Unsafe version of aspectMask.
      • ncolorAttachment

        public static void ncolorAttachment​(long struct,
                                            int value)
        Unsafe version of colorAttachment.
      • nclearValue

        public static void nclearValue​(long struct,
                                       VkClearValue value)
        Unsafe version of clearValue.