]> O.S.I.I.S - jp/vkvg.git/commitdiff
check VK_EXT_debug_utils extension is loaded in debug mode, cancel device creation...
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 21 Aug 2020 23:01:27 +0000 (01:01 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 21 Aug 2020 23:01:27 +0000 (01:01 +0200)
src/shaders.h
src/vkvg_device.c
src/vkvg_device_internal.c
src/vkvg_device_internal.h
tests/svg.c

index 41cd07f5c6669d3c9e949a682b8eff7c299ffec0..ff10715e3657a5a3641bea7d182d3460d848f54f 100644 (file)
@@ -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,
index 74d0edfb64f4d486cf51f7ad5ca330847faea10e..4388ed9b2d90c301d54e247d2f91f722c5ed208f 100644 (file)
@@ -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);
 
index 79a8ff27241f0ee69f9d41334f2c2abd6e8f5fe9..44ca288b5ba06f7a4f82455e8f66cf7234956699 100644 (file)
@@ -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) {
index 8bf653c7ed6409a746b0f51f9cdcc617d68e3900..8d8da08d0f8cccd21c05458808621ec635f62ddd 100644 (file)
@@ -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);
index d00430299b1c89816ae226625069b3238eda09b0..12b897df174930ea33520a4d4abeb0bf172d5e79 100644 (file)
@@ -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);