Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-10-24 17:25:04 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-10-24 17:25:04 +0300
commit4c6e07230f76c21e67f0d5ef15464ca7d55c404a (patch)
tree9bb6ac9dcdcacb5df7cee8ff8b514a90d092c558
parentb4007173267255cbfafdce3f4ccb4a8fd82e850b (diff)
Pencil: Fix regression (part2) with stroke buffer introduced in rB0ee9282b5c51
`vert_len` was being shadowed and index_min & max wasn't correctly set.
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c3
-rw-r--r--source/blender/draw/intern/draw_cache_impl_gpencil.cc7
2 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 525d166dba6..78e658d35eb 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -526,9 +526,6 @@ static void gpencil_stroke_cache_populate(bGPDlayer *gpl,
if (show_fill) {
int vfirst = gps->runtime.fill_start * 3;
int vcount = gps->tot_triangles * 3;
- if (do_sbuffer) {
- printf("draw_fill vfirst %d vcount %d\n", vfirst, vcount);
- }
gpencil_drawcall_add(iter, geom, vfirst, vcount);
}
diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.cc b/source/blender/draw/intern/draw_cache_impl_gpencil.cc
index 33cd62bd33f..b46a4907da8 100644
--- a/source/blender/draw/intern/draw_cache_impl_gpencil.cc
+++ b/source/blender/draw/intern/draw_cache_impl_gpencil.cc
@@ -619,10 +619,10 @@ static void gpencil_sbuffer_stroke_ensure(bGPdata *gpd, bool do_fill)
/* Calc uv data along the stroke. */
BKE_gpencil_stroke_uv_update(gps);
- int vert_len = gps->tot_triangles + (gps->totpoints + gpencil_stroke_is_cyclic(gps)) * 2;
+ int tri_len = gps->tot_triangles + (gps->totpoints + gpencil_stroke_is_cyclic(gps)) * 2;
/* Create IBO. */
GPUIndexBufBuilder ibo_builder;
- GPU_indexbuf_init(&ibo_builder, GPU_PRIM_TRIS, vert_len, 0xFFFFFFFFu);
+ GPU_indexbuf_init(&ibo_builder, GPU_PRIM_TRIS, tri_len, 0xFFFFFFFFu);
/* Create VBO. */
GPUUsageType vbo_flag = GPU_USAGE_STATIC | GPU_USAGE_FLAG_BUFFER_TEXTURE_ONLY;
GPUVertFormat *format = gpencil_stroke_format();
@@ -652,6 +652,9 @@ static void gpencil_sbuffer_stroke_ensure(bGPdata *gpd, bool do_fill)
/* HACK since we didn't use the builder API to avoid another malloc and copy,
* we need to set the number of indices manually. */
ibo_builder.index_len = gps->tot_triangles * 3;
+ ibo_builder.index_min = 0;
+ /* For this case, do not allow index compaction to avoid yet another preprocessing step. */
+ ibo_builder.index_max = 0xFFFFFFFFu - 1u;
gps->runtime.stroke_start = gps->tot_triangles;