]> git.tdb.fi Git - libs/gui.git/commitdiff
Add an option for enabling geometry shaders on Vulkan
authorMikko Rasa <tdb@tdb.fi>
Sun, 12 Dec 2021 11:01:15 +0000 (13:01 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 12 Dec 2021 11:02:32 +0000 (13:02 +0200)
source/graphics/vkxlib/vulkancontext.cpp
source/graphics/vulkancontext.h

index 34c0c511f749c6757820f1121893e2417117efbf..8e253e148b0fbc0a972701382ee42565ce313227 100644 (file)
@@ -62,7 +62,8 @@ string vulkan_error::get_error_message(unsigned code)
 
 VulkanOptions::VulkanOptions():
        enable_validation(false),
-       enable_debug_report(false)
+       enable_debug_report(false),
+       enable_geometry_shader(false)
 { }
 
 
@@ -193,12 +194,16 @@ void VulkanContext::platform_init(const VulkanOptions &opts)
                extensions.clear();
                extensions.push_back("VK_KHR_swapchain");
 
+               VkPhysicalDeviceFeatures features = { };
+               features.geometryShader = (opts.enable_geometry_shader ? VK_TRUE : VK_FALSE);
+
                VkDeviceCreateInfo device_create_info = { };
                device_create_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
                device_create_info.queueCreateInfoCount = 1;
                device_create_info.pQueueCreateInfos = &queue_create_info;
                device_create_info.enabledExtensionCount = extensions.size();
                device_create_info.ppEnabledExtensionNames = extensions.data();
+               device_create_info.pEnabledFeatures = &features;
 
                result = f.vkCreateDevice(priv->physical_device, &device_create_info, 0, &priv->device);
                if(result!=VK_SUCCESS)
index 44ac4a53cc6ae8108e3059b4b7c3ca8604142751..f80f5cb5ddc4363daed3ddc354bd0eb7a50a0abc 100644 (file)
@@ -24,6 +24,7 @@ struct VulkanOptions
 {
        bool enable_validation;
        bool enable_debug_report;
+       bool enable_geometry_shader;
 
        VulkanOptions();
 };