diff --git a/doc/specs/vulkan/appendices/VK_NV_dedicated_allocation.txt b/doc/specs/vulkan/appendices/VK_NV_dedicated_allocation.txt new file mode 100644 index 00000000..9de496bd --- /dev/null +++ b/doc/specs/vulkan/appendices/VK_NV_dedicated_allocation.txt @@ -0,0 +1,134 @@ +== VK_NV_dedicated_allocation + +*Name String*:: VK_NV_dedicated_allocation +*Extension Type*:: Device extension +*Registered Extension Number*:: 27 +*Status*:: Draft. +*Last Modified Date*:: 31/05/2016 +*Revision*:: 1 +*IP Status*:: No known IP claims. +*Dependencies*:: + - This extension is written against version 1.0. of the Vulkan API. +*Contributors*:: + - Jeff Bolz, NVIDIA +*Contacts*:: + - Jeff Bolz (jbolz 'at' nvidia.com) + +This extension allows device memory to be allocated for a particular buffer or +image resource, which on some devices can significantly improve the +performance of that resource. Normal device memory allocations must support +memory aliasing and sparse binding, which could interfere with optimizations +like framebuffer compression or efficient page table usage. This is important +for render targets and very large resources, but need not (and probably should +not) be used for smaller resources that can benefit from suballocation. + +This extension adds a few small structures to resource creation and memory +allocation: a new structure that flags whether am image/buffer will have a +dedicated allocation, and a structure indicating the image or buffer that an +allocation will be bound to. + +=== New Object Types + +None. + +=== New Enum Constants + + * Extending ename:VkStructureType: + ** ename:VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV + ** ename:VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV + ** ename:VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV + +=== New Enums + +None. + +=== New Structures + + * slink:VkDedicatedAllocationImageCreateInfoNV + * slink:VkDedicatedAllocationBufferCreateInfoNV + * slink:VkDedicatedAllocationMemoryAllocateInfoNV + +=== New Functions + +None. + +=== Issues + +None. + +=== Examples + +[source,{basebackend@docbook:c++:cpp}] +---------------------------------------- + + // Create an image with + // VkDedicatedAllocationImageCreateInfoNV::dedicatedAllocation + // set to VK_TRUE + + VkDedicatedAllocationImageCreateInfoNV dedicatedImageInfo = + { + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV, // sType + NULL, // pNext + VK_TRUE, // dedicatedAllocation + }; + + VkImageCreateInfo imageCreateInfo = + { + VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // sType + &dedicatedImageInfo // pNext + // Other members set as usual + }; + + VkImage image; + VkResult result = vkCreateImage( + device, + &imageCreateInfo, + NULL, // pAllocator + &image); + + VkMemoryRequirements memoryRequirements; + vkGetImageMemoryRequirements( + device, + image, + &memoryRequirements); + + // Allocate memory with VkDedicatedAllocationMemoryAllocateInfoNV::image + // pointing to the image we're allocating the memory for + + VkDedicatedAllocationMemoryAllocateInfoNV dedicatedInfo = + { + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV, // 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); + +---------------------------------------- + +=== Version History + + * Revision 1, 2016-05-31 (Jeff Bolz) + - Internal revisions diff --git a/doc/specs/vulkan/chapters/memory.txt b/doc/specs/vulkan/chapters/memory.txt index af3f0072..3a9d35e8 100644 --- a/doc/specs/vulkan/chapters/memory.txt +++ b/doc/specs/vulkan/chapters/memory.txt @@ -571,6 +571,25 @@ include::../structs/VkMemoryAllocateInfo.txt[] include::../validity/structs/VkMemoryAllocateInfo.txt[] +If the pname:pNext list includes a +sname:VkDedicatedAllocationMemoryAllocateInfoNV structure, then that +structure includes a handle of the sole buffer or image resource that the +memory can: be bound to. + +The sname:VkDedicatedAllocationMemoryAllocateInfoNV structure is +defined as: + +include::../structs/VkDedicatedAllocationMemoryAllocateInfoNV.txt[] + + * pname:sType is the type of this structure. + * pname:pNext is `NULL` or a pointer to an extension-specific structure. + * pname:image is sname:VK_NULL_HANDLE or a handle of an image which this + memory will be bound to. + * pname:buffer is sname:VK_NULL_HANDLE or a handle of a buffer which this + memory will be bound to. + +include::../validity/structs/VkDedicatedAllocationMemoryAllocateInfoNV.txt[] + Allocations returned by fname:vkAllocateMemory are guaranteed to meet any alignment requirement by the implementation. For example, if an implementation requires 128 byte alignment for images and 64 byte alignment diff --git a/doc/specs/vulkan/chapters/resources.txt b/doc/specs/vulkan/chapters/resources.txt index 9e514ab7..4d2dea01 100644 --- a/doc/specs/vulkan/chapters/resources.txt +++ b/doc/specs/vulkan/chapters/resources.txt @@ -59,6 +59,23 @@ include::../structs/VkBufferCreateInfo.txt[] include::../validity/structs/VkBufferCreateInfo.txt[] +If the pname:pNext list includes a +sname:VkDedicatedAllocationBufferCreateInfoNV structure, then that +structure includes an enable controlling whether the buffer will have a +dedicated memory allocation bound to it. + +The sname:VkDedicatedAllocationBufferCreateInfoNV structure is defined +as: + +include::../structs/VkDedicatedAllocationBufferCreateInfoNV.txt[] + + * pname:sType is the type of this structure. + * pname:pNext is `NULL` or a pointer to an extension-specific structure. + * pname:dedicatedAllocation indicates whether the buffer will have a + dedicated allocation bound to it. + +include::../validity/structs/VkDedicatedAllocationBufferCreateInfoNV.txt[] + Bits which may: be set in pname:usage are: include::../enums/VkBufferUsageFlagBits.txt[] @@ -276,6 +293,30 @@ out in memory in row-major order, possibly with some padding on each row). include::../validity/structs/VkImageCreateInfo.txt[] +If the pname:pNext list includes a +sname:VkDedicatedAllocationImageCreateInfoNV structure, then that +structure includes an enable controlling whether the image will have a +dedicated memory allocation bound to it. + +The sname:VkDedicatedAllocationImageCreateInfoNV structure is defined +as: + +include::../structs/VkDedicatedAllocationImageCreateInfoNV.txt[] + + * pname:sType is the type of this structure. + * pname:pNext is `NULL` or a pointer to an extension-specific structure. + * pname:dedicatedAllocation indicates whether the image will have a + dedicated allocation bound to it. + +include::../validity/structs/VkDedicatedAllocationImageCreateInfoNV.txt[] + +[NOTE] +.Note +==== +Using a dedicated allocation for color and depth/stencil attachments or other +large images may: improve performance on some devices. +==== + Valid limits for the image pname:extent, pname:mipLevels, pname:arrayLayers and pname:samples members are queried with the flink:vkGetPhysicalDeviceImageFormatProperties command. diff --git a/doc/specs/vulkan/enums/VkStructureType.txt b/doc/specs/vulkan/enums/VkStructureType.txt index 3260a7cc..a5e9b615 100644 --- a/doc/specs/vulkan/enums/VkStructureType.txt +++ b/doc/specs/vulkan/enums/VkStructureType.txt @@ -57,5 +57,8 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46, VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 47, VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 48, + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000, + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001, + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002, } VkStructureType; ------------------------------------------------------------------------------ diff --git a/doc/specs/vulkan/structs/VkDedicatedAllocationBufferCreateInfoNV.txt b/doc/specs/vulkan/structs/VkDedicatedAllocationBufferCreateInfoNV.txt new file mode 100644 index 00000000..fcffa9b6 --- /dev/null +++ b/doc/specs/vulkan/structs/VkDedicatedAllocationBufferCreateInfoNV.txt @@ -0,0 +1,15 @@ +// WARNING: DO NOT MODIFY! This file is automatically generated from the vk.xml registry +ifndef::doctype-manpage[] +[[VkDedicatedAllocationBufferCreateInfoNV,VkDedicatedAllocationBufferCreateInfoNV]] +["source","{basebackend@docbook:c++:cpp}",title=""] +endif::doctype-manpage[] +ifdef::doctype-manpage[] +["source","{basebackend@docbook:c++:cpp}"] +endif::doctype-manpage[] +------------------------------------------------------------------------------ +typedef struct VkDedicatedAllocationBufferCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkBool32 dedicatedAllocation; +} VkDedicatedAllocationBufferCreateInfoNV; +------------------------------------------------------------------------------ diff --git a/doc/specs/vulkan/structs/VkDedicatedAllocationImageCreateInfoNV.txt b/doc/specs/vulkan/structs/VkDedicatedAllocationImageCreateInfoNV.txt new file mode 100644 index 00000000..1e5fef91 --- /dev/null +++ b/doc/specs/vulkan/structs/VkDedicatedAllocationImageCreateInfoNV.txt @@ -0,0 +1,15 @@ +// WARNING: DO NOT MODIFY! This file is automatically generated from the vk.xml registry +ifndef::doctype-manpage[] +[[VkDedicatedAllocationImageCreateInfoNV,VkDedicatedAllocationImageCreateInfoNV]] +["source","{basebackend@docbook:c++:cpp}",title=""] +endif::doctype-manpage[] +ifdef::doctype-manpage[] +["source","{basebackend@docbook:c++:cpp}"] +endif::doctype-manpage[] +------------------------------------------------------------------------------ +typedef struct VkDedicatedAllocationImageCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkBool32 dedicatedAllocation; +} VkDedicatedAllocationImageCreateInfoNV; +------------------------------------------------------------------------------ diff --git a/doc/specs/vulkan/structs/VkDedicatedAllocationMemoryAllocateInfoNV.txt b/doc/specs/vulkan/structs/VkDedicatedAllocationMemoryAllocateInfoNV.txt new file mode 100644 index 00000000..c39de077 --- /dev/null +++ b/doc/specs/vulkan/structs/VkDedicatedAllocationMemoryAllocateInfoNV.txt @@ -0,0 +1,16 @@ +// WARNING: DO NOT MODIFY! This file is automatically generated from the vk.xml registry +ifndef::doctype-manpage[] +[[VkDedicatedAllocationMemoryAllocateInfoNV,VkDedicatedAllocationMemoryAllocateInfoNV]] +["source","{basebackend@docbook:c++:cpp}",title=""] +endif::doctype-manpage[] +ifdef::doctype-manpage[] +["source","{basebackend@docbook:c++:cpp}"] +endif::doctype-manpage[] +------------------------------------------------------------------------------ +typedef struct VkDedicatedAllocationMemoryAllocateInfoNV { + VkStructureType sType; + const void* pNext; + VkImage image; + VkBuffer buffer; +} VkDedicatedAllocationMemoryAllocateInfoNV; +------------------------------------------------------------------------------ diff --git a/doc/specs/vulkan/validity/protos/vkBindBufferMemory.txt b/doc/specs/vulkan/validity/protos/vkBindBufferMemory.txt index 77fa01eb..bb2da215 100644 --- a/doc/specs/vulkan/validity/protos/vkBindBufferMemory.txt +++ b/doc/specs/vulkan/validity/protos/vkBindBufferMemory.txt @@ -22,6 +22,8 @@ endif::doctype-manpage[] * pname:memory must: have been allocated using one of the memory types allowed in the pname:memoryTypeBits member of the sname:VkMemoryRequirements structure returned from a call to fname:vkGetBufferMemoryRequirements with pname:buffer * pname:memoryOffset must: be an integer multiple of the pname:alignment member of the sname:VkMemoryRequirements structure returned from a call to fname:vkGetBufferMemoryRequirements with pname:buffer * The pname:size member of the sname:VkMemoryRequirements structure returned from a call to fname:vkGetBufferMemoryRequirements with pname:buffer must: be less than or equal to the size of pname:memory minus pname:memoryOffset +* If pname:buffer was created with sname:VkDedicatedAllocationBufferCreateInfoNV::pname:dedicatedAllocation equal to ename:VK_TRUE, pname:memory must: have been created with sname:VkDedicatedAllocationMemoryAllocateInfoNV::pname:buffer equal to pname:buffer and pname:memoryOffset must: be zero. +* If pname:buffer was not created with sname:VkDedicatedAllocationBufferCreateInfoNV::pname:dedicatedAllocation equal to ename:VK_TRUE, pname:memory must: not have been allocated dedicated for a specific buffer or image ifndef::doctype-manpage[] ******************************************************************************** endif::doctype-manpage[] diff --git a/doc/specs/vulkan/validity/protos/vkBindImageMemory.txt b/doc/specs/vulkan/validity/protos/vkBindImageMemory.txt index 090a43f6..dccd69dc 100644 --- a/doc/specs/vulkan/validity/protos/vkBindImageMemory.txt +++ b/doc/specs/vulkan/validity/protos/vkBindImageMemory.txt @@ -19,6 +19,8 @@ endif::doctype-manpage[] * pname:memory must: have been allocated using one of the memory types allowed in the pname:memoryTypeBits member of the sname:VkMemoryRequirements structure returned from a call to fname:vkGetImageMemoryRequirements with pname:image * pname:memoryOffset must: be an integer multiple of the pname:alignment member of the sname:VkMemoryRequirements structure returned from a call to fname:vkGetImageMemoryRequirements with pname:image * The pname:size member of the sname:VkMemoryRequirements structure returned from a call to fname:vkGetImageMemoryRequirements with pname:image must: be less than or equal to the size of pname:memory minus pname:memoryOffset +* If pname:image was created with sname:VkDedicatedAllocationImageCreateInfoNV::pname:dedicatedAllocation equal to ename:VK_TRUE, pname:memory must: have been created with sname:VkDedicatedAllocationMemoryAllocateInfoNV::pname:image equal to pname:image and pname:memoryOffset must: be zero. +* If pname:image was not created with sname:VkDedicatedAllocationImageCreateInfoNV::pname:dedicatedAllocation equal to ename:VK_TRUE, pname:memory must: not have been allocated dedicated for a specific buffer or image ifndef::doctype-manpage[] ******************************************************************************** endif::doctype-manpage[] diff --git a/doc/specs/vulkan/validity/structs/VkBufferCreateInfo.txt b/doc/specs/vulkan/validity/structs/VkBufferCreateInfo.txt index d9ddd557..953f52bc 100644 --- a/doc/specs/vulkan/validity/structs/VkBufferCreateInfo.txt +++ b/doc/specs/vulkan/validity/structs/VkBufferCreateInfo.txt @@ -8,7 +8,7 @@ Valid Usage ----------- endif::doctype-manpage[] * pname:sType must: be ename:VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO -* pname:pNext must: be `NULL` +* pname:pNext must: be `NULL`, or a pointer to a valid instance of slink:VkDedicatedAllocationBufferCreateInfoNV * pname:flags must: be a valid combination of elink:VkBufferCreateFlagBits values * pname:usage must: be a valid combination of elink:VkBufferUsageFlagBits values * pname:usage mustnot: be `0` diff --git a/doc/specs/vulkan/validity/structs/VkDedicatedAllocationBufferCreateInfoNV.txt b/doc/specs/vulkan/validity/structs/VkDedicatedAllocationBufferCreateInfoNV.txt new file mode 100644 index 00000000..f8fd65c4 --- /dev/null +++ b/doc/specs/vulkan/validity/structs/VkDedicatedAllocationBufferCreateInfoNV.txt @@ -0,0 +1,16 @@ +// WARNING: DO NOT MODIFY! This file is automatically generated from the vk.xml registry +ifndef::doctype-manpage[] +.Valid Usage +******************************************************************************** +endif::doctype-manpage[] +ifdef::doctype-manpage[] +Valid Usage +----------- +endif::doctype-manpage[] +* pname:sType must: be ename:VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV +* pname:pNext must: be `NULL` +* If pname:dedicatedAllocation is ename:VK_TRUE, sname:VkBufferCreateInfo::pname:flags mustnot: include ename:VK_BUFFER_CREATE_SPARSE_BINDING_BIT, ename:VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT, or ename:VK_BUFFER_CREATE_SPARSE_ALIASED_BIT +ifndef::doctype-manpage[] +******************************************************************************** +endif::doctype-manpage[] + diff --git a/doc/specs/vulkan/validity/structs/VkDedicatedAllocationImageCreateInfoNV.txt b/doc/specs/vulkan/validity/structs/VkDedicatedAllocationImageCreateInfoNV.txt new file mode 100644 index 00000000..04723c53 --- /dev/null +++ b/doc/specs/vulkan/validity/structs/VkDedicatedAllocationImageCreateInfoNV.txt @@ -0,0 +1,16 @@ +// WARNING: DO NOT MODIFY! This file is automatically generated from the vk.xml registry +ifndef::doctype-manpage[] +.Valid Usage +******************************************************************************** +endif::doctype-manpage[] +ifdef::doctype-manpage[] +Valid Usage +----------- +endif::doctype-manpage[] +* pname:sType must: be ename:VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV +* pname:pNext must: be `NULL` +* If pname:dedicatedAllocation is ename:VK_TRUE, sname:VkImageCreateInfo::pname:flags mustnot: include ename:VK_IMAGE_CREATE_SPARSE_BINDING_BIT, ename:VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT, or ename:VK_IMAGE_CREATE_SPARSE_ALIASED_BIT +ifndef::doctype-manpage[] +******************************************************************************** +endif::doctype-manpage[] + diff --git a/doc/specs/vulkan/validity/structs/VkDedicatedAllocationMemoryAllocateInfoNV.txt b/doc/specs/vulkan/validity/structs/VkDedicatedAllocationMemoryAllocateInfoNV.txt new file mode 100644 index 00000000..ee8d2e9e --- /dev/null +++ b/doc/specs/vulkan/validity/structs/VkDedicatedAllocationMemoryAllocateInfoNV.txt @@ -0,0 +1,23 @@ +// WARNING: DO NOT MODIFY! This file is automatically generated from the vk.xml registry +ifndef::doctype-manpage[] +.Valid Usage +******************************************************************************** +endif::doctype-manpage[] +ifdef::doctype-manpage[] +Valid Usage +----------- +endif::doctype-manpage[] +* pname:sType must: be ename:VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV +* pname:pNext must: be `NULL` +* If pname:image is not sname:VK_NULL_HANDLE, pname:image must: be a valid sname:VkImage handle +* If pname:buffer is not sname:VK_NULL_HANDLE, pname:buffer must: be a valid sname:VkBuffer handle +* Each of pname:image and pname:buffer that are valid handles must: have been created, allocated or retrieved from the same sname:VkDevice +* At least one of pname:image and pname:buffer must: be sname:VK_NULL_HANDLE +* If pname:image is not sname:VK_NULL_HANDLE, the image must: have been created with sname:VkDedicatedAllocationImageCreateInfoNV::pname:dedicatedAllocation equal to ename:VK_TRUE +* If pname:buffer is not sname:VK_NULL_HANDLE, the buffer must: have been created with sname:VkDedicatedAllocationBufferCreateInfoNV::pname:dedicatedAllocation equal to ename:VK_TRUE +* If pname:image is not sname:VK_NULL_HANDLE, sname:VkMemoryAllocateInfo::pname:allocationSize must: equal the sname:VkMemoryRequirements::pname:size of the image +* If pname:buffer is not sname:VK_NULL_HANDLE, sname:VkMemoryAllocateInfo::pname:allocationSize must: equal the sname:VkMemoryRequirements::pname:size of the buffer +ifndef::doctype-manpage[] +******************************************************************************** +endif::doctype-manpage[] + diff --git a/doc/specs/vulkan/validity/structs/VkImageCreateInfo.txt b/doc/specs/vulkan/validity/structs/VkImageCreateInfo.txt index dcb7856c..d6ec1511 100644 --- a/doc/specs/vulkan/validity/structs/VkImageCreateInfo.txt +++ b/doc/specs/vulkan/validity/structs/VkImageCreateInfo.txt @@ -8,7 +8,7 @@ Valid Usage ----------- endif::doctype-manpage[] * pname:sType must: be ename:VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO -* pname:pNext must: be `NULL` +* pname:pNext must: be `NULL`, or a pointer to a valid instance of slink:VkDedicatedAllocationImageCreateInfoNV * pname:flags must: be a valid combination of elink:VkImageCreateFlagBits values * pname:imageType must: be a valid elink:VkImageType value * pname:format must: be a valid elink:VkFormat value diff --git a/doc/specs/vulkan/validity/structs/VkMemoryAllocateInfo.txt b/doc/specs/vulkan/validity/structs/VkMemoryAllocateInfo.txt index 865f77fc..a0490789 100644 --- a/doc/specs/vulkan/validity/structs/VkMemoryAllocateInfo.txt +++ b/doc/specs/vulkan/validity/structs/VkMemoryAllocateInfo.txt @@ -8,7 +8,7 @@ Valid Usage ----------- endif::doctype-manpage[] * pname:sType must: be ename:VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO -* pname:pNext must: be `NULL` +* pname:pNext must: be `NULL`, or a pointer to a valid instance of slink:VkDedicatedAllocationMemoryAllocateInfoNV * pname:allocationSize must: be less than or equal to the amount of memory available to the sname:VkMemoryHeap specified by pname:memoryTypeIndex and the calling command's sname:VkDevice * pname:allocationSize must: be greater than `0` ifndef::doctype-manpage[] diff --git a/doc/specs/vulkan/vkapi.py b/doc/specs/vulkan/vkapi.py index ba9bf0a8..730ddf45 100644 --- a/doc/specs/vulkan/vkapi.py +++ b/doc/specs/vulkan/vkapi.py @@ -117,7 +117,10 @@ consts['VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD'] consts['VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT'] = 'VkStructureType' consts['VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT'] = 'VkStructureType' consts['VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT'] = 'VkStructureType' -enums['VkStructureType'] = ['VK_STRUCTURE_TYPE_APPLICATION_INFO', 'VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO', 'VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO', 'VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO', 'VK_STRUCTURE_TYPE_SUBMIT_INFO', 'VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO', 'VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE', 'VK_STRUCTURE_TYPE_BIND_SPARSE_INFO', 'VK_STRUCTURE_TYPE_FENCE_CREATE_INFO', 'VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO', 'VK_STRUCTURE_TYPE_EVENT_CREATE_INFO', 'VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO', 'VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO', 'VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO', 'VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO', 'VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO', 'VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO', 'VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO', 'VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO', 'VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO', 'VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO', 'VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO', 'VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET', 'VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET', 'VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO', 'VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO', 'VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO', 'VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO', 'VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO', 'VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO', 'VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO', 'VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER', 'VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER', 'VK_STRUCTURE_TYPE_MEMORY_BARRIER', 'VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO', 'VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO', 'VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_PRESENT_INFO_KHR', 'VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR', 'VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT', 'VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD', 'VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT', 'VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT', 'VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT'] +consts['VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV'] = 'VkStructureType' +consts['VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV'] = 'VkStructureType' +consts['VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV'] = 'VkStructureType' +enums['VkStructureType'] = ['VK_STRUCTURE_TYPE_APPLICATION_INFO', 'VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO', 'VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO', 'VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO', 'VK_STRUCTURE_TYPE_SUBMIT_INFO', 'VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO', 'VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE', 'VK_STRUCTURE_TYPE_BIND_SPARSE_INFO', 'VK_STRUCTURE_TYPE_FENCE_CREATE_INFO', 'VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO', 'VK_STRUCTURE_TYPE_EVENT_CREATE_INFO', 'VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO', 'VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO', 'VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO', 'VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO', 'VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO', 'VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO', 'VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO', 'VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO', 'VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO', 'VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO', 'VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO', 'VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO', 'VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO', 'VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET', 'VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET', 'VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO', 'VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO', 'VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO', 'VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO', 'VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO', 'VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO', 'VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO', 'VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER', 'VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER', 'VK_STRUCTURE_TYPE_MEMORY_BARRIER', 'VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO', 'VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO', 'VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_PRESENT_INFO_KHR', 'VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR', 'VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR', 'VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT', 'VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD', 'VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT', 'VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT', 'VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT', 'VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV', 'VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV', 'VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV'] # Unprocessed type: void # Unprocessed type: uint32_t # Unprocessed type: VkFlags category: basetype @@ -1035,3 +1038,8 @@ structs['VkDrawIndexedIndirectCommand'] = ['indexCount', 'instanceCount', 'firs structs['VkDrawIndirectCommand'] = ['vertexCount', 'instanceCount', 'firstVertex', 'firstInstance'] consts['VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION'] = None consts['VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME'] = None +structs['VkDedicatedAllocationImageCreateInfoNV'] = ['sType', 'pNext', 'dedicatedAllocation'] +structs['VkDedicatedAllocationBufferCreateInfoNV'] = ['sType', 'pNext', 'dedicatedAllocation'] +structs['VkDedicatedAllocationMemoryAllocateInfoNV'] = ['sType', 'pNext', 'image', 'buffer'] +consts['VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION'] = None +consts['VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME'] = None diff --git a/doc/specs/vulkan/vkspec.txt b/doc/specs/vulkan/vkspec.txt index f4de8be6..618e7903 100644 --- a/doc/specs/vulkan/vkspec.txt +++ b/doc/specs/vulkan/vkspec.txt @@ -107,6 +107,8 @@ include::appendices/extensions.txt[] include::appendices/VK_KHR_sampler_mirror_clamp_to_edge.txt[] +include::appendices/VK_NV_dedicated_allocation.txt[] + include::appendices/invariance.txt[] include::appendices/glossary.txt[] diff --git a/src/spec/genvk.py b/src/spec/genvk.py index 334090c3..6ccb64bb 100755 --- a/src/spec/genvk.py +++ b/src/spec/genvk.py @@ -190,6 +190,7 @@ buildList = [ addExtensions = makeREstring([ 'VK_KHR_sampler_mirror_clamp_to_edge', + 'VK_NV_dedicated_allocation', ]), removeExtensions = makeREstring([ @@ -214,6 +215,7 @@ buildList = [ addExtensions = makeREstring([ 'VK_KHR_sampler_mirror_clamp_to_edge', + 'VK_NV_dedicated_allocation', ]), removeExtensions = makeREstring([ @@ -232,6 +234,7 @@ buildList = [ addExtensions = makeREstring([ 'VK_KHR_sampler_mirror_clamp_to_edge', + 'VK_NV_dedicated_allocation', ]), removeExtensions = makeREstring([ @@ -251,6 +254,7 @@ buildList = [ addExtensions = makeREstring([ 'VK_KHR_sampler_mirror_clamp_to_edge', + 'VK_NV_dedicated_allocation', ]), removeExtensions = makeREstring([ diff --git a/src/spec/vk.xml b/src/spec/vk.xml index fd55c620..bce1a36b 100644 --- a/src/spec/vk.xml +++ b/src/spec/vk.xml @@ -534,7 +534,7 @@ maintained in the master branch of the Khronos Vulkan Github project. VkStructureType sType - const void* pNext + const void* pNext VkDeviceSize allocationSize uint32_t memoryTypeIndex @@ -659,7 +659,7 @@ maintained in the master branch of the Khronos Vulkan Github project. VkStructureType sType - const void* pNext + const void* pNext VkBufferCreateFlags flags VkDeviceSize size VkBufferUsageFlags usage @@ -783,7 +783,7 @@ maintained in the master branch of the Khronos Vulkan Github project. VkStructureType sType - const void* pNext + const void* pNext VkImageCreateFlags flags VkImageType imageType VkFormat format @@ -2157,6 +2157,35 @@ maintained in the master branch of the Khronos Vulkan Github project. const char* pMarkerName float color[4] + + VkStructureType sType + const void* pNext + VkBool32 dedicatedAllocation + + If pname:dedicatedAllocation is ename:VK_TRUE, sname:VkImageCreateInfo::pname:flags mustnot: include ename:VK_IMAGE_CREATE_SPARSE_BINDING_BIT, ename:VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT, or ename:VK_IMAGE_CREATE_SPARSE_ALIASED_BIT + + + + VkStructureType sType + const void* pNext + VkBool32 dedicatedAllocation + + If pname:dedicatedAllocation is ename:VK_TRUE, sname:VkBufferCreateInfo::pname:flags mustnot: include ename:VK_BUFFER_CREATE_SPARSE_BINDING_BIT, ename:VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT, or ename:VK_BUFFER_CREATE_SPARSE_ALIASED_BIT + + + + VkStructureType sType + const void* pNext + VkImage image + VkBuffer buffer + + At least one of pname:image and pname:buffer must: be sname:VK_NULL_HANDLE + If pname:image is not sname:VK_NULL_HANDLE, the image must: have been created with sname:VkDedicatedAllocationImageCreateInfoNV::pname:dedicatedAllocation equal to ename:VK_TRUE + If pname:buffer is not sname:VK_NULL_HANDLE, the buffer must: have been created with sname:VkDedicatedAllocationBufferCreateInfoNV::pname:dedicatedAllocation equal to ename:VK_TRUE + If pname:image is not sname:VK_NULL_HANDLE, sname:VkMemoryAllocateInfo::pname:allocationSize must: equal the sname:VkMemoryRequirements::pname:size of the image + If pname:buffer is not sname:VK_NULL_HANDLE, sname:VkMemoryAllocateInfo::pname:allocationSize must: equal the sname:VkMemoryRequirements::pname:size of the buffer + + @@ -5319,10 +5348,21 @@ maintained in the master branch of the Khronos Vulkan Github project. - + - - + + + + + + + + + If pname:buffer was created with sname:VkDedicatedAllocationBufferCreateInfoNV::pname:dedicatedAllocation equal to ename:VK_TRUE, pname:memory must: have been created with sname:VkDedicatedAllocationMemoryAllocateInfoNV::pname:buffer equal to pname:buffer and pname:memoryOffset must: be zero. + If pname:buffer was not created with sname:VkDedicatedAllocationBufferCreateInfoNV::pname:dedicatedAllocation equal to ename:VK_TRUE, pname:memory must: not have been allocated dedicated for a specific buffer or image + If pname:image was created with sname:VkDedicatedAllocationImageCreateInfoNV::pname:dedicatedAllocation equal to ename:VK_TRUE, pname:memory must: have been created with sname:VkDedicatedAllocationMemoryAllocateInfoNV::pname:image equal to pname:image and pname:memoryOffset must: be zero. + If pname:image was not created with sname:VkDedicatedAllocationImageCreateInfoNV::pname:dedicatedAllocation equal to ename:VK_TRUE, pname:memory must: not have been allocated dedicated for a specific buffer or image + diff --git a/src/vulkan/vulkan.h b/src/vulkan/vulkan.h index 14a15aea..a6880003 100644 --- a/src/vulkan/vulkan.h +++ b/src/vulkan/vulkan.h @@ -214,6 +214,9 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000, VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001, VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002, + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000, + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001, + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002, VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO, VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO, VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1), @@ -3927,6 +3930,31 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerInsertEXT( #define VK_AMD_GCN_SHADER_EXTENSION_NAME "VK_AMD_gcn_shader" +#define VK_NV_dedicated_allocation 1 +#define VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION 1 +#define VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_NV_dedicated_allocation" + +typedef struct VkDedicatedAllocationImageCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkBool32 dedicatedAllocation; +} VkDedicatedAllocationImageCreateInfoNV; + +typedef struct VkDedicatedAllocationBufferCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkBool32 dedicatedAllocation; +} VkDedicatedAllocationBufferCreateInfoNV; + +typedef struct VkDedicatedAllocationMemoryAllocateInfoNV { + VkStructureType sType; + const void* pNext; + VkImage image; + VkBuffer buffer; +} VkDedicatedAllocationMemoryAllocateInfoNV; + + + #ifdef __cplusplus } #endif