Compare commits

...

2 commits

Author SHA1 Message Date
Mars 6395c6b95c
more vk stuff 2024-09-30 21:21:38 -04:00
Mars 9b221b81b4
remove unneeded stuff 2024-09-30 19:56:23 -04:00
3 changed files with 11 additions and 14 deletions

View file

@ -1,4 +1,3 @@
# noinspection SpellCheckingInspection
Checks: >
*,
-ctad-maybe-unsupported,

View file

@ -1,4 +0,0 @@
Diagnostics:
Suppress: >
-Wmissing-template-arg-list-after-template-kw,
-Wctad-maybe-unsupported

View file

@ -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()),