]> O.S.I.I.S - jp/vkvg.git/commitdiff
test dual vbo/ibo with no cpu side cache, buffer mapped mems are written directly... dualvaotest
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sat, 15 Jan 2022 16:10:36 +0000 (17:10 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sat, 15 Jan 2022 16:10:36 +0000 (17:10 +0100)
src/vkvg_context.c
src/vkvg_context_internal.c
src/vkvg_context_internal.h
src/vkvg_device_internal.c

index f497a5442e8fb3f517fc6ca56d6b9363216e4fc1..03194b21d498db59e680b38a84665b8c241067d7 100644 (file)
@@ -55,8 +55,8 @@ VkvgContext vkvg_create(VkvgSurface surf)
        }
 
        ctx->sizePoints         = VKVG_PTS_SIZE;
-       ctx->sizeVertices       = ctx->sizeVBO = VKVG_VBO_SIZE;
-       ctx->sizeIndices        = ctx->sizeIBO = VKVG_IBO_SIZE;
+       ctx->sizeVBO            = VKVG_VBO_SIZE;
+       ctx->sizeIBO            = VKVG_IBO_SIZE;
        ctx->sizePathes         = VKVG_PATHES_SIZE;
        ctx->lineWidth          = 1;
        ctx->curOperator        = VKVG_OPERATOR_OVER;
@@ -99,24 +99,20 @@ VkvgContext vkvg_create(VkvgSurface surf)
 
        ctx->points     = (vec2*)malloc (VKVG_VBO_SIZE*sizeof(vec2));
        ctx->pathes     = (uint32_t*)malloc (VKVG_PATHES_SIZE*sizeof(uint32_t));
-       ctx->vertexCache = (Vertex*)malloc(ctx->sizeVertices * sizeof(Vertex));
-       ctx->indexCache = (VKVG_IBO_INDEX_TYPE*)malloc(ctx->sizeIndices * sizeof(VKVG_IBO_INDEX_TYPE));
+       //ctx->vertexCache = (Vertex*)malloc(ctx->sizeVertices * sizeof(Vertex));
+       //ctx->indexCache = (VKVG_IBO_INDEX_TYPE*)malloc(ctx->sizeIndices * sizeof(VKVG_IBO_INDEX_TYPE));
        ctx->savedStencils = malloc(0);
 
        ctx->selectedFontName = (char*)calloc(FONT_NAME_MAX_SIZE, sizeof(char));
        ctx->selectedCharSize = 10 << 6;
        ctx->currentFont = NULL;
 
