Blender V4.5
BLI_generic_virtual_array.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
13
14#include "BLI_generic_array.hh"
15#include "BLI_generic_span.hh"
16#include "BLI_virtual_array.hh"
17
18namespace blender {
19
20/* -------------------------------------------------------------------- */
23
24class GVArray;
25class GVArrayImpl;
26class GVMutableArray;
28
29/* A generically typed version of #VArrayImpl. */
31 protected:
32 const CPPType *type_;
34
35 public:
37 virtual ~GVArrayImpl() = default;
38
39 const CPPType &type() const;
40
41 int64_t size() const;
42
43 virtual void get(int64_t index, void *r_value) const;
44 virtual void get_to_uninitialized(int64_t index, void *r_value) const = 0;
45
46 virtual CommonVArrayInfo common_info() const;
47
48 virtual void materialize(const IndexMask &mask, void *dst) const;
49 virtual void materialize_to_uninitialized(const IndexMask &mask, void *dst) const;
50
51 virtual void materialize_compressed(const IndexMask &mask, void *dst) const;
52 virtual void materialize_compressed_to_uninitialized(const IndexMask &mask, void *dst) const;
53
54 virtual bool try_assign_VArray(void *varray) const;
55};
56
57/* A generic version of #VMutableArrayImpl. */
59 public:
61
62 virtual void set_by_copy(int64_t index, const void *value);
63 virtual void set_by_relocate(int64_t index, void *value);
64 virtual void set_by_move(int64_t index, void *value) = 0;
65
66 virtual void set_all(const void *src);
67
68 virtual bool try_assign_VMutableArray(void *varray) const;
69};
70
72
73/* -------------------------------------------------------------------- */
76
77namespace detail {
79 const GVArrayImpl *(*get_varray)(const void *buffer) =
80 [](const void * /*buffer*/) -> const GVArrayImpl * { return nullptr; };
81
82 template<typename StorageT> static constexpr GVArrayAnyExtraInfo get();
83};
84} // namespace detail
85
86class GVMutableArray;
87
93 protected:
99
100 const GVArrayImpl *impl_ = nullptr;
102
103 GVArrayCommon() = default;
104 GVArrayCommon(const GVArrayCommon &other);
105 GVArrayCommon(GVArrayCommon &&other) noexcept;
106 GVArrayCommon(const GVArrayImpl *impl);
107 GVArrayCommon(std::shared_ptr<const GVArrayImpl> impl);
109
110 template<typename ImplT, typename... Args> void emplace(Args &&...args);
111
112 void copy_from(const GVArrayCommon &other);
113 void move_from(GVArrayCommon &&other) noexcept;
114
115 const GVArrayImpl *impl_from_storage() const;
116
117 public:
118 const CPPType &type() const;
119 operator bool() const;
120
121 int64_t size() const;
122 bool is_empty() const;
123 IndexRange index_range() const;
124
125 template<typename T> bool try_assign_VArray(VArray<T> &varray) const;
126 bool may_have_ownership() const;
127
128 void materialize(void *dst) const;
129 void materialize(const IndexMask &mask, void *dst) const;
130
131 void materialize_to_uninitialized(void *dst) const;
132 void materialize_to_uninitialized(const IndexMask &mask, void *dst) const;
133
134 void materialize_compressed(const IndexMask &mask, void *dst) const;
135 void materialize_compressed_to_uninitialized(const IndexMask &mask, void *dst) const;
136
138
142 bool is_span() const;
147 GSpan get_internal_span() const;
148
152 bool is_single() const;
158 void get_internal_single(void *r_value) const;
162 void get_internal_single_to_uninitialized(void *r_value) const;
163
164 void get(int64_t index, void *r_value) const;
169 template<typename T> T get(int64_t index) const;
170 void get_to_uninitialized(int64_t index, void *r_value) const;
171};
172
174class GVArray : public GVArrayCommon {
175 private:
176 friend GVMutableArray;
177
178 public:
179 GVArray() = default;
180
181 GVArray(const GVArray &other);
182 GVArray(GVArray &&other) noexcept;
183 GVArray(const GVArrayImpl *impl);
184 GVArray(std::shared_ptr<const GVArrayImpl> impl);
185
186 GVArray(varray_tag::span /*tag*/, GSpan span);
187 GVArray(varray_tag::single_ref /*tag*/, const CPPType &type, int64_t size, const void *value);
188 GVArray(varray_tag::single /*tag*/, const CPPType &type, int64_t size, const void *value);
189
190 template<typename T> GVArray(const VArray<T> &varray);
191 template<typename T> GVArray(VArray<T> &&varray);
192 template<typename T> VArray<T> typed() const;
193
194 template<typename ImplT, typename... Args> static GVArray For(Args &&...args);
195
196 static GVArray ForSingle(const CPPType &type, int64_t size, const void *value);
197 static GVArray ForSingleRef(const CPPType &type, int64_t size, const void *value);
199 static GVArray ForSpan(GSpan span);
201 static GVArray ForEmpty(const CPPType &type);
202
204
205 GVArray &operator=(const GVArray &other);
206 GVArray &operator=(GVArray &&other) noexcept;
207
209 {
210 return impl_;
211 }
212};
213
216 public:
217 GVMutableArray() = default;
221 GVMutableArray(std::shared_ptr<GVMutableArrayImpl> impl);
222
223 template<typename T> GVMutableArray(const VMutableArray<T> &varray);
224 template<typename T> VMutableArray<T> typed() const;
225
226 template<typename ImplT, typename... Args> static GVMutableArray For(Args &&...args);
227
229
230 operator GVArray() const &;
231 operator GVArray() && noexcept;
232
233 GVMutableArray &operator=(const GVMutableArray &other);
234 GVMutableArray &operator=(GVMutableArray &&other) noexcept;
235
237
238 template<typename T> bool try_assign_VMutableArray(VMutableArray<T> &varray) const;
239
240 void set_by_copy(int64_t index, const void *value);
241 void set_by_move(int64_t index, void *value);
242 void set_by_relocate(int64_t index, void *value);
243
244 void fill(const void *value);
248 void set_all(const void *src);
249
251
252 private:
253 GVMutableArrayImpl *get_impl() const;
254};
255
257
258/* -------------------------------------------------------------------- */
261
262/* A generic version of VArraySpan. */
264 private:
265 GVArray varray_;
266 void *owned_data_ = nullptr;
267
268 public:
270 GVArraySpan(GVArray varray);
271 template<typename T> GVArraySpan(VArray<T> varray) : GVArraySpan(GVArray(varray)) {}
272 GVArraySpan(GVArraySpan &&other);
273 ~GVArraySpan();
275};
276
277/* A generic version of MutableVArraySpan. */
279 private:
280 GVMutableArray varray_;
281 void *owned_data_ = nullptr;
282 bool save_has_been_called_ = false;
283 bool show_not_saved_warning_ = true;
284
285 public:
287 GMutableVArraySpan(GVMutableArray varray, bool copy_values_to_span = true);
291
292 const GVMutableArray &varray() const;
293
294 void save();
296};
297
299
300/* -------------------------------------------------------------------- */
303
304/* Used to convert a typed virtual array into a generic one. */
305template<typename T> class GVArrayImpl_For_VArray : public GVArrayImpl {
306 protected:
308
309 public:
311 : GVArrayImpl(CPPType::get<T>(), varray.size()), varray_(std::move(varray))
312 {
313 }
314
315 protected:
316 void get(const int64_t index, void *r_value) const override
317 {
318 *static_cast<T *>(r_value) = varray_[index];
319 }
320
321 void get_to_uninitialized(const int64_t index, void *r_value) const override
322 {
323 new (r_value) T(varray_[index]);
324 }
325
326 void materialize(const IndexMask &mask, void *dst) const override
327 {
328 varray_.materialize(mask, MutableSpan(static_cast<T *>(dst), mask.min_array_size()));
329 }
330
331 void materialize_to_uninitialized(const IndexMask &mask, void *dst) const override
332 {
333 varray_.materialize_to_uninitialized(
334 mask, MutableSpan(static_cast<T *>(dst), mask.min_array_size()));
335 }
336
337 void materialize_compressed(const IndexMask &mask, void *dst) const override
338 {
339 varray_.materialize_compressed(mask, MutableSpan(static_cast<T *>(dst), mask.size()));
340 }
341
342 void materialize_compressed_to_uninitialized(const IndexMask &mask, void *dst) const override
343 {
344 varray_.materialize_compressed_to_uninitialized(
345 mask, MutableSpan(static_cast<T *>(dst), mask.size()));
346 }
347
348 bool try_assign_VArray(void *varray) const override
349 {
350 *(VArray<T> *)varray = varray_;
351 return true;
352 }
353
355 {
356 return varray_.common_info();
357 }
358};
359
360/* Used to convert any generic virtual array into a typed one. */
361template<typename T> class VArrayImpl_For_GVArray : public VArrayImpl<T> {
362 protected:
364
365 public:
366 VArrayImpl_For_GVArray(GVArray varray) : VArrayImpl<T>(varray.size()), varray_(std::move(varray))
367 {
369 BLI_assert(varray_.type().template is<T>());
370 }
371
372 protected:
373 T get(const int64_t index) const override
374 {
375 T value;
376 varray_.get(index, &value);
377 return value;
378 }
379
381 {
382 return varray_.common_info();
383 }
384
385 bool try_assign_GVArray(GVArray &varray) const override
386 {
387 varray = varray_;
388 return true;
389 }
390
391 void materialize(const IndexMask &mask, T *dst) const override
392 {
393 varray_.materialize(mask, dst);
394 }
395
396 void materialize_to_uninitialized(const IndexMask &mask, T *dst) const override
397 {
398 varray_.materialize_to_uninitialized(mask, dst);
399 }
400
401 void materialize_compressed(const IndexMask &mask, T *dst) const override
402 {
403 varray_.materialize_compressed(mask, dst);
404 }
405
406 void materialize_compressed_to_uninitialized(const IndexMask &mask, T *dst) const override
407 {
408 varray_.materialize_compressed_to_uninitialized(mask, dst);
409 }
410};
411
412/* Used to convert any typed virtual mutable array into a generic one. */
413template<typename T> class GVMutableArrayImpl_For_VMutableArray : public GVMutableArrayImpl {
414 protected:
416
417 public:
419 : GVMutableArrayImpl(CPPType::get<T>(), varray.size()), varray_(std::move(varray))
420 {
421 }
422
423 protected:
424 void get(const int64_t index, void *r_value) const override
425 {
426 *static_cast<T *>(r_value) = varray_[index];
427 }
428
429 void get_to_uninitialized(const int64_t index, void *r_value) const override
430 {
431 new (r_value) T(varray_[index]);
432 }
433
435 {
436 return varray_.common_info();
437 }
438
439 void set_by_copy(const int64_t index, const void *value) override
440 {
441 const T &value_ = *(const T *)value;
442 varray_.set(index, value_);
443 }
444
445 void set_by_relocate(const int64_t index, void *value) override
446 {
447 T &value_ = *static_cast<T *>(value);
448 varray_.set(index, std::move(value_));
449 value_.~T();
450 }
451
452 void set_by_move(const int64_t index, void *value) override
453 {
454 T &value_ = *static_cast<T *>(value);
455 varray_.set(index, std::move(value_));
456 }
457
458 void set_all(const void *src) override
459 {
460 varray_.set_all(Span(static_cast<const T *>(src), size_));
461 }
462
463 void materialize(const IndexMask &mask, void *dst) const override
464 {
465 varray_.materialize(mask, MutableSpan(static_cast<T *>(dst), mask.min_array_size()));
466 }
467
468 void materialize_to_uninitialized(const IndexMask &mask, void *dst) const override
469 {
470 varray_.materialize_to_uninitialized(
471 mask, MutableSpan(static_cast<T *>(dst), mask.min_array_size()));
472 }
473
474 void materialize_compressed(const IndexMask &mask, void *dst) const override
475 {
476 varray_.materialize_compressed(mask, MutableSpan(static_cast<T *>(dst), mask.size()));
477 }
478
479 void materialize_compressed_to_uninitialized(const IndexMask &mask, void *dst) const override
480 {
481 varray_.materialize_compressed_to_uninitialized(
482 mask, MutableSpan(static_cast<T *>(dst), mask.size()));
483 }
484
485 bool try_assign_VArray(void *varray) const override
486 {
487 *(VArray<T> *)varray = varray_;
488 return true;
489 }
490
491 bool try_assign_VMutableArray(void *varray) const override
492 {
493 *(VMutableArray<T> *)varray = varray_;
494 return true;
495 }
496};
497
498/* Used to convert an generic mutable virtual array into a typed one. */
499template<typename T> class VMutableArrayImpl_For_GVMutableArray : public VMutableArrayImpl<T> {
500 protected:
502
503 public:
505 : VMutableArrayImpl<T>(varray.size()), varray_(varray)
506 {
508 BLI_assert(varray_.type().template is<T>());
509 }
510
511 private:
512 T get(const int64_t index) const override
513 {
514 T value;
515 varray_.get(index, &value);
516 return value;
517 }
518
519 void set(const int64_t index, T value) override
520 {
521 varray_.set_by_relocate(index, &value);
522 }
523
524 CommonVArrayInfo common_info() const override
525 {
526 return varray_.common_info();
527 }
528
529 bool try_assign_GVArray(GVArray &varray) const override
530 {
531 varray = varray_;
532 return true;
533 }
534
535 bool try_assign_GVMutableArray(GVMutableArray &varray) const override
536 {
537 varray = varray_;
538 return true;
539 }
540
541 void materialize(const IndexMask &mask, T *dst) const override
542 {
543 varray_.materialize(mask, dst);
544 }
545
546 void materialize_to_uninitialized(const IndexMask &mask, T *dst) const override
547 {
549 }
550
551 void materialize_compressed(const IndexMask &mask, T *dst) const override
552 {
553 varray_.materialize_compressed(mask, dst);
554 }
555
556 void materialize_compressed_to_uninitialized(const IndexMask &mask, T *dst) const override
557 {
559 }
560};
561
563
564/* -------------------------------------------------------------------- */
567
569 protected:
570 void *data_ = nullptr;
572
573 public:
575 : GVMutableArrayImpl(span.type(), span.size()),
576 data_(span.data()),
577 element_size_(span.type().size)
578 {
579 }
580
581 protected:
586
587 public:
588 void get(int64_t index, void *r_value) const override;
589 void get_to_uninitialized(int64_t index, void *r_value) const override;
590
591 void set_by_copy(int64_t index, const void *value) override;
592 void set_by_move(int64_t index, void *value) override;
593 void set_by_relocate(int64_t index, void *value) override;
594
595 CommonVArrayInfo common_info() const override;
596
597 void materialize(const IndexMask &mask, void *dst) const override;
598 void materialize_to_uninitialized(const IndexMask &mask, void *dst) const override;
599
600 void materialize_compressed(const IndexMask &mask, void *dst) const override;
601 void materialize_compressed_to_uninitialized(const IndexMask &mask, void *dst) const override;
602};
603
605 public:
607
608 private:
609 CommonVArrayInfo common_info() const override;
610};
611
612template<> inline constexpr bool is_trivial_extended_v<GVArrayImpl_For_GSpan_final> = true;
613
615
616/* -------------------------------------------------------------------- */
619
621 protected:
622 const void *value_ = nullptr;
623
624 public:
625 GVArrayImpl_For_SingleValueRef(const CPPType &type, const int64_t size, const void *value)
626 : GVArrayImpl(type, size), value_(value)
627 {
628 }
629
630 protected:
634
635 void get(const int64_t index, void *r_value) const override;
636 void get_to_uninitialized(const int64_t index, void *r_value) const override;
637 CommonVArrayInfo common_info() const override;
638 void materialize(const IndexMask &mask, void *dst) const override;
639 void materialize_to_uninitialized(const IndexMask &mask, void *dst) const override;
640 void materialize_compressed(const IndexMask &mask, void *dst) const override;
641 void materialize_compressed_to_uninitialized(const IndexMask &mask, void *dst) const override;
642};
643
645 public:
647
648 private:
649 CommonVArrayInfo common_info() const override;
650};
651
652template<>
654
656
657/* -------------------------------------------------------------------- */
660
662 : type_(&type), size_(size)
663{
664 BLI_assert(size_ >= 0);
665}
666
667inline const CPPType &GVArrayImpl::type() const
668{
669 return *type_;
670}
671
673{
674 return size_;
675}
676
678
679/* -------------------------------------------------------------------- */
682
683inline void GVMutableArray::set_by_copy(const int64_t index, const void *value)
684{
685 BLI_assert(index >= 0);
686 BLI_assert(index < this->size());
687 this->get_impl()->set_by_copy(index, value);
688}
689
690inline void GVMutableArray::set_by_move(const int64_t index, void *value)
691{
692 BLI_assert(index >= 0);
693 BLI_assert(index < this->size());
694 this->get_impl()->set_by_move(index, value);
695}
696
697inline void GVMutableArray::set_by_relocate(const int64_t index, void *value)
698{
699 BLI_assert(index >= 0);
700 BLI_assert(index < this->size());
701 this->get_impl()->set_by_relocate(index, value);
702}
703
704template<typename T>
706{
707 BLI_assert(impl_->type().is<T>());
708 return this->get_impl()->try_assign_VMutableArray(&varray);
709}
710
711inline GVMutableArrayImpl *GVMutableArray::get_impl() const
712{
713 return const_cast<GVMutableArrayImpl *>(static_cast<const GVMutableArrayImpl *>(impl_));
714}
715
717
718/* -------------------------------------------------------------------- */
721
722template<typename ImplT, typename... Args> inline void GVArrayCommon::emplace(Args &&...args)
723{
724 static_assert(std::is_base_of_v<GVArrayImpl, ImplT>);
725 if constexpr (std::is_copy_constructible_v<ImplT> && Storage::template is_inline_v<ImplT>) {
726 impl_ = &storage_.template emplace<ImplT>(std::forward<Args>(args)...);
727 }
728 else {
729 std::shared_ptr<const GVArrayImpl> ptr = std::make_shared<ImplT>(std::forward<Args>(args)...);
730 impl_ = &*ptr;
731 storage_ = std::move(ptr);
732 }
733}
734
735/* Copies the value at the given index into the provided storage. The `r_value` pointer is
736 * expected to point to initialized memory. */
737inline void GVArrayCommon::get(const int64_t index, void *r_value) const
738{
739 BLI_assert(index >= 0);
740 BLI_assert(index < this->size());
741 impl_->get(index, r_value);
742}
743
744template<typename T> inline T GVArrayCommon::get(const int64_t index) const
745{
746 BLI_assert(index >= 0);
747 BLI_assert(index < this->size());
748 BLI_assert(this->type().is<T>());
749 T value{};
750 impl_->get(index, &value);
751 return value;
752}
753
754/* Same as `get`, but `r_value` is expected to point to uninitialized memory. */
755inline void GVArrayCommon::get_to_uninitialized(const int64_t index, void *r_value) const
756{
757 BLI_assert(index >= 0);
758 BLI_assert(index < this->size());
759 impl_->get_to_uninitialized(index, r_value);
760}
761
762template<typename T> inline bool GVArrayCommon::try_assign_VArray(VArray<T> &varray) const
763{
764 BLI_assert(impl_->type().is<T>());
765 return impl_->try_assign_VArray(&varray);
766}
767
768inline const CPPType &GVArrayCommon::type() const
769{
770 return impl_->type();
771}
772
773inline GVArrayCommon::operator bool() const
774{
775 return impl_ != nullptr;
776}
777
779{
780 return impl_->common_info();
781}
782
784{
785 if (impl_ == nullptr) {
786 return 0;
787 }
788 return impl_->size();
789}
790
791inline bool GVArrayCommon::is_empty() const
792{
793 return this->size() == 0;
794}
795
797
799template<typename T, bool UseSingle, bool UseSpan> struct GVArrayDevirtualizer {
801
802 template<typename Fn> bool devirtualize(const Fn &fn) const
803 {
804 const CommonVArrayInfo info = this->varray_impl.common_info();
805 const int64_t size = this->varray_impl.size();
806 if constexpr (UseSingle) {
808 return fn(SingleAsSpan<T>(*static_cast<const T *>(info.data), size));
809 }
810 }
811 if constexpr (UseSpan) {
813 return fn(Span<T>(static_cast<const T *>(info.data), size));
814 }
815 }
816 return false;
817 }
818};
819
820/* -------------------------------------------------------------------- */
823
824inline GVArray::GVArray(varray_tag::span /*tag*/, const GSpan span)
825{
826 /* Use const-cast because the underlying virtual array implementation is shared between const
827 * and non const data. */
828 GMutableSpan mutable_span{span.type(), const_cast<void *>(span.data()), span.size()};
829 this->emplace<GVArrayImpl_For_GSpan_final>(mutable_span);
830}
831
833 const CPPType &type,
834 const int64_t size,
835 const void *value)
836{
838}
839
840namespace detail {
841template<typename StorageT> constexpr GVArrayAnyExtraInfo GVArrayAnyExtraInfo::get()
842{
843 static_assert(std::is_base_of_v<GVArrayImpl, StorageT> ||
845
846 if constexpr (std::is_base_of_v<GVArrayImpl, StorageT>) {
847 return {[](const void *buffer) {
848 return static_cast<const GVArrayImpl *>((const StorageT *)buffer);
849 }};
850 }
851 else if constexpr (std::is_same_v<StorageT, const GVArrayImpl *>) {
852 return {[](const void *buffer) { return *(const StorageT *)buffer; }};
853 }
854 else if constexpr (std::is_same_v<StorageT, std::shared_ptr<const GVArrayImpl>>) {
855 return {[](const void *buffer) { return ((const StorageT *)buffer)->get(); }};
856 }
857 else {
859 return {};
860 }
861}
862} // namespace detail
863
864template<typename ImplT, typename... Args> inline GVArray GVArray::For(Args &&...args)
865{
866 static_assert(std::is_base_of_v<GVArrayImpl, ImplT>);
867 GVArray varray;
868 varray.template emplace<ImplT>(std::forward<Args>(args)...);
869 return varray;
870}
871
872template<typename T> inline GVArray::GVArray(const VArray<T> &varray) : GVArray(VArray<T>(varray))
873{
874}
875
876template<typename T> inline GVArray::GVArray(VArray<T> &&varray)
877{
878 if (!varray) {
879 return;
880 }
881 const CommonVArrayInfo info = varray.common_info();
883 *this = GVArray::ForSingle(CPPType::get<T>(), varray.size(), info.data);
884 return;
885 }
886 /* Need to check for ownership, because otherwise the referenced data can be destructed when
887 * #this is destructed. */
889 *this = GVArray::ForSpan(GSpan(CPPType::get<T>(), info.data, varray.size()));
890 return;
891 }
892 if (varray.try_assign_GVArray(*this)) {
893 return;
894 }
895 *this = GVArray::For<GVArrayImpl_For_VArray<T>>(std::move(varray));
896}
897
898template<typename T> inline VArray<T> GVArray::typed() const
899{
900 if (!*this) {
901 return {};
902 }
903 BLI_assert(impl_->type().is<T>());
904 const CommonVArrayInfo info = this->common_info();
906 return VArray<T>::ForSingle(*static_cast<const T *>(info.data), this->size());
907 }
908 /* Need to check for ownership, because otherwise the referenced data can be destructed when
909 * #this is destructed. */
911 return VArray<T>::ForSpan(Span<T>(static_cast<const T *>(info.data), this->size()));
912 }
913 VArray<T> varray;
914 if (this->try_assign_VArray(varray)) {
915 return varray;
916 }
918}
919
921
922/* -------------------------------------------------------------------- */
925
926template<typename ImplT, typename... Args>
928{
929 static_assert(std::is_base_of_v<GVMutableArrayImpl, ImplT>);
930 GVMutableArray varray;
931 varray.emplace<ImplT>(std::forward<Args>(args)...);
932 return varray;
933}
934
935template<typename T> inline GVMutableArray::GVMutableArray(const VMutableArray<T> &varray)
936{
937 if (!varray) {
938 return;
939 }
940 const CommonVArrayInfo info = varray.common_info();
943 GMutableSpan(CPPType::get<T>(), const_cast<void *>(info.data), varray.size()));
944 return;
945 }
946 if (varray.try_assign_GVMutableArray(*this)) {
947 return;
948 }
950}
951
952template<typename T> inline VMutableArray<T> GVMutableArray::typed() const
953{
954 if (!*this) {
955 return {};
956 }
957 BLI_assert(this->type().is<T>());
958 const CommonVArrayInfo info = this->common_info();
961 MutableSpan<T>(const_cast<T *>(static_cast<const T *>(info.data)), this->size()));
962 }
963 VMutableArray<T> varray;
964 if (this->try_assign_VMutableArray(varray)) {
965 return varray;
966 }
968}
969
971
972} // namespace blender
#define BLI_assert_unreachable()
Definition BLI_assert.h:93
#define BLI_assert(a)
Definition BLI_assert.h:46
#define final(a, b, c)
Definition BLI_hash.h:19
BMesh const char void * data
long long int int64_t
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
btGeneric6DofConstraint & operator=(btGeneric6DofConstraint &other)
static const CPPType & get()
const GVMutableArray & varray() const
const CPPType & type() const
GSpan()=default
const void * data() const
int64_t size() const
CommonVArrayInfo common_info() const
bool may_have_ownership() const
void materialize_compressed_to_uninitialized(const IndexMask &mask, void *dst) const
const GVArrayImpl * impl_from_storage() const
bool try_assign_VArray(VArray< T > &varray) const
void copy_from(const GVArrayCommon &other)
void move_from(GVArrayCommon &&other) noexcept
void get_to_uninitialized(int64_t index, void *r_value) const
void materialize(void *dst) const
void get_internal_single_to_uninitialized(void *r_value) const
void materialize_to_uninitialized(void *dst) const
void get(int64_t index, void *r_value) const
Any< detail::GVArrayAnyExtraInfo, 40, 8 > Storage
void materialize_compressed(const IndexMask &mask, void *dst) const
void get_internal_single(void *r_value) const
GVArrayImpl_For_GSpan(const CPPType &type, int64_t size)
GVArrayImpl_For_GSpan(const GMutableSpan span)
GVArrayImpl_For_SingleValueRef(const CPPType &type, const int64_t size, const void *value)
GVArrayImpl_For_SingleValueRef(const CPPType &type, const int64_t size, const void *value)
GVArrayImpl_For_SingleValueRef(const CPPType &type, const int64_t size)
void materialize(const IndexMask &mask, void *dst) const override
bool try_assign_VArray(void *varray) const override
void get(const int64_t index, void *r_value) const override
void get_to_uninitialized(const int64_t index, void *r_value) const override
CommonVArrayInfo common_info() const override
void materialize_compressed(const IndexMask &mask, void *dst) const override
void materialize_compressed_to_uninitialized(const IndexMask &mask, void *dst) const override
void materialize_to_uninitialized(const IndexMask &mask, void *dst) const override
virtual void materialize_compressed_to_uninitialized(const IndexMask &mask, void *dst) const
virtual void materialize(const IndexMask &mask, void *dst) const
virtual void get_to_uninitialized(int64_t index, void *r_value) const =0
virtual void materialize_compressed(const IndexMask &mask, void *dst) const
virtual void get(int64_t index, void *r_value) const
virtual bool try_assign_VArray(void *varray) const
GVArrayImpl(const CPPType &type, int64_t size)
virtual CommonVArrayInfo common_info() const
const CPPType & type() const
virtual ~GVArrayImpl()=default
virtual void materialize_to_uninitialized(const IndexMask &mask, void *dst) const
GVArray slice(IndexRange slice) const
static GVArray ForEmpty(const CPPType &type)
static GVArray ForGArray(GArray<> array)
GVArray()=default
static GVArray ForSingleDefault(const CPPType &type, int64_t size)
GVArray & operator=(const GVArray &other)
static GVArray For(Args &&...args)
GVArray(const GVArray &other)
const GVArrayImpl * get_implementation() const
GVArray(GVArray &&other) noexcept
static GVArray ForSingleRef(const CPPType &type, int64_t size, const void *value)
static GVArray ForSpan(GSpan span)
static GVArray ForSingle(const CPPType &type, int64_t size, const void *value)
void set_by_copy(const int64_t index, const void *value) override
void materialize(const IndexMask &mask, void *dst) const override
bool try_assign_VMutableArray(void *varray) const override
void get(const int64_t index, void *r_value) const override
void materialize_to_uninitialized(const IndexMask &mask, void *dst) const override
void get_to_uninitialized(const int64_t index, void *r_value) const override
void materialize_compressed_to_uninitialized(const IndexMask &mask, void *dst) const override
void set_by_relocate(const int64_t index, void *value) override
void materialize_compressed(const IndexMask &mask, void *dst) const override
void set_by_move(const int64_t index, void *value) override
virtual bool try_assign_VMutableArray(void *varray) const
virtual void set_all(const void *src)
virtual void set_by_copy(int64_t index, const void *value)
GVMutableArrayImpl(const CPPType &type, int64_t size)
virtual void set_by_relocate(int64_t index, void *value)
virtual void set_by_move(int64_t index, void *value)=0
GVMutableArray(GVMutableArray &&other) noexcept
void set_by_move(int64_t index, void *value)
void set_all(const void *src)
void set_by_copy(int64_t index, const void *value)
GVMutableArray(const GVMutableArray &other)
GVMutableArrayImpl * get_implementation() const
GMutableSpan get_internal_span() const
bool try_assign_VMutableArray(VMutableArray< T > &varray) const
GVMutableArray & operator=(const GVMutableArray &other)
void fill(const void *value)
VMutableArray< T > typed() const
static GVMutableArray ForSpan(GMutableSpan span)
static GVMutableArray For(Args &&...args)
void set_by_relocate(int64_t index, void *value)
NonCopyable(const NonCopyable &other)=delete
NonMovable(NonMovable &&other)=delete
CommonVArrayInfo common_info() const
void materialize_compressed_to_uninitialized(const IndexMask &mask, T *dst) const override
void materialize_to_uninitialized(const IndexMask &mask, T *dst) const override
void materialize_compressed(const IndexMask &mask, T *dst) const override
void materialize(const IndexMask &mask, T *dst) const override
bool try_assign_GVArray(GVArray &varray) const override
CommonVArrayInfo common_info() const override
T get(const int64_t index) const override
VArrayImpl(const int64_t size)
static VArray ForSingle(T value, const int64_t size)
static VArray ForSpan(Span< T > values)
static VMutableArray ForSpan(MutableSpan< T > values)
bool try_assign_GVMutableArray(GVMutableArray &varray) const
#define this
#define class
#define public
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
#define T
constexpr bool is_same_any_v
constexpr bool is_trivial_extended_v
static constexpr GVArrayAnyExtraInfo get()
PointerRNA * ptr
Definition wm_files.cc:4227