@@ -5,9 +5,9 @@ It might be useful for some layers to implement an extension, such as
55This page explains the general approach that needs to be taken, and the
66specific API modifications that need to be applied for specific extensions.
77
8- Note that the core framework allows you to expose additional extensions via
8+ The core libGPULayers framework allows you to expose additional extensions via
99the default ` vkEnumerate*ExtensionProperties() ` implementation, but per-layer
10- code must implement the API modifications to other functions as needed.
10+ code must implement the API modifications in any other functions as needed.
1111
1212## Exposing a new extension
1313
@@ -20,13 +20,14 @@ add the new extension information that they want to expose to either:
2020* ` Instance::injectedDeviceExtensions ` for device extensions.
2121
2222Device extensions will be removed from this list if we can detect that the
23- underlying device already supports them, which means we can just pass through.
23+ underlying device already supports them, which means we can just pass through
24+ rather than emulating support.
2425
2526### Handling extended API entry points
2627
27- All entrypoints that are touched by an extension need to be intercepted with
28- a ` user_tag ` version of a function, which will implement the functionality that
29- the layer requires.
28+ All entrypoints that are touched by an extension need to be intercepted with a
29+ ` user_tag ` version of that function, which will implement the functionality
30+ that the layer requires.
3031
3132If the driver beneath the layer actually supports the extension, the extended
3233API parameters can be passed down to the driver without modification. This
@@ -37,7 +38,7 @@ this check to reduce performance overhead.
3738If the driver beneath the layer does not support the extension, the extended
3839API parameters should be rewritten to remove the extension before passing down
3940to the driver. User structure inputs to the Vulkan API are usually marked as
40- ` const ` , so we must take a safe-struct copy which we can modify and pass
41+ ` const ` , so we must take a safe-struct copy which we can modify and then pass
4142that copy to the driver.
4243
4344Note that Vulkan specifies that components must ignore structures in the
@@ -66,16 +67,20 @@ where CPU processing for frames can overlap, and for applications which
6667do not have frames, but that want to use tools such as RenderDoc that
6768require them.
6869
70+ The ` layer_gpu_timeline ` layer is an example of a layer exposing this
71+ extension using emulation on devices that do not support it.
72+
6973#### Exposing extension
7074
7175Adding exposure handling:
7276
7377* Add ` VK_EXT_frame_boundary ` to device extension list.
74- * Add ` VkPhysicalDeviceFrameBoundary ` to ` VkPhysicalDeviceFeatures2.pNext ` list
75- returned by ` vkGetPhysicalDeviceFeatures2() ` , or force existing structure to
76- ` VK_TRUE ` , if not supported by driver.
78+ * Populate the ` VkPhysicalDeviceFrameBoundary ` in the
79+ ` VkPhysicalDeviceFeatures2.pNext ` list returned by
80+ ` vkGetPhysicalDeviceFeatures2() ` , forcing the value to ` VK_TRUE ` , if the
81+ extension is "supported" but feature-disabled by the driver.
7782* Query ` VkPhysicalDeviceFrameBoundary ` in ` VkDeviceCreateInfo.pNext ` to see if
78- application enabled the extension. Strip if not supported by the driver.
83+ application enabled the extension.
7984
8085#### Implementing extension
8186
@@ -92,8 +97,9 @@ Adding implementation handling:
9297Most applications using this that I have seen are using it to demarcate frames
9398when using a single submitting render thread for off-screen rendering or
9499compute use cases that do not use ` vkQueuePresent() ` . In these systems just
95- detecting a change in frame ID is enough to indicate "frame changed", much
96- how we would use ` vkQueuePresent() ` to do the same without this extension.
100+ detecting the frame boundary flag in the extension structure passed to a queue
101+ submit is enough, and how we would use ` vkQueuePresent() ` to do the same
102+ without this extension.
97103
98104It is possible for applications to have multiple concurrent frames being
99105submitted in an overlapping manner, which can be handled by tagging work with
0 commit comments