All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lwjgl.vulkan.VkSparseImageMemoryBind Maven / Gradle / Ivy

Go to download

A new generation graphics and compute API that provides high-efficiency, cross-platform access to modern GPUs used in a wide variety of devices from PCs and consoles to mobile phones and embedded platforms.

There is a newer version: 3.3.4
Show newest version
/*
 * Copyright LWJGL. All rights reserved.
 * License terms: https://www.lwjgl.org/license
 * MACHINE GENERATED FILE, DO NOT EDIT
 */
package org.lwjgl.vulkan;

import javax.annotation.*;

import java.nio.*;

import org.lwjgl.*;
import org.lwjgl.system.*;

import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryStack.*;

/**
 * Structure specifying sparse image memory bind.
 * 
 * 
Valid Usage
* *
    *
  • If the sparse aliased residency feature is not enabled, and if any other resources are bound to ranges of {@code memory}, the range of {@code memory} being bound must not overlap with those bound ranges
  • *
  • {@code memory} and {@code memoryOffset} must match the memory requirements of the calling command’s {@code image}, as described in section the “Resource Memory Association” section
  • *
  • {@code subresource} must be a valid image subresource for {@code image} (see the “Image Views” section)
  • *
  • {@code offset.x} must be a multiple of the sparse image block width ({@link VkSparseImageFormatProperties}{@code ::imageGranularity}.width) of the image
  • *
  • {@code extent.width} must either be a multiple of the sparse image block width of the image, or else (extent.width offset.x) must equal the width of the image subresource
  • *
  • {@code offset.y} must be a multiple of the sparse image block height ({@link VkSparseImageFormatProperties}{@code ::imageGranularity}.height) of the image
  • *
  • {@code extent.height} must either be a multiple of the sparse image block height of the image, or else (extent.height offset.y) must equal the height of the image subresource
  • *
  • {@code offset.z} must be a multiple of the sparse image block depth ({@link VkSparseImageFormatProperties}{@code ::imageGranularity}.depth) of the image
  • *
  • {@code extent.depth} must either be a multiple of the sparse image block depth of the image, or else (extent.depth offset.z) must equal the depth of the image subresource
  • *
* *
Valid Usage (Implicit)
* *
    *
  • {@code subresource} must be a valid {@link VkImageSubresource} structure
  • *
  • If {@code memory} is not {@link VK10#VK_NULL_HANDLE NULL_HANDLE}, {@code memory} must be a valid {@code VkDeviceMemory} handle
  • *
  • {@code flags} must be a valid combination of {@code VkSparseMemoryBindFlagBits} values
  • *
* *
See Also
* *

{@link VkExtent3D}, {@link VkImageSubresource}, {@link VkOffset3D}, {@link VkSparseImageMemoryBindInfo}

* *

Member documentation

* *
    *
  • {@code subresource} – the aspectMask and region of interest in the image.
  • *
  • {@code offset} – are the coordinates of the first texel within the image subresource to bind.
  • *
  • {@code extent} – the size in texels of the region within the image subresource to bind. The extent must be a multiple of the sparse image block dimensions, except when binding sparse image blocks along the edge of an image subresource it can instead be such that any coordinate of offset + extent equals the corresponding dimensions of the image subresource.
  • *
  • {@code memory} – the {@code VkDeviceMemory} object that the sparse image blocks of the image are bound to. If {@code memory} is {@link VK10#VK_NULL_HANDLE NULL_HANDLE}, the sparse image blocks are unbound.
  • *
  • {@code memoryOffset} – an offset into {@code VkDeviceMemory} object. If {@code memory} is {@link VK10#VK_NULL_HANDLE NULL_HANDLE}, this value is ignored.
  • *
  • {@code flags} – are sparse memory binding flags.
  • *
* *

Layout

* *
 * struct VkSparseImageMemoryBind {
 *     {@link VkImageSubresource VkImageSubresource} subresource;
 *     {@link VkOffset3D VkOffset3D} offset;
 *     {@link VkExtent3D VkExtent3D} extent;
 *     VkDeviceMemory memory;
 *     VkDeviceSize memoryOffset;
 *     VkSparseMemoryBindFlags flags;
 * }
*/ public class VkSparseImageMemoryBind extends Struct implements NativeResource { /** The struct size in bytes. */ public static final int SIZEOF; public static final int ALIGNOF; /** The struct member offsets. */ public static final int SUBRESOURCE, OFFSET, EXTENT, MEMORY, MEMORYOFFSET, FLAGS; static { Layout layout = __struct( __member(VkImageSubresource.SIZEOF, VkImageSubresource.ALIGNOF), __member(VkOffset3D.SIZEOF, VkOffset3D.ALIGNOF), __member(VkExtent3D.SIZEOF, VkExtent3D.ALIGNOF), __member(8), __member(8), __member(4) ); SIZEOF = layout.getSize(); ALIGNOF = layout.getAlignment(); SUBRESOURCE = layout.offsetof(0); OFFSET = layout.offsetof(1); EXTENT = layout.offsetof(2); MEMORY = layout.offsetof(3); MEMORYOFFSET = layout.offsetof(4); FLAGS = layout.offsetof(5); } VkSparseImageMemoryBind(long address, @Nullable ByteBuffer container) { super(address, container); } /** * Creates a {@link VkSparseImageMemoryBind} instance at the current position of the specified {@link 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.

*/ public VkSparseImageMemoryBind(ByteBuffer container) { this(memAddress(container), __checkContainer(container, SIZEOF)); } @Override public int sizeof() { return SIZEOF; } /** Returns a {@link VkImageSubresource} view of the {@code subresource} field. */ public VkImageSubresource subresource() { return nsubresource(address()); } /** Returns a {@link VkOffset3D} view of the {@code offset} field. */ public VkOffset3D offset() { return noffset(address()); } /** Returns a {@link VkExtent3D} view of the {@code extent} field. */ public VkExtent3D extent() { return nextent(address()); } /** Returns the value of the {@code memory} field. */ @NativeType("VkDeviceMemory") public long memory() { return nmemory(address()); } /** Returns the value of the {@code memoryOffset} field. */ @NativeType("VkDeviceSize") public long memoryOffset() { return nmemoryOffset(address()); } /** Returns the value of the {@code flags} field. */ @NativeType("VkSparseMemoryBindFlags") public int flags() { return nflags(address()); } /** Copies the specified {@link VkImageSubresource} to the {@code subresource} field. */ public VkSparseImageMemoryBind subresource(VkImageSubresource value) { nsubresource(address(), value); return this; } /** Copies the specified {@link VkOffset3D} to the {@code offset} field. */ public VkSparseImageMemoryBind offset(VkOffset3D value) { noffset(address(), value); return this; } /** Copies the specified {@link VkExtent3D} to the {@code extent} field. */ public VkSparseImageMemoryBind extent(VkExtent3D value) { nextent(address(), value); return this; } /** Sets the specified value to the {@code memory} field. */ public VkSparseImageMemoryBind memory(@NativeType("VkDeviceMemory") long value) { nmemory(address(), value); return this; } /** Sets the specified value to the {@code memoryOffset} field. */ public VkSparseImageMemoryBind memoryOffset(@NativeType("VkDeviceSize") long value) { nmemoryOffset(address(), value); return this; } /** Sets the specified value to the {@code flags} field. */ public VkSparseImageMemoryBind flags(@NativeType("VkSparseMemoryBindFlags") int value) { nflags(address(), value); return this; } /** Initializes this struct with the specified values. */ public VkSparseImageMemoryBind set( VkImageSubresource subresource, VkOffset3D offset, VkExtent3D extent, long memory, long memoryOffset, int flags ) { subresource(subresource); offset(offset); extent(extent); memory(memory); memoryOffset(memoryOffset); flags(flags); return this; } /** * Copies the specified struct data to this struct. * * @param src the source struct * * @return this struct */ public VkSparseImageMemoryBind set(VkSparseImageMemoryBind src) { memCopy(src.address(), address(), SIZEOF); return this; } // ----------------------------------- /** Returns a new {@link VkSparseImageMemoryBind} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */ public static VkSparseImageMemoryBind malloc() { return create(nmemAllocChecked(SIZEOF)); } /** Returns a new {@link VkSparseImageMemoryBind} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */ public static VkSparseImageMemoryBind calloc() { return create(nmemCallocChecked(1, SIZEOF)); } /** Returns a new {@link VkSparseImageMemoryBind} instance allocated with {@link BufferUtils}. */ public static VkSparseImageMemoryBind create() { return new VkSparseImageMemoryBind(BufferUtils.createByteBuffer(SIZEOF)); } /** Returns a new {@link VkSparseImageMemoryBind} instance for the specified memory address. */ public static VkSparseImageMemoryBind create(long address) { return new VkSparseImageMemoryBind(address, null); } /** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */ @Nullable public static VkSparseImageMemoryBind createSafe(long address) { return address == NULL ? null : create(address); } /** * Returns a new {@link VkSparseImageMemoryBind.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. * * @param capacity the buffer capacity */ public static VkSparseImageMemoryBind.Buffer malloc(int capacity) { return create(__malloc(capacity, SIZEOF), capacity); } /** * Returns a new {@link VkSparseImageMemoryBind.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. * * @param capacity the buffer capacity */ public static VkSparseImageMemoryBind.Buffer calloc(int capacity) { return create(nmemCallocChecked(capacity, SIZEOF), capacity); } /** * Returns a new {@link VkSparseImageMemoryBind.Buffer} instance allocated with {@link BufferUtils}. * * @param capacity the buffer capacity */ public static VkSparseImageMemoryBind.Buffer create(int capacity) { return new Buffer(__create(capacity, SIZEOF)); } /** * Create a {@link VkSparseImageMemoryBind.Buffer} instance at the specified memory. * * @param address the memory address * @param capacity the buffer capacity */ public static VkSparseImageMemoryBind.Buffer create(long address, int capacity) { return new Buffer(address, capacity); } /** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */ @Nullable public static VkSparseImageMemoryBind.Buffer createSafe(long address, int capacity) { return address == NULL ? null : create(address, capacity); } // ----------------------------------- /** Returns a new {@link VkSparseImageMemoryBind} instance allocated on the thread-local {@link MemoryStack}. */ public static VkSparseImageMemoryBind mallocStack() { return mallocStack(stackGet()); } /** Returns a new {@link VkSparseImageMemoryBind} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. */ public static VkSparseImageMemoryBind callocStack() { return callocStack(stackGet()); } /** * Returns a new {@link VkSparseImageMemoryBind} instance allocated on the specified {@link MemoryStack}. * * @param stack the stack from which to allocate */ public static VkSparseImageMemoryBind mallocStack(MemoryStack stack) { return create(stack.nmalloc(ALIGNOF, SIZEOF)); } /** * Returns a new {@link VkSparseImageMemoryBind} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. * * @param stack the stack from which to allocate */ public static VkSparseImageMemoryBind callocStack(MemoryStack stack) { return create(stack.ncalloc(ALIGNOF, 1, SIZEOF)); } /** * Returns a new {@link VkSparseImageMemoryBind.Buffer} instance allocated on the thread-local {@link MemoryStack}. * * @param capacity the buffer capacity */ public static VkSparseImageMemoryBind.Buffer mallocStack(int capacity) { return mallocStack(capacity, stackGet()); } /** * Returns a new {@link VkSparseImageMemoryBind.Buffer} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. * * @param capacity the buffer capacity */ public static VkSparseImageMemoryBind.Buffer callocStack(int capacity) { return callocStack(capacity, stackGet()); } /** * Returns a new {@link VkSparseImageMemoryBind.Buffer} instance allocated on the specified {@link MemoryStack}. * * @param stack the stack from which to allocate * @param capacity the buffer capacity */ public static VkSparseImageMemoryBind.Buffer mallocStack(int capacity, MemoryStack stack) { return create(stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity); } /** * Returns a new {@link VkSparseImageMemoryBind.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. * * @param stack the stack from which to allocate * @param capacity the buffer capacity */ public static VkSparseImageMemoryBind.Buffer callocStack(int capacity, MemoryStack stack) { return create(stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity); } // ----------------------------------- /** Unsafe version of {@link #subresource}. */ public static VkImageSubresource nsubresource(long struct) { return VkImageSubresource.create(struct + VkSparseImageMemoryBind.SUBRESOURCE); } /** Unsafe version of {@link #offset}. */ public static VkOffset3D noffset(long struct) { return VkOffset3D.create(struct + VkSparseImageMemoryBind.OFFSET); } /** Unsafe version of {@link #extent}. */ public static VkExtent3D nextent(long struct) { return VkExtent3D.create(struct + VkSparseImageMemoryBind.EXTENT); } /** Unsafe version of {@link #memory}. */ public static long nmemory(long struct) { return memGetLong(struct + VkSparseImageMemoryBind.MEMORY); } /** Unsafe version of {@link #memoryOffset}. */ public static long nmemoryOffset(long struct) { return memGetLong(struct + VkSparseImageMemoryBind.MEMORYOFFSET); } /** Unsafe version of {@link #flags}. */ public static int nflags(long struct) { return memGetInt(struct + VkSparseImageMemoryBind.FLAGS); } /** Unsafe version of {@link #subresource(VkImageSubresource) subresource}. */ public static void nsubresource(long struct, VkImageSubresource value) { memCopy(value.address(), struct + VkSparseImageMemoryBind.SUBRESOURCE, VkImageSubresource.SIZEOF); } /** Unsafe version of {@link #offset(VkOffset3D) offset}. */ public static void noffset(long struct, VkOffset3D value) { memCopy(value.address(), struct + VkSparseImageMemoryBind.OFFSET, VkOffset3D.SIZEOF); } /** Unsafe version of {@link #extent(VkExtent3D) extent}. */ public static void nextent(long struct, VkExtent3D value) { memCopy(value.address(), struct + VkSparseImageMemoryBind.EXTENT, VkExtent3D.SIZEOF); } /** Unsafe version of {@link #memory(long) memory}. */ public static void nmemory(long struct, long value) { memPutLong(struct + VkSparseImageMemoryBind.MEMORY, value); } /** Unsafe version of {@link #memoryOffset(long) memoryOffset}. */ public static void nmemoryOffset(long struct, long value) { memPutLong(struct + VkSparseImageMemoryBind.MEMORYOFFSET, value); } /** Unsafe version of {@link #flags(int) flags}. */ public static void nflags(long struct, int value) { memPutInt(struct + VkSparseImageMemoryBind.FLAGS, value); } // ----------------------------------- /** An array of {@link VkSparseImageMemoryBind} structs. */ public static class Buffer extends StructBuffer implements NativeResource { /** * Creates a new {@link VkSparseImageMemoryBind.Buffer} instance backed by the specified container. * * Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values * will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided * by {@link VkSparseImageMemoryBind#SIZEOF}, and its mark will be undefined. * *

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

*/ public Buffer(ByteBuffer container) { super(container, container.remaining() / SIZEOF); } public Buffer(long address, int cap) { super(address, null, -1, 0, cap, cap); } Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) { super(address, container, mark, pos, lim, cap); } @Override protected Buffer self() { return this; } @Override protected Buffer newBufferInstance(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) { return new Buffer(address, container, mark, pos, lim, cap); } @Override protected VkSparseImageMemoryBind newInstance(long address) { return new VkSparseImageMemoryBind(address, container); } @Override public int sizeof() { return SIZEOF; } /** Returns a {@link VkImageSubresource} view of the {@code subresource} field. */ public VkImageSubresource subresource() { return VkSparseImageMemoryBind.nsubresource(address()); } /** Returns a {@link VkOffset3D} view of the {@code offset} field. */ public VkOffset3D offset() { return VkSparseImageMemoryBind.noffset(address()); } /** Returns a {@link VkExtent3D} view of the {@code extent} field. */ public VkExtent3D extent() { return VkSparseImageMemoryBind.nextent(address()); } /** Returns the value of the {@code memory} field. */ @NativeType("VkDeviceMemory") public long memory() { return VkSparseImageMemoryBind.nmemory(address()); } /** Returns the value of the {@code memoryOffset} field. */ @NativeType("VkDeviceSize") public long memoryOffset() { return VkSparseImageMemoryBind.nmemoryOffset(address()); } /** Returns the value of the {@code flags} field. */ @NativeType("VkSparseMemoryBindFlags") public int flags() { return VkSparseImageMemoryBind.nflags(address()); } /** Copies the specified {@link VkImageSubresource} to the {@code subresource} field. */ public VkSparseImageMemoryBind.Buffer subresource(VkImageSubresource value) { VkSparseImageMemoryBind.nsubresource(address(), value); return this; } /** Copies the specified {@link VkOffset3D} to the {@code offset} field. */ public VkSparseImageMemoryBind.Buffer offset(VkOffset3D value) { VkSparseImageMemoryBind.noffset(address(), value); return this; } /** Copies the specified {@link VkExtent3D} to the {@code extent} field. */ public VkSparseImageMemoryBind.Buffer extent(VkExtent3D value) { VkSparseImageMemoryBind.nextent(address(), value); return this; } /** Sets the specified value to the {@code memory} field. */ public VkSparseImageMemoryBind.Buffer memory(@NativeType("VkDeviceMemory") long value) { VkSparseImageMemoryBind.nmemory(address(), value); return this; } /** Sets the specified value to the {@code memoryOffset} field. */ public VkSparseImageMemoryBind.Buffer memoryOffset(@NativeType("VkDeviceSize") long value) { VkSparseImageMemoryBind.nmemoryOffset(address(), value); return this; } /** Sets the specified value to the {@code flags} field. */ public VkSparseImageMemoryBind.Buffer flags(@NativeType("VkSparseMemoryBindFlags") int value) { VkSparseImageMemoryBind.nflags(address(), value); return this; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy