Skip to content

Commit d2644db

Browse files
committed
Allow layers to expose new extensions
1 parent 5f2c9a0 commit d2644db

File tree

11 files changed

+171
-31
lines changed

11 files changed

+171
-31
lines changed

generator/vk_layer/source/instance.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,18 @@ static std::unordered_map<void*, std::unique_ptr<Instance>> g_instances;
3838
const APIVersion Instance::minAPIVersion { 1, 1 };
3939

4040
/* See header for documentation. */
41-
const std::vector<std::string> Instance::extraDriverExtensions {
41+
const std::vector<std::string> Instance::requiredDriverExtensions {
4242
VK_EXT_DEBUG_UTILS_EXTENSION_NAME
4343
};
4444

4545
/* See header for documentation. */
46-
const std::vector<std::string> Instance::injectedLayerExtensions {};
46+
const std::vector<std::string> Instance::injectedInstanceExtensions {};
47+
48+
/* See header for documentation. */
49+
const std::vector<std::string> Instance::injectedDeviceExtensions {};
50+
51+
/* See header for documentation. */
52+
const std::vector<std::string> Instance::injectedAPIFunctions {};
4753

4854
/* See header for documentation. */
4955
void Instance::store(

generator/vk_layer/source/instance.hpp

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,34 @@ class Instance
143143
static const APIVersion minAPIVersion;
144144

145145
/**
146-
* @brief The minimum set of instance extensions needed from the underlying driver.
146+
* @brief Required extensions from the driver.
147+
*
148+
* The layer will attempt to enable these even if the application does not.
149+
*/
150+
static const std::vector<std::string> requiredDriverExtensions;
151+
152+
/**
153+
* @brief Additional instance extensions injected by the layer.
154+
*
155+
* The layer will expose these even if the driver does not.
147156
*/
148-
static const std::vector<std::string> extraDriverExtensions;
157+
static const std::vector<std::string> injectedInstanceExtensions;
149158

150159
/**
151-
* @brief The minimum set of instance extensions injected by the layer.
160+
* @brief Additional device extensions injected by the layer.
161+
*
162+
* The layer will expose these even if the driver does not.
163+
*/
164+
static const std::vector<std::string> injectedDeviceExtensions;
165+
166+
/**
167+
* @brief Additional API functions that are injected by the layer.
168+
*
169+
* This list must include both instance and device functions, because
170+
* vkGetInstanceProcAddr can (inefficiently) be used to return device
171+
* functions.
172+
*
173+
* The layer will expose these even if the driver does not.
152174
*/
153-
static const std::vector<std::string> injectedLayerExtensions;
175+
static const std::vector<std::string> injectedAPIFunctions;
154176
};

layer_example/source/instance.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,18 @@ static std::unordered_map<void*, std::unique_ptr<Instance>> g_instances;
3838
const APIVersion Instance::minAPIVersion { 1, 1 };
3939

4040
/* See header for documentation. */
41-
const std::vector<std::string> Instance::extraDriverExtensions {
41+
const std::vector<std::string> Instance::requiredDriverExtensions {
4242
VK_EXT_DEBUG_UTILS_EXTENSION_NAME
4343
};
4444

4545
/* See header for documentation. */
46-
const std::vector<std::string> Instance::injectedLayerExtensions {};
46+
const std::vector<std::string> Instance::injectedInstanceExtensions {};
47+
48+
/* See header for documentation. */
49+
const std::vector<std::string> Instance::injectedDeviceExtensions {};
50+
51+
/* See header for documentation. */
52+
const std::vector<std::string> Instance::injectedAPIFunctions {};
4753

4854
/* See header for documentation. */
4955
void Instance::store(VkInstance handle, std::unique_ptr<Instance>& instance)

layer_example/source/instance.hpp

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,34 @@ class Instance
137137
static const APIVersion minAPIVersion;
138138

139139
/**
140-
* @brief The minimum set of instance extensions needed from the underlying driver.
140+
* @brief Required extensions from the driver.
141+
*
142+
* The layer will attempt to enable these even if the application does not.
143+
*/
144+
static const std::vector<std::string> requiredDriverExtensions;
145+
146+
/**
147+
* @brief Additional instance extensions injected by the layer.
148+
*
149+
* The layer will expose these even if the driver does not.
141150
*/
142-
static const std::vector<std::string> extraDriverExtensions;
151+
static const std::vector<std::string> injectedInstanceExtensions;
143152

144153
/**
145-
* @brief The minimum set of instance extensions injected by the layer.
154+
* @brief Additional device extensions injected by the layer.
155+
*
156+
* The layer will expose these even if the driver does not.
157+
*/
158+
static const std::vector<std::string> injectedDeviceExtensions;
159+
160+
/**
161+
* @brief Additional API functions that are injected by the layer.
162+
*
163+
* This list must include both instance and device functions, because
164+
* vkGetInstanceProcAddr can (inefficiently) be used to return device
165+
* functions.
166+
*
167+
* The layer will expose these even if the driver does not.
146168
*/
147-
static const std::vector<std::string> injectedLayerExtensions;
169+
static const std::vector<std::string> injectedAPIFunctions;
148170
};

layer_gpu_profile/source/instance.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,18 @@ static std::unordered_map<void*, std::unique_ptr<Instance>> g_instances;
3838
const APIVersion Instance::minAPIVersion { 1, 1 };
3939

4040
/* See header for documentation. */
41-
const std::vector<std::string> Instance::extraDriverExtensions {
41+
const std::vector<std::string> Instance::requiredDriverExtensions {
4242
VK_EXT_DEBUG_UTILS_EXTENSION_NAME,
4343
};
4444

4545
/* See header for documentation. */
46-
const std::vector<std::string> Instance::injectedLayerExtensions {};
46+
const std::vector<std::string> Instance::injectedInstanceExtensions {};
47+
48+
/* See header for documentation. */
49+
const std::vector<std::string> Instance::injectedDeviceExtensions {};
50+
51+
/* See header for documentation. */
52+
const std::vector<std::string> Instance::injectedAPIFunctions {};
4753

4854
/* See header for documentation. */
4955
void Instance::store(VkInstance handle, std::unique_ptr<Instance>& instance)

layer_gpu_profile/source/instance.hpp

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,34 @@ class Instance
143143
static const APIVersion minAPIVersion;
144144

145145
/**
146-
* @brief The minimum set of instance extensions needed from the underlying driver.
146+
* @brief Required extensions from the driver.
147+
*
148+
* The layer will attempt to enable these even if the application does not.
149+
*/
150+
static const std::vector<std::string> requiredDriverExtensions;
151+
152+
/**
153+
* @brief Additional instance extensions injected by the layer.
154+
*
155+
* The layer will expose these even if the driver does not.
147156
*/
148-
static const std::vector<std::string> extraDriverExtensions;
157+
static const std::vector<std::string> injectedInstanceExtensions;
149158

150159
/**
151-
* @brief The minimum set of instance extensions injected by the layer.
160+
* @brief Additional device extensions injected by the layer.
161+
*
162+
* The layer will expose these even if the driver does not.
163+
*/
164+
static const std::vector<std::string> injectedDeviceExtensions;
165+
166+
/**
167+
* @brief Additional API functions that are injected by the layer.
168+
*
169+
* This list must include both instance and device functions, because
170+
* vkGetInstanceProcAddr can (inefficiently) be used to return device
171+
* functions.
172+
*
173+
* The layer will expose these even if the driver does not.
152174
*/
153-
static const std::vector<std::string> injectedLayerExtensions;
175+
static const std::vector<std::string> injectedAPIFunctions;
154176
};

layer_gpu_support/source/instance.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,18 @@ static std::unordered_map<void*, std::unique_ptr<Instance>> g_instances;
3838
const APIVersion Instance::minAPIVersion { 1, 1 };
3939

4040
/* See header for documentation. */
41-
const std::vector<std::string> Instance::extraDriverExtensions {
41+
const std::vector<std::string> Instance::requiredDriverExtensions {
4242
VK_EXT_DEBUG_UTILS_EXTENSION_NAME,
4343
};
4444

4545
/* See header for documentation. */
46-
const std::vector<std::string> Instance::injectedLayerExtensions {};
46+
const std::vector<std::string> Instance::injectedInstanceExtensions {};
47+
48+
/* See header for documentation. */
49+
const std::vector<std::string> Instance::injectedDeviceExtensions {};
50+
51+
/* See header for documentation. */
52+
const std::vector<std::string> Instance::injectedAPIFunctions {};
4753

4854
/* See header for documentation. */
4955
void Instance::store(VkInstance handle, std::unique_ptr<Instance>& instance)

layer_gpu_support/source/instance.hpp

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,34 @@ class Instance
142142
static const APIVersion minAPIVersion;
143143

144144
/**
145-
* @brief The minimum set of instance extensions needed from the underlying driver.
145+
* @brief Required extensions from the driver.
146+
*
147+
* The layer will attempt to enable these even if the application does not.
148+
*/
149+
static const std::vector<std::string> requiredDriverExtensions;
150+
151+
/**
152+
* @brief Additional instance extensions injected by the layer.
153+
*
154+
* The layer will expose these even if the driver does not.
146155
*/
147-
static const std::vector<std::string> extraDriverExtensions;
156+
static const std::vector<std::string> injectedInstanceExtensions;
148157

149158
/**
150-
* @brief The minimum set of instance extensions injected by the layer.
159+
* @brief Additional device extensions injected by the layer.
160+
*
161+
* The layer will expose these even if the driver does not.
162+
*/
163+
static const std::vector<std::string> injectedDeviceExtensions;
164+
165+
/**
166+
* @brief Additional API functions that are injected by the layer.
167+
*
168+
* This list must include both instance and device functions, because
169+
* vkGetInstanceProcAddr can (inefficiently) be used to return device
170+
* functions.
171+
*
172+
* The layer will expose these even if the driver does not.
151173
*/
152-
static const std::vector<std::string> injectedLayerExtensions;
174+
static const std::vector<std::string> injectedAPIFunctions;
153175
};

layer_gpu_timeline/source/instance.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,18 @@ static std::unordered_map<void*, std::unique_ptr<Instance>> g_instances;
3838
const APIVersion Instance::minAPIVersion { 1, 1 };
3939

4040
/* See header for documentation. */
41-
const std::vector<std::string> Instance::extraDriverExtensions {
41+
const std::vector<std::string> Instance::requiredDriverExtensions {
4242
VK_EXT_DEBUG_UTILS_EXTENSION_NAME,
4343
};
4444

4545
/* See header for documentation. */
46-
const std::vector<std::string> Instance::injectedLayerExtensions {};
46+
const std::vector<std::string> Instance::injectedInstanceExtensions {};
47+
48+
/* See header for documentation. */
49+
const std::vector<std::string> Instance::injectedDeviceExtensions {};
50+
51+
/* See header for documentation. */
52+
const std::vector<std::string> Instance::injectedAPIFunctions {};
4753

4854
/* See header for documentation. */
4955
void Instance::store(VkInstance handle, std::unique_ptr<Instance>& instance)

layer_gpu_timeline/source/instance.hpp

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,34 @@ class Instance
137137
static const APIVersion minAPIVersion;
138138

139139
/**
140-
* @brief The minimum set of instance extensions needed from the underlying driver.
140+
* @brief Required extensions from the driver.
141+
*
142+
* The layer will attempt to enable these even if the application does not.
143+
*/
144+
static const std::vector<std::string> requiredDriverExtensions;
145+
146+
/**
147+
* @brief Additional instance extensions injected by the layer.
148+
*
149+
* The layer will expose these even if the driver does not.
141150
*/
142-
static const std::vector<std::string> extraDriverExtensions;
151+
static const std::vector<std::string> injectedInstanceExtensions;
143152

144153
/**
145-
* @brief The minimum set of instance extensions injected by the layer.
154+
* @brief Additional device extensions injected by the layer.
155+
*
156+
* The layer will expose these even if the driver does not.
157+
*/
158+
static const std::vector<std::string> injectedDeviceExtensions;
159+
160+
/**
161+
* @brief Additional API functions that are injected by the layer.
162+
*
163+
* This list must include both instance and device functions, because
164+
* vkGetInstanceProcAddr can (inefficiently) be used to return device
165+
* functions.
166+
*
167+
* The layer will expose these even if the driver does not.
146168
*/
147-
static const std::vector<std::string> injectedLayerExtensions;
169+
static const std::vector<std::string> injectedAPIFunctions;
148170
};

0 commit comments

Comments
 (0)