Output warning to stderr if an extension is not supported (#756)
This commit is contained in:
parent
d5be770f55
commit
3298455373
2 changed files with 24 additions and 0 deletions
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
#include <VulkanDevice.h>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace vks
|
||||
{
|
||||
|
|
@ -272,6 +273,12 @@ namespace vks
|
|||
|
||||
if (deviceExtensions.size() > 0)
|
||||
{
|
||||
for (const char* ext : deviceExtensions)
|
||||
{
|
||||
if (!extensionSupported(ext))
|
||||
std::cerr << ext << " device extension support seems to be missing" << std::endl;
|
||||
}
|
||||
|
||||
deviceCreateInfo.enabledExtensionCount = (uint32_t)deviceExtensions.size();
|
||||
deviceCreateInfo.ppEnabledExtensionNames = deviceExtensions.data();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
#include "vulkanexamplebase.h"
|
||||
#include <unordered_set>
|
||||
|
||||
std::vector<const char*> VulkanExampleBase::args;
|
||||
|
||||
|
|
@ -44,8 +45,24 @@ VkResult VulkanExampleBase::createInstance(bool enableValidation)
|
|||
instanceExtensions.push_back(VK_MVK_MACOS_SURFACE_EXTENSION_NAME);
|
||||
#endif
|
||||
|
||||
std::uint32_t extCount = 0;
|
||||
vkEnumerateInstanceExtensionProperties(nullptr, &extCount, nullptr);
|
||||
|
||||
std::unordered_set<std::string> supportedExtensions;
|
||||
if (extCount > 0)
|
||||
{
|
||||
std::vector<VkExtensionProperties> instanceExtensions(extCount);
|
||||
vkEnumerateInstanceExtensionProperties(nullptr, &extCount, instanceExtensions.data());
|
||||
|
||||
for (const auto &ext : instanceExtensions)
|
||||
supportedExtensions.emplace(ext.extensionName);
|
||||
}
|
||||
|
||||
if (enabledInstanceExtensions.size() > 0) {
|
||||
for (auto enabledExtension : enabledInstanceExtensions) {
|
||||
if (supportedExtensions.find(enabledExtension) == supportedExtensions.end())
|
||||
std::cerr << enabledExtension << " instance extension support seems to be missing" << std::endl;
|
||||
|
||||
instanceExtensions.push_back(enabledExtension);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue