more vk stuff
This commit is contained in:
parent
9b221b81b4
commit
6395c6b95c
20
src/main.cpp
20
src/main.cpp
|
@ -7,6 +7,9 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#define VK_ENABLE_BETA_EXTENSIONS
|
||||||
|
#endif
|
||||||
#define VULKAN_HPP_NO_CONSTRUCTORS
|
#define VULKAN_HPP_NO_CONSTRUCTORS
|
||||||
#include <vulkan/vulkan.hpp>
|
#include <vulkan/vulkan.hpp>
|
||||||
|
|
||||||
|
@ -85,20 +88,22 @@ class VulkanApp {
|
||||||
|
|
||||||
fn createInstance() -> void {
|
fn createInstance() -> void {
|
||||||
if (enableValidationLayers && !checkValidationLayerSupport())
|
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",
|
vk::ApplicationInfo appInfo { .pApplicationName = "Hello Triangle",
|
||||||
.applicationVersion = 1,
|
.applicationVersion = 1,
|
||||||
.pEngineName = "No Engine",
|
.pEngineName = "No Engine",
|
||||||
.engineVersion = 1,
|
.engineVersion = 1,
|
||||||
.apiVersion = VK_API_VERSION_1_0 };
|
.apiVersion = vk::ApiVersion10 };
|
||||||
|
|
||||||
// Retrieve extensions using custom function
|
// Retrieve extensions using custom function
|
||||||
std::vector<const char*> extensions = getRequiredExtensions();
|
std::vector<const char*> extensions = getRequiredExtensions();
|
||||||
|
|
||||||
// Enable the portability extension and set flags
|
// Enable the portability extension and set flags
|
||||||
extensions.push_back("VK_KHR_portability_enumeration");
|
extensions.push_back(vk::KHRPortabilityEnumerationExtensionName);
|
||||||
extensions.push_back("VK_KHR_get_physical_device_properties2");
|
#if VK_HEADER_VERSION < 110
|
||||||
|
extensions.push_back(vk::KHRGetPhysicalDeviceProperties2ExtensionName);
|
||||||
|
#endif
|
||||||
|
|
||||||
vk::InstanceCreateInfo createInfo {
|
vk::InstanceCreateInfo createInfo {
|
||||||
.flags = vk::InstanceCreateFlagBits::eEnumeratePortabilityKHR,
|
.flags = vk::InstanceCreateFlagBits::eEnumeratePortabilityKHR,
|
||||||
|
@ -187,13 +192,10 @@ class VulkanApp {
|
||||||
vk::PhysicalDeviceFeatures deviceFeatures;
|
vk::PhysicalDeviceFeatures deviceFeatures;
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#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()),
|
vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast<u32>(queueCreateInfos.size()),
|
||||||
.pQueueCreateInfos = queueCreateInfos.data(),
|
.pQueueCreateInfos = queueCreateInfos.data(),
|
||||||
.enabledExtensionCount = static_cast<u32>(deviceExtensions.size()),
|
.enabledExtensionCount = 1,
|
||||||
.ppEnabledExtensionNames = deviceExtensions.data(),
|
.ppEnabledExtensionNames = { vk::KHRPortabilitySubsetExtensionName },
|
||||||
.pEnabledFeatures = &deviceFeatures };
|
.pEnabledFeatures = &deviceFeatures };
|
||||||
#else
|
#else
|
||||||
vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast<u32>(queueCreateInfos.size()),
|
vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast<u32>(queueCreateInfos.size()),
|
||||||
|
|
Loading…
Reference in a new issue