]> O.S.I.I.S - jp/vkvg.git/commitdiff
resolve release build sigsev
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 8 Jan 2019 02:09:59 +0000 (03:09 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 8 Jan 2019 02:09:59 +0000 (03:09 +0100)
src/vkvg_device_internal.h
src/vkvg_fonts.c
src/vkvg_fonts.h
tests/vkengine.c
vkh

index ac479843413a34ce939d8a415b12a1be9c1cc1b0..e7366836c8593ad240984cc267122ec77389c322 100644 (file)
@@ -89,6 +89,7 @@ typedef struct _vkvg_device_t{
 
     VkhImage                emptyImg;//prevent unbound descriptor to trigger Validation error 61
     VkSampleCountFlags      samples;//samples count for all surfaces
+    vkvg_status_t           status;
 
     _font_cache_t*     fontCache;
     VkvgContext     lastCtx;    //double linked list last elmt
index 21049d110feb763780aeeefbd521d7b7e6bd3358..3215fa08f991c2dfcd360be920234118de6856b2 100644 (file)
@@ -34,7 +34,7 @@ void _init_fonts_cache (VkvgDevice dev){
 
     cache->config = FcInitLoadConfigAndFonts();
 
-    assert(!FT_Init_FreeType(&cache->library));
+    FT_CHECK_RESULT(FT_Init_FreeType(&cache->library));
 
     cache->cacheTexLength = FONT_CACHE_INIT_LAYERS;
     cache->cacheTex = vkh_tex2d_array_create ((VkhDevice)dev, VK_FORMAT_R8_UNORM, FONT_PAGE_SIZE, FONT_PAGE_SIZE,
@@ -174,7 +174,7 @@ void _dump_glyphs (FT_Face face){
     char gname[256];
 
     for (int i = 0; i < face->num_glyphs; ++i) {
-        assert(!FT_Load_Glyph(face,i,FT_LOAD_RENDER));
+        FT_CHECK_RESULT(FT_Load_Glyph(face,i,FT_LOAD_RENDER));
         slot = face->glyph;
 
         FT_Get_Glyph_Name(face,i,gname,256);
@@ -227,7 +227,7 @@ void _flush_chars_to_tex (VkvgDevice dev, _vkvg_font_t* f) {
 }
 
 _char_ref* _prepare_char (VkvgDevice dev, _vkvg_font_t* f, FT_UInt gindex){
-    assert(!FT_Load_Glyph(f->face, gindex, FT_LOAD_RENDER));
+    FT_CHECK_RESULT(FT_Load_Glyph(f->face, gindex, FT_LOAD_RENDER));
 
     FT_GlyphSlot slot = f->face->glyph;
     FT_Bitmap   bmp  = slot->bitmap;
@@ -319,8 +319,8 @@ void _update_current_font (VkvgContext ctx) {
             nf.fontFile = (char*)calloc(strlen(ctx->selectedFont.fontFile),sizeof(char));
             strcpy (nf.fontFile, ctx->selectedFont.fontFile);
 
-            assert(!FT_New_Face(cache->library, nf.fontFile, 0, &nf.face));
-            assert(!FT_Set_Char_Size(nf.face, 0, nf.charSize, dev->hdpi, dev->vdpi ));
+            FT_CHECK_RESULT(FT_New_Face(cache->library, nf.fontFile, 0, &nf.face));
+            FT_CHECK_RESULT(FT_Set_Char_Size(nf.face, 0, nf.charSize, dev->hdpi, dev->vdpi ));
             nf.hb_font = hb_ft_font_create(nf.face, NULL);
             nf.charLookup = (_char_ref**)calloc(nf.face->num_glyphs,sizeof(_char_ref*));
 
index 84f61282001deb80a418fcc01c74a06d1e4d1303..ac5ad8cd34a23023229a33b136d2502aed5e23cf 100644 (file)
 #define FONT_CACHE_INIT_LAYERS  2
 #define FONT_FILE_NAME_MAX_SIZE 256
 
+#define FT_CHECK_RESULT(f)                                                                                                                                                             \
+{                                                                                                                                                                                                              \
+    FT_Error res = (f);                                                                                                                                                                        \
+    if (res != 0)                                                                                                                                                              \
+    {                                                                                                                                                                                                  \
+        printf("Fatal : FreeType error is %d in %s at line %d\n", res,  __FILE__, __LINE__); \
+        assert(res == 0);                                                                                                                                              \
+    }                                                                                                                                                                                                  \
+}
+
 #include "vkvg_internal.h"
 #include "vkvg.h"
 #include "vkvg_buff.h"
index 148fc67ea852aacee391acdb4655b32b2a74efdc..435a054275b0dc155d542da71fd3137ee34dbf96 100644 (file)
@@ -94,10 +94,9 @@ vk_engine_t* vkengine_create (VkPhysicalDeviceType preferedGPU, uint32_t width,
     glfwWindowHint(GLFW_DECORATED,  GLFW_TRUE);
 
     e->window = glfwCreateWindow (width, height, "Window Title", NULL, NULL);
-    VkSurfaceKHR surf;
-
-    assert (glfwCreateWindowSurface(e->app->inst, e->window, NULL, &surf)==VK_SUCCESS);
 
+    VkSurfaceKHR surf;
+    VkResult res = glfwCreateWindowSurface(e->app->inst, e->window, NULL, &surf);
 
     VkhPhyInfo* phys = vkh_app_get_phyinfos (e->app, &phyCount, surf);
 
diff --git a/vkh b/vkh
index f2b18c96b0a919a35edaf13ee42593ee3ee55095..012ca283a29bca6dd6b828406fe490ff356484f1 160000 (submodule)
--- a/vkh
+++ b/vkh
@@ -1 +1 @@
-Subproject commit f2b18c96b0a919a35edaf13ee42593ee3ee55095
+Subproject commit 012ca283a29bca6dd6b828406fe490ff356484f1