namespace vk
{
-std::vector<VkPhysicalDevice> enumeratePhysicalDevices (const InstanceInterface& vk, VkInstance instance)
+using std::vector;
+
+vector<VkPhysicalDevice> enumeratePhysicalDevices (const InstanceInterface& vk, VkInstance instance)
{
- deUint32 numDevices = 0;
- std::vector<VkPhysicalDevice> devices;
+ deUint32 numDevices = 0;
+ vector<VkPhysicalDevice> devices;
VK_CHECK(vk.enumeratePhysicalDevices(instance, &numDevices, DE_NULL));
return devices;
}
-std::vector<VkQueueFamilyProperties> getPhysicalDeviceQueueFamilyProperties (const InstanceInterface& vk, VkPhysicalDevice physicalDevice)
+vector<VkQueueFamilyProperties> getPhysicalDeviceQueueFamilyProperties (const InstanceInterface& vk, VkPhysicalDevice physicalDevice)
{
- deUint32 numQueues = 0;
- std::vector<VkQueueFamilyProperties> properties;
+ deUint32 numQueues = 0;
+ vector<VkQueueFamilyProperties> properties;
VK_CHECK(vk.getPhysicalDeviceQueueFamilyProperties(physicalDevice, &numQueues, DE_NULL));
return req;
}
+vector<VkLayerProperties> enumerateInstanceLayerProperties (const PlatformInterface& vkp)
+{
+ vector<VkLayerProperties> properties;
+ deUint32 numLayers = 0;
+
+ VK_CHECK(vkp.enumerateInstanceLayerProperties(&numLayers, DE_NULL));
+
+ if (numLayers > 0)
+ {
+ properties.resize(numLayers);
+ VK_CHECK(vkp.enumerateInstanceLayerProperties(&numLayers, &properties[0]));
+ TCU_CHECK((size_t)numLayers == properties.size());
+ }
+
+ return properties;
+}
+
+vector<VkExtensionProperties> enumerateInstanceExtensionProperties (const PlatformInterface& vkp, const char* layerName)
+{
+ vector<VkExtensionProperties> properties;
+ deUint32 numExtensions = 0;
+
+ VK_CHECK(vkp.enumerateInstanceExtensionProperties(layerName, &numExtensions, DE_NULL));
+
+ if (numExtensions > 0)
+ {
+ properties.resize(numExtensions);
+ VK_CHECK(vkp.enumerateInstanceExtensionProperties(layerName, &numExtensions, &properties[0]));
+ TCU_CHECK((size_t)numExtensions == properties.size());
+ }
+
+ return properties;
+}
+
+vector<VkLayerProperties> enumerateDeviceLayerProperties (const InstanceInterface& vki, VkPhysicalDevice physicalDevice)
+{
+ vector<VkLayerProperties> properties;
+ deUint32 numLayers = 0;
+
+ VK_CHECK(vki.enumerateDeviceLayerProperties(physicalDevice, &numLayers, DE_NULL));
+
+ if (numLayers > 0)
+ {
+ properties.resize(numLayers);
+ VK_CHECK(vki.enumerateDeviceLayerProperties(physicalDevice, &numLayers, &properties[0]));
+ TCU_CHECK((size_t)numLayers == properties.size());
+ }
+
+ return properties;
+}
+
+vector<VkExtensionProperties> enumerateDeviceExtensionProperties (const InstanceInterface& vki, VkPhysicalDevice physicalDevice, const char* layerName)
+{
+ vector<VkExtensionProperties> properties;
+ deUint32 numExtensions = 0;
+
+ VK_CHECK(vki.enumerateDeviceExtensionProperties(physicalDevice, layerName, &numExtensions, DE_NULL));
+
+ if (numExtensions > 0)
+ {
+ properties.resize(numExtensions);
+ VK_CHECK(vki.enumerateDeviceExtensionProperties(physicalDevice, layerName, &numExtensions, &properties[0]));
+ TCU_CHECK((size_t)numExtensions == properties.size());
+ }
+
+ return properties;
+}
+
} // vk
#include "tcuFormatUtil.hpp"
#include "deUniquePtr.hpp"
+#include "deMemory.h"
namespace vkt
{
using std::vector;
using std::string;
using tcu::TestLog;
+using tcu::ScopedLogSection;
tcu::TestStatus enumeratePhysicalDevices (Context& context)
{
TestLog& log = context.getTestContext().getLog();
- const vector<VkPhysicalDevice> devices = vk::enumeratePhysicalDevices(context.getInstanceInterface(), context.getInstance());
+ const vector<VkPhysicalDevice> devices = enumeratePhysicalDevices(context.getInstanceInterface(), context.getInstance());
log << TestLog::Integer("NumDevices", "Number of devices", "", QP_KEY_TAG_NONE, deInt64(devices.size()));
return tcu::TestStatus::pass("Enumerating devices succeeded");
}
-tcu::TestStatus queueProperties (Context& context)
+tcu::TestStatus enumerateInstanceLayers (Context& context)
+{
+ TestLog& log = context.getTestContext().getLog();
+ const vector<VkLayerProperties> properties = enumerateInstanceLayerProperties(context.getPlatformInterface());
+
+ for (size_t ndx = 0; ndx < properties.size(); ndx++)
+ log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
+
+ return tcu::TestStatus::pass("Enumerating layers succeeded");
+}
+
+tcu::TestStatus enumerateInstanceExtensions (Context& context)
+{
+ TestLog& log = context.getTestContext().getLog();
+
+ {
+ const ScopedLogSection section (log, "Global", "Global Extensions");
+ const vector<VkExtensionProperties> properties = enumerateInstanceExtensionProperties(context.getPlatformInterface(), DE_NULL);
+
+ for (size_t ndx = 0; ndx < properties.size(); ndx++)
+ log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
+ }
+
+ {
+ const vector<VkLayerProperties> layers = enumerateInstanceLayerProperties(context.getPlatformInterface());
+
+ for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
+ {
+ const ScopedLogSection section (log, layer->layerName, string("Layer: ") + layer->layerName);
+ const vector<VkExtensionProperties> properties = enumerateInstanceExtensionProperties(context.getPlatformInterface(), layer->layerName);
+
+ for (size_t extNdx = 0; extNdx < properties.size(); extNdx++)
+ log << TestLog::Message << extNdx << ": " << properties[extNdx] << TestLog::EndMessage;
+ }
+ }
+
+ return tcu::TestStatus::pass("Enumerating extensions succeeded");
+}
+
+tcu::TestStatus enumerateDeviceLayers (Context& context)
+{
+ TestLog& log = context.getTestContext().getLog();
+ const vector<VkLayerProperties> properties = vk::enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
+
+ for (size_t ndx = 0; ndx < properties.size(); ndx++)
+ log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
+
+ return tcu::TestStatus::pass("Enumerating layers succeeded");
+}
+
+tcu::TestStatus enumerateDeviceExtensions (Context& context)
+{
+ TestLog& log = context.getTestContext().getLog();
+
+ {
+ const ScopedLogSection section (log, "Global", "Global Extensions");
+ const vector<VkExtensionProperties> properties = enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), DE_NULL);
+
+ for (size_t ndx = 0; ndx < properties.size(); ndx++)
+ log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
+ }
+
+ {
+ const vector<VkLayerProperties> layers = enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
+
+ for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
+ {
+ const ScopedLogSection section (log, layer->layerName, string("Layer: ") + layer->layerName);
+ const vector<VkExtensionProperties> properties = enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), layer->layerName);
+
+ for (size_t extNdx = 0; extNdx < properties.size(); extNdx++)
+ log << TestLog::Message << extNdx << ": " << properties[extNdx] << TestLog::EndMessage;
+ }
+ }
+
+ return tcu::TestStatus::pass("Enumerating extensions succeeded");
+}
+
+tcu::TestStatus deviceFeatures (Context& context)
+{
+ TestLog& log = context.getTestContext().getLog();
+ VkPhysicalDeviceFeatures features;
+
+ deMemset(&features, 0, sizeof(features));
+
+ VK_CHECK(context.getInstanceInterface().getPhysicalDeviceFeatures(context.getPhysicalDevice(), &features));
+
+ log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage
+ << TestLog::Message << features << TestLog::EndMessage;
+
+ return tcu::TestStatus::pass("Query succeeded");
+}
+
+tcu::TestStatus deviceProperties (Context& context)
+{
+ TestLog& log = context.getTestContext().getLog();
+ VkPhysicalDeviceProperties props;
+
+ deMemset(&props, 0, sizeof(props));
+
+ VK_CHECK(context.getInstanceInterface().getPhysicalDeviceProperties(context.getPhysicalDevice(), &props));
+
+ log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage
+ << TestLog::Message << props << TestLog::EndMessage;
+
+ return tcu::TestStatus::pass("Query succeeded");
+}
+
+tcu::TestStatus deviceQueueFamilyProperties (Context& context)
{
TestLog& log = context.getTestContext().getLog();
const vector<VkQueueFamilyProperties> queueProperties = getPhysicalDeviceQueueFamilyProperties(context.getInstanceInterface(), context.getPhysicalDevice());
return tcu::TestStatus::pass("Querying queue properties succeeded");
}
-tcu::TestStatus memoryProperties (Context& context)
+tcu::TestStatus deviceMemoryProperties (Context& context)
{
TestLog& log = context.getTestContext().getLog();
{
de::MovePtr<tcu::TestCaseGroup> infoTests (new tcu::TestCaseGroup(testCtx, "info", "Platform Information Tests"));
- addFunctionCase(infoTests.get(), "physical_devices", "Physical devices", enumeratePhysicalDevices);
- addFunctionCase(infoTests.get(), "queue_properties", "Queue properties", queueProperties);
- addFunctionCase(infoTests.get(), "memory_properties", "Memory properties", memoryProperties);
+ {
+ de::MovePtr<tcu::TestCaseGroup> instanceInfoTests (new tcu::TestCaseGroup(testCtx, "instance", "Instance Information Tests"));
+
+ addFunctionCase(instanceInfoTests.get(), "physical_devices", "Physical devices", enumeratePhysicalDevices);
+ addFunctionCase(instanceInfoTests.get(), "layers", "Layers", enumerateInstanceLayers);
+ addFunctionCase(instanceInfoTests.get(), "extensions", "Extensions", enumerateInstanceExtensions);
+
+ infoTests->addChild(instanceInfoTests.release());
+ }
+
+ {
+ de::MovePtr<tcu::TestCaseGroup> deviceInfoTests (new tcu::TestCaseGroup(testCtx, "device", "Device Information Tests"));
+
+ addFunctionCase(deviceInfoTests.get(), "features", "Device Features", deviceFeatures);
+ addFunctionCase(deviceInfoTests.get(), "properties", "Device Properties", deviceProperties);
+ addFunctionCase(deviceInfoTests.get(), "queue_family_properties", "Queue family properties", deviceQueueFamilyProperties);
+ addFunctionCase(deviceInfoTests.get(), "memory_properties", "Memory properties", deviceMemoryProperties);
+ addFunctionCase(deviceInfoTests.get(), "layers", "Layers", enumerateDeviceLayers);
+ addFunctionCase(deviceInfoTests.get(), "extensions", "Extensions", enumerateDeviceExtensions);
+
+ infoTests->addChild(deviceInfoTests.release());
+ }
return infoTests.release();
}