-       if (!ctx->points || !ctx->pathes || !ctx->vertexCache || !ctx->indexCache || !ctx->savedStencils || !ctx->selectedFontName) {
+       if (!ctx->points || !ctx->pathes || !ctx->savedStencils || !ctx->selectedFontName) {
                dev->status = VKVG_STATUS_NO_MEMORY;
                if (ctx->points)
                        free(ctx->points);
                if (ctx->pathes)
                        free(ctx->pathes);
-               if (ctx->vertexCache)
-                       free(ctx->vertexCache);
-               if (ctx->indexCache)
-                       free(ctx->indexCache);
                if (ctx->savedStencils)
                        free(ctx->savedStencils);
                if (ctx->selectedFontName)
@@ -140,11 +136,15 @@ VkvgContext vkvg_create(VkvgSurface surf)
        _clear_path                             (ctx);
 
        ctx->cmd = ctx->cmdBuffers[0];//current recording buffer
+       ctx->vbo = ctx->vbos;
+       ctx->ibo = ctx->ibos;
+       ctx->vertexCache = ctx->vbo->allocInfo.pMappedData;
+       ctx->indexCache = ctx->ibo->allocInfo.pMappedData;
 
        ctx->references = 1;
        ctx->status = VKVG_STATUS_SUCCESS;
 
-       LOG(VKVG_LOG_DBG_ARRAYS, "INIT\tctx = %p; pathes:%ju pts:%ju vch:%d vbo:%d ich:%d ibo:%d\n", ctx, (uint64_t)ctx->sizePathes, (uint64_t)ctx->sizePoints, ctx->sizeVertices, ctx->sizeVBO, ctx->sizeIndices, ctx->sizeIBO);
+       LOG(VKVG_LOG_DBG_ARRAYS, "INIT\tctx = %p; pathes:%ju pts:%ju vbo:%d ibo:%d\n", ctx, (uint64_t)ctx->sizePathes, (uint64_t)ctx->sizePoints, ctx->sizeVBO, ctx->sizeIBO);
 
 #if defined(DEBUG) && defined (VKVG_DBG_UTILS)
        vkh_device_set_object_name((VkhDevice)dev, VK_OBJECT_TYPE_COMMAND_POOL, (uint64_t)ctx->cmdPool, "CTX Cmd Pool");
@@ -157,8 +157,10 @@ VkvgContext vkvg_create(VkvgSurface surf)
        vkh_device_set_object_name((VkhDevice)dev, VK_OBJECT_TYPE_DESCRIPTOR_SET, (uint64_t)ctx->dsFont, "CTX DescSet FONT");
        vkh_device_set_object_name((VkhDevice)dev, VK_OBJECT_TYPE_DESCRIPTOR_SET, (uint64_t)ctx->dsGrad, "CTX DescSet GRADIENT");
 
-       vkh_device_set_object_name((VkhDevice)dev, VK_OBJECT_TYPE_BUFFER, (uint64_t)ctx->indices.buffer, "CTX Index Buff");
-       vkh_device_set_object_name((VkhDevice)dev, VK_OBJECT_TYPE_BUFFER, (uint64_t)ctx->vertices.buffer, "CTX Vertex Buff");
+       vkh_device_set_object_name((VkhDevice)dev, VK_OBJECT_TYPE_BUFFER, (uint64_t)ctx->ibos[0].buffer, "CTX Index Buff A");
+       vkh_device_set_object_name((VkhDevice)dev, VK_OBJECT_TYPE_BUFFER, (uint64_t)ctx->vbos[0].buffer, "CTX Vertex Buff A");
+       vkh_device_set_object_name((VkhDevice)dev, VK_OBJECT_TYPE_BUFFER, (uint64_t)ctx->ibos[1].buffer, "CTX Index Buff B");
+       vkh_device_set_object_name((VkhDevice)dev, VK_OBJECT_TYPE_BUFFER, (uint64_t)ctx->vbos[1].buffer, "CTX Vertex Buff B");
 #endif
 
        return ctx;
@@ -202,7 +204,7 @@ void vkvg_destroy (VkvgContext ctx)
 
        vkvg_flush (ctx);
 
-       LOG(VKVG_LOG_DBG_ARRAYS, "END\tctx = %p; pathes:%d pts:%d vch:%d vbo:%d ich:%d ibo:%d\n", ctx, ctx->sizePathes, ctx->sizePoints, ctx->sizeVertices, ctx->sizeVBO, ctx->sizeIndices, ctx->sizeIBO);
+       LOG(VKVG_LOG_DBG_ARRAYS, "END\tctx = %p; pathes:%d pts:%d vbo:%d ibo:%d\n", ctx, ctx->sizePathes, ctx->sizePoints, ctx->sizeVBO, ctx->sizeIBO);
 
 #if VKVG_RECORDING
        if (ctx->recording)
@@ -241,11 +243,13 @@ void vkvg_destroy (VkvgContext ctx)
        vkDestroyDescriptorPool (dev, ctx->descriptorPool,NULL);
 
        vkvg_buffer_destroy (&ctx->uboGrad);
-       vkvg_buffer_destroy (&ctx->indices);
-       vkvg_buffer_destroy (&ctx->vertices);
+       vkvg_buffer_destroy (ctx->ibos);
+       vkvg_buffer_destroy (ctx->vbos);
+       vkvg_buffer_destroy (&ctx->ibos[1]);
+       vkvg_buffer_destroy (&ctx->vbos[1]);
 
-       free(ctx->vertexCache);
-       free(ctx->indexCache);
+       /*free(ctx->vertexCache);
+       free(ctx->indexCache);*/
 
        //TODO:check this for source counter
        //vkh_image_destroy       (ctx->source);
index d40d2b7f0a0e8f712e125f97c299a48f43d7f697..f0f1cfbcf9f6462b0d9b0017d12b5e84d2ba1f08 100644 (file)
 #ifdef VKVG_FILL_NZ_GLUTESS
 #include "glutess.h"
 #endif
-
-void _resize_vertex_cache (VkvgContext ctx, uint32_t newSize) {
-       Vertex* tmp = (Vertex*) realloc (ctx->vertexCache, (size_t)newSize * sizeof(Vertex));
-       LOG(VKVG_LOG_DBG_ARRAYS, "resize vertex cache (vx count=%u): old size: %u -> new size: %u size(byte): %zu Ptr: %p -> %p\n",
-               ctx->vertCount, ctx->sizeVertices, newSize, (size_t)newSize * sizeof(Vertex), ctx->vertexCache, tmp);
-       if (tmp == NULL){
-               ctx->status = VKVG_STATUS_NO_MEMORY;
-               LOG(VKVG_LOG_ERR, "resize vertex cache failed: vert count: %u byte size: %zu\n", newSize, newSize * sizeof(Vertex));
-               return;
-       }
-       ctx->vertexCache = tmp;
-       ctx->sizeVertices = newSize;
+void _resize_vbo (VkvgContext ctx, uint32_t new_size) {
+       ctx->sizeVBO = new_size;
+       uint32_t mod = ctx->sizeVBO % VKVG_VBO_SIZE;
+       if (mod > 0)
+               ctx->sizeVBO += VKVG_VBO_SIZE - mod;
+       LOG(VKVG_LOG_DBG_ARRAYS, "resize VBO: new size: %d\n", ctx->sizeVBO);
+       vkvg_buffer_destroy (ctx->vbo);
+       vkvg_buffer_create (ctx->pSurf->dev,
+               VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
+               VMA_MEMORY_USAGE_CPU_TO_GPU,
+               ctx->sizeVBO * sizeof(Vertex), ctx->vbo);
+       /*if (ctx->cmd == ctx->cmdBuffers[0])
+               ctx->vbos[0] = *ctx->vbo;
+       else
+               ctx->vbos[1] = *ctx->vbo;*/
 }
-void _resize_index_cache (VkvgContext ctx, uint32_t newSize) {
-       VKVG_IBO_INDEX_TYPE* tmp = (VKVG_IBO_INDEX_TYPE*) realloc (ctx->indexCache, (size_t)newSize * sizeof(VKVG_IBO_INDEX_TYPE));
-       LOG(VKVG_LOG_DBG_ARRAYS, "resize IBO: new size: %lu Ptr: %p -> %p\n", (size_t)newSize * sizeof(VKVG_IBO_INDEX_TYPE), ctx->indexCache, tmp);
-       if (tmp == NULL){
-               ctx->status = VKVG_STATUS_NO_MEMORY;
-               LOG(VKVG_LOG_ERR, "resize IBO failed: idx count: %u size(byte): %zu\n", newSize, (size_t)newSize * sizeof(VKVG_IBO_INDEX_TYPE));
-               return;
-       }
-       ctx->indexCache = tmp;
-       ctx->sizeIndices = newSize;
+void _resize_ibo (VkvgContext ctx, size_t new_size) {
+       ctx->sizeIBO = new_size;
+       uint32_t mod = ctx->sizeIBO % VKVG_IBO_SIZE;
+       if (mod > 0)
+               ctx->sizeIBO += VKVG_IBO_SIZE - mod;
+       LOG(VKVG_LOG_DBG_ARRAYS, "resize IBO: new size: %d\n", ctx->sizeIBO);
+       vkvg_buffer_destroy (ctx->ibo);
+       vkvg_buffer_create (ctx->pSurf->dev,
+               VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
+               VMA_MEMORY_USAGE_CPU_TO_GPU,
+               ctx->sizeIBO * sizeof(VKVG_IBO_INDEX_TYPE), ctx->ibo);
 }
 void _ensure_vertex_cache_size (VkvgContext ctx, uint32_t addedVerticesCount) {
-       if (ctx->sizeVertices - ctx->vertCount > VKVG_ARRAY_THRESHOLD + addedVerticesCount)
+       if (ctx->sizeVBO - ctx->vertCount > VKVG_ARRAY_THRESHOLD + addedVerticesCount)
                return;
-       uint32_t newSize = ctx->sizeVertices + addedVerticesCount;
+       uint32_t newSize = ctx->sizeVBO + addedVerticesCount;
        uint32_t modulo = addedVerticesCount % VKVG_VBO_SIZE;
        if (modulo > 0)
                newSize += VKVG_VBO_SIZE - modulo;
-       _resize_vertex_cache (ctx, newSize);
+       _resize_vbo (ctx, newSize);
 }
 void _check_vertex_cache_size (VkvgContext ctx) {
-       if (ctx->sizeVertices - ctx->vertCount > VKVG_ARRAY_THRESHOLD)
+       if (ctx->sizeVBO - ctx->vertCount > VKVG_ARRAY_THRESHOLD)
                return;
-       _resize_vertex_cache (ctx, ctx->sizeVertices + VKVG_VBO_SIZE);
+       _resize_vbo (ctx, ctx->sizeVBO + VKVG_VBO_SIZE);
 }
 void _ensure_index_cache_size (VkvgContext ctx, uint32_t addedIndicesCount) {
-       if (ctx->sizeIndices - ctx->indCount > VKVG_ARRAY_THRESHOLD + addedIndicesCount)
+       if (ctx->sizeIBO - ctx->indCount > VKVG_ARRAY_THRESHOLD + addedIndicesCount)
                return;
-       uint32_t newSize = ctx->sizeIndices + addedIndicesCount;
+       uint32_t newSize = ctx->sizeIBO + addedIndicesCount;
        uint32_t modulo = addedIndicesCount % VKVG_IBO_SIZE;
        if (modulo > 0)
                newSize += VKVG_IBO_SIZE - modulo;
-       _resize_index_cache (ctx, newSize);
+       _resize_ibo (ctx, newSize);
 }
 void _check_index_cache_size (VkvgContext ctx) {
-       if (ctx->sizeIndices - ctx->indCount > VKVG_ARRAY_THRESHOLD)
+       if (ctx->sizeIBO - ctx->indCount > VKVG_ARRAY_THRESHOLD)
                return;
-       _resize_index_cache (ctx, ctx->sizeIndices + VKVG_IBO_SIZE);
+       _resize_ibo (ctx, ctx->sizeIBO + VKVG_IBO_SIZE);
 }
 //check host path array size, return true if error. pathPtr is already incremented
 bool _check_pathes_array (VkvgContext ctx){
@@ -256,40 +260,21 @@ void _create_vertices_buff (VkvgContext ctx){
        vkvg_buffer_create (ctx->pSurf->dev,
                VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
                VMA_MEMORY_USAGE_CPU_TO_GPU,
-               ctx->sizeVBO * sizeof(Vertex), &ctx->vertices);
+               ctx->sizeVBO * sizeof(Vertex), ctx->vbos);
        vkvg_buffer_create (ctx->pSurf->dev,
-               VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
+               VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
                VMA_MEMORY_USAGE_CPU_TO_GPU,
-               ctx->sizeIBO * sizeof(VKVG_IBO_INDEX_TYPE), &ctx->indices);
-}
-void _resize_vbo (VkvgContext ctx, uint32_t new_size) {
-       if (!_wait_flush_fence (ctx))//wait previous cmd if not completed
-               return;
-       ctx->sizeVBO = new_size;
-       uint32_t mod = ctx->sizeVBO % VKVG_VBO_SIZE;
-       if (mod > 0)
-               ctx->sizeVBO += VKVG_VBO_SIZE - mod;
-       LOG(VKVG_LOG_DBG_ARRAYS, "resize VBO: new size: %d\n", ctx->sizeVBO);
-       vkvg_buffer_destroy (&ctx->vertices);
+               ctx->sizeVBO * sizeof(Vertex), &ctx->vbos[1]);
        vkvg_buffer_create (ctx->pSurf->dev,
-               VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
+               VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
                VMA_MEMORY_USAGE_CPU_TO_GPU,
-               ctx->sizeVBO * sizeof(Vertex), &ctx->vertices);
-}
-void _resize_ibo (VkvgContext ctx, size_t new_size) {
-       if (!_wait_flush_fence (ctx))//wait previous cmd if not completed
-               return;
-       ctx->sizeIBO = new_size;
-       uint32_t mod = ctx->sizeIBO % VKVG_IBO_SIZE;
-       if (mod > 0)
-               ctx->sizeIBO += VKVG_IBO_SIZE - mod;
-       LOG(VKVG_LOG_DBG_ARRAYS, "resize IBO: new size: %d\n", ctx->sizeIBO);
-       vkvg_buffer_destroy (&ctx->indices);
+               ctx->sizeIBO * sizeof(VKVG_IBO_INDEX_TYPE), ctx->ibos);
        vkvg_buffer_create (ctx->pSurf->dev,
                VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
                VMA_MEMORY_USAGE_CPU_TO_GPU,
-               ctx->sizeIBO * sizeof(VKVG_IBO_INDEX_TYPE), &ctx->indices);
+               ctx->sizeIBO * sizeof(VKVG_IBO_INDEX_TYPE), &ctx->ibos[1]);
 }
+
 void _add_vertexf (VkvgContext ctx, float x, float y){
        Vertex* pVert = &ctx->vertexCache[ctx->vertCount];
        pVert->pos.x = x;
@@ -418,12 +403,25 @@ bool _wait_and_submit_cmd (VkvgContext ctx){
 
        _submit_cmd (ctx->pSurf->dev, &ctx->cmd, ctx->flushFence);
 
-       if (ctx->cmd == ctx->cmdBuffers[0])
+       if (ctx->cmd == ctx->cmdBuffers[0]) {
                ctx->cmd = ctx->cmdBuffers[1];
-       else
+               ctx->vbo = &ctx->vbos[1];
+               ctx->ibo = &ctx->ibos[1];
+               ctx->vertexCache = ctx->vbo->allocInfo.pMappedData;
+       } else {
                ctx->cmd = ctx->cmdBuffers[0];
+               ctx->vbo = ctx->vbos;
+               ctx->ibo = ctx->ibos;
+               ctx->indexCache = ctx->ibo->allocInfo.pMappedData;
+       }
 
        ResetCommandBuffer (ctx->cmd, 0);
+
+       if (ctx->vbo->allocInfo.size < ctx->sizeVBO)
+               _resize_vbo(ctx, ctx->sizeVBO);
+       if (ctx->ibo->allocInfo.size < ctx->sizeIBO)
+               _resize_ibo(ctx, ctx->sizeIBO);
+
        ctx->cmdStarted = false;
        return true;
 }
@@ -450,32 +448,9 @@ bool _wait_and_submit_cmd (VkvgContext ctx){
                                                  VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
 }*/
 
-//pre flush vertices because of vbo or ibo too small, all vertices except last draw call are flushed
-//this function expects a vertex offset > 0
-void _flush_vertices_caches_until_vertex_base (VkvgContext ctx) {
-       _wait_flush_fence (ctx);
-
-       memcpy(ctx->vertices.allocInfo.pMappedData, ctx->vertexCache, ctx->curVertOffset * sizeof (Vertex));
-       memcpy(ctx->indices.allocInfo.pMappedData, ctx->indexCache, ctx->curIndStart * sizeof (VKVG_IBO_INDEX_TYPE));
-
-       //copy remaining vertices and indices to caches starts
-       ctx->vertCount -= ctx->curVertOffset;
-       ctx->indCount -= ctx->curIndStart;
-       memcpy(ctx->vertexCache, &ctx->vertexCache[ctx->curVertOffset], ctx->vertCount * sizeof (Vertex));
-       memcpy(ctx->indexCache, &ctx->indexCache[ctx->curIndStart], ctx->indCount * sizeof (VKVG_IBO_INDEX_TYPE));
-
-       ctx->curVertOffset = 0;
-       ctx->curIndStart = 0;
-}
 //copy vertex and index caches to the vbo and ibo vkbuffers used by gpu for drawing
 //current running cmd has to be completed to free usage of those
 void _flush_vertices_caches (VkvgContext ctx) {
-       if (!_wait_flush_fence (ctx))
-               return;
-
-       memcpy(ctx->vertices.allocInfo.pMappedData, ctx->vertexCache, ctx->vertCount * sizeof (Vertex));
-       memcpy(ctx->indices.allocInfo.pMappedData, ctx->indexCache, ctx->indCount * sizeof (VKVG_IBO_INDEX_TYPE));
-
        ctx->vertCount = ctx->indCount = ctx->curIndStart = ctx->curVertOffset = 0;
 }
 //this func expect cmdStarted to be true
@@ -488,27 +463,11 @@ void _end_render_pass (VkvgContext ctx) {
        ctx->renderPassBeginInfo.renderPass = ctx->pSurf->dev->renderPass;
 }
 
-void _check_vao_size (VkvgContext ctx) {
-       if (ctx->vertCount > ctx->sizeVBO || ctx->indCount > ctx->sizeIBO){
-               //vbo or ibo buffers too small
-               if (ctx->cmdStarted)
-                       //if cmd is started buffers, are already bound, so no resize is possible
-                       //instead we flush, and clear vbo and ibo caches
-                       _flush_cmd_until_vx_base (ctx);
-               if (ctx->vertCount > ctx->sizeVBO)              
-                       _resize_vbo(ctx, ctx->sizeVertices);
-               if (ctx->indCount > ctx->sizeIBO)
-                       _resize_ibo(ctx, ctx->sizeIndices);
-       }
-}
-
 //stroke and non-zero draw call for solid color flush
 void _emit_draw_cmd_undrawn_vertices (VkvgContext ctx){
        if (ctx->indCount == ctx->curIndStart)
                return;
 
-       _check_vao_size(ctx);
-
        _ensure_renderpass_is_started(ctx);
 
 #ifdef VKVG_WIRED_DEBUG
@@ -534,16 +493,6 @@ void _emit_draw_cmd_undrawn_vertices (VkvgContext ctx){
        ctx->curIndStart = ctx->indCount;
        ctx->curVertOffset = ctx->vertCount;
 }
-//preflush vertices with drawcommand already emited
-void _flush_cmd_until_vx_base (VkvgContext ctx){
-       _end_render_pass (ctx);
-       if (ctx->curVertOffset > 0){
-               LOG(VKVG_LOG_INFO, "FLUSH UNTIL VX BASE CTX: ctx = %p; vertices = %d; indices = %d\n", ctx, ctx->vertCount, ctx->indCount);
-               _flush_vertices_caches_until_vertex_base (ctx);
-       }
-       vkh_cmd_end (ctx->cmd);
-       _wait_and_submit_cmd (ctx);
-}
 void _flush_cmd_buff (VkvgContext ctx){
        _emit_draw_cmd_undrawn_vertices (ctx);
        if (!ctx->cmdStarted)
@@ -612,8 +561,8 @@ void _start_cmd_for_render_pass (VkvgContext ctx) {
                                                        0, 3, dss, 0, NULL);
 
        VkDeviceSize offsets[1] = { 0 };
-       CmdBindVertexBuffers(ctx->cmd, 0, 1, &ctx->vertices.buffer, offsets);
-       CmdBindIndexBuffer(ctx->cmd, ctx->indices.buffer, 0, VKVG_VK_INDEX_TYPE);
+       CmdBindVertexBuffers(ctx->cmd, 0, 1, &ctx->vbo->buffer, offsets);
+       CmdBindIndexBuffer(ctx->cmd, ctx->ibo->buffer, 0, VKVG_VK_INDEX_TYPE);
 
        _update_push_constants  (ctx);
 
index 537fc8f081cb30e08cc53b843a993c55ea4875d3..d49b81ef17ed79da84bf1e4dadd897237300afd3 100644 (file)
@@ -164,17 +164,19 @@ typedef struct _vkvg_context_t {
        vkvg_buff       uboGrad;                //uniform buff obj holdings gradient infos
 
        //vk buffers, holds data until flush
-       vkvg_buff       indices;                //index buffer with persistent map memory
+       vkvg_buff       ibos[2];                //index buffer with persistent map memory
+       vkvg_buff*      ibo;            //current recording index buffer
        uint32_t        sizeIBO;                //size of vk ibo
-       uint32_t        sizeIndices;    //reserved size
+       //uint32_t      sizeIndices;    //reserved size
        uint32_t        indCount;               //current indice count
 
        uint32_t        curIndStart;    //last index recorded in cmd buff
        VKVG_IBO_INDEX_TYPE     curVertOffset;  //vertex offset in draw indexed command
 
-       vkvg_buff       vertices;               //vertex buffer with persistent mapped memory
+       vkvg_buff       vbos[2];                //vertex buffer with persistent mapped memory
+       vkvg_buff*      vbo;                    //current recording vertex buffer
        uint32_t        sizeVBO;                //size of vk vbo size
-       uint32_t        sizeVertices;   //reserved size
+       //uint32_t      sizeVertices;   //reserved size
        uint32_t        vertCount;              //effective vertices count
 
        Vertex*         vertexCache;
@@ -292,11 +294,9 @@ void _vao_add_rectangle            (VkvgContext ctx, float x, float y, float width, float
 
 void _bind_draw_pipeline       (VkvgContext ctx);
 void _create_cmd_buff          (VkvgContext ctx);
-void _check_vao_size           (VkvgContext ctx);
 void _ensure_renderpass_is_started     (VkvgContext ctx);
 void _flush_cmd_buff           (VkvgContext ctx);
 void _emit_draw_cmd_undrawn_vertices(VkvgContext ctx);
-void _flush_cmd_until_vx_base (VkvgContext ctx);
 bool _wait_flush_fence         (VkvgContext ctx);
 void _reset_flush_fence                (VkvgContext ctx);
 bool _wait_and_submit_cmd      (VkvgContext ctx);
index 90556a283858282b9eb01dd8ea819123ec6a4e00..33d26a4b1a284ea10ac7ab07aa266f3ff5ca7aae 100644 (file)
@@ -68,7 +68,7 @@ void _flush_all_contexes (VkvgDevice dev){
        VkvgContext ctx = dev->lastCtx;
        while (ctx != NULL){
                if (ctx->cmdStarted)
-                       _flush_cmd_until_vx_base (ctx);
+                       _flush_cmd_buff (ctx);
 
                ctx = ctx->pPrev;
        }