From 68130a5c19717a0268f427b928616ac49dca23c0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Fri, 10 May 2019 03:49:20 +0200 Subject: [PATCH] remove full screen rectancle no longer needed --- src/vkvg_context.c | 9 ++++----- src/vkvg_context_internal.c | 15 ++++----------- src/vkvg_context_internal.h | 1 - src/vkvg_device_internal.c | 7 ------- src/vkvg_device_internal.h | 1 - src/vkvg_fonts.c | 2 -- 6 files changed, 8 insertions(+), 27 deletions(-) diff --git a/src/vkvg_context.c b/src/vkvg_context.c index 8dc1366..021b4dd 100644 --- a/src/vkvg_context.c +++ b/src/vkvg_context.c @@ -65,6 +65,10 @@ VkvgContext vkvg_create(VkvgSurface surf) ctx->curOperator = VKVG_OPERATOR_OVER; ctx->curFillRule = VKVG_FILL_RULE_NON_ZERO; ctx->curSavBit = 0x4; + ctx->vertCount = 0; + ctx->indCount = 0; + ctx->curIndStart = 0; + push_constants pc = { {.height=1}, @@ -117,10 +121,6 @@ VkvgContext vkvg_create(VkvgSurface surf) _update_descriptor_set (ctx, surf->dev->emptyImg, ctx->dsSrc); _update_gradient_desc_set(ctx); - //add full screen quad at the beginning, recurently used - _vao_add_rectangle (ctx,0,0,ctx->pSurf->width,ctx->pSurf->height); - - _init_cmd_buff (ctx); _clear_path (ctx); ctx->references = 1; @@ -133,7 +133,6 @@ VkvgContext vkvg_create(VkvgSurface surf) */ void vkvg_flush (VkvgContext ctx){ _flush_cmd_buff(ctx); - _init_cmd_buff(ctx); /* #ifdef DEBUG diff --git a/src/vkvg_context_internal.c b/src/vkvg_context_internal.c index 529761f..4375bd4 100644 --- a/src/vkvg_context_internal.c +++ b/src/vkvg_context_internal.c @@ -247,6 +247,10 @@ void _flush_cmd_buff (VkvgContext ctx){ vkh_cmd_end (ctx->cmd); _submit_wait_and_reset_cmd(ctx); + + ctx->vertCount = 0; + ctx->indCount = 0; + ctx->curIndStart = 0; } //bind correct draw pipeline depending on current OPERATOR @@ -264,17 +268,6 @@ void _bind_draw_pipeline (VkvgContext ctx) { break; } } -void _init_cmd_buff (VkvgContext ctx){ - //full surf quad triangles is at the beginning - ctx->vertCount = 4; - ctx->indCount = 6; - ctx->curIndStart = 6; - //VkClearValue clearValues[2]; - //clearValues[0].color = { { 0.0f, 0.0f, 0.0f, 1.0f } }; - //clearValues[1].depthStencil = { 1.0f, 0 }; - -} - void _start_cmd_for_render_pass (VkvgContext ctx) { vkh_cmd_begin (ctx->cmd,VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT); diff --git a/src/vkvg_context_internal.h b/src/vkvg_context_internal.h index ff8f891..cf400ae 100644 --- a/src/vkvg_context_internal.h +++ b/src/vkvg_context_internal.h @@ -171,7 +171,6 @@ void _vao_add_rectangle (VkvgContext ctx, float x, float y, float width, flo void _bind_draw_pipeline (VkvgContext ctx); void _create_cmd_buff (VkvgContext ctx); -void _init_cmd_buff (VkvgContext ctx); void _check_cmd_buff_state (VkvgContext ctx); void _flush_cmd_buff (VkvgContext ctx); void _record_draw_cmd (VkvgContext ctx); diff --git a/src/vkvg_device_internal.c b/src/vkvg_device_internal.c index a4c7b3d..5a7b18b 100644 --- a/src/vkvg_device_internal.c +++ b/src/vkvg_device_internal.c @@ -33,13 +33,6 @@ void _flush_all_contexes (VkvgDevice dev){ next = next->pPrev; } } -void _init_all_contexes (VkvgDevice dev){ - VkvgContext next = dev->lastCtx; - while (next != NULL){ - _init_cmd_buff (next); - next = next->pPrev; - } -} void _create_pipeline_cache(VkvgDevice dev){ diff --git a/src/vkvg_device_internal.h b/src/vkvg_device_internal.h index 44060e8..49f4ffa 100644 --- a/src/vkvg_device_internal.h +++ b/src/vkvg_device_internal.h @@ -107,7 +107,6 @@ VkRenderPass _createRenderPassNoResolve(VkvgDevice dev, VkAttachmentLoadOp loadO void _setupPipelines (VkvgDevice dev); void _createDescriptorSetLayout (VkvgDevice dev); void _flush_all_contexes (VkvgDevice dev); -void _init_all_contexes (VkvgDevice dev); void _wait_and_reset_device_fence (VkvgDevice dev); void _submit_cmd (VkvgDevice dev, VkCommandBuffer* cmd, VkFence fence); #endif diff --git a/src/vkvg_fonts.c b/src/vkvg_fonts.c index dbb34f6..3b138e7 100644 --- a/src/vkvg_fonts.c +++ b/src/vkvg_fonts.c @@ -135,8 +135,6 @@ void _increase_font_tex_array (VkvgDevice dev){ _update_descriptor_set (next, next->source, next->dsSrc); next = next->pPrev; } - - _init_all_contexes (dev); } ///Start a new line in font cache, increase texture layer count if needed. void _init_next_line_in_tex_cache (VkvgDevice dev, _vkvg_font_t* f){ -- 2.47.3