Class VkAttachmentDescription

java.lang.Object
org.lwjgl.system.Pointer.Default
org.lwjgl.system.Struct<VkAttachmentDescription>
org.lwjgl.vulkan.VkAttachmentDescription
All Implemented Interfaces:
AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer

public class VkAttachmentDescription extends org.lwjgl.system.Struct<VkAttachmentDescription> implements org.lwjgl.system.NativeResource
Structure specifying an attachment description.
Description

If the attachment uses a color format, then loadOp and storeOp are used, and stencilLoadOp and stencilStoreOp are ignored. If the format has depth and/or stencil components, loadOp and storeOp apply only to the depth data, while stencilLoadOp and stencilStoreOp define how the stencil data is handled. loadOp and stencilLoadOp define the load operations for the attachment. storeOp and stencilStoreOp define the store operations for the attachment. If an attachment is not used by any subpass, loadOp, storeOp, stencilStoreOp, and stencilLoadOp will be ignored for that attachment, and no load or store ops will be performed. However, any transition specified by initialLayout and finalLayout will still be executed.

If flags includes ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT, then the attachment is treated as if it shares physical memory with another attachment in the same render pass. This information limits the ability of the implementation to reorder certain operations (like layout transitions and the loadOp) such that it is not improperly reordered against other uses of the same physical memory via a different attachment. This is described in more detail below.

If a render pass uses multiple attachments that alias the same device memory, those attachments must each include the ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT bit in their attachment description flags. Attachments aliasing the same memory occurs in multiple ways:

  • Multiple attachments being assigned the same image view as part of framebuffer creation.
  • Attachments using distinct image views that correspond to the same image subresource of an image.
  • Attachments using views of distinct image subresources which are bound to overlapping memory ranges.
Note

Render passes must include subpass dependencies (either directly or via a subpass dependency chain) between any two subpasses that operate on the same attachment or aliasing attachments and those subpass dependencies must include execution and memory dependencies separating uses of the aliases, if at least one of those subpasses writes to one of the aliases. These dependencies must not include the DEPENDENCY_BY_REGION_BIT if the aliases are views of distinct image subresources which overlap in memory.

Multiple attachments that alias the same memory must not be used in a single subpass. A given attachment index must not be used multiple times in a single subpass, with one exception: two subpass attachments can use the same attachment index if at least one use is as an input attachment and neither use is as a resolve or preserve attachment. In other words, the same view can be used simultaneously as an input and color or depth/stencil attachment, but must not be used as multiple color or depth/stencil attachments nor as resolve or preserve attachments.

If a set of attachments alias each other, then all except the first to be used in the render pass must use an initialLayout of IMAGE_LAYOUT_UNDEFINED, since the earlier uses of the other aliases make their contents undefined. Once an alias has been used and a different alias has been used after it, the first alias must not be used in any later subpasses. However, an application can assign the same image view to multiple aliasing attachment indices, which allows that image view to be used multiple times even if other aliases are used in between.

Note

Once an attachment needs the ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT bit, there should be no additional cost of introducing additional aliases, and using these additional aliases may allow more efficient clearing of the attachments on multiple uses via ATTACHMENT_LOAD_OP_CLEAR.

Valid Usage
Valid Usage (Implicit)
  • flags must be a valid combination of VkAttachmentDescriptionFlagBits values
  • format must be a valid VkFormat value
  • samples must be a valid VkSampleCountFlagBits value
  • loadOp must be a valid VkAttachmentLoadOp value
  • storeOp must be a valid VkAttachmentStoreOp value
  • stencilLoadOp must be a valid VkAttachmentLoadOp value
  • stencilStoreOp must be a valid VkAttachmentStoreOp value
  • initialLayout must be a valid VkImageLayout value
  • finalLayout must be a valid VkImageLayout value
See Also

VkRenderPassCreateInfo

