diff options
-rw-r--r-- | doc/specs/vulkan/appendices/VK_EXT_queue_family_foreign.txt | 74 | ||||
-rw-r--r-- | doc/specs/vulkan/appendices/extensions.txt | 4 | ||||
-rw-r--r-- | doc/specs/vulkan/chapters/resources.txt | 7 | ||||
-rw-r--r-- | doc/specs/vulkan/chapters/synchronization.txt | 85 | ||||
-rw-r--r-- | src/spec/vk.xml | 8 | ||||
-rw-r--r-- | src/vulkan/vulkan.h | 6 |
6 files changed, 160 insertions, 24 deletions
diff --git a/doc/specs/vulkan/appendices/VK_EXT_queue_family_foreign.txt b/doc/specs/vulkan/appendices/VK_EXT_queue_family_foreign.txt new file mode 100644 index 0000000..041846c --- /dev/null +++ b/doc/specs/vulkan/appendices/VK_EXT_queue_family_foreign.txt @@ -0,0 +1,74 @@ +// Copyright (c) 2016-2017 Khronos Group. This work is licensed under a +// Creative Commons Attribution 4.0 International License; see +// http://creativecommons.org/licenses/by/4.0/ + +include::meta/VK_EXT_queue_family_foreign.txt[] + +*Last Modified Date*:: + 2017-11-01 +*IP Status*:: + No known IP claims. +*Contributors*:: + - Chad Versace, Google + - James Jones, NVIDIA + - Jason Ekstrand, Intel + - Jesse Hall, Google + - Ray Smith, ARM + +This extension defines a special queue family, ename:VK_QUEUE_FAMILY_FOREIGN_EXT, +which can be used to transfer ownership +of resources backed by external memory +to foreign, external queues. +This is similar to ename:VK_QUEUE_FAMILY_EXTERNAL_KHR, +defined in <<VK_KHR_external_memory>>. +The key differences between the two are: + + * The queues represented by ename:VK_QUEUE_FAMILY_EXTERNAL_KHR + must share the same physical device and the same driver version + as the current slink:VkInstance. + ename:VK_QUEUE_FAMILY_FOREIGN_EXT has no such restrictions. + It can represent devices and drivers from other vendors, + and can even represent non-Vulkan-capable devices. + * All resources backed by external memory support ename:VK_QUEUE_FAMILY_EXTERNAL_KHR. + Support for ename:VK_QUEUE_FAMILY_FOREIGN_EXT is more restrictive. + * Applications should expect transitions to/from + ename:VK_QUEUE_FAMILY_FOREIGN_EXT + to be more expensive than transitions to/from + ename:VK_QUEUE_FAMILY_EXTERNAL_KHR. + +=== New Enum Constants + + ** Special constants: + * ename:VK_QUEUE_FAMILY_FOREIGN_EXT + +=== Version History + + TODO(chadversary): Squash these internal revisions before merging. + + * Revision 0.5, 2017-11-01 (Chad Versace) + - Remove VK_IMAGE_CREATE_FOREIGN_QUEUE_BIT_EXT and + VK_BUFFER_CREATE_FOREIGN_QUEUE_BIT_EXT, due to today's Khronos telco. + - Specify that it is invalid to use VK_QUEUE_FAMILY_FOREIGN_EXT except + when allowed by layered extensions. + + * Revision 0.4 2017-10-18 (Chad Versace) + - Add VK_IMAGE_CREATE_FOREIGN_QUEUE_BIT_EXT and + VK_BUFFER_CREATE_FOREIGN_QUEUE_BIT_EXT. + - VK_QUEUE_FAMILY_EXTERNAL_KHR is no longer a subset of + VK_QUEUE_FAMILY_FOREIGN_EXT. + + * Revision 0.3 2017-10-18 (Chad Versace) + - Show table column only when VK_EXT_queue_family_foreign is + enabled. [found by Ray] + - In "ownership of external memory can be transferred", say "ownership + of resources backed by external memory". [for Ray] + - Fix more typos. + + * Revision 0.2 (Chad Versace) + - Fix typos. [found by Ray] + - s/non-GPU/non-Vulkan-capable/ [for Jesse] + - Add new table "Support for special queue families among external + memory handle types". [for Ray] + + * Revision 0.1 (Chad Versace) + - Initial revision diff --git a/doc/specs/vulkan/appendices/extensions.txt b/doc/specs/vulkan/appendices/extensions.txt index b2560a2..3268b05 100644 --- a/doc/specs/vulkan/appendices/extensions.txt +++ b/doc/specs/vulkan/appendices/extensions.txt @@ -294,6 +294,10 @@ ifdef::VK_EXT_global_priority[] include::VK_EXT_global_priority.txt[] endif::VK_EXT_global_priority[] +ifdef::VK_EXT_queue_family_foreign[] +include::VK_EXT_queue_family_foreign.txt[] +endif::VK_EXT_queue_family_foreign[] + ifdef::VK_EXT_hdr_metadata[] include::VK_EXT_hdr_metadata.txt[] endif::VK_EXT_hdr_metadata[] diff --git a/doc/specs/vulkan/chapters/resources.txt b/doc/specs/vulkan/chapters/resources.txt index 8fe1ff5..0622568 100644 --- a/doc/specs/vulkan/chapters/resources.txt +++ b/doc/specs/vulkan/chapters/resources.txt @@ -3886,8 +3886,11 @@ specified explicitly when releasing ownership, nor is the source instance or API specified when acquiring ownership. Instead, the image or memory barrier's pname:dstQueueFamilyIndex or pname:srcQueueFamilyIndex parameters are set to the reserved queue family -index ename:VK_QUEUE_FAMILY_EXTERNAL_KHR to represent the external -destination or source respectively. +index ename:VK_QUEUE_FAMILY_EXTERNAL_KHR +ifdef::VK_EXT_queue_family_foreign[] +or ename:VK_QUEUE_FAMILY_FOREIGN_EXT +endif::VK_EXT_queue_family_foreign[] +to represent the external destination or source respectively. Upon creation, memory objects shared between multiple Vulkan instances or other APIs are not owned by any instance or API. diff --git a/doc/specs/vulkan/chapters/synchronization.txt b/doc/specs/vulkan/chapters/synchronization.txt index b238327..50cd193 100644 --- a/doc/specs/vulkan/chapters/synchronization.txt +++ b/doc/specs/vulkan/chapters/synchronization.txt @@ -3569,12 +3569,12 @@ ifdef::VK_KHR_external_memory[] ename:VK_SHARING_MODE_CONCURRENT, at least one of pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex must: be ename:VK_QUEUE_FAMILY_IGNORED - * [[VUID-VkBufferMemoryBarrier-buffer-01380]] - If pname:buffer was created with a sharing mode of + * If pname:buffer was created with a sharing mode of ename:VK_SHARING_MODE_CONCURRENT, and one of pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex is ename:VK_QUEUE_FAMILY_IGNORED, the other must: be ename:VK_QUEUE_FAMILY_IGNORED or - ename:VK_QUEUE_FAMILY_EXTERNAL_KHR + a special queue family reserved for external memory transfers, + as described in <<synchronization-queue-transfers>>. endif::VK_KHR_external_memory[] ifndef::VK_KHR_external_memory[] * [[VUID-VkBufferMemoryBarrier-buffer-01192]] @@ -3590,16 +3590,16 @@ ifdef::VK_KHR_external_memory[] ename:VK_SHARING_MODE_EXCLUSIVE and pname:srcQueueFamilyIndex is ename:VK_QUEUE_FAMILY_IGNORED, pname:dstQueueFamilyIndex must: also be ename:VK_QUEUE_FAMILY_IGNORED - * [[VUID-VkBufferMemoryBarrier-buffer-01194]] - If pname:buffer was created with a sharing mode of + * If pname:buffer was created with a sharing mode of ename:VK_SHARING_MODE_EXCLUSIVE and pname:srcQueueFamilyIndex is not ename:VK_QUEUE_FAMILY_IGNORED, it must: be a valid queue family or - ename:VK_QUEUE_FAMILY_EXTERNAL_KHR (see <<devsandqueues-queueprops>>) - * [[VUID-VkBufferMemoryBarrier-buffer-01195]] - If pname:buffer was created with a sharing mode of + a special queue family reserved for external memory transfers, + as described in <<synchronization-queue-transfers>>. + * If pname:buffer was created with a sharing mode of ename:VK_SHARING_MODE_EXCLUSIVE and pname:dstQueueFamilyIndex is not ename:VK_QUEUE_FAMILY_IGNORED, it must: be a valid queue family or - ename:VK_QUEUE_FAMILY_EXTERNAL_KHR (see <<devsandqueues-queueprops>>) + a special queue family reserved for external memory transfers, + as described in <<synchronization-queue-transfers>>. endif::VK_KHR_external_memory[] * [[VUID-VkBufferMemoryBarrier-buffer-01196]] If pname:buffer was created with a sharing mode of @@ -3607,6 +3607,13 @@ endif::VK_KHR_external_memory[] pname:dstQueueFamilyIndex are not ename:VK_QUEUE_FAMILY_IGNORED, at least one of them must: be the same as the family of the queue that will execute this barrier +ifdef::VK_EXT_queue_family_foreign[] + * pname:srcQueueFamilyIndex must: not be ename:VK_QUEUE_FAMILY_FOREIGN_EXT, + and pname:dstQueueFamilyIndex must: not be + ename:VK_QUEUE_FAMILY_FOREIGN_EXT. (Valid usage for + ename:VK_QUEUE_FAMILY_FOREIGN_EXT is defined by extensions, and all such + extensions are disabled in this build of the specification). +endif::VK_EXT_queue_family_foreign[] **** include::../validity/structs/VkBufferMemoryBarrier.txt[] @@ -3746,12 +3753,12 @@ ifdef::VK_KHR_external_memory[] ename:VK_SHARING_MODE_CONCURRENT, at least one of pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex must: be ename:VK_QUEUE_FAMILY_IGNORED - * [[VUID-VkImageMemoryBarrier-image-01382]] - If pname:image was created with a sharing mode of + * If pname:image was created with a sharing mode of ename:VK_SHARING_MODE_CONCURRENT, and one of pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex is ename:VK_QUEUE_FAMILY_IGNORED, the other must: be ename:VK_QUEUE_FAMILY_IGNORED or - ename:VK_QUEUE_FAMILY_EXTERNAL_KHR + a special queue family reserved for external memory transfers, + as described in <<synchronization-queue-transfers>>. endif::VK_KHR_external_memory[] ifndef::VK_KHR_external_memory[] * [[VUID-VkImageMemoryBarrier-image-01200]] @@ -3767,17 +3774,24 @@ ifdef::VK_KHR_external_memory[] ename:VK_SHARING_MODE_EXCLUSIVE and pname:srcQueueFamilyIndex is ename:VK_QUEUE_FAMILY_IGNORED, pname:dstQueueFamilyIndex must: also be ename:VK_QUEUE_FAMILY_IGNORED. - * [[VUID-VkImageMemoryBarrier-image-01202]] - If pname:image was created with a sharing mode of + * If pname:image was created with a sharing mode of ename:VK_SHARING_MODE_EXCLUSIVE and pname:srcQueueFamilyIndex is not ename:VK_QUEUE_FAMILY_IGNORED, it must: be a valid queue family or - ename:VK_QUEUE_FAMILY_EXTERNAL_KHR (see <<devsandqueues-queueprops>>). - * [[VUID-VkImageMemoryBarrier-image-01203]] - If pname:image was created with a sharing mode of + a special queue family reserved for external memory transfers, + as described in <<synchronization-queue-transfers>>. + * If pname:image was created with a sharing mode of ename:VK_SHARING_MODE_EXCLUSIVE and pname:dstQueueFamilyIndex is not ename:VK_QUEUE_FAMILY_IGNORED, it must: be a valid queue family or - ename:VK_QUEUE_FAMILY_EXTERNAL_KHR (see <<devsandqueues-queueprops>>). + a special queue family reserved for external memory transfers, + as described in <<synchronization-queue-transfers>>. endif::VK_KHR_external_memory[] +ifdef::VK_EXT_queue_family_foreign[] + * pname:srcQueueFamilyIndex must: not be ename:VK_QUEUE_FAMILY_FOREIGN_EXT, + and pname:dstQueueFamilyIndex must: not be + ename:VK_QUEUE_FAMILY_FOREIGN_EXT. (Valid usage for + ename:VK_QUEUE_FAMILY_FOREIGN_EXT is defined by extensions, and all such + extensions are disabled in this build of the specification). +endif::VK_EXT_queue_family_foreign[] * [[VUID-VkImageMemoryBarrier-image-01205]] If pname:image was created with a sharing mode of ename:VK_SHARING_MODE_EXCLUSIVE, and pname:srcQueueFamilyIndex and @@ -3885,7 +3899,29 @@ also explicitly manage ownership transfers between local and external queues (or equivalent constructs in external APIs) regardless of the elink:VkSharingMode specified when creating them. The special queue family index ename:VK_QUEUE_FAMILY_EXTERNAL_KHR represents -any queue external to the resource's current Vulkan instance. +any queue external to the resource's current Vulkan instance, +as long as the queue uses the same underlying physical device +ifdef::VK_KHX_device_group[] +or device group +endif::VK_KHX_device_group[] +and uses the same driver version +as the resource's slink:VkDevice, +as indicated by slink:VkPhysicalDeviceIDPropertiesKHR::pname:deviceUUID +and slink:VkPhysicalDeviceIDPropertiesKHR::pname:driverUUID. +ifdef::VK_EXT_queue_family_foreign[] +The special queue family index ename:VK_QUEUE_FAMILY_FOREIGN_EXT +represents any queue external to the resource's current Vulkan instance, +regardless of the queue's underlying physical device or driver version. +This includes, for example, +queues for fixed-function image processing devices, +media codec devices, +and display devices, +as well as all queues that use the same underlying physical device +ifdef::VK_KHX_device_group[] +(or device group) +endif::VK_KHX_device_group[] +and driver version as the resource's slink:VkDevice. +endif::VK_EXT_queue_family_foreign[] endif::VK_KHR_external_memory[] If memory dependencies are correctly expressed between uses of such a resource between two queues in different families, but no ownership transfer @@ -3900,6 +3936,17 @@ when transferring from one queue family to another, then the ownership transfer should: be skipped. ==== +ifdef::VK_EXT_queue_family_foreign[] +.Note +[NOTE] +==== +Applications should expect transfers to/from +ename:VK_QUEUE_FAMILY_FOREIGN_EXT +to be more expensive than transfers to/from +ename:VK_QUEUE_FAMILY_EXTERNAL_KHR. +==== +endif::VK_EXT_queue_family_foreign[] + A queue family ownership transfer consists of two distinct parts: . Release exclusive ownership from the source queue family diff --git a/src/spec/vk.xml b/src/spec/vk.xml index f2f93b2..66ec58a 100644 --- a/src/spec/vk.xml +++ b/src/spec/vk.xml @@ -2666,6 +2666,7 @@ private version is maintained in the 1.0 branch of the member gitlab server. <enum value="1" name="VK_TRUE"/> <enum value="0" name="VK_FALSE"/> <enum value="(~0U)" name="VK_QUEUE_FAMILY_IGNORED"/> + <enum value="(~0U-2)" name="VK_QUEUE_FAMILY_FOREIGN_EXT"/> <enum value="(~0U-1)" name="VK_QUEUE_FAMILY_EXTERNAL_KHR"/> <enum value="(~0U)" name="VK_SUBPASS_EXTERNAL"/> <enum value="32" name="VK_MAX_DEVICE_GROUP_SIZE_KHX"/> @@ -6946,10 +6947,11 @@ private version is maintained in the 1.0 branch of the member gitlab server. <enum value=""VK_MESA_extension_126"" name="VK_MESA_EXTENSION_126_EXTENSION_NAME"/> </require> </extension> - <extension name="VK_MESA_extension_127" number="127" author="MESA" contact="Chad Versace @chadversary" supported="disabled"> + <extension name="VK_EXT_queue_family_foreign" number="127" type="device" author="EXT" requires="VK_KHR_external_memory" contact="Chad Versace @chadversary" supported="vulkan"> <require> - <enum value="0" name="VK_MESA_EXTENSION_127_SPEC_VERSION"/> - <enum value=""VK_MESA_extension_127"" name="VK_MESA_EXTENSION_127_EXTENSION_NAME"/> + <enum value="1" name="VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION"/> + <enum value=""VK_EXT_queue_family_foreign"" name="VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME"/> + <enum name="VK_QUEUE_FAMILY_FOREIGN_EXT"/> </require> </extension> <extension name="VK_KHR_dedicated_allocation" number="128" type="device" author="KHR" requires="VK_KHR_get_memory_requirements2" contact="James Jones @cubanismo" supported="vulkan"> diff --git a/src/vulkan/vulkan.h b/src/vulkan/vulkan.h index 8e21042..7f31445 100644 --- a/src/vulkan/vulkan.h +++ b/src/vulkan/vulkan.h @@ -6616,6 +6616,12 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK( #endif #endif /* VK_USE_PLATFORM_MACOS_MVK */ +#define VK_EXT_queue_family_foreign 1 +#define VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION 1 +#define VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME "VK_EXT_queue_family_foreign" +#define VK_QUEUE_FAMILY_FOREIGN_EXT (~0U-2) + + #define VK_EXT_sampler_filter_minmax 1 #define VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION 1 #define VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME "VK_EXT_sampler_filter_minmax" |