]> O.S.I.I.S - jp/vkvg.git/commitdiff
debug, log, comments
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 22 Nov 2019 03:47:55 +0000 (04:47 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 22 Nov 2019 03:47:55 +0000 (04:47 +0100)
src/vkvg_context.c
src/vkvg_context_internal.c
src/vkvg_context_internal.h

index 287a969943e322fa3595aec08fa2452fac75ad16..f93be7e21ddd8f45817c6b849f8444ef043cf082 100644 (file)
@@ -455,7 +455,7 @@ void vkvg_curve_to (VkvgContext ctx, float x1, float y1, float x2, float y2, flo
     /*cp.x = x3;
     cp.y = y3;
     if (!vec2_equ(ctx->points[ctx->pointCount-1],cp))*/
-    _add_point(ctx,x3,y3);
+        _add_point(ctx,x3,y3);
     _set_curve_end (ctx);
 }
 void vkvg_rel_curve_to (VkvgContext ctx, float x1, float y1, float x2, float y2, float x3, float y3) {
@@ -544,7 +544,7 @@ void vkvg_fill_preserve (VkvgContext ctx){
 
     LOG(LOG_INFO, "FILL: ctx = %lu; path cpt = %d;\n", ctx, ctx->pathPtr / 2);
 
-    if (ctx->curFillRule == VKVG_FILL_RULE_EVEN_ODD){
+     if (ctx->curFillRule == VKVG_FILL_RULE_EVEN_ODD){
         _poly_fill (ctx);
         _bind_draw_pipeline (ctx);
         CmdSetStencilCompareMask(ctx->cmd, VK_STENCIL_FRONT_AND_BACK, STENCIL_FILL_BIT);
@@ -668,8 +668,9 @@ void vkvg_stroke_preserve (VkvgContext ctx)
             v.pos = vec2_sub(p0, vhw);
             _add_vertex(ctx, v);
 
-            if (ctx->lineCap == VKVG_LINE_CAP_ROUND){
-                firstIdx = (VKVG_IBO_INDEX_TYPE)(ctx->vertCount - ctx->curVertOffset);
+            firstIdx = (VKVG_IBO_INDEX_TYPE)(ctx->vertCount - ctx->curVertOffset);
+
+            if (ctx->lineCap == VKVG_LINE_CAP_ROUND){                
                 float step = M_PIF / hw;
                 float a = acosf(n.x)+ M_PIF_2;
                 if (n.y < 0)
index 686ca21f78500aaa4b766f25fef5cf7235e1f798..964789449dc13b6d48b493065890759adc4e88c2 100644 (file)
@@ -240,6 +240,7 @@ void _add_tri_indices_for_rect (VkvgContext ctx, VKVG_IBO_INDEX_TYPE i){
     ctx->indCount+=6;
 
     _check_ibo_size(ctx);
+    LOG(LOG_INFO, "Rectangle IDX: %d %d %d | %d %d %d (count=%d)\n", inds[0], inds[1], inds[2], inds[3], inds[4], inds[5], ctx->indCount);
 }
 void _add_triangle_indices(VkvgContext ctx, VKVG_IBO_INDEX_TYPE i0, VKVG_IBO_INDEX_TYPE i1, VKVG_IBO_INDEX_TYPE i2){
     VKVG_IBO_INDEX_TYPE* inds = &ctx->indexCache[ctx->indCount];
@@ -249,6 +250,7 @@ void _add_triangle_indices(VkvgContext ctx, VKVG_IBO_INDEX_TYPE i0, VKVG_IBO_IND
     ctx->indCount+=3;
 
     _check_ibo_size(ctx);
+    LOG(LOG_INFO, "Triangle IDX: %d %d %d (count=%d)\n", i0,i1,i2,ctx->indCount);
 }
 void _vao_add_rectangle (VkvgContext ctx, float x, float y, float width, float height){
     Vertex v[4] =
@@ -290,7 +292,7 @@ inline void _reset_flush_fence (VkvgContext ctx) {
     vkResetFences (ctx->pSurf->dev->vkDev, 1, &ctx->flushFence);
 }
 void _wait_and_submit_cmd (VkvgContext ctx){
-    if (!ctx->cmdStarted)
+    if (!ctx->cmdStarted)//current cmd buff is empty, be aware that wait is also canceled!!
         return;
 
     _wait_flush_fence (ctx);
@@ -387,7 +389,9 @@ void _record_draw_cmd (VkvgContext ctx){
     _check_cmd_buff_state(ctx);
     CmdDrawIndexed(ctx->cmd, ctx->indCount - ctx->curIndStart, 1, ctx->curIndStart, (int32_t)ctx->curVertOffset, 0);
 
-    LOG(LOG_INFO, "RECORD DRAW CMD: ctx = %lu; vertices = %d; indices = %d\n", (ulong)ctx, ctx->vertCount - ctx->indexCache[ctx->curIndStart], ctx->indCount - ctx->curIndStart);
+    LOG(LOG_INFO, "RECORD DRAW CMD: ctx = %lu; vertices = %d; indices = %d (vxOff = %d idxStart = %d idxTot = %d )\n",
+        (ulong)ctx, ctx->vertCount - ctx->curVertOffset,
+        ctx->indCount - ctx->curIndStart, ctx->curVertOffset, ctx->curIndStart, ctx->indCount);
 
 #ifdef VKVG_WIRED_DEBUG
     CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineWired);
@@ -1097,7 +1101,7 @@ void _fill_ec (VkvgContext ctx){
 
         ptrPath+=2;
     }
-    _record_draw_cmd(ctx);
+    _record_draw_cmd(ctx);    
 }
 
 static const uint32_t one = 1;
index e742154252c52dfc54af68435ce23939c37d9187..e83fd3a4f94d7c75f979f8bc33dbb86214186d84 100644 (file)
@@ -125,10 +125,10 @@ typedef struct _vkvg_context_t {
     uint32_t*  pathes;
     size_t             sizePathes;
 
-    //if current path contains curves, start/end points are store next to the path start/stop
+    //if current path contains curves, curve's start/end points are store next to the path start/stop
     //curve start point = pathPtr + curvePtr
     //when closing of finishing path, pathPtr is incremented by 1 + pathPtr
-    //note:number of pathes can no longuer be computed from pathPtr/2, the array contains now curves datas
+    //note:number of pathes can no longer be computed from pathPtr/2, the array contains now curves datas
     uint32_t    curvePtr;
 
     float              lineWidth;