• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2021-2024 The Khronos Group Inc.
2//
3// SPDX-License-Identifier: CC-BY-4.0
4
5= VK_GOOGLE_surfaceless_query
6:toc: left
7:refpage: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/
8:sectnums:
9
10This proposal regards layering OpenGL over Vulkan, and addresses a discrepancy
11where EGL is able to respond to certain queries before a surface is created,
12while Vulkan requires a surface for corresponding queries.
13
14== Problem Statement
15
16An application using EGL can query the list of supported ``EGLConfig``s, based on
17which it would create an `EGLSurface`.
18Additionally, based on the availability of extensions, it can provide a
19color space to `eglCreateWindowSurface` at the same time.
20
21In Vulkan, the format and color space information are retrievable from the
22`VkSurfaceKHR` through
23link:{refpage}vkGetPhysicalDeviceSurfaceFormatsKHR.html[`vkGetPhysicalDeviceSurfaceFormatsKHR`]
24When layering OpenGL over Vulkan, there needs to be a way to query this
25information before the surface is created.
26
27Similarly, the OpenGL implementation layer needs to know:
28
29- The supported present modes by the platform to be able to correctly expose
30  the `EGL_KHR_mutable_render_buffer` extension,
31- Whether protected surfaces are supported to be able to correctly expose the
32  `EGL_EXT_protected_content` extension.
33
34On some implementations and platforms, the surface formats, color spaces,
35present modes and support for protected content are identical for every
36surface, and such queries could in fact be answered before a surface is
37created.
38
39== Solution Space
40
41Currently, no cross-platform solution is known to exist to support layering
42OpenGL over Vulkan in this regard.
43
44=== Surfaceless Queries
45
46One solution is to modify the existing relevant queries to allow querying
47without a link:{refpage}VkSurfaceKHR.html[`VkSurfaceKHR`].
48This works on platforms where this information is truly global, which is
49currently the case with Google's Android and SwiftShader.
50
51Pros:
52
53- Trivial to implement and use
54
55Cons:
56
57- Works only on some platforms, and cannot be implemented on all platforms.
58
59== Proposal
60
61In VK_GOOGLE_surfaceless_query, the first solution is adopted primarily to
62accelerate producing working systems where OpenGL is layered on Vulkan.
63
64With this extension, the `surface` parameter can be `VK_NULL_HANDLE` in the
65following:
66
67- link:{refpage}vkGetPhysicalDeviceSurfaceFormatsKHR.html[`vkGetPhysicalDeviceSurfaceFormatsKHR`]
68- link:{refpage}vkGetPhysicalDeviceSurfacePresentModesKHR.html[`vkGetPhysicalDeviceSurfacePresentModesKHR`]
69- `pSurfaceInfo->surface` passed to
70  link:{refpage}vkGetPhysicalDeviceSurfaceCapabilities2KHR.html[`vkGetPhysicalDeviceSurfaceCapabilities2KHR`]
71  if
72  link:{refpage}VkSurfaceProtectedCapabilitiesKHR.html[`VkSurfaceProtectedCapabilitiesKHR`]
73  is chained to `pSurfaceCapabilities`.
74  In this case, only the protected information is populated, while
75  link:{refpage}VkSurfaceCapabilities2KHR.html[`VkSurfaceCapabilities2KHR`]`::surfaceCapabilities`
76  and any other chained structs will have undefined values.
77
78In all the above situations, calling the function with any valid `surface`
79parameter will produce identical results to calling it with `VK_NULL_HANDLE`.
80