From: Jean-Philippe Bruyère Date: Fri, 21 Aug 2020 23:01:27 +0000 (+0200) Subject: check VK_EXT_debug_utils extension is loaded in debug mode, cancel device creation... X-Git-Tag: v0.2.0~107 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=52283db2923120b1be9b7b99561fb2db484c993f;p=jp%2Fvkvg.git check VK_EXT_debug_utils extension is loaded in debug mode, cancel device creation if not --- diff --git a/src/shaders.h b/src/shaders.h index 41cd07f..ff10715 100644 --- a/src/shaders.h +++ b/src/shaders.h @@ -1,5 +1,5 @@ unsigned char shader_comp_spv[] = { - 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x0d, 0x00, + 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x0d, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, @@ -301,7 +301,7 @@ unsigned char shader_comp_spv[] = { }; unsigned int shader_comp_spv_len = 3580; unsigned char shader2_comp_spv[] = { - 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x0d, 0x00, + 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x0d, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, @@ -521,7 +521,7 @@ unsigned char shader2_comp_spv[] = { }; unsigned int shader2_comp_spv_len = 2604; unsigned char vkvg_main_frag_spv[] = { - 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x0d, 0x00, + 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x0d, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, @@ -968,7 +968,7 @@ unsigned char vkvg_main_frag_spv[] = { }; unsigned int vkvg_main_frag_spv_len = 5320; unsigned char vkvg_main_vert_spv[] = { - 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x0d, 0x00, + 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x0d, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, @@ -1247,7 +1247,7 @@ unsigned char vkvg_main_vert_spv[] = { }; unsigned int vkvg_main_vert_spv_len = 3308; unsigned char vkvg_main_lcd_frag_spv[] = { - 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x0d, 0x00, + 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x0d, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, @@ -1732,7 +1732,7 @@ unsigned char vkvg_main_lcd_frag_spv[] = { }; unsigned int vkvg_main_lcd_frag_spv_len = 5784; unsigned char wired_frag_spv[] = { - 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x0d, 0x00, + 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x0d, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, diff --git a/src/vkvg_device.c b/src/vkvg_device.c index 74d0edf..4388ed9 100644 --- a/src/vkvg_device.c +++ b/src/vkvg_device.c @@ -72,7 +72,10 @@ VkvgDevice vkvg_device_create_multisample(VkInstance inst, VkPhysicalDevice phy, return dev; } - _init_function_pointers (dev); + if (!_init_function_pointers (dev)){ + dev->status = VKVG_STATUS_NULL_POINTER; + return dev; + } VkhPhyInfo phyInfos = vkh_phyinfo_create (dev->phy, NULL); diff --git a/src/vkvg_device_internal.c b/src/vkvg_device_internal.c index 79a8ff2..44ca288 100644 --- a/src/vkvg_device_internal.c +++ b/src/vkvg_device_internal.c @@ -409,7 +409,14 @@ void _submit_cmd (VkvgDevice dev, VkCommandBuffer* cmd, VkFence fence) { MUTEX_UNLOCK (&dev->gQMutex); } -void _init_function_pointers (VkvgDevice dev) { +bool _init_function_pointers (VkvgDevice dev) { +#ifdef DEBUG + if (vkGetInstanceProcAddr(dev->instance, "vkSetDebugUtilsObjectNameEXT")==VK_NULL_HANDLE){ + LOG(VKVG_LOG_ERR, "vkvg create device failed: 'VK_EXT_debug_utils' has to be loaded for Debug build%d\n", format); + return false; + } + vkh_device_init_debug_utils ((VkhDevice)dev); +#endif CmdBindPipeline = GetInstProcAddress(dev->instance, vkCmdBindPipeline); CmdBindDescriptorSets = GetInstProcAddress(dev->instance, vkCmdBindDescriptorSets); CmdBindIndexBuffer = GetInstProcAddress(dev->instance, vkCmdBindIndexBuffer); @@ -425,9 +432,7 @@ void _init_function_pointers (VkvgDevice dev) { CmdSetScissor = GetInstProcAddress(dev->instance, vkCmdSetScissor); CmdPushConstants = GetInstProcAddress(dev->instance, vkCmdPushConstants); CmdPushDescriptorSet = (PFN_vkCmdPushDescriptorSetKHR)vkGetInstanceProcAddr(dev->instance, "vkCmdDescriptorSet"); -#ifdef DEBUG - vkh_device_init_debug_utils ((VkhDevice)dev); -#endif + return true; } void _create_empty_texture (VkvgDevice dev, VkFormat format, VkImageTiling tiling) { diff --git a/src/vkvg_device_internal.h b/src/vkvg_device_internal.h index 8bf653c..8d8da08 100644 --- a/src/vkvg_device_internal.h +++ b/src/vkvg_device_internal.h @@ -96,7 +96,7 @@ typedef struct _vkvg_device_t{ VkvgContext lastCtx; /**< last element of double linked list of context, used to trigger font caching system update on all contexts*/ }vkvg_device; -void _init_function_pointers (VkvgDevice dev); +bool _init_function_pointers (VkvgDevice dev); void _create_empty_texture (VkvgDevice dev, VkFormat format, VkImageTiling tiling); bool _get_best_image_tiling (VkvgDevice dev, VkFormat format, VkImageTiling* pTiling); void _create_pipeline_cache (VkvgDevice dev); diff --git a/tests/svg.c b/tests/svg.c index d004302..12b897d 100644 --- a/tests/svg.c +++ b/tests/svg.c @@ -6,8 +6,6 @@ static float rotation = 0.f; static const char* path = "data/tiger.svg"; -//static const char* path = "data/vkvg.svg"; -//static const char* path = "data/testPiece.svg"; void test_svg_surface() { VkvgSurface svgSurf = vkvg_surface_create_from_svg(device, path);