45 [&](
const int i,
const int pos) {
46 loose_edge_data[pos * 2 + 0] = edges[i][0];
47 loose_edge_data[pos * 2 + 1] = edges[i][1];
62 for (const int face_index : range) {
63 const BMFace &face = *BM_face_at_index(&const_cast<BMesh &>(bm), face_index);
64 const BMLoop *loop = BM_FACE_FIRST_LOOP(&face);
65 for ([[maybe_unused]] const int i : IndexRange(face.len)) {
66 const int index = BM_elem_index_get(loop);
67 corners_data[index] = BM_elem_index_get(loop->v);
73 mr.loose_edges.foreach_index(
74 [&](
const int i,
const int pos) {
81 mr.loose_verts.to_indices(loose_vert_data);
105 [&](
const int i,
const int pos) {
106 loose_edge_data[pos * 2 + 0] = orig_index_edge[i];
107 loose_edge_data[pos * 2 + 1] = orig_index_edge[i];
114 [&](
const int i,
const int pos) {
115 loose_edge_data[pos * 2 + 0] = i;
116 loose_edge_data[pos * 2 + 1] = i;
129 for (const int face_index : range) {
130 const BMFace &face = *BM_face_at_index(&const_cast<BMesh &>(bm), face_index);
131 const BMLoop *loop = BM_FACE_FIRST_LOOP(&face);
132 for ([[maybe_unused]] const int i : IndexRange(face.len)) {
133 const int index = BM_elem_index_get(loop);
134 corners_data[index] = BM_elem_index_get(loop->e);
140 mr.loose_edges.foreach_index_optimized<
int>(
141 [&](
const int i,
const int pos) {
142 loose_edge_data[pos * 2 + 0] = i;
143 loose_edge_data[pos * 2 + 1] = i;
145 exec_mode::grain_size(4096));
166 for (const int face : range) {
167 vbo_data.slice(faces[face]).fill(orig_index_face[face]);
180 for (const int face_index : range) {
181 const BMFace &face = *BM_face_at_index(&const_cast<BMesh &>(bm), face_index);
182 const IndexRange face_range(BM_elem_index_get(BM_FACE_FIRST_LOOP(&face)), face.len);
183 vbo_data.slice(face_range).fill(face_index);
213 loose_edges.
size() * verts_per_edge);
215 const int2 edge = coarse_edges[i];
248 if (vbo_data[i] == -1) {
268 loose_edges.
size() * verts_per_edge);
271 data.slice(i * verts_per_edge, verts_per_edge).fill(
index);
#define BM_elem_index_get(ele)
constexpr IndexRange()=default
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
constexpr MutableSpan take_back(const int64_t n) const
constexpr T * data() const
constexpr MutableSpan take_front(const int64_t n) const
constexpr const T * data() const
void foreach_index_optimized(Fn &&fn, Mode mode=exec_mode::serial) const
void to_indices(MutableSpan< T > r_indices) const
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) const
IndexRange index_range() const
void gather(const GVArray &src, const IndexMask &indices, GMutableSpan dst, exec_mode::Mode mode=exec_mode::parallel)
void copy(const GVArray &src, GMutableSpan dst, exec_mode::Mode mode=exec_mode::parallel)
void fill_index_range(MutableSpan< T > span, const T start=0)
void extract_mesh_loose_edge_data(const Span< T > vert_data, const Span< int2 > edges, const IndexMask &loose_edges, MutableSpan< T > gpu_data)
int subdiv_loose_edges_num(const MeshRenderData &mr, const DRWSubdivCache &cache)
static void extract_vert_index_bm(const MeshRenderData &mr, MutableSpan< int > vbo_data)
static void extract_face_index_bm(const MeshRenderData &mr, MutableSpan< int > vbo_data)
int subdiv_verts_per_coarse_edge(const DRWSubdivCache &cache)
gpu::VertBufPtr extract_edge_index(const MeshRenderData &mr)
gpu::VertBufPtr draw_subdiv_init_origindex_buffer(int32_t *vert_origindex, uint num_loops, uint loose_len)
gpu::VertBufPtr extract_vert_index_subdiv(const DRWSubdivCache &subdiv_cache, const MeshRenderData &mr)
gpu::VertBufPtr extract_face_dot_index(const MeshRenderData &mr)
static gpu::VertBufPtr create_vbo(const int size)
static void extract_edge_index_bm(const MeshRenderData &mr, MutableSpan< int > vbo_data)
gpu::VertBufPtr extract_face_index_subdiv(const DRWSubdivCache &subdiv_cache, const MeshRenderData &mr)
static void extract_vert_index_mesh(const MeshRenderData &mr, MutableSpan< int > vbo_data)
gpu::VertBufPtr extract_edge_index_subdiv(const DRWSubdivCache &subdiv_cache, const MeshRenderData &mr)
static void extract_edge_idx_loose_geom_subdiv(const DRWSubdivCache &subdiv_cache, const MeshRenderData &mr, MutableSpan< int32_t > vbo_data)
static void extract_edge_index_mesh(const MeshRenderData &mr, MutableSpan< int > vbo_data)
static void extract_vert_idx_loose_geom_subdiv(const DRWSubdivCache &subdiv_cache, const MeshRenderData &mr, MutableSpan< int32_t > vbo_data)
gpu::VertBufPtr extract_vert_index(const MeshRenderData &mr)
gpu::VertBufPtr extract_face_index(const MeshRenderData &mr)
static void extract_face_index_mesh(const MeshRenderData &mr, MutableSpan< int > vbo_data)
constexpr ParallelGrainSize grain_size(int grain_size)
std::unique_ptr< gpu::VertBuf, gpu::VertBufDeleter > VertBufPtr
void build_reverse_map(OffsetIndices< int > offsets, MutableSpan< int > r_map)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
BLI_INLINE BMEdge * BM_edge_at_index(BMesh *bm, const int index)
GPUVertFormat GPU_vertformat_from_attribute(StringRef name, gpu::VertAttrType type)
VecBase< int32_t, 2 > int2
BMesh const char void * data
void GPU_vertbuf_data_alloc(gpu::VertBuf &verts, uint v_len)
gpu::VertBuf * verts_orig_index
gpu::VertBuf * edges_orig_index
int * subdiv_loop_face_index
const int * orig_index_vert
MeshExtractType extract_type
const int * orig_index_face
const int * orig_index_edge
OffsetIndices< int > faces