From a702784e6f1afd84da3f08e62c96a811ced2d3ab Mon Sep 17 00:00:00 2001
From: Hans Goudey <hans@blender.org>
Date: Tue, 14 Nov 2023 16:28:46 +0100
Subject: [PATCH] Fix #114841: Sculpt Multires drawing broken with no mask

The GPU buffer type was replaced with `float` in 4151691552413785cc7a,
but the "no mask" case wasn't changed. We still assigned a `uchar` value
to a `float` pointer, which made the drawing look random. Instead do the
same fill we use for other PBVH types.

Pull Request: https://projects.blender.org/blender/blender/pulls/114846
---
 source/blender/draw/intern/draw_pbvh.cc | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/source/blender/draw/intern/draw_pbvh.cc b/source/blender/draw/intern/draw_pbvh.cc
index 42ff9cc3df9..15986810f75 100644
--- a/source/blender/draw/intern/draw_pbvh.cc
+++ b/source/blender/draw/intern/draw_pbvh.cc
@@ -623,10 +623,9 @@ struct PBVHBatches {
         });
       }
       else {
-        foreach_grids(
-            [&](int /*x*/, int /*y*/, int /*grid_index*/, CCGElem * /*elems*/[4], int /*i*/) {
-              *static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = 0;
-            });
+        MutableSpan(static_cast<float *>(GPU_vertbuf_get_data(vbo.vert_buf)),
+                    GPU_vertbuf_get_vertex_len(vbo.vert_buf))
+            .fill(0.0f);
       }
     }
     else if (vbo.type == CD_PBVH_FSET_TYPE) {
-- 
GitLab