[Bf-blender-cvs] [7e1c56d9091] sculpt-dev: Sculpt-dev: fix sculpt colors for new opensubdiv system.

Joseph Eagar noreply at git.blender.org
Tue Jan 4 08:30:28 CET 2022


Commit: 7e1c56d90910047a47bdc8ea43466d5945caff02
Author: Joseph Eagar
Date:   Mon Jan 3 23:29:51 2022 -0800
Branches: sculpt-dev
https://developer.blender.org/rB7e1c56d90910047a47bdc8ea43466d5945caff02

Sculpt-dev: fix sculpt colors for new opensubdiv
            system.

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

M	source/blender/draw/intern/draw_cache.c
M	source/blender/draw/intern/draw_cache_extract_mesh.cc
M	source/blender/draw/intern/draw_cache_impl_mesh.c
M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc
M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_brushes.c
M	source/blender/editors/sculpt_paint/sculpt_cloth.c
M	source/blender/gpu/intern/gpu_buffers.c
M	source/blender/gpu/intern/gpu_vertex_format.cc

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

diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index ac3b0c3cefb..1889f93aef7 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -3458,7 +3458,7 @@ void drw_batch_cache_validate(Object *ob)
   }
 }
 
-ATTR_NO_OPT void drw_batch_cache_generate_requested(Object *ob)
+void drw_batch_cache_generate_requested(Object *ob)
 {
   const DRWContextState *draw_ctx = DRW_context_state_get();
   const Scene *scene = draw_ctx->scene;
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.cc b/source/blender/draw/intern/draw_cache_extract_mesh.cc
index 5c0f17f927e..711183d4ae5 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh.cc
+++ b/source/blender/draw/intern/draw_cache_extract_mesh.cc
@@ -566,22 +566,21 @@ static struct TaskNode *mesh_extract_render_data_node_create(struct TaskGraph *t
 /* ---------------------------------------------------------------------- */
 /** \name Extract Loop
  * \{ */
-
-ATTR_NO_OPT static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
-                                                           MeshBatchCache *cache,
-                                                           MeshBufferCache *mbc,
-                                                           Mesh *me,
-
-                                                           const bool is_editmode,
-                                                           const bool is_paint_mode,
-                                                           const bool is_mode_active,
-                                                           const float obmat[4][4],
-                                                           const bool do_final,
-                                                           const bool do_uvedit,
-                                                           const bool use_subsurf_fdots,
-                                                           const Scene *scene,
-                                                           const ToolSettings *ts,
-                                                           const bool use_hide)
+static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
+                                               MeshBatchCache *cache,
+                                               MeshBufferCache *mbc,
+                                               Mesh *me,
+
+                                               const bool is_editmode,
+                                               const bool is_paint_mode,
+                                               const bool is_mode_active,
+                                               const float obmat[4][4],
+                                               const bool do_final,
+                                               const bool do_uvedit,
+                                               const bool use_subsurf_fdots,
+                                               const Scene *scene,
+                                               const ToolSettings *ts,
+                                               const bool use_hide)
 {
   /* For each mesh where batches needs to be updated a sub-graph will be added to the task_graph.
    * This sub-graph starts with an extract_render_data_node. This fills/converts the required
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 50a7dc1ee92..6981c771173 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -537,10 +537,10 @@ static bool custom_data_match_attribute(const CustomData *custom_data,
   return false;
 }
 
-ATTR_NO_OPT static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Mesh *me,
-                                                               struct GPUMaterial **gpumat_array,
-                                                               int gpumat_array_len,
-                                                               DRW_MeshAttributes *attributes)
+static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Mesh *me,
+                                                   struct GPUMaterial **gpumat_array,
+                                                   int gpumat_array_len,
+                                                   DRW_MeshAttributes *attributes)
 {
   const Mesh *me_final = editmesh_final_or_this(me);
   const CustomData *cd_ldata = mesh_cd_ldata_get_from_mesh(me_final);
@@ -571,7 +571,7 @@ ATTR_NO_OPT static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Mesh *me,
           if (name[0] != '\0') {
             layer = CustomData_get_named_layer(cd_ldata, CD_MLOOPUV, name);
             type = CD_MTFACE;
-            
+
             if (layer == -1) {
               layer = CustomData_get_named_layer(cd_vdata, CD_PROP_COLOR, name);
               type = CD_PROP_COLOR;
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc
index b83bf4efbc7..ea702e5efdd 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc
@@ -152,7 +152,7 @@ static GPUVertCompType get_comp_type_for_type(CustomDataType type)
   }
 }
 
-ATTR_NO_OPT static void init_vbo_for_attribute(const MeshRenderData *mr,
+static void init_vbo_for_attribute(const MeshRenderData *mr,
                                    GPUVertBuf *vbo,
                                    const DRW_AttributeRequest &request,
                                    bool build_on_device,
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc
index c2285e0a374..8aadffb9467 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc
@@ -40,9 +40,9 @@ namespace blender::draw {
 /* get all vcol layers as AttributeRefs, filtered by vcol_layers.
  *  the casual use of std::vector should be okay here.
  */
-ATTR_NO_OPT static std::vector<AttributeRef> get_vcol_refs(const CustomData *cd_vdata,
-                                                           const CustomData *cd_ldata,
-                                                           const uint vcol_layers)
+static std::vector<AttributeRef> get_vcol_refs(const CustomData *cd_vdata,
+                                               const CustomData *cd_ldata,
+                                               const uint vcol_layers)
 {
   std::vector<AttributeRef> refs;
 
@@ -62,7 +62,7 @@ ATTR_NO_OPT static std::vector<AttributeRef> get_vcol_refs(const CustomData *cd_
       for (; i < cdata->totlayer && (CustomDataType)cdata->layers[i].type == type; i++, layeri++) {
         const CustomDataLayer *layer = cdata->layers + i;
 
-        if (/*!(vcol_layers & (1UL << layeri)) ||*/ (layer->flag & CD_FLAG_TEMPORARY)) {
+        if (!(vcol_layers & (1UL << layeri)) || (layer->flag & CD_FLAG_TEMPORARY)) {
           continue;
         }
 
@@ -111,12 +111,12 @@ extern "C" int mesh_cd_get_render_color_i(const Mesh *me,
 }
 
 /* Initialize the common vertex format for vcol for coarse and subdivided meshes. */
-ATTR_NO_OPT static void init_vcol_format(GPUVertFormat *format,
-                                         const MeshBatchCache *cache,
-                                         CustomData *cd_vdata,
-                                         CustomData *cd_ldata,
-                                         AttributeRef *attr_active,
-                                         AttributeRef *attr_render)
+static void init_vcol_format(GPUVertFormat *format,
+                             const MeshBatchCache *cache,
+                             CustomData *cd_vdata,
+                             CustomData *cd_ldata,
+                             AttributeRef *attr_active,
+                             AttributeRef *attr_render)
 {
   GPU_vertformat_deinterleave(format);
 
@@ -197,10 +197,10 @@ using gpuMeshVcol = struct gpuMeshVcol {
   ushort r, g, b, a;
 };
 
-ATTR_NO_OPT static void extract_vcol_init(const MeshRenderData *mr,
-                                          struct MeshBatchCache *cache,
-                                          void *buf,
-                                          void *UNUSED(tls_data))
+static void extract_vcol_init(const MeshRenderData *mr,
+                              struct MeshBatchCache *cache,
+                              void *buf,
+                              void *UNUSED(tls_data))
 {
   GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
   GPUVertFormat format = {0};
@@ -350,11 +350,11 @@ ATTR_NO_OPT static void extract_vcol_init(const MeshRenderData *mr,
   }
 }
 
-ATTR_NO_OPT static void extract_vcol_init_subdiv(const DRWSubdivCache *subdiv_cache,
-                                                 const MeshRenderData *UNUSED(mr),
-                                                 struct MeshBatchCache *cache,
-                                                 void *buffer,
-                                                 void *UNUSED(data))
+static void extract_vcol_init_subdiv(const DRWSubdivCache *subdiv_cache,
+                                     const MeshRenderData *UNUSED(mr),
+                                     struct MeshBatchCache *cache,
+                                     void *buffer,
+                                     void *UNUSED(data))
 {
   GPUVertBuf *dst_buffer = static_cast<GPUVertBuf *>(buffer);
   Mesh *coarse_mesh = subdiv_cache->mesh;
@@ -376,38 +376,71 @@ ATTR_NO_OPT static void extract_vcol_init_subdiv(const DRWSubdivCache *subdiv_ca
 
   gpuMeshVcol *mesh_vcol = (gpuMeshVcol *)GPU_vertbuf_get_data(src_data);
 
+  const CustomData *cd_vdata = &coarse_mesh->vdata;
   const CustomData *cd_ldata = &coarse_mesh->ldata;
 
   const uint vcol_layers = cache->cd_used.vcol;
 
+  std::vector<AttributeRef> refs = get_vcol_refs(cd_vdata, cd_ldata, vcol_layers);
+
+  gpuMeshVcol *vcol = mesh_vcol;
+


@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list