Blender V5.3
type_conversions.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10
12
13#include "BLI_color.hh"
14#include "BLI_cpp_type.hh"
15#include "BLI_math_euler.hh"
17#include "BLI_math_vector.hh"
19
20namespace blender::bke {
21
22using mf::DataType;
23
24template<typename From, typename To, To (*ConversionF)(const From &)>
26{
27 static const CPPType &from_type = CPPType::get<From>();
28 static const CPPType &to_type = CPPType::get<To>();
29 static const std::string conversion_name = from_type.name() + " to " + to_type.name();
30
31 static auto multi_function = mf::build::SI1_SO<From, To>(
32 conversion_name.c_str(),
33 /* Use lambda instead of passing #ConversionF directly, because otherwise the compiler won't
34 * inline the function. */
35 [](const From &a) { return ConversionF(a); },
36 mf::build::exec_presets::AllSpanOrSingle());
37 static auto convert_single_to_initialized = [](const void *src, void *dst) {
38 *static_cast<To *>(dst) = ConversionF(*static_cast<const From *>(src));
39 };
40 static auto convert_single_to_uninitialized = [](const void *src, void *dst) {
41 new (dst) To(ConversionF(*static_cast<const From *>(src)));
42 };
43 conversions.add(mf::DataType::ForSingle<From>(),
44 mf::DataType::ForSingle<To>(),
45 multi_function,
46 convert_single_to_initialized,
47 convert_single_to_uninitialized);
48}
49
50static float2 float_to_float2(const float &a)
51{
52 return float2(a);
53}
54static float3 float_to_float3(const float &a)
55{
56 return float3(a);
57}
58static float4 float_to_float4(const float &a)
59{
60 return float4(a);
61}
62static int32_t float_to_int(const float &a)
63{
64 return int32_t(a);
65}
66static short2 float_to_short2(const float &a)
67{
68 return short2(a);
69}
70static int2 float_to_int2(const float &a)
71{
72 return int2(a);
73}
74static int3 float_to_int3(const float &a)
75{
76 return int3(a);
77}
78static bool float_to_bool(const float &a)
79{
80 return a > 0.0f;
81}
82static int8_t float_to_int8(const float &a)
83{
84 return std::clamp(
85 a, float(std::numeric_limits<int8_t>::min()), float(std::numeric_limits<int8_t>::max()));
86}
87static ColorGeometry4f float_to_color(const float &a)
88{
89 return ColorGeometry4f(a, a, a, 1.0f);
90}
92{
94}
96{
98}
99
101{
102 return float3(a.x, a.y, 0.0f);
103}
105{
106 return float4(a.x, a.y, 0.0f, 0.0f);
107}
108static float float2_to_float(const float2 &a)
109{
110 return (a.x + a.y) / 2.0f;
111}
112static int float2_to_int(const float2 &a)
113{
114 return int32_t((a.x + a.y) / 2.0f);
115}
117{
118 return short2(a.x, a.y);
119}
120static int2 float2_to_int2(const float2 &a)
121{
122 return int2(a.x, a.y);
123}
124static int3 float2_to_int3(const float2 &a)
125{
126 return int3(a.x, a.y, 0);
127}
128static bool float2_to_bool(const float2 &a)
129{
130 return !math::is_zero(a);
131}
133{
134 return float_to_int8((a.x + a.y) / 2.0f);
135}
137{
138 return ColorGeometry4f(a.x, a.y, 0.0f, 1.0f);
139}
145{
146 return math::to_quaternion(math::EulerXYZ(float3(a.x, a.y, 0.0f)));
147}
148
149static bool float3_to_bool(const float3 &a)
150{
151 return !math::is_zero(a);
152}
154{
155 return float_to_int8((a.x + a.y + a.z) / 3.0f);
156}
157static float float3_to_float(const float3 &a)
158{
159 return (a.x + a.y + a.z) / 3.0f;
160}
161static int float3_to_int(const float3 &a)
162{
163 return int((a.x + a.y + a.z) / 3.0f);
164}
166{
167 return short2(a.x, a.y);
168}
169static int2 float3_to_int2(const float3 &a)
170{
171 return int2(a.x, a.y);
172}
173static int3 float3_to_int3(const float3 &a)
174{
175 return int3(a.x, a.y, a.z);
176}
178{
179 return float2(a);
180}
182{
183 return float4(a, 0.0f);
184}
186{
187 return ColorGeometry4f(a.x, a.y, a.z, 1.0f);
188}
197
198static bool float4_to_bool(const float4 &a)
199{
200 return !math::is_zero(a);
201}
203{
204 return float_to_int8((a.x + a.y + a.z + a.w) / 4.0f);
205}
206static float float4_to_float(const float4 &a)
207{
208 return (a.x + a.y + a.z + a.w) / 4.0f;
209}
210static int float4_to_int(const float4 &a)
211{
212 return int((a.x + a.y + a.z + a.w) / 4.0f);
213}
215{
216 return short2(a.x, a.y);
217}
218static int2 float4_to_int2(const float4 &a)
219{
220 return int2(a.x, a.y);
221}
222static int3 float4_to_int3(const float4 &a)
223{
224 return int3(a.x, a.y, a.z);
225}
227{
228 return a.xy();
229}
231{
232 return a.xyz();
233}
235{
236 return ColorGeometry4f(a);
237}
243{
244 return math::Quaternion(a);
245}
246
247static bool int_to_bool(const int32_t &a)
248{
249 return a > 0;
250}
251static int8_t int_to_int8(const int32_t &a)
252{
253 return std::clamp(
254 a, int(std::numeric_limits<int8_t>::min()), int(std::numeric_limits<int8_t>::max()));
255}
257{
258 return short2(a);
259}
260static int2 int_to_int2(const int32_t &a)
261{
262 return int2(a);
263}
264static int3 int_to_int3(const int32_t &a)
265{
266 return int3(a);
267}
268static float int_to_float(const int32_t &a)
269{
270 return float(a);
271}
273{
274 return float2(float(a));
275}
277{
278 return float3(float(a));
279}
281{
282 return float4(float(a));
283}
285{
286 return ColorGeometry4f(float(a), float(a), float(a), 1.0f);
287}
289{
290 return color::encode(int_to_color(a));
291}
292
293static bool short2_to_bool(const short2 &a)
294{
295 return !math::is_zero(a);
296}
298{
299 return float2(a);
300}
301static int short2_to_int(const short2 &a)
302{
303 return math::midpoint(a.x, a.y);
304}
305static int2 short2_to_int2(const short2 &a)
306{
307 return int2(a.x, a.y);
308}
309static int3 short2_to_int3(const short2 &a)
310{
311 return int3(a.x, a.y, 0);
312}
314{
315 return int_to_int8(short2_to_int(a));
316}
317static float short2_to_float(const short2 &a)
318{
319 return float2_to_float(float2(a));
320}
322{
323 return float3(float(a.x), float(a.y), 0.0f);
324}
326{
327 return float4(float(a.x), float(a.y), 0.0f, 0.0f);
328}
330{
331 return ColorGeometry4f(float(a.x), float(a.y), 0.0f, 1.0f);
332}
337
338static bool int2_to_bool(const int2 &a)
339{
340 return !math::is_zero(a);
341}
342static float2 int2_to_float2(const int2 &a)
343{
344 return float2(a);
345}
346static int int2_to_int(const int2 &a)
347{
348 return math::midpoint(a.x, a.y);
349}
350static int3 int2_to_int3(const int2 &a)
351{
352 return int3(a, 0);
353}
354static short2 int2_to_short2(const int2 &a)
355{
356 return short2(a.x, a.y);
357}
358static int8_t int2_to_int8(const int2 &a)
359{
360 return int_to_int8(int2_to_int(a));
361}
362static float int2_to_float(const int2 &a)
363{
364 return float2_to_float(float2(a));
365}
366static float3 int2_to_float3(const int2 &a)
367{
368 return float3(float(a.x), float(a.y), 0.0f);
369}
370static float4 int2_to_float4(const int2 &a)
371{
372 return float4(float(a.x), float(a.y), 0.0f, 0.0f);
373}
375{
376 return ColorGeometry4f(float(a.x), float(a.y), 0.0f, 1.0f);
377}
379{
380 return color::encode(int2_to_color(a));
381}
382
383static bool int3_to_bool(const int3 &a)
384{
385 return !math::is_zero(a);
386}
387static float2 int3_to_float2(const int3 &a)
388{
389 return float2(a.xy());
390}
391static int int3_to_int(const int3 &a)
392{
393 return float3_to_int(float3(a));
394}
395static int2 int3_to_int2(const int3 &a)
396{
397 return a.xy();
398}
399static short2 int3_to_short2(const int3 &a)
400{
401 return short2(a.x, a.y);
402}
403static int8_t int3_to_int8(const int3 &a)
404{
405 return int_to_int8(int3_to_int(a));
406}
407static float int3_to_float(const int3 &a)
408{
409 return float3_to_float(float3(a));
410}
411static float3 int3_to_float3(const int3 &a)
412{
413 return float3(float(a.x), float(a.y), float(a.z));
414}
415static float4 int3_to_float4(const int3 &a)
416{
417 return float4(float(a.x), float(a.y), float(a.z), 0.0f);
418}
420{
421 return ColorGeometry4f(float(a.x), float(a.y), float(a.z), 1.0f);
422}
424{
425 return color::encode(int3_to_color(a));
426}
427
428static bool int8_to_bool(const int8_t &a)
429{
430 return a > 0;
431}
432static int int8_to_int(const int8_t &a)
433{
434 return int(a);
435}
437{
438 return short2(a);
439}
440static int2 int8_to_int2(const int8_t &a)
441{
442 return int2(a);
443}
444static int3 int8_to_int3(const int8_t &a)
445{
446 return int3(a);
447}
448static float int8_to_float(const int8_t &a)
449{
450 return float(a);
451}
453{
454 return float2(float(a));
455}
457{
458 return float3(float(a));
459}
461{
462 return float4(float(a));
463}
465{
466 return ColorGeometry4f(float(a), float(a), float(a), 1.0f);
467}
469{
470 return color::encode(int8_to_color(a));
471}
472
473static float bool_to_float(const bool &a)
474{
475 return float(a);
476}
477static int8_t bool_to_int8(const bool &a)
478{
479 return int8_t(a);
480}
481static int32_t bool_to_int(const bool &a)
482{
483 return int32_t(a);
484}
485static short2 bool_to_short2(const bool &a)
486{
487 return short2(a);
488}
489static int2 bool_to_int2(const bool &a)
490{
491 return int2(a);
492}
493static int3 bool_to_int3(const bool &a)
494{
495 return int3(a);
496}
497static float2 bool_to_float2(const bool &a)
498{
499 return (a) ? float2(1.0f) : float2(0.0f);
500}
501static float3 bool_to_float3(const bool &a)
502{
503 return (a) ? float3(1.0f) : float3(0.0f);
504}
505static float4 bool_to_float4(const bool &a)
506{
507 return (a) ? float4(1.0f) : float4(0.0f);
508}
509static ColorGeometry4f bool_to_color(const bool &a)
510{
511 return (a) ? ColorGeometry4f(1.0f, 1.0f, 1.0f, 1.0f) : ColorGeometry4f(0.0f, 0.0f, 0.0f, 1.0f);
512}
514{
515 return color::encode(bool_to_color(a));
516}
517
518static bool color_to_bool(const ColorGeometry4f &a)
519{
520 return IMB_colormanagement_get_luminance(a) > 0.0f;
521}
522static float color_to_float(const ColorGeometry4f &a)
523{
525}
527{
529}
531{
532 return short2(a.r, a.g);
533}
535{
536 return int2(a.r, a.g);
537}
539{
540 return int3(a.r, a.g, a.b);
541}
543{
544 return int_to_int8(color_to_int(a));
545}
547{
548 return float2(a.r, a.g);
549}
551{
552 return float3(a.r, a.g, a.b);
553}
555{
556 return float4(a);
557}
559{
560 return color::encode(a);
561}
562
564{
565 return a.r > 0 || a.g > 0 || a.b > 0;
566}
568{
569 return color_to_float(color::decode(a));
570}
572{
573 return color_to_int(color::decode(a));
574}
576{
577 return short2(a.r, a.g);
578}
580{
581 return int2(a.r, a.g);
582}
584{
585 return int3(a.r, a.g, a.b);
586}
588{
589 return color_to_int8(color::decode(a));
590}
604{
605 return color::decode(a);
606}
607
612
614{
615 return float2(math::to_euler(a).xyz().xy());
616}
618{
619 return float3(math::to_euler(a).xyz());
620}
622{
623 return float4(a);
624}
629
631{
632 DataTypeConversions conversions;
633
646
659
672
685
697
709
721
733
745
757
769
781
783
788
789 return conversions;
790}
791
793{
794 static const DataTypeConversions conversions = create_implicit_conversions();
795 return conversions;
796}
797
799 const CPPType &to_type,
800 const void *from_value,
801 void *to_value) const
802{
803 if (from_type == to_type) {
804 from_type.copy_construct(from_value, to_value);
805 return;
806 }
807
808 const ConversionFunctions *functions = this->get_conversion_functions(
809 DataType::ForSingle(from_type), DataType::ForSingle(to_type));
810 BLI_assert(functions != nullptr);
811
812 functions->convert_single_to_uninitialized(from_value, to_value);
813}
814
816 const mf::MultiFunction &fn,
817 const IndexMask &mask,
818 GMutableSpan to)
819{
820 mf::ParamsBuilder params{fn, &mask};
821 params.add_readonly_single_input(from);
822 params.add_uninitialized_single_output(to);
823 mf::ContextBuilder context;
824 fn.call_auto(mask, params, context);
825}
826
828 const mf::MultiFunction &fn,
829 GMutableSpan to)
830{
832}
833
835{
836 const CPPType &from_type = from_span.type();
837 const CPPType &to_type = to_span.type();
838
839 BLI_assert(from_span.size() == to_span.size());
840 BLI_assert(this->is_convertible(from_type, to_type));
841
842 const mf::MultiFunction *fn = this->get_conversion_multi_function(DataType::ForSingle(from_type),
843 DataType::ForSingle(to_type));
844
845 to_type.destruct_n(to_span.data(), to_span.size());
847}
848
850 private:
851 GVArray varray_;
852 const CPPType &from_type_;
853 ConversionFunctions old_to_new_conversions_;
854
855 public:
857 const CPPType &to_type,
858 const DataTypeConversions &conversions)
859 : GVArrayImpl(to_type, varray.size()), varray_(std::move(varray)), from_type_(varray_.type())
860 {
861 old_to_new_conversions_ = *conversions.get_conversion_functions(from_type_, to_type);
862 }
863
864 private:
865 void get(const int64_t index, void *r_value) const override
866 {
867 BUFFER_FOR_CPP_TYPE_VALUE(from_type_, buffer);
868 varray_.get(index, buffer);
869 old_to_new_conversions_.convert_single_to_initialized(buffer, r_value);
870 from_type_.destruct(buffer);
871 }
872
873 void get_to_uninitialized(const int64_t index, void *r_value) const override
874 {
875 BUFFER_FOR_CPP_TYPE_VALUE(from_type_, buffer);
876 varray_.get(index, buffer);
877 old_to_new_conversions_.convert_single_to_uninitialized(buffer, r_value);
878 from_type_.destruct(buffer);
879 }
880
881 void materialize(const IndexMask &mask,
882 void *dst,
883 const bool dst_is_uninitialized) const override
884 {
885 if (!dst_is_uninitialized) {
886 type_->destruct_n(dst, mask.min_array_size());
887 }
889 *old_to_new_conversions_.multi_function,
890 mask,
891 {this->type(), dst, mask.min_array_size()});
892 }
893
894 void materialize_compressed(const IndexMask &mask,
895 void *dst,
896 const bool dst_is_uninitialized) const override
897 {
898 const CPPType &dst_type = this->type();
899 mask.foreach_range([&](const IndexRange range, const int64_t segment_pos) {
900 void *segment_dst = POINTER_OFFSET(dst, dst_type.size * segment_pos);
901 if (!dst_is_uninitialized) {
902 type_->destruct_n(segment_dst, range.size());
903 }
904 call_convert_to_uninitialized_fn(varray_.slice(range),
905 *old_to_new_conversions_.multi_function,
906 range.index_range(),
907 {dst_type, segment_dst, range.size()});
908 });
909 }
910};
911
913 private:
914 GVMutableArray varray_;
915 const CPPType &from_type_;
916 ConversionFunctions old_to_new_conversions_;
917 ConversionFunctions new_to_old_conversions_;
918
919 public:
921 const CPPType &to_type,
922 const DataTypeConversions &conversions)
923 : GVMutableArrayImpl(to_type, varray.size()),
924 varray_(std::move(varray)),
925 from_type_(varray_.type())
926 {
927 old_to_new_conversions_ = *conversions.get_conversion_functions(from_type_, to_type);
928 new_to_old_conversions_ = *conversions.get_conversion_functions(to_type, from_type_);
929 }
930
931 private:
932 void get(const int64_t index, void *r_value) const override
933 {
934 BUFFER_FOR_CPP_TYPE_VALUE(from_type_, buffer);
935 varray_.get(index, buffer);
936 old_to_new_conversions_.convert_single_to_initialized(buffer, r_value);
937 from_type_.destruct(buffer);
938 }
939
940 void get_to_uninitialized(const int64_t index, void *r_value) const override
941 {
942 BUFFER_FOR_CPP_TYPE_VALUE(from_type_, buffer);
943 varray_.get(index, buffer);
944 old_to_new_conversions_.convert_single_to_uninitialized(buffer, r_value);
945 from_type_.destruct(buffer);
946 }
947
948 void set_by_move(const int64_t index, void *value) override
949 {
950 BUFFER_FOR_CPP_TYPE_VALUE(from_type_, buffer);
951 new_to_old_conversions_.convert_single_to_uninitialized(value, buffer);
952 varray_.set_by_relocate(index, buffer);
953 }
954
955 void materialize(const IndexMask &mask,
956 void *dst,
957 const bool dst_is_uninitialized) const override
958 {
959 if (!dst_is_uninitialized) {
960 type_->destruct_n(dst, mask.min_array_size());
961 }
963 *old_to_new_conversions_.multi_function,
964 mask,
965 {this->type(), dst, mask.min_array_size()});
966 }
967};
968
970{
971 const CPPType &from_type = varray.type();
972 if (from_type == to_type) {
973 return varray;
974 }
975 if (!this->is_convertible(from_type, to_type)) {
976 return {};
977 }
978 return GVArray::from<GVArray_For_ConvertedGVArray>(std::move(varray), to_type, *this);
979}
980
982 const CPPType &to_type) const
983{
984 const CPPType &from_type = varray.type();
985 if (from_type == to_type) {
986 return varray;
987 }
988 if (!this->is_convertible(from_type, to_type)) {
989 return {};
990 }
992 std::move(varray), to_type, *this);
993}
994
995std::optional<fn::GField> DataTypeConversions::try_convert(fn::GField field,
996 const CPPType &to_type) const
997{
998 const CPPType &from_type = field.cpp_type();
999 if (from_type == to_type) {
1000 return field;
1001 }
1002 if (!this->is_convertible(from_type, to_type)) {
1003 return std::nullopt;
1004 }
1005 const mf::MultiFunction &fn = *this->get_conversion_multi_function(
1006 mf::DataType::ForSingle(from_type), mf::DataType::ForSingle(to_type));
1007 return fn::GField{fn::FieldOperation::from(fn, {std::move(field)})};
1008}
1009
1010} // namespace blender::bke
#define BUFFER_FOR_CPP_TYPE_VALUE(type, variable_name)
#define POINTER_OFFSET(v, ofs)
long long int int64_t
static const CPPType & get()
void destruct_n(void *ptr, int64_t n) const
StringRefNull name() const
void copy_construct(const void *src, void *dst) const
void destruct(void *ptr) const
ChannelStorageType r
ChannelStorageType g
ChannelStorageType b
const CPPType & type() const
const CPPType & type() const
int64_t size() const
void get(int64_t index, void *r_value) const
GVArrayImpl(const CPPType &type, int64_t size)
const CPPType & type() const
static GVArray from(Args &&...args)
static GVArray from_span(GSpan span)
GVMutableArrayImpl(const CPPType &type, int64_t size)
static GVMutableArray from(Args &&...args)
void set_by_relocate(int64_t index, void *value)
void convert_to_uninitialized(const CPPType &from_type, const CPPType &to_type, const void *from_value, void *to_value) const
void add(mf::DataType from_type, mf::DataType to_type, const mf::MultiFunction &fn, void(*convert_single_to_initialized)(const void *src, void *dst), void(*convert_single_to_uninitialized)(const void *src, void *dst))
void convert_to_initialized_n(GSpan from_span, GMutableSpan to_span) const
const ConversionFunctions * get_conversion_functions(mf::DataType from, mf::DataType to) const
bool is_convertible(const CPPType &from_type, const CPPType &to_type) const
GVArray try_convert(GVArray varray, const CPPType &to_type) const
const mf::MultiFunction * get_conversion_multi_function(mf::DataType from, mf::DataType to) const
GVArray_For_ConvertedGVArray(GVArray varray, const CPPType &to_type, const DataTypeConversions &conversions)
GVMutableArray_For_ConvertedGVMutableArray(GVMutableArray varray, const CPPType &to_type, const DataTypeConversions &conversions)
static FieldOperationPtr from(std::shared_ptr< const mf::MultiFunction > fn, Vector< GField > inputs)
Definition field.cc:252
const CPPType & cpp_type() const
Definition FN_field.hh:518
#define index(i)
uint to_type(bool)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
static float4 float_to_float4(const float &a)
static ColorGeometry4f int3_to_color(const int3 &a)
static int2 bool_to_int2(const bool &a)
static float3 quaternion_to_float3(const math::Quaternion &a)
static float2 short2_to_float2(const short2 &a)
static float3 color_to_float3(const ColorGeometry4f &a)
static float bool_to_float(const bool &a)
static int2 int_to_int2(const int32_t &a)
static short2 float_to_short2(const float &a)
static short2 bool_to_short2(const bool &a)
static short2 float4_to_short2(const float4 &a)
static ColorGeometry4b float_to_byte_color(const float &a)
static ColorGeometry4f float_to_color(const float &a)
static int short2_to_int(const short2 &a)
static ColorGeometry4f byte_color_to_color(const ColorGeometry4b &a)
static int8_t float_to_int8(const float &a)
static float2 float4_to_float2(const float4 &a)
static float color_to_float(const ColorGeometry4f &a)
static ColorGeometry4b float4_to_byte_color(const float4 &a)
static int2 int8_to_int2(const int8_t &a)
static int float4_to_int(const float4 &a)
static float2 float_to_float2(const float &a)
static float int2_to_float(const int2 &a)
static int3 float2_to_int3(const float2 &a)
static ColorGeometry4b int_to_byte_color(const int32_t &a)
static int2 float_to_int2(const float &a)
static int3 short2_to_int3(const short2 &a)
static float2 int2_to_float2(const int2 &a)
static bool float_to_bool(const float &a)
static void add_implicit_conversion(DataTypeConversions &conversions)
static int8_t int2_to_int8(const int2 &a)
static bool int2_to_bool(const int2 &a)
static ColorGeometry4f float4_to_color(const float4 &a)
static float4 float2_to_float4(const float2 &a)
static float4 int3_to_float4(const int3 &a)
static int8_t float4_to_int8(const float4 &a)
static float4 float3_to_float4(const float3 &a)
static int8_t float2_to_int8(const float2 &a)
static ColorGeometry4b int2_to_byte_color(const int2 &a)
const DataTypeConversions & get_implicit_type_conversions()
static short2 int2_to_short2(const int2 &a)
static float float3_to_float(const float3 &a)
static float3 float2_to_float3(const float2 &a)
static float float2_to_float(const float2 &a)
static float3 float4_to_float3(const float4 &a)
static math::Quaternion float_to_quaternion(const float &a)
static int3 int8_to_int3(const int8_t &a)
static float2 bool_to_float2(const bool &a)
static int8_t bool_to_int8(const bool &a)
static short2 color_to_short2(const ColorGeometry4f &a)
static ColorGeometry4b float3_to_byte_color(const float3 &a)
static float4 color_to_float4(const ColorGeometry4f &a)
static float short2_to_float(const short2 &a)
static float3 int8_to_float3(const int8_t &a)
static ColorGeometry4f short2_to_color(const short2 &a)
static int32_t color_to_int(const ColorGeometry4f &a)
static float3 float_to_float3(const float &a)
static float4 byte_color_to_float4(const ColorGeometry4b &a)
static ColorGeometry4f float3_to_color(const float3 &a)
static int2 byte_color_to_int2(const ColorGeometry4b &a)
static math::Quaternion float4_to_quaternion(const float4 &a)
static math::Quaternion float2_to_quaternion(const float2 &a)
static int2 float3_to_int2(const float3 &a)
static int float2_to_int(const float2 &a)
static bool byte_color_to_bool(const ColorGeometry4b &a)
static bool float2_to_bool(const float2 &a)
static bool color_to_bool(const ColorGeometry4f &a)
static float3 short2_to_float3(const short2 &a)
static short2 int_to_short2(const int32_t &a)
static ColorGeometry4f float2_to_color(const float2 &a)
static float2 int_to_float2(const int32_t &a)
static float int8_to_float(const int8_t &a)
static int3 int2_to_int3(const int2 &a)
static int2 color_to_int2(const ColorGeometry4f &a)
static bool short2_to_bool(const short2 &a)
static int3 float_to_int3(const float &a)
static short2 int8_to_short2(const int8_t &a)
static float4 bool_to_float4(const bool &a)
static DataTypeConversions create_implicit_conversions()
static bool float3_to_bool(const float3 &a)
static ColorGeometry4b short2_to_byte_color(const short2 &a)
static float4 int8_to_float4(const int8_t &a)
static int8_t int3_to_int8(const int3 &a)
static float4 int_to_float4(const int32_t &a)
static float2 int8_to_float2(const int8_t &a)
static float2 int3_to_float2(const int3 &a)
static bool int8_to_bool(const int8_t &a)
static float4x4 quaternion_to_float4x4(const math::Quaternion &a)
static int int2_to_int(const int2 &a)
static float3 int_to_float3(const int32_t &a)
static float float4_to_float(const float4 &a)
static bool int3_to_bool(const int3 &a)
static float4 short2_to_float4(const short2 &a)
static int3 float4_to_int3(const float4 &a)
static float byte_color_to_float(const ColorGeometry4b &a)
static float3 int2_to_float3(const int2 &a)
static ColorGeometry4b float2_to_byte_color(const float2 &a)
static int3 float3_to_int3(const float3 &a)
static int32_t byte_color_to_int(const ColorGeometry4b &a)
static int32_t bool_to_int(const bool &a)
static int float3_to_int(const float3 &a)
static int2 short2_to_int2(const short2 &a)
static float int_to_float(const int32_t &a)
static short2 float3_to_short2(const float3 &a)
static math::Quaternion float3_to_quaternion(const float3 &a)
static int3 byte_color_to_int3(const ColorGeometry4b &a)
static int3 bool_to_int3(const bool &a)
static float2 quaternion_to_float2(const math::Quaternion &a)
static ColorGeometry4b int3_to_byte_color(const int3 &a)
static ColorGeometry4f int_to_color(const int32_t &a)
static ColorGeometry4b bool_to_byte_color(const bool &a)
static ColorGeometry4f int2_to_color(const int2 &a)
static int32_t float_to_int(const float &a)
static bool int_to_bool(const int32_t &a)
static math::Quaternion float4x4_to_quaternion(const float4x4 &a)
static short2 byte_color_to_short2(const ColorGeometry4b &a)
static ColorGeometry4f int8_to_color(const int8_t &a)
static int8_t byte_color_to_int8(const ColorGeometry4b &a)
static bool float4_to_bool(const float4 &a)
static float int3_to_float(const int3 &a)
static float2 float3_to_float2(const float3 &a)
static int2 float4_to_int2(const float4 &a)
static short2 float2_to_short2(const float2 &a)
static float3 int3_to_float3(const int3 &a)
static int8_t int_to_int8(const int32_t &a)
static float2 byte_color_to_float2(const ColorGeometry4b &a)
static int2 float2_to_int2(const float2 &a)
static int8_t float3_to_int8(const float3 &a)
static ColorGeometry4b int8_to_byte_color(const int8_t &a)
static short2 int3_to_short2(const int3 &a)
static ColorGeometry4b color_to_byte_color(const ColorGeometry4f &a)
static float2 color_to_float2(const ColorGeometry4f &a)
static int3 color_to_int3(const ColorGeometry4f &a)
static float4 quaternion_to_float4(const math::Quaternion &a)
static int int8_to_int(const int8_t &a)
static int8_t color_to_int8(const ColorGeometry4f &a)
static int3 int_to_int3(const int32_t &a)
static void call_convert_to_uninitialized_fn(const GVArray &from, const mf::MultiFunction &fn, const IndexMask &mask, GMutableSpan to)
static int int3_to_int(const int3 &a)
static int2 int3_to_int2(const int3 &a)
static ColorGeometry4f bool_to_color(const bool &a)
static int8_t short2_to_int8(const short2 &a)
static float3 byte_color_to_float3(const ColorGeometry4b &a)
static float4 int2_to_float4(const int2 &a)
static float3 bool_to_float3(const bool &a)
BLI_INLINE ColorSceneLinear4f< Alpha > decode(const ColorSceneLinearByteEncoded4b< Alpha > &color)
Definition BLI_color.hh:77
BLI_INLINE ColorSceneLinearByteEncoded4b< Alpha > encode(const ColorSceneLinear4f< Alpha > &color)
Definition BLI_color.hh:50
QuaternionBase< float > Quaternion
QuaternionBase< T > to_quaternion(const AxisAngleBase< T, AngleT > &axis_angle)
EulerXYZBase< float > EulerXYZ
bool is_zero(const T &a)
T midpoint(const T &a, const T &b)
QuaternionBase< T > normalized_to_quaternion_safe(const MatBase< T, 3, 3 > &mat)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
MatT from_rotation(const RotationT &rotation)
Euler3Base< T > to_euler(const AxisAngleBase< T, AngleT > &axis_angle, EulerOrder order)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
__int64 int64_t
Definition BKE_text.h:90
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< int32_t, 3 > int3
MatBase< float, 3, 3 > float3x3
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
VecBase< int16_t, 2 > short2
signed int int32_t
Definition BKE_text.h:78
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
VecBase< float, 3 > float3
signed char int8_t
Definition BKE_text.h:76
ColorSceneLinearByteEncoded4b< eAlpha::Premultiplied > ColorGeometry4b
void mask(PageMask &srt, TileMaps &tilemaps, const uint3 global_id, const uint local_tile_index)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
void(*) convert_single_to_initialized(const void *src, void *dst)
void(*) convert_single_to_uninitialized(const void *src, void *dst)