Layout


 struct VkAttachmentDescription {
     VkAttachmentDescriptionFlags flags();
     VkFormat format();
     VkSampleCountFlagBits samples();
     VkAttachmentLoadOp loadOp();
     VkAttachmentStoreOp storeOp();
     VkAttachmentLoadOp stencilLoadOp();
     VkAttachmentStoreOp stencilStoreOp();
     VkImageLayout initialLayout();
     VkImageLayout finalLayout();
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • FLAGS

      public static final int FLAGS
      The struct member offsets.
    • FORMAT

      public static final int FORMAT
      The struct member offsets.
    • SAMPLES

      public static final int SAMPLES
      The struct member offsets.
    • LOADOP

      public static final int LOADOP
      The struct member offsets.
    • STOREOP

      public static final int STOREOP
      The struct member offsets.
    • STENCILLOADOP

      public static final int STENCILLOADOP
      The struct member offsets.
    • STENCILSTOREOP

      public static final int STENCILSTOREOP
      The struct member offsets.
    • INITIALLAYOUT

      public static final int INITIALLAYOUT
      The struct member offsets.
    • FINALLAYOUT

      public static final int FINALLAYOUT
      The struct member offsets.
  • Constructor Details

    • VkAttachmentDescription

      public VkAttachmentDescription(ByteBuffer container)
      Creates a VkAttachmentDescription 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 Details

    • sizeof

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

      public int flags()
      a bitmask of VkAttachmentDescriptionFlagBits specifying additional properties of the attachment.
    • format

      public int format()
      a VkFormat value specifying the format of the image view that will be used for the attachment.
    • samples

      public int samples()
      a VkSampleCountFlagBits value specifying the number of samples of the image.
    • loadOp

      public int loadOp()
      a VkAttachmentLoadOp value specifying how the contents of color and depth components of the attachment are treated at the beginning of the subpass where it is first used.
    • storeOp

      public int storeOp()
      a VkAttachmentStoreOp value specifying how the contents of color and depth components of the attachment are treated at the end of the subpass where it is last used.
    • stencilLoadOp

      public int stencilLoadOp()
      a VkAttachmentLoadOp value specifying how the contents of stencil components of the attachment are treated at the beginning of the subpass where it is first used.
    • stencilStoreOp

      public int stencilStoreOp()
      a VkAttachmentStoreOp value specifying how the contents of stencil components of the attachment are treated at the end of the last subpass where it is used.
    • initialLayout

      public int initialLayout()
      the layout the attachment image subresource will be in when a render pass instance begins.
    • finalLayout

      public int finalLayout()
      the layout the attachment image subresource will be transitioned to when a render pass instance ends.
    • flags

      public VkAttachmentDescription flags(int value)
      Sets the specified value to the flags() field.
    • format

      public VkAttachmentDescription format(int value)
      Sets the specified value to the format() field.
    • samples

      public VkAttachmentDescription samples(int value)
      Sets the specified value to the samples() field.
    • loadOp

      public VkAttachmentDescription loadOp(int value)
      Sets the specified value to the loadOp() field.
    • storeOp

      public VkAttachmentDescription storeOp(int value)
      Sets the specified value to the storeOp() field.
    • stencilLoadOp

      public VkAttachmentDescription stencilLoadOp(int value)
      Sets the specified value to the stencilLoadOp() field.
    • stencilStoreOp

      public VkAttachmentDescription stencilStoreOp(int value)
      Sets the specified value to the stencilStoreOp() field.
    • initialLayout

      public VkAttachmentDescription initialLayout(int value)
      Sets the specified value to the initialLayout() field.
    • finalLayout

      public VkAttachmentDescription finalLayout(int value)
      Sets the specified value to the finalLayout() field.
    • set

      public VkAttachmentDescription set(int flags, int format, int samples, int loadOp, int storeOp, int stencilLoadOp, int stencilStoreOp, int initialLayout, int finalLayout)
      Initializes this struct with the specified values.
    • set

      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

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

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

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

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

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

      public static VkAttachmentDescription.Buffer malloc(int capacity)
      Returns a new VkAttachmentDescription.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static VkAttachmentDescription.Buffer calloc(int capacity)
      Returns a new VkAttachmentDescription.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static VkAttachmentDescription.Buffer create(int capacity)
      Returns a new VkAttachmentDescription.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static VkAttachmentDescription.Buffer create(long address, int capacity)
      Create a VkAttachmentDescription.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

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

      @Deprecated public static VkAttachmentDescription mallocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static VkAttachmentDescription callocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • mallocStack

      @Deprecated public static VkAttachmentDescription mallocStack(org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static VkAttachmentDescription callocStack(org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • mallocStack

      @Deprecated public static VkAttachmentDescription.Buffer mallocStack(int capacity)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(int, MemoryStack) instead.
    • callocStack

      @Deprecated public static VkAttachmentDescription.Buffer callocStack(int capacity)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(int, MemoryStack) instead.
    • mallocStack

      @Deprecated public static VkAttachmentDescription.Buffer mallocStack(int capacity, org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(int, MemoryStack) instead.
    • callocStack

      @Deprecated public static VkAttachmentDescription.Buffer callocStack(int capacity, org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(int, MemoryStack) instead.
    • malloc

      public static VkAttachmentDescription malloc(org.lwjgl.system.MemoryStack stack)
      Returns a new VkAttachmentDescription instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

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

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

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

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

      public static int nformat(long struct)
      Unsafe version of format().
    • nsamples

      public static int nsamples(long struct)
      Unsafe version of samples().
    • nloadOp

      public static int nloadOp(long struct)
      Unsafe version of loadOp().
    • nstoreOp

      public static int nstoreOp(long struct)
      Unsafe version of storeOp().
    • nstencilLoadOp

      public static int nstencilLoadOp(long struct)
      Unsafe version of stencilLoadOp().
    • nstencilStoreOp

      public static int nstencilStoreOp(long struct)
      Unsafe version of stencilStoreOp().
    • ninitialLayout

      public static int ninitialLayout(long struct)
      Unsafe version of initialLayout().
    • nfinalLayout

      public static int nfinalLayout(long struct)
      Unsafe version of finalLayout().
    • nflags

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

      public static void nformat(long struct, int value)
      Unsafe version of format.
    • nsamples

      public static void nsamples(long struct, int value)
      Unsafe version of samples.
    • nloadOp

      public static void nloadOp(long struct, int value)
      Unsafe version of loadOp.
    • nstoreOp

      public static void nstoreOp(long struct, int value)
      Unsafe version of storeOp.
    • nstencilLoadOp

      public static void nstencilLoadOp(long struct, int value)
      Unsafe version of stencilLoadOp.
    • nstencilStoreOp

      public static void nstencilStoreOp(long struct, int value)
      Unsafe version of stencilStoreOp.
    • ninitialLayout

      public static void ninitialLayout(long struct, int value)
      Unsafe version of initialLayout.
    • nfinalLayout

      public static void nfinalLayout(long struct, int value)
      Unsafe version of finalLayout.