Fix T98886: PBVH_GRIDS ignores face smooth flag on first gpu build

This commit is contained in:
Joseph Eagar 2022-06-29 21:04:07 -07:00 committed by Thomas Dinges
parent 9410d7bd2e
commit 8677874168
Notes: blender-bot 2023-02-14 08:58:01 +01:00
Referenced by issue #98886, Regression: Smooth shading issues with multiresolution
Referenced by issue #98661, 3.2: Potential candidates for corrective releases
3 changed files with 12 additions and 4 deletions

View File

@ -1301,9 +1301,14 @@ static void pbvh_update_draw_buffer_cb(void *__restrict userdata,
if (node->flag & PBVH_RebuildDrawBuffers) {
switch (pbvh->type) {
case PBVH_GRIDS:
node->draw_buffers = GPU_pbvh_grid_buffers_build(node->totprim, pbvh->grid_hidden);
case PBVH_GRIDS: {
bool smooth = node->totprim > 0 ?
pbvh->grid_flag_mats[node->prim_indices[0]].flag & ME_SMOOTH :
false;
node->draw_buffers = GPU_pbvh_grid_buffers_build(node->totprim, pbvh->grid_hidden, smooth);
break;
}
case PBVH_FACES:
node->draw_buffers = GPU_pbvh_mesh_buffers_build(
pbvh->mpoly,

View File

@ -53,7 +53,9 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const struct MPoly *mpoly,
/**
* Threaded: do not call any functions that use OpenGL calls!
*/
GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(int totgrid, unsigned int **grid_hidden);
GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(int totgrid,
unsigned int **grid_hidden,
bool smooth);
/**
* Threaded: do not call any functions that use OpenGL calls!

View File

@ -783,13 +783,14 @@ void GPU_pbvh_grid_buffers_update(GPU_PBVH_Buffers *buffers,
buffers->show_overlay = !empty_mask || !default_face_set;
}
GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(int totgrid, BLI_bitmap **grid_hidden)
GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(int totgrid, BLI_bitmap **grid_hidden, bool smooth)
{
GPU_PBVH_Buffers *buffers;
buffers = MEM_callocN(sizeof(GPU_PBVH_Buffers), "GPU_Buffers");
buffers->grid_hidden = grid_hidden;
buffers->totgrid = totgrid;
buffers->smooth = smooth;
buffers->show_overlay = false;