• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2014-2024 The Khronos Group Inc.
2//
3// SPDX-License-Identifier: CC-BY-4.0
4
5include::{generated}/meta/{refprefix}VK_KHR_win32_surface.adoc[]
6
7=== Other Extension Metadata
8
9*Last Modified Date*::
10    2017-04-24
11*IP Status*::
12    No known IP claims.
13*Contributors*::
14  - Patrick Doane, Blizzard
15  - Faith Ekstrand, Intel
16  - Ian Elliott, LunarG
17  - Courtney Goeltzenleuchter, LunarG
18  - Jesse Hall, Google
19  - James Jones, NVIDIA
20  - Antoine Labour, Google
21  - Jon Leech, Khronos
22  - David Mao, AMD
23  - Norbert Nopper, Freescale
24  - Alon Or-bach, Samsung
25  - Daniel Rakos, AMD
26  - Graham Sellers, AMD
27  - Ray Smith, ARM
28  - Jeff Vigil, Qualcomm
29  - Chia-I Wu, LunarG
30
31=== Description
32
33The `VK_KHR_win32_surface` extension is an instance extension.
34It provides a mechanism to create a slink:VkSurfaceKHR object (defined by
35the `apiext:VK_KHR_surface` extension) that refers to a Win32 code:HWND, as
36well as a query to determine support for rendering to the windows desktop.
37
38include::{generated}/interfaces/VK_KHR_win32_surface.adoc[]
39
40=== Issues
41
421) Does Win32 need a way to query for compatibility between a particular
43physical device and a specific screen? Compatibility between a physical
44device and a window generally only depends on what screen the window is on.
45However, there is not an obvious way to identify a screen without already
46having a window on the screen.
47
48*RESOLVED*: No.
49While it may be useful, there is not a clear way to do this on Win32.
50However, a method was added to query support for presenting to the windows
51desktop as a whole.
52
532) If a native window object (code:HWND) is used by one graphics API, and
54then is later used by a different graphics API (one of which is Vulkan), can
55these uses interfere with each other?
56
57*RESOLVED*: Yes.
58
59Uses of a window object by multiple graphics APIs results in undefined:
60behavior.
61Such behavior may succeed when using one Vulkan implementation but fail when
62using a different Vulkan implementation.
63Potential failures include:
64
65  * Creating then destroying a flip presentation model DXGI swapchain on a
66    window object can prevent flink:vkCreateSwapchainKHR from succeeding on
67    the same window object.
68  * Creating then destroying a slink:VkSwapchainKHR on a window object can
69    prevent creation of a bitblt model DXGI swapchain on the same window
70    object.
71  * Creating then destroying a slink:VkSwapchainKHR on a window object can
72    effectively code:SetPixelFormat to a different format than the format
73    chosen by an OpenGL application.
74  * Creating then destroying a slink:VkSwapchainKHR on a window object on
75    one slink:VkPhysicalDevice can prevent flink:vkCreateSwapchainKHR from
76    succeeding on the same window object, but on a different
77    slink:VkPhysicalDevice that is associated with a different Vulkan ICD.
78
79In all cases the problem can be worked around by creating a new window
80object.
81
82Technical details include:
83
84  * Creating a DXGI swapchain over a window object can alter the object for
85    the remainder of its lifetime.
86    The alteration persists even after the DXGI swapchain has been
87    destroyed.
88    This alteration can make it impossible for a conformant Vulkan
89    implementation to create a slink:VkSwapchainKHR over the same window
90    object.
91    Mention of this alteration can be found in the remarks section of the
92    MSDN documentation for code:DXGI_SWAP_EFFECT.
93  * Calling GDI's code:SetPixelFormat (needed by OpenGL's WGL layer) on a
94    window object alters the object for the remainder of its lifetime.
95    The MSDN documentation for code:SetPixelFormat explains that a window
96    object's pixel format can be set only one time.
97  * Creating a slink:VkSwapchainKHR over a window object can alter the
98    object for its remaining lifetime.
99    Either of the above alterations may occur as a side effect of
100    flink:vkCreateSwapchainKHR.
101
102=== Version History
103
104  * Revision 1, 2015-09-23 (Jesse Hall)
105  ** Initial draft, based on the previous contents of VK_EXT_KHR_swapchain
106     (later renamed VK_EXT_KHR_surface).
107
108  * Revision 2, 2015-10-02 (James Jones)
109  ** Added presentation support query for win32 desktops.
110
111  * Revision 3, 2015-10-26 (Ian Elliott)
112  ** Renamed from VK_EXT_KHR_win32_surface to VK_KHR_win32_surface.
113
114  * Revision 4, 2015-11-03 (Daniel Rakos)
115  ** Added allocation callbacks to vkCreateWin32SurfaceKHR.
116
117  * Revision 5, 2015-11-28 (Daniel Rakos)
118  ** Updated the surface create function to take a pCreateInfo structure.
119
120  * Revision 6, 2017-04-24 (Jeff Juliano)
121  ** Add issue 2 addressing reuse of a native window object in a different
122     Graphics API, or by a different Vulkan ICD.
123