tests: layer init moved to instance create - drop from device
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 8d62a93..f58d5e1 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -66,12 +66,12 @@
ErrorMonitor *m_errorMonitor;
virtual void SetUp() {
- const char *layer_names[] = {"MemTracker", "ObjectTracker"};
- const std::vector<const char *> layers(layer_names, layer_names + 2);
+ const char *extension_names[] = {"MemTracker", "ObjectTracker"};
+ const std::vector<const char *> extensions(extension_names, extension_names + 2);
size_t extSize = sizeof(uint32_t);
uint32_t extCount = 0;
- VkResult err;
+ VkResult U_ASSERT_ONLY err;
err = vkGetGlobalExtensionInfo(VK_EXTENSION_INFO_TYPE_COUNT, 0, &extSize, &extCount);
assert(!err);
@@ -79,16 +79,17 @@
extSize = sizeof(VkExtensionProperties);
bool32_t extFound;
- for (uint32_t i = 0; i < layers.size(); i++) {
+ for (uint32_t i = 0; i < extensions.size(); i++) {
extFound = 0;
for (uint32_t j = 0; j < extCount; j++) {
err = vkGetGlobalExtensionInfo(VK_EXTENSION_INFO_TYPE_PROPERTIES, j, &extSize, &extProp);
- if (!strcmp(layers[i], extProp.extName)) {
+ assert(!err);
+ if (!strcmp(extensions[i], extProp.extName)) {
extFound = 1;
break;
}
}
- ASSERT_EQ(extFound, 1) << "ERROR: Cannot find extension named " << layers[i] << " which is necessary to pass this test";
+ ASSERT_EQ(extFound, 1) << "ERROR: Cannot find extension named " << extensions[i] << " which is necessary to pass this test";
}
this->app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
@@ -99,7 +100,7 @@
this->app_info.engineVersion = 1;
this->app_info.apiVersion = VK_API_VERSION;
- InitFramework(layers);
+ InitFramework(extensions);
m_errorMonitor = new ErrorMonitor(inst);
}
diff --git a/tests/vkrenderframework.cpp b/tests/vkrenderframework.cpp
index d67a700..864f37d 100644
--- a/tests/vkrenderframework.cpp
+++ b/tests/vkrenderframework.cpp
@@ -60,11 +60,11 @@
void VkRenderFramework::InitFramework()
{
- const std::vector<const char *> layers;
- InitFramework(layers);
+ const std::vector<const char *> extensions;
+ InitFramework(extensions);
}
-void VkRenderFramework::InitFramework(const std::vector<const char *> &layers)
+void VkRenderFramework::InitFramework(const std::vector<const char *> &extensions)
{
VkResult err;
VkInstanceCreateInfo instInfo = {};
@@ -72,8 +72,8 @@
instInfo.pNext = NULL;
instInfo.pAppInfo = &app_info;
instInfo.pAllocCb = NULL;
- instInfo.extensionCount = 0;
- instInfo.ppEnabledExtensionNames = NULL;
+ instInfo.extensionCount = extensions.size();
+ instInfo.ppEnabledExtensionNames = (extensions.size()) ? &extensions[0] : NULL;;
err = vkCreateInstance(&instInfo, &this->inst);
ASSERT_VK_SUCCESS(err);
err = vkEnumeratePhysicalDevices(inst, &this->gpu_count, NULL);
@@ -83,7 +83,7 @@
ASSERT_VK_SUCCESS(err);
ASSERT_GE(this->gpu_count, 1) << "No GPU available";
- m_device = new VkDeviceObj(0, objs[0], layers);
+ m_device = new VkDeviceObj(0, objs[0]);
m_device->get_device_queue();
m_depthStencil = new VkDepthStencilObj();
@@ -271,15 +271,6 @@
queue_props = &gpu().queue_properties()[0];
}
-VkDeviceObj::VkDeviceObj(uint32_t id, VkPhysicalDevice obj, const std::vector<const char *> &layers) :
- vk_testing::Device(obj), id(id)
-{
- init(layers);
-
- props = gpu().properties();
- queue_props = &gpu().queue_properties()[0];
-}
-
void VkDeviceObj::get_device_queue()
{
ASSERT_NE(true, graphics_queues().empty());
diff --git a/tests/vkrenderframework.h b/tests/vkrenderframework.h
index 4d2e561..c84244f 100644
--- a/tests/vkrenderframework.h
+++ b/tests/vkrenderframework.h
@@ -35,7 +35,6 @@
{
public:
VkDeviceObj(uint32_t id, VkPhysicalDevice obj);
- VkDeviceObj(uint32_t id, VkPhysicalDevice obj, const std::vector<const char *> &layers);
VkDevice device() { return obj(); }
void get_device_queue();
diff --git a/tests/vktestbinding.cpp b/tests/vktestbinding.cpp
index 0190ee8..f084662 100644
--- a/tests/vktestbinding.cpp
+++ b/tests/vktestbinding.cpp
@@ -401,43 +401,6 @@
init(dev_info);
}
-void Device::init(const std::vector<const char *> &layers)
-{
- const char *ext_names[] = {
- "VK_WSI_LunarG",
- };
-
- // request all queues
- const std::vector<VkPhysicalDeviceQueueProperties> queue_props = gpu_.queue_properties();
- std::vector<VkDeviceQueueCreateInfo> queue_info;
- queue_info.reserve(queue_props.size());
- for (int i = 0; i < queue_props.size(); i++) {
- VkDeviceQueueCreateInfo qi = {};
- qi.queueNodeIndex = i;
- qi.queueCount = queue_props[i].queueCount;
- if (queue_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
- graphics_queue_node_index_ = i;
- }
- queue_info.push_back(qi);
- }
- VkLayerCreateInfo layer_info = {};
- if (layers.size()) {
- layer_info.sType = VK_STRUCTURE_TYPE_LAYER_CREATE_INFO;
- layer_info.layerCount = layers.size();
- layer_info.ppActiveLayerNames = &layers[0];
- }
-
- VkDeviceCreateInfo dev_info = {};
- dev_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
- dev_info.pNext = (layers.size()) ? static_cast<void *>(&layer_info) : NULL;
- dev_info.queueRecordCount = queue_info.size();
- dev_info.pRequestedQueues = &queue_info[0];
- dev_info.extensionCount = 1;
- dev_info.ppEnabledExtensionNames = ext_names;
- dev_info.flags = VK_DEVICE_CREATE_VALIDATION_BIT;
-
- init(dev_info);
-}
void Device::init(const VkDeviceCreateInfo &info)
{
diff --git a/tests/vktestbinding.h b/tests/vktestbinding.h
index 0ad984f..ca37380 100644
--- a/tests/vktestbinding.h
+++ b/tests/vktestbinding.h
@@ -214,7 +214,6 @@
// vkCreateDevice()
void init(const VkDeviceCreateInfo &info);
void init(bool enable_layers); // all queues, all extensions, etc
- void init(const std::vector<const char *> &layers);
void init() { init(false); };
const PhysicalGpu &gpu() const { return gpu_; }