forked from Dynamitos/Seele
Adding more Window validation
This commit is contained in:
1 parent
7271fe8a0b
commit
87390db80d
4 files changed
+50
-23
No files matched your search
@@ -667,6 +667,17 @@ Array<const char*> Graphics::getRequiredExtensions() {
|
||||
unsigned int glfwExtensionCount = 0;
|
||||
const char** glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount);
|
||||
|
||||
if (glfwExtensions == nullptr || glfwExtensionCount == 0) {
|
||||
const char* glfwError = nullptr;
|
||||
glfwGetError(&glfwError);
|
||||
std::string message = "GLFW did not report required Vulkan instance extensions";
|
||||
if (glfwError != nullptr) {
|
||||
message += ": ";
|
||||
message += glfwError;
|
||||
}
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < glfwExtensionCount; i++) {
|
||||
extensions.add(glfwExtensions[i]);
|
||||
}
|
||||
@@ -677,8 +688,12 @@ Array<const char*> Graphics::getRequiredExtensions() {
|
||||
}
|
||||
|
||||
void Graphics::initInstance(GraphicsInitializer initInfo) {
|
||||
glfwInit();
|
||||
assert(glfwVulkanSupported());
|
||||
if (!glfwInit()) {
|
||||
throw std::runtime_error("Failed to initialize GLFW");
|
||||
}
|
||||
if (!glfwVulkanSupported()) {
|
||||
throw std::runtime_error("GLFW: Vulkan not supported");
|
||||
}
|
||||
VkApplicationInfo appInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
|
||||
.pNext = nullptr,
|
||||
|
||||
Reference in new issue
Block a user