25 if (!mr.
mesh->
runtime->subsurf_optimal_display_edges.is_empty()) {
50 const uint loose_start = mr.corners_num;
51 if (visible.size() == mr.loose_edges.size()) {
52 array_utils::fill_index_range(data.cast<uint>(), loose_start);
55 visible.foreach_index_optimized<int>(GrainSize(4096), [&](const int i, const int pos) {
56 data[pos] = loose_start + uint2(i * 2 + 0, i * 2 + 1);
69 visible,
GrainSize(4096), memory, [&](
const int i) {
return !hide_edge[loose_edges[
i]]; });
89 no_loose_wire = visible_loose_edges.
is_empty();
91 if (lines_loose && !lines) {
107 visible_non_loose_edges.
size() + visible_loose_edges.
size(),
126 threading::parallel_for(faces.index_range(), 2048, [&](const IndexRange range) {
127 for (const int face_index : range) {
128 const IndexRange face = faces[face_index];
129 for (const int corner : face) {
130 const int edge = corner_edges[corner];
133 data[edge] = edge_from_corners(face, corner);
143 map.as_span().size_in_bytes() +
data.size_in_bytes() + corner_edges.size_in_bytes(),
145 index_mask::build_reverse_map(visible_non_loose_edges, map.as_mutable_span());
146 threading::parallel_for(faces.index_range(), 2048, [&](const IndexRange range) {
147 for (const int face_index : range) {
148 const IndexRange face = faces[face_index];
149 for (const int corner : face) {
150 const int edge = corner_edges[corner];
151 const int vbo_index = map[edge];
152 if (vbo_index != -1) {
154 data[vbo_index] = edge_from_corners(face, corner);
167 lines->get(), visible_non_loose_edges.size() * 2, visible_loose_edges.size() * 2));
187 no_loose_wire = visible_loose_edges.
is_empty();
189 if (lines_loose && !lines) {
201 non_loose_edges,
GrainSize(2048), memory, [&](
const int i) {
209 visible_non_loose_edges.
size() + visible_loose_edges.
size(),
225 lines->get(), visible_non_loose_edges.
size() * 2, visible_loose_edges.
size() * 2));
244 const int edge_loose_offset,
256 gpu::VertAttrType::UINT_32);
268 if (orig_index_edge ==
nullptr) {
272 const bool value = hide_edge[loose_edges[
i]];
273 flags_data.
slice(
i * edges_per_edge, edges_per_edge).
fill(value);
285 flags_data.
slice(
i * edges_per_edge, edges_per_edge).
fill(value);
292 const bool value = (orig_index_edge[loose_edges[
i]] ==
ORIGINDEX_NONE) ?
294 hide_edge[loose_edges[
i]];
295 flags_data.
slice(
i * edges_per_edge, edges_per_edge).
fill(value);
310 flags_data.
slice(
i * edges_per_edge, edges_per_edge).
fill(value);
317 subdiv_cache, ibo, flags,
uint(edge_loose_offset), loose_edges_num);
329 no_loose_wire = loose_ibo_size == 0;
331 if (lines_loose && !lines) {
340 if (non_loose_ibo_size > 0) {
blender::MutableSpan< uint32_t > GPU_indexbuf_get_data(GPUIndexBufBuilder *)
blender::gpu::IndexBuf * GPU_indexbuf_build_on_device(uint index_len)
void GPU_indexbuf_init(GPUIndexBufBuilder *, GPUPrimType, uint prim_len, uint vertex_len)
blender::gpu::IndexBuf * GPU_indexbuf_build_ex(GPUIndexBufBuilder *builder, uint index_min, uint index_max, bool uses_restart_indices)
blender::gpu::IndexBuf * GPU_indexbuf_create_subrange(blender::gpu::IndexBuf *elem_src, uint start, uint length)
#define GPU_vertbuf_init_with_format(verts, format)
blender::gpu::VertBuf * GPU_vertbuf_calloc()
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
void GPU_vertbuf_discard(blender::gpu::VertBuf *)
#define BM_elem_index_get(ele)
#define BM_elem_flag_test_bool(ele, hflag)
BMesh const char void * data
BLI_INLINE BMEdge * BM_edge_at_index(BMesh *bm, const int index)
static IndexMask from_predicate(const IndexMask &universe, GrainSize grain_size, IndexMaskMemory &memory, Fn &&predicate)
static IndexMask from_indices(Span< T > indices, IndexMaskMemory &memory)
constexpr int64_t size() const
constexpr bool is_empty() const
Span< T > as_span() const
static IndexMask from_predicate(const IndexMask &universe, GrainSize grain_size, IndexMaskMemory &memory, Fn &&predicate)
static IndexMask from_bits(BitSpan bits, IndexMaskMemory &memory)
static IndexMask from_bools_inverse(const VArray< bool > &bools, IndexMaskMemory &memory)
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
constexpr void fill(const T &value) const
constexpr int64_t size_in_bytes() const
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr bool is_empty() const
IndexMask complement(const IndexMask &universe, IndexMaskMemory &memory) const
void foreach_index(Fn &&fn) const
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
static void fill_loose_lines_ibo(const MeshRenderData &mr, const IndexMask &visible, MutableSpan< uint2 > data)
static void extract_lines_bm(const MeshRenderData &mr, gpu::IndexBufPtr *lines, gpu::IndexBufPtr *lines_loose, bool &no_loose_wire)
int subdiv_loose_edges_num(const MeshRenderData &mr, const DRWSubdivCache &cache)
static IndexMask calc_mesh_edge_visibility(const MeshRenderData &mr, const IndexMask &mask, IndexMaskMemory &memory)
static void extract_lines_loose_geom_subdiv(const DRWSubdivCache &subdiv_cache, const MeshRenderData &mr, const int edge_loose_offset, gpu::IndexBuf *ibo)
BLI_INLINE BMEdge * bm_original_edge_get(const MeshRenderData &mr, int idx)
int subdiv_edges_per_coarse_edge(const DRWSubdivCache &cache)
static IndexMask calc_visible_loose_edge_indices(const MeshRenderData &mr, IndexMaskMemory &memory)
void draw_subdiv_build_lines_buffer(const DRWSubdivCache &cache, gpu::IndexBuf *lines_indices)
void extract_lines(const MeshRenderData &mr, gpu::IndexBufPtr *lines, gpu::IndexBufPtr *lines_loose, bool &no_loose_wire)
void draw_subdiv_build_lines_loose_buffer(const DRWSubdivCache &cache, gpu::IndexBuf *lines_indices, gpu::VertBuf *lines_flags, uint edge_loose_offset, uint num_loose_edges)
static void extract_lines_mesh(const MeshRenderData &mr, gpu::IndexBufPtr *lines, gpu::IndexBufPtr *lines_loose, bool &no_loose_wire)
void extract_lines_subdiv(const DRWSubdivCache &subdiv_cache, const MeshRenderData &mr, gpu::IndexBufPtr *lines, gpu::IndexBufPtr *lines_loose, bool &no_loose_wire)
std::unique_ptr< IndexBuf, IndexBufDeleter > IndexBufPtr
void memory_bandwidth_bound_task(const int64_t approximate_bytes_touched, const Function &function)
VecBase< uint32_t, 2 > uint2
MeshRuntimeHandle * runtime
VArraySpan< bool > hide_edge
MeshExtractType extract_type
const int * orig_index_edge
OffsetIndices< int > faces