Sculpt: Fix T101502: GPU tris miscounted for dyntopo
Dyntopo PBVH draw was miscounting the number of triangles.
This commit is contained in:
@@ -707,26 +707,14 @@ struct PBVHBatches {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BMLoop *l = f->l_first;
|
BMLoop *l = f->l_first;
|
||||||
do {
|
callback(l->prev);
|
||||||
callback(l);
|
callback(l);
|
||||||
} while ((l = l->next) != f->l_first);
|
callback(l->next);
|
||||||
}
|
}
|
||||||
GSET_FOREACH_END();
|
GSET_FOREACH_END();
|
||||||
};
|
};
|
||||||
|
|
||||||
faces_count = 0;
|
faces_count = tris_count = count_faces(args);
|
||||||
GSET_FOREACH_BEGIN (BMFace *, f, args->bm_faces) {
|
|
||||||
if (BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
BMLoop *l = f->l_first;
|
|
||||||
do {
|
|
||||||
faces_count++;
|
|
||||||
} while ((l = l->next) != f->l_first);
|
|
||||||
}
|
|
||||||
GSET_FOREACH_END();
|
|
||||||
tris_count = faces_count;
|
|
||||||
|
|
||||||
int existing_num = GPU_vertbuf_get_vertex_len(vbo.vert_buf);
|
int existing_num = GPU_vertbuf_get_vertex_len(vbo.vert_buf);
|
||||||
void *existing_data = GPU_vertbuf_get_data(vbo.vert_buf);
|
void *existing_data = GPU_vertbuf_get_data(vbo.vert_buf);
|
||||||
@@ -741,7 +729,24 @@ struct PBVHBatches {
|
|||||||
GPUVertBufRaw access;
|
GPUVertBufRaw access;
|
||||||
GPU_vertbuf_attr_get_raw_data(vbo.vert_buf, 0, &access);
|
GPU_vertbuf_attr_get_raw_data(vbo.vert_buf, 0, &access);
|
||||||
|
|
||||||
|
#if 0 /* Enable to fuzz gpu data (to check for overallocation). */
|
||||||
|
existing_data = GPU_vertbuf_get_data(vbo.vert_buf);
|
||||||
|
uchar *c = static_cast<uchar *>(existing_data);
|
||||||
|
for (int i : IndexRange(vert_count * access.stride)) {
|
||||||
|
*c++ = i & 255;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (vbo.type) {
|
switch (vbo.type) {
|
||||||
|
case CD_PROP_COLOR:
|
||||||
|
case CD_PROP_BYTE_COLOR: {
|
||||||
|
ushort4 white = {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX};
|
||||||
|
|
||||||
|
foreach_bmesh([&](BMLoop * /*l*/) {
|
||||||
|
*static_cast<ushort4 *>(GPU_vertbuf_raw_step(&access)) = white;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
case CD_PBVH_CO_TYPE:
|
case CD_PBVH_CO_TYPE:
|
||||||
foreach_bmesh(
|
foreach_bmesh(
|
||||||
[&](BMLoop *l) { *static_cast<float3 *>(GPU_vertbuf_raw_step(&access)) = l->v->co; });
|
[&](BMLoop *l) { *static_cast<float3 *>(GPU_vertbuf_raw_step(&access)) = l->v->co; });
|
||||||
|
|||||||
Reference in New Issue
Block a user