19 if (
format.attr_len == 0) {
24 return vbo.
data<
int>();
49 for (const int i : range) {
50 loose_edge_data[i * 2 + 0] = edges[loose_edges[i]][0];
51 loose_edge_data[i * 2 + 1] = edges[loose_edges[i]][1];
66 for (const int face_index : range) {
67 const BMFace &face = *BM_face_at_index(&const_cast<BMesh &>(bm), face_index);
68 const BMLoop *loop = BM_FACE_FIRST_LOOP(&face);
69 for ([[maybe_unused]] const int i : IndexRange(face.len)) {
70 const int index = BM_elem_index_get(loop);
71 corners_data[index] = BM_elem_index_get(loop->v);
77 const Span<int> loose_edges = mr.loose_edges;
78 threading::parallel_for(loose_edges.index_range(), 4096, [&](
const IndexRange range) {
79 for (const int i : range) {
80 const BMEdge &edge = *BM_edge_at_index(&const_cast<BMesh &>(bm), loose_edges[i]);
81 loose_edge_data[i * 2 + 0] = BM_elem_index_get(edge.v1);
82 loose_edge_data[i * 2 + 1] = BM_elem_index_get(edge.v2);
86 array_utils::copy(mr.loose_verts, loose_vert_data);
108 array_utils::gather(orig_index_edge, mr.
corner_edges, corners_data);
110 for (const int i : range) {
111 loose_edge_data[i * 2 + 0] = orig_index_edge[loose_edges[i]];
112 loose_edge_data[i * 2 + 1] = orig_index_edge[loose_edges[i]];
117 array_utils::copy(mr.corner_edges, corners_data);
118 threading::parallel_for(loose_edges.index_range(), 4096, [&](
const IndexRange range) {
119 for (const int i : range) {
120 loose_edge_data[i * 2 + 0] = loose_edges[i];
121 loose_edge_data[i * 2 + 1] = loose_edges[i];
134 for (const int face_index : range) {
135 const BMFace &face = *BM_face_at_index(&const_cast<BMesh &>(bm), face_index);
136 const BMLoop *loop = BM_FACE_FIRST_LOOP(&face);
137 for ([[maybe_unused]] const int i : IndexRange(face.len)) {
138 const int index = BM_elem_index_get(loop);
139 corners_data[index] = BM_elem_index_get(loop->e);
145 const Span<int> loose_edges = mr.loose_edges;
146 threading::parallel_for(loose_edges.index_range(), 4096, [&](
const IndexRange range) {
147 for (const int i : range) {
148 loose_edge_data[i * 2 + 0] = loose_edges[i];
149 loose_edge_data[i * 2 + 1] = loose_edges[i];
170 threading::parallel_for(faces.index_range(), 2048, [&](
const IndexRange range) {
171 for (const int face : range) {
172 vbo_data.slice(faces[face]).fill(orig_index_face[face]);
177 offset_indices::build_reverse_map(faces, vbo_data);
185 for (const int face_index : range) {
186 const BMFace &face = *BM_face_at_index(&const_cast<BMesh &>(bm), face_index);
187 const IndexRange face_range(BM_elem_index_get(BM_FACE_FIRST_LOOP(&face)), face.len);
188 vbo_data.slice(face_range).fill(face_index);
219 loose_edges.
size() * verts_per_edge);
221 const int2 edge = coarse_edges[loose_edges[i]];
232 array_utils::copy(loose_verts, loose_vert_data);
254 if (vbo_data[i] == -1) {
275 loose_edges.
size() * verts_per_edge);
277 const int edge = loose_edges[i];
279 data.slice(i * verts_per_edge, verts_per_edge).fill(index);
320 array_utils::copy(orig_index_face, vbo_data);
323 array_utils::fill_index_range(vbo_data);
327 array_utils::fill_index_range(vbo_data);
#define GPU_vertbuf_init_with_format(verts, format)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
ATTR_WARN_UNUSED_RESULT BMesh * bm
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
constexpr MutableSpan take_back(const int64_t n) const
constexpr T & first() const
constexpr MutableSpan take_front(const int64_t n) const
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr bool is_empty() const
void copy(const GVArray &src, GMutableSpan dst, int64_t grain_size=4096)
void gather(const GVArray &src, const IndexMask &indices, GMutableSpan dst, int64_t grain_size=4096)
void extract_edge_index(const MeshRenderData &mr, gpu::VertBuf &vbo)
int subdiv_loose_edges_num(const MeshRenderData &mr, const DRWSubdivCache &cache)
static void extract_vert_idx_loose_geom_subdiv(const DRWSubdivCache &subdiv_cache, const MeshRenderData &mr, gpu::VertBuf &vbo)
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)
static void extract_edge_idx_loose_geom_subdiv(const DRWSubdivCache &subdiv_cache, const MeshRenderData &mr, gpu::VertBuf &vbo)
void extract_face_dot_index(const MeshRenderData &mr, gpu::VertBuf &vbo)
static void extract_edge_index_bm(const MeshRenderData &mr, MutableSpan< int > vbo_data)
void extract_vert_index_subdiv(const DRWSubdivCache &subdiv_cache, const MeshRenderData &mr, gpu::VertBuf &vbo)
void extract_face_index_subdiv(const DRWSubdivCache &subdiv_cache, const MeshRenderData &mr, gpu::VertBuf &vbo)
int subdiv_full_vbo_size(const MeshRenderData &mr, const DRWSubdivCache &cache)
static void extract_vert_index_mesh(const MeshRenderData &mr, MutableSpan< int > vbo_data)
void extract_vert_index(const MeshRenderData &mr, gpu::VertBuf &vbo)
void extract_face_index(const MeshRenderData &mr, gpu::VertBuf &vbo)
static MutableSpan< int > init_vbo_data(gpu::VertBuf &vbo, const int size)
static void extract_edge_index_mesh(const MeshRenderData &mr, MutableSpan< int > vbo_data)
void extract_mesh_loose_edge_data(const Span< T > vert_data, const Span< int2 > edges, const Span< int > loose_edges, MutableSpan< T > gpu_data)
void draw_subdiv_init_origindex_buffer(gpu::VertBuf &buffer, int32_t *vert_origindex, uint num_loops, uint loose_len)
static void extract_face_index_mesh(const MeshRenderData &mr, MutableSpan< int > vbo_data)
void extract_edge_index_subdiv(const DRWSubdivCache &subdiv_cache, const MeshRenderData &mr, gpu::VertBuf &vbo)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
gpu::VertBuf * verts_orig_index
gpu::VertBuf * edges_orig_index
int * subdiv_loop_face_index
const int * orig_index_vert
const int * orig_index_face
eMRExtractType extract_type
const int * orig_index_edge
OffsetIndices< int > faces