Compare commits
2 commits
658595e0c5
...
6395c6b95c
Author | SHA1 | Date | |
---|---|---|---|
Mars | 6395c6b95c | ||
Mars | 9b221b81b4 |
|
@ -1,4 +1,3 @@
|
|||
# noinspection SpellCheckingInspection
|
||||
Checks: >
|
||||
*,
|
||||
-ctad-maybe-unsupported,
|
||||
|
|
4
.clangd
4
.clangd
|
@ -1,4 +0,0 @@
|
|||
Diagnostics:
|
||||
Suppress: >
|
||||
-Wmissing-template-arg-list-after-template-kw,
|
||||
-Wctad-maybe-unsupported
|
20
src/main.cpp
20
src/main.cpp
|
@ -7,6 +7,9 @@
|
|||
#include <set>
|
||||
#include <stdexcept>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define VK_ENABLE_BETA_EXTENSIONS
|
||||
#endif
|
||||
#define VULKAN_HPP_NO_CONSTRUCTORS
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
|
@ -85,20 +88,22 @@ class VulkanApp {
|
|||
|
||||
fn createInstance() -> void {
|
||||
if (enableValidationLayers && !checkValidationLayerSupport())
|
||||
throw std::runtime_error("validation layers requested, but not available!");
|
||||
throw std::runtime_error("Validation layers requested, but not available!");
|
||||
|
||||
vk::ApplicationInfo appInfo { .pApplicationName = "Hello Triangle",
|
||||
.applicationVersion = 1,
|
||||
.pEngineName = "No Engine",
|
||||
.engineVersion = 1,
|
||||
.apiVersion = VK_API_VERSION_1_0 };
|
||||
.apiVersion = vk::ApiVersion10 };
|
||||
|
||||
// Retrieve extensions using custom function
|
||||
std::vector<const char*> extensions = getRequiredExtensions();
|
||||
|
||||
// Enable the portability extension and set flags
|
||||
extensions.push_back("VK_KHR_portability_enumeration");
|
||||
extensions.push_back("VK_KHR_get_physical_device_properties2");
|
||||
extensions.push_back(vk::KHRPortabilityEnumerationExtensionName);
|
||||
#if VK_HEADER_VERSION < 110
|
||||
extensions.push_back(vk::KHRGetPhysicalDeviceProperties2ExtensionName);
|
||||
#endif
|
||||
|
||||
vk::InstanceCreateInfo createInfo {
|
||||
.flags = vk::InstanceCreateFlagBits::eEnumeratePortabilityKHR,
|
||||
|
@ -187,13 +192,10 @@ class VulkanApp {
|
|||
vk::PhysicalDeviceFeatures deviceFeatures;
|
||||
|
||||
#ifdef __APPLE__
|
||||
// Add the portability subset extension
|
||||
std::vector<const char*> deviceExtensions = { "VK_KHR_portability_subset" };
|
||||
|
||||
vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast<u32>(queueCreateInfos.size()),
|
||||
.pQueueCreateInfos = queueCreateInfos.data(),
|
||||
.enabledExtensionCount = static_cast<u32>(deviceExtensions.size()),
|
||||
.ppEnabledExtensionNames = deviceExtensions.data(),
|
||||
.enabledExtensionCount = 1,
|
||||
.ppEnabledExtensionNames = { vk::KHRPortabilitySubsetExtensionName },
|
||||
.pEnabledFeatures = &deviceFeatures };
|
||||
#else
|
||||
vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast<u32>(queueCreateInfos.size()),
|
||||
|
|
Loading…
Reference in a new issue