]> O.S.I.I.S - jp/vkvg.git/commitdiff
check draw batch size between path émissions to avoid ibo index out of bound
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Thu, 15 Jul 2021 05:43:32 +0000 (07:43 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Thu, 15 Jul 2021 05:43:32 +0000 (07:43 +0200)
src/vkvg_context.c

index bca11643d4d1a15a807fa538164defec84b9aab0..00f39328e8e3f8189a3556408a08ce50acfcafc0 100644 (file)
@@ -779,35 +779,16 @@ void vkvg_stroke_preserve (VkvgContext ctx)
                }else
                        _draw_stoke_cap (ctx, hw, ctx->points[curPathPointIdx], vec2_line_norm(ctx->points[curPathPointIdx-1], ctx->points[curPathPointIdx]), false);
 
-               /*if (ctx->vertCount - ctx->curVertOffset > VKVG_IBO_MAX) {
-                       _check_vao_size (ctx);
-                       _ensure_renderpass_is_started(ctx);
-
-                       //split triangle emission into batch adressable by VKVG_IBO_MAX (index type)
-                       VKVG_IBO_INDEX_TYPE indexMax = VKVG_IBO_MAX - VKVG_IBO_MAX % 3;
-                       uint32_t vxTot = ctx->vertCount;
-                       uint32_t idxTot = ctx->indCount;
-                       ctx->indCount = ctx->curIndStart;
-
-
-                       while (ctx->curVertOffset < vxTot) {
-                               while (ctx->indexCache[ctx->indCount] < indexMax)
-                                       ctx->indCount++;
-                               ctx->indCount -= ctx->indCount % 3;
-                               uint32_t minInd = 
-                               uint32_t newVertOffset = ctx->indexCache[ctx->indCount-1];
-
-                               _emit_draw (ctx);                               
-                       }
-
-               }               */      
-
                curPathPointIdx = firstPathPointIdx + pathPointCount;
 
                if (ptrSegment > 0)
                        ptrPath += ptrSegment;
                else
                        ptrPath++;
+
+               //limit batch size here to 1/3 of the ibo index type ability
+               if (ctx->vertCount - ctx->curVertOffset > VKVG_IBO_MAX / 3)
+                       _emit_draw_cmd_undrawn_vertices(ctx);
        }
 
 }