tests:Add "--devsim" option
Add "--devsim" option to vk_layer_validation_tests. This will enable
the Device Simulation layer as the bottom layer on the stack.
It still requires the caller to set the VK_DEVSIM_FILENAME env var in
order to select the json profile that they want to test with.
When "--devsim" option is specified, the device_profile layer will not
be enabled by default when InitFramework() is called. Instead, any
tests that require the device_profile layer can call
EnableDeviceProfileLayer(). This function will cause the device profile
layer to replace the dev sim layer as the bottome layer on the stack.
diff --git a/tests/vkrenderframework.cpp b/tests/vkrenderframework.cpp
index e3b34af..e860f3f 100644
--- a/tests/vkrenderframework.cpp
+++ b/tests/vkrenderframework.cpp
@@ -89,6 +89,23 @@
return false;
};
+// Enable device profile as last layer on stack overriding devsim if there, or return if not available
+bool VkRenderFramework::EnableDeviceProfileLayer() {
+ if (InstanceLayerSupported("VK_LAYER_LUNARG_device_profile_api")) {
+ if (VkTestFramework::m_devsim_layer) {
+ assert(0 == strcmp(m_instance_layer_names.back(), "VK_LAYER_LUNARG_device_simulation"));
+ m_instance_layer_names.pop_back();
+ m_instance_layer_names.push_back("VK_LAYER_LUNARG_device_profile_api");
+ } else {
+ m_instance_layer_names.push_back("VK_LAYER_LUNARG_device_profile_api");
+ }
+ } else {
+ printf(" Did not find VK_LAYER_LUNARG_device_profile_api layer; skipped.\n");
+ return false;
+ }
+ return true;
+}
+
// Return true if extension name is found and spec value is >= requested spec value
bool VkRenderFramework::InstanceExtensionSupported(const char *ext_name, uint32_t spec) {
uint32_t ext_count = 0;
@@ -134,7 +151,8 @@
};
void VkRenderFramework::InitFramework(PFN_vkDebugReportCallbackEXT dbgFunction, void *userData) {
- if (InstanceLayerSupported("VK_LAYER_LUNARG_device_profile_api")) {
+ // Only enable device profile layer by default if devsim is not enabled
+ if (!VkTestFramework::m_devsim_layer && InstanceLayerSupported("VK_LAYER_LUNARG_device_profile_api")) {
m_instance_layer_names.push_back("VK_LAYER_LUNARG_device_profile_api");
}