]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/vkxlib/vulkancontext.cpp
Add flag for tessellation shaders in Vulkan context
[libs/gui.git] / source / graphics / vkxlib / vulkancontext.cpp
index 51a623b8e2b15ddc1bd74e66b14fde7324292158..f25349974c8adfd3d47b1bb44ad5a1a9737d2b4f 100644 (file)
@@ -3,6 +3,7 @@
 #define VK_USE_PLATFORM_XLIB_KHR
 #include <vulkan/vulkan.h>
 #include <msp/core/application.h>
+#include <msp/debug/debugapi.h>
 #include <msp/io/print.h>
 #include "display_private.h"
 #include "vulkancontext.h"
@@ -63,7 +64,8 @@ string vulkan_error::get_error_message(unsigned code)
 VulkanOptions::VulkanOptions():
        enable_validation(false),
        enable_debug_report(false),
-       enable_geometry_shader(false)
+       enable_geometry_shader(false),
+       enable_tessellation_shader(false)
 { }
 
 
@@ -121,7 +123,7 @@ void VulkanContext::platform_init(const VulkanOptions &opts)
                {
                        VkDebugReportCallbackCreateInfoEXT debug_report_create_info = { };
                        debug_report_create_info.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT;
-                       debug_report_create_info.flags = VK_DEBUG_REPORT_WARNING_BIT_EXT|VK_DEBUG_REPORT_ERROR_BIT_EXT|VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT;
+                       debug_report_create_info.flags = VK_DEBUG_REPORT_WARNING_BIT_EXT|VK_DEBUG_REPORT_ERROR_BIT_EXT|VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT|VK_DEBUG_REPORT_INFORMATION_BIT_EXT;
                        debug_report_create_info.pfnCallback = &Private::debug_report_func;
                        debug_report_create_info.pUserData = this;
 
@@ -199,6 +201,7 @@ void VulkanContext::platform_init(const VulkanOptions &opts)
 
                VkPhysicalDeviceFeatures features = { };
                features.geometryShader = (opts.enable_geometry_shader ? VK_TRUE : VK_FALSE);
+               features.tessellationShader = (opts.enable_tessellation_shader ? VK_TRUE : VK_FALSE);
 
                VkDeviceCreateInfo device_create_info = { };
                device_create_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
@@ -254,9 +257,11 @@ VulkanContext::Private::Private():
        debug_report_callback(0)
 { }
 
-VkBool32 VulkanContext::Private::debug_report_func(VkDebugReportFlagsEXT, VkDebugReportObjectTypeEXT obj_type, uint64_t obj_id, size_t, int32_t, const char *layer_prefix, const char *message, void *)
+VkBool32 VulkanContext::Private::debug_report_func(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT, uint64_t, size_t, int32_t, const char *, const char *message, void *)
 {
-       IO::print(IO::cerr, "Vulkan debug report from %s: Object %d of type %d: %s\n", layer_prefix, obj_type, obj_id, message);
+       IO::print(IO::cerr, "%s\n", message);
+       if((flags&VK_DEBUG_REPORT_ERROR_BIT_EXT) && Debug::check_debugger()==Debug::GDB)
+               Debug::debug_break();
        return VK_FALSE;
 }