Support specifying next chain to instance creation, and inst extensions

This commit is contained in:
baldurk
2020-06-29 13:07:25 +01:00
parent 81e99a71c5
commit 6d23e59aa6
3 changed files with 23 additions and 2 deletions
+6
View File
@@ -202,6 +202,12 @@ struct InstanceCreateInfo : public VkInstanceCreateInfo
ppEnabledExtensionNames = exts.data();
}
InstanceCreateInfo &next(const void *next)
{
this->pNext = next;
return *this;
}
operator const VkInstanceCreateInfo *() const { return this; }
};
+14 -2
View File
@@ -85,6 +85,8 @@ void VulkanGraphicsTest::Prepare(int argc, char **argv)
if(volk && spv)
{
enabledInstExts = instExts;
enabledInstExts.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
#if defined(WIN32)
@@ -137,6 +139,15 @@ void VulkanGraphicsTest::Prepare(int argc, char **argv)
std::vector<VkExtensionProperties> supportedExts;
CHECK_VKR(vkh::enumerateInstanceExtensionProperties(supportedExts, NULL));
for(const char *l : enabledLayers)
{
std::vector<VkExtensionProperties> tmp;
CHECK_VKR(vkh::enumerateInstanceExtensionProperties(tmp, l));
for(const VkExtensionProperties &t : tmp)
supportedExts.push_back(t);
}
// strip any extensions that are not supported
for(auto it = enabledInstExts.begin(); it != enabledInstExts.end();)
{
@@ -186,8 +197,9 @@ void VulkanGraphicsTest::Prepare(int argc, char **argv)
TEST_LOG("Initialising Vulkan at VK%u.%u", VK_VERSION_MAJOR(vulkanVersion),
VK_VERSION_MINOR(vulkanVersion));
VkResult vkr = vkCreateInstance(vkh::InstanceCreateInfo(app, enabledLayers, enabledInstExts),
NULL, &inst);
VkResult vkr = vkCreateInstance(
vkh::InstanceCreateInfo(app, enabledLayers, enabledInstExts).next(instInfoNext), NULL,
&inst);
if(vkr == VK_SUCCESS)
{
+3
View File
@@ -234,6 +234,9 @@ struct VulkanGraphicsTest : public GraphicsTest
// device version
uint32_t devVersion;
// a custom struct to pass to vkInstanceCreateInfo::pNext
const void *instInfoNext = NULL;
// requested features
VkPhysicalDeviceFeatures features = {};