From 8247bab0a75aac2bbecc6d3f7bcfd72a095270d5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Fri, 22 Nov 2019 04:47:55 +0100 Subject: [PATCH] debug, log, comments --- src/vkvg_context.c | 9 +++++---- src/vkvg_context_internal.c | 10 +++++++--- src/vkvg_context_internal.h | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/vkvg_context.c b/src/vkvg_context.c index 287a969..f93be7e 100644 --- a/src/vkvg_context.c +++ b/src/vkvg_context.c @@ -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) diff --git a/src/vkvg_context_internal.c b/src/vkvg_context_internal.c index 686ca21..9647894 100644 --- a/src/vkvg_context_internal.c +++ b/src/vkvg_context_internal.c @@ -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; diff --git a/src/vkvg_context_internal.h b/src/vkvg_context_internal.h index e742154..e83fd3a 100644 --- a/src/vkvg_context_internal.h +++ b/src/vkvg_context_internal.h @@ -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; -- 2.47.3