2016-09-17 04:22:17 +00:00
|
|
|
[[VK_NV_win32_keyed_mutex]]
|
2016-08-28 10:47:19 +00:00
|
|
|
== VK_NV_win32_keyed_mutex
|
|
|
|
|
2016-09-17 04:22:17 +00:00
|
|
|
*Name*::
|
Change log for September 23, 2016 Vulkan 1.0.28 spec update:
* Bump API patch number and header version number to 28 for this update.
Github Issues:
* Minor spelling and typography cleanup, add definitions of
ename:VK_FALSE and ename:VK_TRUE as just what their names say
(public issues 220, 318, 325, 365; internal issues 451, 496)
* Clarify that the pname:maxDescriptorSet limits in the
<<features-limits-required,Required Limits>> table are n *
maxPerStage limit (where n=number of supported stages) (public issue
254).
* Minor cleanup to <<boilerplate-platform-macros,Platform-Specific
Macro Definitions>> appendix (public issue 314).
* Add valid usage statement to slink:VkPipelineLayoutCreateInfo
disallowing multiple push constant ranges for the same shader stage
(public issue 340).
* Clarify the elink:VkSharingMode description of what executing the
"same" barriers means in case of ownership transfer (public issue
347).
* Rename copyright.txt and add COPYING.md to try and reduce confusion
about applicable copyrights (public issue 350).
* Extend the table in the <<boilerplate-wsi-header, Window System-Specific
Header Control>> section to describe the external headers included when
each etext:VK_USE_PLATFORM_* macro is defined (public issue 376).
Internal Issues:
* Add "Revision History" to the PDF outputs following the table of
contents, to match HTML outputs (internal issue 43).
* Clarified that flink:vkMapMemory may fail due to virtual address
space limitations (internal issue 346).
* Add +refBody+ comment markup for ref page autoextraction when required
(internal issue 400).
* Document proper use of "mipmap" and "mip" in the style guide API
naming rules, matching the spelling rules (internal issue 471).
* Tweak the <<extensions,Layers and Extensions>> appendix to note that
the Specification may be built with arbitrary combinations of
extensions (internal issue 483).
* Remove incorrect statement allowing
slink:VkClearAttachment::pname:colorAttachment to be >=
slink:VkSubpassDescription::pname:colorAttachmentCount (internal
issue 488).
* The <<features-limits-viewportboundsrange,viewportBoundsRange>> is
expressed in terms of the pname:maxViewportDimensions but this is
actually two values. Clarify that it's based on the larger of the two
(if they differ) (internal issue 499).
Other Issues:
* Reflowed text of the entire spec using the 'reflow' Makefile gater,
to (hopefully) reduce future internal git churn as edits are made
and extensions added in return for one-time pain. This has no
perceptible change on the spec outputs but considerable changes on
the asciidoc source (internal issue 367).
2016-09-24 07:58:11 +00:00
|
|
|
+VK_NV_win32_keyed_mutex+
|
2016-09-17 04:22:17 +00:00
|
|
|
*Extension Type*::
|
|
|
|
Device extension
|
|
|
|
*Registered Extension Number*::
|
|
|
|
59
|
|
|
|
*Status*::
|
|
|
|
Complete
|
|
|
|
*Last Modified Date*::
|
|
|
|
2016-08-19
|
|
|
|
*Revision*::
|
|
|
|
2
|
|
|
|
*IP Status*::
|
|
|
|
No known IP claims.
|
2016-08-28 10:47:19 +00:00
|
|
|
*Dependencies*::
|
|
|
|
- This extension is written against version 1.0 of the Vulkan API.
|
Change log for September 23, 2016 Vulkan 1.0.28 spec update:
* Bump API patch number and header version number to 28 for this update.
Github Issues:
* Minor spelling and typography cleanup, add definitions of
ename:VK_FALSE and ename:VK_TRUE as just what their names say
(public issues 220, 318, 325, 365; internal issues 451, 496)
* Clarify that the pname:maxDescriptorSet limits in the
<<features-limits-required,Required Limits>> table are n *
maxPerStage limit (where n=number of supported stages) (public issue
254).
* Minor cleanup to <<boilerplate-platform-macros,Platform-Specific
Macro Definitions>> appendix (public issue 314).
* Add valid usage statement to slink:VkPipelineLayoutCreateInfo
disallowing multiple push constant ranges for the same shader stage
(public issue 340).
* Clarify the elink:VkSharingMode description of what executing the
"same" barriers means in case of ownership transfer (public issue
347).
* Rename copyright.txt and add COPYING.md to try and reduce confusion
about applicable copyrights (public issue 350).
* Extend the table in the <<boilerplate-wsi-header, Window System-Specific
Header Control>> section to describe the external headers included when
each etext:VK_USE_PLATFORM_* macro is defined (public issue 376).
Internal Issues:
* Add "Revision History" to the PDF outputs following the table of
contents, to match HTML outputs (internal issue 43).
* Clarified that flink:vkMapMemory may fail due to virtual address
space limitations (internal issue 346).
* Add +refBody+ comment markup for ref page autoextraction when required
(internal issue 400).
* Document proper use of "mipmap" and "mip" in the style guide API
naming rules, matching the spelling rules (internal issue 471).
* Tweak the <<extensions,Layers and Extensions>> appendix to note that
the Specification may be built with arbitrary combinations of
extensions (internal issue 483).
* Remove incorrect statement allowing
slink:VkClearAttachment::pname:colorAttachment to be >=
slink:VkSubpassDescription::pname:colorAttachmentCount (internal
issue 488).
* The <<features-limits-viewportboundsrange,viewportBoundsRange>> is
expressed in terms of the pname:maxViewportDimensions but this is
actually two values. Clarify that it's based on the larger of the two
(if they differ) (internal issue 499).
Other Issues:
* Reflowed text of the entire spec using the 'reflow' Makefile gater,
to (hopefully) reduce future internal git churn as edits are made
and extensions added in return for one-time pain. This has no
perceptible change on the spec outputs but considerable changes on
the asciidoc source (internal issue 367).
2016-09-24 07:58:11 +00:00
|
|
|
- Requires +VK_NV_external_memory_capabilities+
|
|
|
|
- Requires +VK_NV_external_memory_win32+
|
2016-08-28 10:47:19 +00:00
|
|
|
*Contributors*::
|
|
|
|
- James Jones, NVIDIA
|
|
|
|
- Carsten Rohde, NVIDIA
|
|
|
|
*Contact*::
|
|
|
|
- Carsten Rohde (crohde 'at' nvidia.com)
|
|
|
|
|
Change log for September 23, 2016 Vulkan 1.0.28 spec update:
* Bump API patch number and header version number to 28 for this update.
Github Issues:
* Minor spelling and typography cleanup, add definitions of
ename:VK_FALSE and ename:VK_TRUE as just what their names say
(public issues 220, 318, 325, 365; internal issues 451, 496)
* Clarify that the pname:maxDescriptorSet limits in the
<<features-limits-required,Required Limits>> table are n *
maxPerStage limit (where n=number of supported stages) (public issue
254).
* Minor cleanup to <<boilerplate-platform-macros,Platform-Specific
Macro Definitions>> appendix (public issue 314).
* Add valid usage statement to slink:VkPipelineLayoutCreateInfo
disallowing multiple push constant ranges for the same shader stage
(public issue 340).
* Clarify the elink:VkSharingMode description of what executing the
"same" barriers means in case of ownership transfer (public issue
347).
* Rename copyright.txt and add COPYING.md to try and reduce confusion
about applicable copyrights (public issue 350).
* Extend the table in the <<boilerplate-wsi-header, Window System-Specific
Header Control>> section to describe the external headers included when
each etext:VK_USE_PLATFORM_* macro is defined (public issue 376).
Internal Issues:
* Add "Revision History" to the PDF outputs following the table of
contents, to match HTML outputs (internal issue 43).
* Clarified that flink:vkMapMemory may fail due to virtual address
space limitations (internal issue 346).
* Add +refBody+ comment markup for ref page autoextraction when required
(internal issue 400).
* Document proper use of "mipmap" and "mip" in the style guide API
naming rules, matching the spelling rules (internal issue 471).
* Tweak the <<extensions,Layers and Extensions>> appendix to note that
the Specification may be built with arbitrary combinations of
extensions (internal issue 483).
* Remove incorrect statement allowing
slink:VkClearAttachment::pname:colorAttachment to be >=
slink:VkSubpassDescription::pname:colorAttachmentCount (internal
issue 488).
* The <<features-limits-viewportboundsrange,viewportBoundsRange>> is
expressed in terms of the pname:maxViewportDimensions but this is
actually two values. Clarify that it's based on the larger of the two
(if they differ) (internal issue 499).
Other Issues:
* Reflowed text of the entire spec using the 'reflow' Makefile gater,
to (hopefully) reduce future internal git churn as edits are made
and extensions added in return for one-time pain. This has no
perceptible change on the spec outputs but considerable changes on
the asciidoc source (internal issue 367).
2016-09-24 07:58:11 +00:00
|
|
|
Applications that wish to import Direct3D 11 memory objects into the Vulkan
|
|
|
|
API may wish to use the native keyed mutex mechanism to synchronize access
|
|
|
|
to the memory between Vulkan and Direct3D.
|
|
|
|
This extension provides a way for an application to access the keyed mutex
|
|
|
|
associated with an imported Vulkan memory object when submitting command
|
|
|
|
buffers to a queue.
|
2016-08-28 10:47:19 +00:00
|
|
|
|
|
|
|
=== New Object Types
|
|
|
|
|
|
|
|
None.
|
Change log for September 6, 2016 Vulkan 1.0.26 spec update:
* Bump API patch number and header version number to 26 for this update.
Github Issues:
* Bring sample code in the +VK_KHR_surface+ and +VK_KHR_swapchain+
extension summary appendices up to date, and note they will be replaced
with pointers to the LunarG SDK examples in the future (public issue
279).
* Add a new <<fundamentals-commandsyntax-results-lifetime,Lifetime of
Retrieved Results>> section specifying that ftext:vkGet* and
ftext:VkEnumerate* results are invariant unless otherwise specified, and
specify behavior for individual commands which are not invariant (public
issue 280).
* Remove conflicting definition of
slink:VkDisplayPlaneCapabilitiesKHR::pname:maxSrcPosition and clean up
language of the remaining definition (public issue 351).
* Fix many minor spelling errors and add rules to the style guide to
prevent recurrences (public issue 352).
Internal Issues:
* Remove redundant descriptions of the etext:VK_USE_PLATFORM_* macros from
the <<wsi,Window System Integration>> chapter in favor of the
description in the <<boilerplate-wsi-header,Window System-Specific
Header Control>> appendix (internal issue 6).
* Replace misleading 'can: be destroyed when not X' with more correct
'must: not be destroyed while X' in the
<<fundamentals-objectmodel-lifetime,Object Lifetime>> section. Disallow
destroying a pipeline layout while a command buffer using it is
recording (internal issue 241).
* Clarify that ename:VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT is valid for
all images used as attachments in elink:VkImageUsageFlagBits and the
slink:VkImageLayout validity language (internal issue 320).
* Note that <<extended-functionality-layers,Layers>> may wrap object
handles, but that this is a generally discouraged. A link to additional
information in the documentation for layer authors is provided (issue
398)
* Replace the mustnot: and shouldnot: macros with equivalent must: not and
should: not to get rid of non-English words while still highlighting
normative language (internal issue 407).
* Disallow creating multisampled images with
ename:VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT in the slink:VkImageLayout
validity language and the <<features-supported-sample-counts,Supported
Sample Counts>> section (internal issue 445).
* Fix typo so that flink:vkCmdDrawIndexedIndirect is defined in terms of
flink:vkCmdDrawIndexed rather than flink:vkCmdDrawIndirect (internal
issue 446).
* Reorganize the per-extension information sections to all be in the
<<extensions,Layers & Extensions>> appendix. Also fix a typo in
+VK_IMG_filter_cubic+ which incorrectly identified it as a +KHR+
extension (internal issue 461).
Other Issues:
* Use asciidoc markup instead of latexmath to simplify diagrams in the
<<features-formats-non-packed,byte mapping tables>> for color formats.
* Fix a markup problem with the wildcarded enumerant names in a NOTE in
the <<textures-texel-replacement,Texel Replacement>> section.
* Fix missing attributes in the XML interface for
elink:VkExternalMemoryHandleTypeFlagBitsNV and
elink:VkExternalMemoryFeatureFlagBitsNV (KhronosGroup/Vulkan-Hpp issue
#25)
* Cleanup reference page builds so only core pages are built for releases.
2016-09-06 13:17:27 +00:00
|
|
|
|
2016-08-28 10:47:19 +00:00
|
|
|
=== New Enum Constants
|
|
|
|
|
Change log for September 6, 2016 Vulkan 1.0.26 spec update:
* Bump API patch number and header version number to 26 for this update.
Github Issues:
* Bring sample code in the +VK_KHR_surface+ and +VK_KHR_swapchain+
extension summary appendices up to date, and note they will be replaced
with pointers to the LunarG SDK examples in the future (public issue
279).
* Add a new <<fundamentals-commandsyntax-results-lifetime,Lifetime of
Retrieved Results>> section specifying that ftext:vkGet* and
ftext:VkEnumerate* results are invariant unless otherwise specified, and
specify behavior for individual commands which are not invariant (public
issue 280).
* Remove conflicting definition of
slink:VkDisplayPlaneCapabilitiesKHR::pname:maxSrcPosition and clean up
language of the remaining definition (public issue 351).
* Fix many minor spelling errors and add rules to the style guide to
prevent recurrences (public issue 352).
Internal Issues:
* Remove redundant descriptions of the etext:VK_USE_PLATFORM_* macros from
the <<wsi,Window System Integration>> chapter in favor of the
description in the <<boilerplate-wsi-header,Window System-Specific
Header Control>> appendix (internal issue 6).
* Replace misleading 'can: be destroyed when not X' with more correct
'must: not be destroyed while X' in the
<<fundamentals-objectmodel-lifetime,Object Lifetime>> section. Disallow
destroying a pipeline layout while a command buffer using it is
recording (internal issue 241).
* Clarify that ename:VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT is valid for
all images used as attachments in elink:VkImageUsageFlagBits and the
slink:VkImageLayout validity language (internal issue 320).
* Note that <<extended-functionality-layers,Layers>> may wrap object
handles, but that this is a generally discouraged. A link to additional
information in the documentation for layer authors is provided (issue
398)
* Replace the mustnot: and shouldnot: macros with equivalent must: not and
should: not to get rid of non-English words while still highlighting
normative language (internal issue 407).
* Disallow creating multisampled images with
ename:VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT in the slink:VkImageLayout
validity language and the <<features-supported-sample-counts,Supported
Sample Counts>> section (internal issue 445).
* Fix typo so that flink:vkCmdDrawIndexedIndirect is defined in terms of
flink:vkCmdDrawIndexed rather than flink:vkCmdDrawIndirect (internal
issue 446).
* Reorganize the per-extension information sections to all be in the
<<extensions,Layers & Extensions>> appendix. Also fix a typo in
+VK_IMG_filter_cubic+ which incorrectly identified it as a +KHR+
extension (internal issue 461).
Other Issues:
* Use asciidoc markup instead of latexmath to simplify diagrams in the
<<features-formats-non-packed,byte mapping tables>> for color formats.
* Fix a markup problem with the wildcarded enumerant names in a NOTE in
the <<textures-texel-replacement,Texel Replacement>> section.
* Fix missing attributes in the XML interface for
elink:VkExternalMemoryHandleTypeFlagBitsNV and
elink:VkExternalMemoryFeatureFlagBitsNV (KhronosGroup/Vulkan-Hpp issue
#25)
* Cleanup reference page builds so only core pages are built for releases.
2016-09-06 13:17:27 +00:00
|
|
|
* Extending elink:VkStructureType:
|
|
|
|
** ename:VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV
|
2016-08-28 10:47:19 +00:00
|
|
|
|
|
|
|
=== New Enums
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
|
|
|
=== New Structures
|
|
|
|
|
Change log for September 6, 2016 Vulkan 1.0.26 spec update:
* Bump API patch number and header version number to 26 for this update.
Github Issues:
* Bring sample code in the +VK_KHR_surface+ and +VK_KHR_swapchain+
extension summary appendices up to date, and note they will be replaced
with pointers to the LunarG SDK examples in the future (public issue
279).
* Add a new <<fundamentals-commandsyntax-results-lifetime,Lifetime of
Retrieved Results>> section specifying that ftext:vkGet* and
ftext:VkEnumerate* results are invariant unless otherwise specified, and
specify behavior for individual commands which are not invariant (public
issue 280).
* Remove conflicting definition of
slink:VkDisplayPlaneCapabilitiesKHR::pname:maxSrcPosition and clean up
language of the remaining definition (public issue 351).
* Fix many minor spelling errors and add rules to the style guide to
prevent recurrences (public issue 352).
Internal Issues:
* Remove redundant descriptions of the etext:VK_USE_PLATFORM_* macros from
the <<wsi,Window System Integration>> chapter in favor of the
description in the <<boilerplate-wsi-header,Window System-Specific
Header Control>> appendix (internal issue 6).
* Replace misleading 'can: be destroyed when not X' with more correct
'must: not be destroyed while X' in the
<<fundamentals-objectmodel-lifetime,Object Lifetime>> section. Disallow
destroying a pipeline layout while a command buffer using it is
recording (internal issue 241).
* Clarify that ename:VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT is valid for
all images used as attachments in elink:VkImageUsageFlagBits and the
slink:VkImageLayout validity language (internal issue 320).
* Note that <<extended-functionality-layers,Layers>> may wrap object
handles, but that this is a generally discouraged. A link to additional
information in the documentation for layer authors is provided (issue
398)
* Replace the mustnot: and shouldnot: macros with equivalent must: not and
should: not to get rid of non-English words while still highlighting
normative language (internal issue 407).
* Disallow creating multisampled images with
ename:VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT in the slink:VkImageLayout
validity language and the <<features-supported-sample-counts,Supported
Sample Counts>> section (internal issue 445).
* Fix typo so that flink:vkCmdDrawIndexedIndirect is defined in terms of
flink:vkCmdDrawIndexed rather than flink:vkCmdDrawIndirect (internal
issue 446).
* Reorganize the per-extension information sections to all be in the
<<extensions,Layers & Extensions>> appendix. Also fix a typo in
+VK_IMG_filter_cubic+ which incorrectly identified it as a +KHR+
extension (internal issue 461).
Other Issues:
* Use asciidoc markup instead of latexmath to simplify diagrams in the
<<features-formats-non-packed,byte mapping tables>> for color formats.
* Fix a markup problem with the wildcarded enumerant names in a NOTE in
the <<textures-texel-replacement,Texel Replacement>> section.
* Fix missing attributes in the XML interface for
elink:VkExternalMemoryHandleTypeFlagBitsNV and
elink:VkExternalMemoryFeatureFlagBitsNV (KhronosGroup/Vulkan-Hpp issue
#25)
* Cleanup reference page builds so only core pages are built for releases.
2016-09-06 13:17:27 +00:00
|
|
|
* Extending slink:VkSubmitInfo:
|
|
|
|
** slink:VkWin32KeyedMutexAcquireReleaseInfoNV
|
2016-08-28 10:47:19 +00:00
|
|
|
|
|
|
|
=== New Functions
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
|
|
|
=== Issues
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
|
|
|
=== Examples
|
|
|
|
|
|
|
|
[source,{basebackend@docbook:c++:cpp}]
|
|
|
|
----------------------------------------
|
|
|
|
|
|
|
|
//
|
|
|
|
// Import a memory object from Direct3D 11, and synchronize
|
|
|
|
// access to it in Vulkan using keyed mutex objects.
|
|
|
|
//
|
|
|
|
|
|
|
|
extern VkPhysicalDevice physicalDevice;
|
|
|
|
extern VkDevice device;
|
|
|
|
extern HANDLE sharedNtHandle;
|
Change log for September 6, 2016 Vulkan 1.0.26 spec update:
* Bump API patch number and header version number to 26 for this update.
Github Issues:
* Bring sample code in the +VK_KHR_surface+ and +VK_KHR_swapchain+
extension summary appendices up to date, and note they will be replaced
with pointers to the LunarG SDK examples in the future (public issue
279).
* Add a new <<fundamentals-commandsyntax-results-lifetime,Lifetime of
Retrieved Results>> section specifying that ftext:vkGet* and
ftext:VkEnumerate* results are invariant unless otherwise specified, and
specify behavior for individual commands which are not invariant (public
issue 280).
* Remove conflicting definition of
slink:VkDisplayPlaneCapabilitiesKHR::pname:maxSrcPosition and clean up
language of the remaining definition (public issue 351).
* Fix many minor spelling errors and add rules to the style guide to
prevent recurrences (public issue 352).
Internal Issues:
* Remove redundant descriptions of the etext:VK_USE_PLATFORM_* macros from
the <<wsi,Window System Integration>> chapter in favor of the
description in the <<boilerplate-wsi-header,Window System-Specific
Header Control>> appendix (internal issue 6).
* Replace misleading 'can: be destroyed when not X' with more correct
'must: not be destroyed while X' in the
<<fundamentals-objectmodel-lifetime,Object Lifetime>> section. Disallow
destroying a pipeline layout while a command buffer using it is
recording (internal issue 241).
* Clarify that ename:VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT is valid for
all images used as attachments in elink:VkImageUsageFlagBits and the
slink:VkImageLayout validity language (internal issue 320).
* Note that <<extended-functionality-layers,Layers>> may wrap object
handles, but that this is a generally discouraged. A link to additional
information in the documentation for layer authors is provided (issue
398)
* Replace the mustnot: and shouldnot: macros with equivalent must: not and
should: not to get rid of non-English words while still highlighting
normative language (internal issue 407).
* Disallow creating multisampled images with
ename:VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT in the slink:VkImageLayout
validity language and the <<features-supported-sample-counts,Supported
Sample Counts>> section (internal issue 445).
* Fix typo so that flink:vkCmdDrawIndexedIndirect is defined in terms of
flink:vkCmdDrawIndexed rather than flink:vkCmdDrawIndirect (internal
issue 446).
* Reorganize the per-extension information sections to all be in the
<<extensions,Layers & Extensions>> appendix. Also fix a typo in
+VK_IMG_filter_cubic+ which incorrectly identified it as a +KHR+
extension (internal issue 461).
Other Issues:
* Use asciidoc markup instead of latexmath to simplify diagrams in the
<<features-formats-non-packed,byte mapping tables>> for color formats.
* Fix a markup problem with the wildcarded enumerant names in a NOTE in
the <<textures-texel-replacement,Texel Replacement>> section.
* Fix missing attributes in the XML interface for
elink:VkExternalMemoryHandleTypeFlagBitsNV and
elink:VkExternalMemoryFeatureFlagBitsNV (KhronosGroup/Vulkan-Hpp issue
#25)
* Cleanup reference page builds so only core pages are built for releases.
2016-09-06 13:17:27 +00:00
|
|
|
|
2016-08-28 10:47:19 +00:00
|
|
|
static const VkFormat format = VK_FORMAT_R8G8B8A8_UNORM;
|
|
|
|
static const VkExternalMemoryHandleTypeFlagsNV handleType =
|
|
|
|
VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV;
|
|
|
|
|
|
|
|
VkPhysicalDeviceMemoryProperties memoryProperties;
|
|
|
|
VkExternalImageFormatPropertiesNV properties;
|
|
|
|
VkExternalMemoryImageCreateInfoNV externalMemoryImageCreateInfo;
|
|
|
|
VkImageCreateInfo imageCreateInfo;
|
|
|
|
VkImage image;
|
|
|
|
VkMemoryRequirements imageMemoryRequirements;
|
|
|
|
uint32_t numMemoryTypes;
|
|
|
|
uint32_t memoryType;
|
|
|
|
VkImportMemoryWin32HandleInfoNV importMemoryInfo;
|
|
|
|
VkMemoryAllocateInfo memoryAllocateInfo;
|
|
|
|
VkDeviceMemory mem;
|
|
|
|
VkResult result;
|
|
|
|
|
|
|
|
// Figure out how many memory types the device supports
|
|
|
|
vkGetPhysicalDeviceMemoryProperties(physicalDevice,
|
|
|
|
&memoryProperties);
|
|
|
|
numMemoryTypes = memoryProperties.memoryTypeCount;
|
|
|
|
|
|
|
|
// Check the external handle type capabilities for the chosen format
|
|
|
|
// Importable 2D image support with at least 1 mip level, 1 array
|
|
|
|
// layer, and VK_SAMPLE_COUNT_1_BIT using optimal tiling and supporting
|
|
|
|
// texturing and color rendering is required.
|
|
|
|
result = vkGetPhysicalDeviceExternalImageFormatPropertiesNV(
|
|
|
|
physicalDevice,
|
|
|
|
format,
|
|
|
|
VK_IMAGE_TYPE_2D,
|
|
|
|
VK_IMAGE_TILING_OPTIMAL,
|
|
|
|
VK_IMAGE_USAGE_SAMPLED_BIT |
|
|
|
|
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
|
|
|
|
0,
|
|
|
|
handleType,
|
|
|
|
&properties);
|
|
|
|
|
|
|
|
if ((result != VK_SUCCESS) ||
|
|
|
|
!(properties.externalMemoryFeatures &
|
|
|
|
VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_NV)) {
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set up the external memory image creation info
|
|
|
|
memset(&externalMemoryImageCreateInfo,
|
|
|
|
0, sizeof(externalMemoryImageCreateInfo));
|
|
|
|
externalMemoryImageCreateInfo.sType =
|
|
|
|
VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV;
|
|
|
|
externalMemoryImageCreateInfo.handleTypes = handleType;
|
|
|
|
// Set up the core image creation info
|
|
|
|
memset(&imageCreateInfo, 0, sizeof(imageCreateInfo));
|
|
|
|
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
|
|
|
imageCreateInfo.pNext = &externalMemoryImageCreateInfo;
|
|
|
|
imageCreateInfo.format = format;
|
|
|
|
imageCreateInfo.extent.width = 64;
|
|
|
|
imageCreateInfo.extent.height = 64;
|
|
|
|
imageCreateInfo.extent.depth = 1;
|
|
|
|
imageCreateInfo.mipLevels = 1;
|
|
|
|
imageCreateInfo.arrayLayers = 1;
|
|
|
|
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
|
|
|
imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
|
|
|
imageCreateInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT |
|
|
|
|
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
|
|
|
imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
|
|
|
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
|
|
|
|
|
|
|
vkCreateImage(device, &imageCreateInfo, NULL, &image);
|
|
|
|
vkGetImageMemoryRequirements(device,
|
|
|
|
image,
|
|
|
|
&imageMemoryRequirements);
|
|
|
|
|
|
|
|
// For simplicity, just pick the first compatible memory type.
|
|
|
|
for (memoryType = 0; memoryType < numMemoryTypes; memoryType++) {
|
|
|
|
if ((1 << memoryType) & imageMemoryRequirements.memoryTypeBits) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// At least one memory type must be supported given the prior external
|
|
|
|
// handle capability check.
|
|
|
|
assert(memoryType < numMemoryTypes);
|
|
|
|
|
|
|
|
// Allocate the external memory object.
|
|
|
|
memset(&exportMemoryAllocateInfo, 0, sizeof(exportMemoryAllocateInfo));
|
|
|
|
exportMemoryAllocateInfo.sType =
|
|
|
|
VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV;
|
|
|
|
importMemoryInfo.handleTypes = handleType;
|
|
|
|
importMemoryInfo.handle = sharedNtHandle;
|
|
|
|
|
|
|
|
memset(&memoryAllocateInfo, 0, sizeof(memoryAllocateInfo));
|
|
|
|
memoryAllocateInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
|
|
|
|
memoryAllocateInfo.pNext = &exportMemoryAllocateInfo;
|
|
|
|
memoryAllocateInfo.allocationSize = imageMemoryRequirements.size;
|
|
|
|
memoryAllocateInfo.memoryTypeIndex = memoryType;
|
|
|
|
|
|
|
|
vkAllocateMemory(device, &memoryAllocateInfo, NULL, &mem);
|
|
|
|
|
|
|
|
vkBindImageMemory(device, image, mem, 0);
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
const uint64_t acquireKey = 1;
|
|
|
|
const uint32_t timeout = INFINITE;
|
|
|
|
const uint64_t releaseKey = 2;
|
Change log for September 6, 2016 Vulkan 1.0.26 spec update:
* Bump API patch number and header version number to 26 for this update.
Github Issues:
* Bring sample code in the +VK_KHR_surface+ and +VK_KHR_swapchain+
extension summary appendices up to date, and note they will be replaced
with pointers to the LunarG SDK examples in the future (public issue
279).
* Add a new <<fundamentals-commandsyntax-results-lifetime,Lifetime of
Retrieved Results>> section specifying that ftext:vkGet* and
ftext:VkEnumerate* results are invariant unless otherwise specified, and
specify behavior for individual commands which are not invariant (public
issue 280).
* Remove conflicting definition of
slink:VkDisplayPlaneCapabilitiesKHR::pname:maxSrcPosition and clean up
language of the remaining definition (public issue 351).
* Fix many minor spelling errors and add rules to the style guide to
prevent recurrences (public issue 352).
Internal Issues:
* Remove redundant descriptions of the etext:VK_USE_PLATFORM_* macros from
the <<wsi,Window System Integration>> chapter in favor of the
description in the <<boilerplate-wsi-header,Window System-Specific
Header Control>> appendix (internal issue 6).
* Replace misleading 'can: be destroyed when not X' with more correct
'must: not be destroyed while X' in the
<<fundamentals-objectmodel-lifetime,Object Lifetime>> section. Disallow
destroying a pipeline layout while a command buffer using it is
recording (internal issue 241).
* Clarify that ename:VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT is valid for
all images used as attachments in elink:VkImageUsageFlagBits and the
slink:VkImageLayout validity language (internal issue 320).
* Note that <<extended-functionality-layers,Layers>> may wrap object
handles, but that this is a generally discouraged. A link to additional
information in the documentation for layer authors is provided (issue
398)
* Replace the mustnot: and shouldnot: macros with equivalent must: not and
should: not to get rid of non-English words while still highlighting
normative language (internal issue 407).
* Disallow creating multisampled images with
ename:VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT in the slink:VkImageLayout
validity language and the <<features-supported-sample-counts,Supported
Sample Counts>> section (internal issue 445).
* Fix typo so that flink:vkCmdDrawIndexedIndirect is defined in terms of
flink:vkCmdDrawIndexed rather than flink:vkCmdDrawIndirect (internal
issue 446).
* Reorganize the per-extension information sections to all be in the
<<extensions,Layers & Extensions>> appendix. Also fix a typo in
+VK_IMG_filter_cubic+ which incorrectly identified it as a +KHR+
extension (internal issue 461).
Other Issues:
* Use asciidoc markup instead of latexmath to simplify diagrams in the
<<features-formats-non-packed,byte mapping tables>> for color formats.
* Fix a markup problem with the wildcarded enumerant names in a NOTE in
the <<textures-texel-replacement,Texel Replacement>> section.
* Fix missing attributes in the XML interface for
elink:VkExternalMemoryHandleTypeFlagBitsNV and
elink:VkExternalMemoryFeatureFlagBitsNV (KhronosGroup/Vulkan-Hpp issue
#25)
* Cleanup reference page builds so only core pages are built for releases.
2016-09-06 13:17:27 +00:00
|
|
|
|
2016-08-28 10:47:19 +00:00
|
|
|
VkWin32KeyedMutexAcquireReleaseInfoNV keyedMutex =
|
|
|
|
{ VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV };
|
|
|
|
keyedMutex.acquireCount = 1;
|
|
|
|
keyedMutex.pAcquireSyncs = &mem;
|
|
|
|
keyedMutex.pAcquireKeys = &acquireKey;
|
|
|
|
keyedMutex.pAcquireTimeoutMilliseconds = &timeout;
|
|
|
|
keyedMutex.releaseCount = 1;
|
|
|
|
keyedMutex.pReleaseSyncs = &mem;
|
|
|
|
keyedMutex.pReleaseKeys = &releaseKey;
|
|
|
|
|
|
|
|
VkSubmitInfo submit_info = { VK_STRUCTURE_TYPE_SUBMIT_INFO, &keyedMutex };
|
|
|
|
submit_info.commandBufferCount = 1;
|
|
|
|
submit_info.pCommandBuffers = &cmd_buf;
|
|
|
|
vkQueueSubmit(queue, 1, &submit_info, VK_NULL_HANDLE);
|
|
|
|
|
|
|
|
----------------------------------------
|
|
|
|
|
|
|
|
=== Version History
|
|
|
|
|
|
|
|
* Revision 2, 2016-08-11 (James Jones)
|
|
|
|
- Updated sample code based on the NV external memory extensions.
|
|
|
|
- Renamed from NVX to NV extension.
|
|
|
|
- Added Overview and Description sections.
|
|
|
|
- Updated sample code to use the NV external memory extensions.
|
|
|
|
|
|
|
|
* Revision 1, 2016-06-14 (Carsten Rohde)
|
|
|
|
- Initial draft.
|