m_instance_layer_names.push_back("VK_LAYER_LUNARG_object_tracker");
m_instance_layer_names.push_back("VK_LAYER_LUNARG_core_validation");
m_instance_layer_names.push_back("VK_LAYER_GOOGLE_unique_objects");
-
+ if (VkTestFramework::m_devsim_layer) {
+ if (InstanceLayerSupported("VK_LAYER_LUNARG_device_simulation")) {
+ m_instance_layer_names.push_back("VK_LAYER_LUNARG_device_simulation");
+ } else {
+ VkTestFramework::m_devsim_layer = false;
+ printf(" Did not find VK_LAYER_LUNARG_device_simulation layer so it will not be enabled.\n");
+ }
+ }
if (m_enableWSI) {
m_instance_extension_names.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
m_device_extension_names.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
const int max_mems = 32;
VkDeviceMemory mems[max_mems + 1];
- if (InstanceLayerSupported("VK_LAYER_LUNARG_device_profile_api")) {
- 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;
- }
+ if (!EnableDeviceProfileLayer()) return;
ASSERT_NO_FATAL_FAILURE(InitFramework(myDbgFunc, m_errorMonitor));
"Test VALIDATION_ERROR_14a004dc: offset must be less than or equal to "
"VkPhysicalDeviceLimits::maxVertexInputAttributeOffset");
- if (InstanceLayerSupported("VK_LAYER_LUNARG_device_profile_api")) {
- m_instance_layer_names.push_back("VK_LAYER_LUNARG_device_profile_api");
- }
+ EnableDeviceProfileLayer();
ASSERT_NO_FATAL_FAILURE(InitFramework(myDbgFunc, m_errorMonitor));
TEST_F(VkLayerTest, CreateImageViewFormatFeatureMismatch) {
TEST_DESCRIPTION("Create view with a format that does not have the same features as the image format.");
+ if (!EnableDeviceProfileLayer()) return;
+
ASSERT_NO_FATAL_FAILURE(InitFramework(myDbgFunc, m_errorMonitor));
ASSERT_NO_FATAL_FAILURE(InitState());
TEST_F(VkLayerTest, CreateImageViewFormatMismatchUnrelated) {
TEST_DESCRIPTION("Create an image with a color format, then try to create a depth view of it");
- if (InstanceLayerSupported("VK_LAYER_LUNARG_device_profile_api")) {
- 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;
- }
+ if (!EnableDeviceProfileLayer()) return;
+
ASSERT_NO_FATAL_FAILURE(InitFramework(myDbgFunc, m_errorMonitor));
ASSERT_NO_FATAL_FAILURE(InitState());
TEST_F(VkLayerTest, CreateImageViewNoMutableFormatBit) {
TEST_DESCRIPTION("Create an image view with a different format, when the image does not have MUTABLE_FORMAT bit");
+ if (!EnableDeviceProfileLayer()) return;
+
ASSERT_NO_FATAL_FAILURE(InitFramework(myDbgFunc, m_errorMonitor));
ASSERT_NO_FATAL_FAILURE(InitState());
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;
};
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");
}
const VkRenderPassBeginInfo &renderPassBeginInfo() const { return m_renderPassBeginInfo; }
bool InstanceLayerSupported(const char *name, uint32_t specVersion = 0, uint32_t implementationVersion = 0);
+ bool EnableDeviceProfileLayer();
bool InstanceExtensionSupported(const char *name, uint32_t specVersion = 0);
bool DeviceExtensionSupported(VkPhysicalDevice dev, const char *layer, const char *name, uint32_t specVersion = 0);
bool VkTestFramework::m_canonicalize_spv = false;
bool VkTestFramework::m_strip_spv = false;
bool VkTestFramework::m_do_everything_spv = false;
+bool VkTestFramework::m_devsim_layer = false;
int VkTestFramework::m_width = 0;
int VkTestFramework::m_height = 0;
m_strip_spv = true;
else if (optionMatch("--canonicalize-SPV", argv[i]))
m_canonicalize_spv = true;
+ else if (optionMatch("--devsim", argv[i]))
+ m_devsim_layer = true;
else if (optionMatch("--help", argv[i]) || optionMatch("-h", argv[i])) {
printf("\nOther options:\n");
printf(
static bool m_canonicalize_spv;
static bool m_strip_spv;
static bool m_do_everything_spv;
+ static bool m_devsim_layer;
char **ReadFileData(const char *fileName);
void FreeFileData(char **data);
VkTestFramework::VkTestFramework() {}
VkTestFramework::~VkTestFramework() {}
+// Define static elements
+bool VkTestFramework::m_devsim_layer = false;
+
VkFormat VkTestFramework::GetFormat(VkInstance instance, vk_testing::Device *device) {
VkFormatProperties format_props;
vkGetPhysicalDeviceFormatProperties(device->phy().handle(), VK_FORMAT_B8G8R8A8_UNORM, &format_props);
VkFormat GetFormat(VkInstance instance, vk_testing::Device *device);
bool GLSLtoSPV(const VkShaderStageFlagBits shader_type, const char *pshader, std::vector<unsigned int> &spv);
+ static bool m_devsim_layer;
};
class TestEnvironment : public ::testing::Environment {