Blender V4.3
extract_mesh_vbo_fdots_edituv_data.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2021 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include "extract_mesh.hh"
10
11#include "draw_cache_impl.hh"
12
13namespace blender::draw {
14
16{
17 static GPUVertFormat format = {0};
18 if (format.attr_len == 0) {
21 }
24 MutableSpan vbo_data = vbo.data<EditLoopData>();
25 const BMesh &bm = *mr.bm;
26 const BMUVOffsets offsets = BM_uv_map_get_offsets(&bm);
28 threading::parallel_for(IndexRange(bm.totface), 2048, [&](const IndexRange range) {
29 for (const int face_index : range) {
30 const BMFace &face = *BM_face_at_index(&const_cast<BMesh &>(bm), face_index);
31 vbo_data[face_index] = {};
32 mesh_render_data_face_flag(mr, &face, offsets, vbo_data[face_index]);
33 }
34 });
35 }
36 else {
37 if (mr.orig_index_face) {
38 const Span<int> orig_index_face(mr.orig_index_face, mr.faces_num);
39 threading::parallel_for(IndexRange(mr.faces_num), 4096, [&](const IndexRange range) {
40 for (const int face : range) {
41 vbo_data[face] = {};
42 if (orig_index_face[face] == ORIGINDEX_NONE) {
43 continue;
44 }
45 const BMFace *orig_face = bm_original_face_get(mr, face);
46 mesh_render_data_face_flag(mr, orig_face, offsets, vbo_data[face]);
47 }
48 });
49 }
50 else {
51 vbo_data.fill({});
52 }
53 }
54}
55
56} // namespace blender::draw
#define GPU_vertbuf_init_with_format(verts, format)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
@ GPU_FETCH_INT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
void GPU_vertformat_alias_add(GPUVertFormat *, const char *alias)
@ GPU_COMP_U8
ATTR_WARN_UNUSED_RESULT BMesh * bm
BMUVOffsets BM_uv_map_get_offsets(const BMesh *bm)
MutableSpan< T > data()
Extraction of Mesh data into VBO to feed to GPU.
format
void extract_face_dots_edituv_data(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))
Definition BLI_task.hh:95
int totface