[Bf-blender-cvs] [7391c2fc33b] temp-vert-normals-cleanup: Fix build errors from GPU subdivision changes

Hans Goudey noreply at git.blender.org
Tue Dec 28 17:40:39 CET 2021


Commit: 7391c2fc33b5e65218fb53956a59cce537076e9b
Author: Hans Goudey
Date:   Tue Dec 28 10:40:31 2021 -0600
Branches: temp-vert-normals-cleanup
https://developer.blender.org/rB7391c2fc33b5e65218fb53956a59cce537076e9b

Fix build errors from GPU subdivision changes

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

M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
M	source/blender/makesdna/DNA_mesh_types.h

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

diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
index dd0c391ca4d..5d2ea923658 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
@@ -254,7 +254,7 @@ static void extract_pos_nor_init_subdiv(const DRWSubdivCache *subdiv_cache,
 }
 
 static void extract_pos_nor_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache,
-                                              const MeshRenderData *UNUSED(mr),
+                                              const MeshRenderData *mr,
                                               const MeshExtractLooseGeom *loose_geom,
                                               void *buffer,
                                               void *UNUSED(data))
@@ -284,11 +284,11 @@ static void extract_pos_nor_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache
     const MVert *loose_vert2 = &coarse_verts[loose_edge->v2];
 
     copy_v3_v3(edge_data[0].pos, loose_vert1->co);
-    normal_short_to_float_v3(edge_data[0].nor, loose_vert1->no);
+    copy_v3_v3(edge_data[0].nor, mr->vert_normals[loose_edge->v1]);
     edge_data[0].flag = 0.0f;
 
     copy_v3_v3(edge_data[1].pos, loose_vert2->co);
-    normal_short_to_float_v3(edge_data[1].nor, loose_vert2->no);
+    copy_v3_v3(edge_data[1].nor, mr->vert_normals[loose_edge->v2]);
     edge_data[1].flag = 0.0f;
 
     GPU_vertbuf_update_sub(
@@ -303,7 +303,7 @@ static void extract_pos_nor_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache
     const MVert *loose_vertex = &coarse_verts[loose_geom->verts[i]];
 
     copy_v3_v3(vert_data.pos, loose_vertex->co);
-    normal_short_to_float_v3(vert_data.nor, loose_vertex->no);
+    copy_v3_v3(vert_data.nor, mr->vert_normals[loose_geom->verts[i]]);
 
     GPU_vertbuf_update_sub(
         vbo, offset * sizeof(SubdivPosNorLoop), sizeof(SubdivPosNorLoop), &vert_data);
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index 338116dd1e9..fdd389c9c50 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -132,7 +132,16 @@ typedef struct Mesh_Runtime {
    */
   char wrapper_type_finalize;
 
-  void *_pad;
+  /**
+   * Settings for lazily evaluating the subdivision on the CPU if needed. These are
+   * set in the modifier when GPU subdivision can be performed.
+   */
+  char subsurf_apply_render;
+  char subsurf_use_optimal_display;
+  char _pad[2];
+  int subsurf_resolution;
+
+  void *_pad2;
 
   /**
    * Used to mark when derived data needs to be recalculated for a certain layer.
@@ -144,15 +153,6 @@ typedef struct Mesh_Runtime {
   int64_t cd_dirty_loop;
   int64_t cd_dirty_poly;
 
-  /**
-   * Settings for lazily evaluating the subdivision on the CPU if needed. These are
-   * set in the modifier when GPU subdivision can be performed.
-   */
-  char subsurf_apply_render;
-  char subsurf_use_optimal_display;
-  char _pad[2];
-  int subsurf_resolution;
-
 } Mesh_Runtime;
 
 typedef struct Mesh {
@@ -346,7 +346,7 @@ typedef struct Mesh {
 
   char _pad1[4];
 
-  void *_pad;
+  void *_pad2;
 
   Mesh_Runtime runtime;
 } Mesh;



More information about the Bf-blender-cvs mailing list