org.lwjgl.vulkan.KHRDedicatedAllocation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lwjgl-vulkan Show documentation
Show all versions of lwjgl-vulkan Show documentation
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.
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.vulkan;
/**
* This extension enables resources to be bound to a dedicated allocation, rather than suballocated. For any particular resource, applications can query whether a dedicated allocation is recommended, in which case using a dedicated allocation may improve the performance of access to that resource. Normal device memory allocations must support multiple resources per allocation, memory aliasing and sparse binding, which could interfere with some optimizations. Applications should query the implementation for when a dedicated allocation may be beneficial by adding {@link VkMemoryDedicatedRequirementsKHR} to the {@code pNext} chain of the {@link VkMemoryRequirements2KHR} structure passed as the {@code pMemoryRequirements} parameter to a call to {@link KHRGetMemoryRequirements2#vkGetBufferMemoryRequirements2KHR GetBufferMemoryRequirements2KHR} or {@link KHRGetMemoryRequirements2#vkGetImageMemoryRequirements2KHR GetImageMemoryRequirements2KHR}. Certain external handle types and external images or buffers may also depend on dedicated allocations on implementations that associate image or buffer metadata with OS-level memory objects.
*
* This extension adds a two small structures to memory requirements querying and memory allocation: a new structure that flags whether an image/buffer should have a dedicated allocation, and a structure indicating the image or buffer that an allocation will be bound to.
*
* Examples
*
*
* // Create an image with a dedicated allocation based on the
* // implementation's preference
*
* VkImageCreateInfo imageCreateInfo =
* {
* // Image creation parameters
* };
*
* VkImage image;
* VkResult result = vkCreateImage(
* device,
* &imageCreateInfo,
* NULL, // pAllocator
* &image);
*
* VkMemoryDedicatedRequirementsKHR dedicatedRequirements =
* {
* VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR,
* NULL, // pNext
* };
*
* VkMemoryRequirements2KHR memoryRequirements =
* {
* VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR,
* &dedicatedRequirements, // pNext
* };
*
* const VkImageMemoryRequirementsInfo2KHR imageRequirementsInfo =
* {
* VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR,
* NULL, // pNext
* image
* };
*
* vkGetImageMemoryRequirements2KHR(
* device,
* &imageRequirementsInfo,
* &memoryRequirements);
*
* if (dedicatedRequirements.prefersDedicatedAllocation) {
* // Allocate memory with VkMemoryDedicatedAllocateInfoKHR::image
* // pointing to the image we are allocating the memory for
*
* VkMemoryDedicatedAllocateInfoKHR dedicatedInfo =
* {
* VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR, // sType
* NULL, // pNext
* image, // image
* VK_NULL_HANDLE, // buffer
* };
*
* VkMemoryAllocateInfo memoryAllocateInfo =
* {
* VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, // sType
* &dedicatedInfo, // pNext
* memoryRequirements.size, // allocationSize
* FindMemoryTypeIndex(memoryRequirements.memoryTypeBits), // memoryTypeIndex
* };
*
* VkDeviceMemory memory;
* vkAllocateMemory(
* device,
* &memoryAllocateInfo,
* NULL, // pAllocator
* &memory);
*
* // Bind the image to the memory
*
* vkBindImageMemory(
* device,
* image,
* memory,
* 0);
* } else {
* // Take the normal memory sub-allocation path
* }
*
*
* - Name String
* - {@code VK_KHR_dedicated_allocation}
* - Extension Type
* - Device extension
* - Registered Extension Number
* - 128
* - Revision
* - 3
* - Extension and Version Dependencies
*
* - Requires Vulkan 1.0
* - Requires {@link KHRGetMemoryRequirements2 VK_KHR_get_memory_requirements2}
*
* - Contact
*
* - James Jones @cubanismo
*
* - Last Modified Date
* - 2017-08-07
* - IP Status
* - No known IP claims.
* - Contributors
*
* - Jeff Bolz, NVIDIA
* - Jason Ekstrand, Intel
*
*
*/
public final class KHRDedicatedAllocation {
/** The extension specification version. */
public static final int VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION = 3;
/** The extension name. */
public static final String VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME = "VK_KHR_dedicated_allocation";
/**
* Extends {@code VkStructureType}.
*
* Enum values:
*
*
* - {@link #VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR}
* - {@link #VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR}
*
*/
public static final int
VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR = 1000127000,
VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR = 1000127001;
private KHRDedicatedAllocation() {}
}