Commit: 3cefa13770a1a76f223e3183c494edf533739a2e
Author: Joseph Eagar
Date:   Wed Jun 29 21:04:07 2022 -0700
Branches: master
https://developer.blender.org/rB3cefa13770a1a76f223e3183c494edf533739a2e

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

===================================================================

M       source/blender/blenkernel/intern/pbvh.c
M       source/blender/gpu/GPU_buffers.h
M       source/blender/gpu/intern/gpu_buffers.c

===================================================================

diff --git a/source/blender/blenkernel/intern/pbvh.c 
b/source/blender/blenkernel/intern/pbvh.c
index 5e5443f48ca..00a4eee47e3 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1316,9 +1316,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,
diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h
index 1fe3b363687..89473ac0fe0 100644
--- a/source/blender/gpu/GPU_buffers.h
+++ b/source/blender/gpu/GPU_buffers.h
@@ -58,7 +58,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!
diff --git a/source/blender/gpu/intern/gpu_buffers.c 
b/source/blender/gpu/intern/gpu_buffers.c
index a1fe3d79223..8665b49f4aa 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -881,13 +881,14 @@ void GPU_pbvh_grid_buffers_update(PBVHGPUFormat *vbo_id,
   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;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to