85 if (host_format != device_format) {
86 if (host_format == TextureFormat::SFLOAT_16_16_16 &&
87 device_format == TextureFormat::SFLOAT_16_16_16_16)
91 if (host_format == TextureFormat::SFLOAT_32_32_32 &&
92 device_format == TextureFormat::SFLOAT_32_32_32_32)
100 switch (device_format) {
101 case TextureFormat::SFLOAT_32_32_32_32:
102 case TextureFormat::SFLOAT_32_32:
103 case TextureFormat::SFLOAT_32:
104 case TextureFormat::SFLOAT_32_DEPTH:
107 case TextureFormat::SFLOAT_32_DEPTH_UINT_8:
110 case TextureFormat::SFLOAT_16_16_16_16:
111 case TextureFormat::SFLOAT_16_16:
112 case TextureFormat::SFLOAT_16:
113 case TextureFormat::SFLOAT_16_16_16:
116 case TextureFormat::SRGBA_8_8_8_8:
117 case TextureFormat::UNORM_8_8_8_8:
118 case TextureFormat::UNORM_8_8:
119 case TextureFormat::UNORM_8:
122 case TextureFormat::SNORM_8_8_8_8:
123 case TextureFormat::SNORM_8_8_8:
124 case TextureFormat::SNORM_8_8:
125 case TextureFormat::SNORM_8:
128 case TextureFormat::UNORM_16_16_16_16:
129 case TextureFormat::UNORM_16_16:
130 case TextureFormat::UNORM_16:
133 case TextureFormat::SNORM_16_16_16_16:
134 case TextureFormat::SNORM_16_16_16:
135 case TextureFormat::SNORM_16_16:
136 case TextureFormat::SNORM_16:
139 case TextureFormat::UFLOAT_11_11_10:
142 case TextureFormat::SRGB_DXT1:
143 case TextureFormat::SRGB_DXT3:
144 case TextureFormat::SRGB_DXT5:
145 case TextureFormat::SNORM_DXT1:
146 case TextureFormat::SNORM_DXT3:
147 case TextureFormat::SNORM_DXT5:
153 case TextureFormat::SFLOAT_32_32_32:
155 case TextureFormat::UINT_8_8_8_8:
156 case TextureFormat::SINT_8_8_8_8:
157 case TextureFormat::UINT_16_16_16_16:
158 case TextureFormat::SINT_16_16_16_16:
159 case TextureFormat::UINT_32_32_32_32:
160 case TextureFormat::SINT_32_32_32_32:
161 case TextureFormat::UINT_8_8:
162 case TextureFormat::SINT_8_8:
163 case TextureFormat::UINT_16_16:
164 case TextureFormat::SINT_16_16:
165 case TextureFormat::UINT_32_32:
166 case TextureFormat::SINT_32_32:
167 case TextureFormat::UINT_8:
168 case TextureFormat::SINT_8:
169 case TextureFormat::UINT_16:
170 case TextureFormat::SINT_16:
171 case TextureFormat::UINT_32:
172 case TextureFormat::SINT_32:
173 case TextureFormat::UNORM_10_10_10_2:
174 case TextureFormat::UINT_10_10_10_2:
175 case TextureFormat::UINT_8_8_8:
176 case TextureFormat::SINT_8_8_8:
177 case TextureFormat::UNORM_8_8_8:
178 case TextureFormat::UINT_16_16_16:
179 case TextureFormat::SINT_16_16_16:
180 case TextureFormat::UNORM_16_16_16:
181 case TextureFormat::UINT_32_32_32:
182 case TextureFormat::SINT_32_32_32:
183 case TextureFormat::SRGBA_8_8_8:
184 case TextureFormat::UFLOAT_9_9_9_EXP_5:
185 case TextureFormat::UNORM_16_DEPTH:
197 switch (device_format) {
198 case TextureFormat::SINT_32_32_32_32:
199 case TextureFormat::SINT_32_32:
200 case TextureFormat::SINT_32:
203 case TextureFormat::SINT_16_16_16_16:
204 case TextureFormat::SINT_16_16:
205 case TextureFormat::SINT_16:
208 case TextureFormat::SINT_8_8_8_8:
209 case TextureFormat::SINT_8_8:
210 case TextureFormat::SINT_8:
213 case TextureFormat::UINT_8_8_8_8:
214 case TextureFormat::UNORM_8_8_8_8:
215 case TextureFormat::UINT_16_16_16_16:
216 case TextureFormat::SFLOAT_16_16_16_16:
217 case TextureFormat::UNORM_16_16_16_16:
218 case TextureFormat::UINT_32_32_32_32:
219 case TextureFormat::SFLOAT_32_32_32_32:
220 case TextureFormat::UINT_8_8:
221 case TextureFormat::UNORM_8_8:
222 case TextureFormat::UINT_16_16:
223 case TextureFormat::SFLOAT_16_16:
224 case TextureFormat::UINT_32_32:
225 case TextureFormat::SFLOAT_32_32:
226 case TextureFormat::UNORM_16_16:
227 case TextureFormat::UINT_8:
228 case TextureFormat::UNORM_8:
229 case TextureFormat::UINT_16:
230 case TextureFormat::SFLOAT_16:
231 case TextureFormat::UNORM_16:
232 case TextureFormat::UINT_32:
233 case TextureFormat::SFLOAT_32:
234 case TextureFormat::UNORM_10_10_10_2:
235 case TextureFormat::UINT_10_10_10_2:
236 case TextureFormat::UFLOAT_11_11_10:
237 case TextureFormat::SFLOAT_32_DEPTH_UINT_8:
238 case TextureFormat::SRGBA_8_8_8_8:
239 case TextureFormat::SNORM_8_8_8_8:
240 case TextureFormat::SNORM_16_16_16_16:
241 case TextureFormat::UINT_8_8_8:
242 case TextureFormat::SINT_8_8_8:
243 case TextureFormat::UNORM_8_8_8:
244 case TextureFormat::SNORM_8_8_8:
245 case TextureFormat::UINT_16_16_16:
246 case TextureFormat::SINT_16_16_16:
247 case TextureFormat::SFLOAT_16_16_16:
248 case TextureFormat::UNORM_16_16_16:
249 case TextureFormat::SNORM_16_16_16:
250 case TextureFormat::UINT_32_32_32:
251 case TextureFormat::SINT_32_32_32:
252 case TextureFormat::SFLOAT_32_32_32:
253 case TextureFormat::SNORM_8_8:
254 case TextureFormat::SNORM_16_16:
255 case TextureFormat::SNORM_8:
256 case TextureFormat::SNORM_16:
257 case TextureFormat::SRGB_DXT1:
258 case TextureFormat::SRGB_DXT3:
259 case TextureFormat::SRGB_DXT5:
260 case TextureFormat::SNORM_DXT1:
261 case TextureFormat::SNORM_DXT3:
262 case TextureFormat::SNORM_DXT5:
263 case TextureFormat::SRGBA_8_8_8:
264 case TextureFormat::UFLOAT_9_9_9_EXP_5:
265 case TextureFormat::SFLOAT_32_DEPTH:
266 case TextureFormat::UNORM_16_DEPTH:
278 switch (device_format) {
279 case TextureFormat::UINT_32_32_32_32:
280 case TextureFormat::UINT_32_32:
281 case TextureFormat::UINT_32:
284 case TextureFormat::UINT_16_16_16_16:
285 case TextureFormat::UINT_16_16:
286 case TextureFormat::UINT_16:
287 case TextureFormat::UINT_16_16_16:
290 case TextureFormat::UINT_8_8_8_8:
291 case TextureFormat::UINT_8_8:
292 case TextureFormat::UINT_8:
295 case TextureFormat::SFLOAT_32_DEPTH:
296 case TextureFormat::SFLOAT_32_DEPTH_UINT_8:
299 case TextureFormat::SINT_8_8_8_8:
300 case TextureFormat::UNORM_8_8_8_8:
301 case TextureFormat::SINT_16_16_16_16:
302 case TextureFormat::SFLOAT_16_16_16_16:
303 case TextureFormat::UNORM_16_16_16_16:
304 case TextureFormat::SINT_32_32_32_32:
305 case TextureFormat::SFLOAT_32_32_32_32:
306 case TextureFormat::SINT_8_8:
307 case TextureFormat::UNORM_8_8:
308 case TextureFormat::SINT_16_16:
309 case TextureFormat::SFLOAT_16_16:
310 case TextureFormat::UNORM_16_16:
311 case TextureFormat::SINT_32_32:
312 case TextureFormat::SFLOAT_32_32:
313 case TextureFormat::SINT_8:
314 case TextureFormat::UNORM_8:
315 case TextureFormat::SINT_16:
316 case TextureFormat::SFLOAT_16:
317 case TextureFormat::UNORM_16:
318 case TextureFormat::SINT_32:
319 case TextureFormat::SFLOAT_32:
320 case TextureFormat::UNORM_10_10_10_2:
321 case TextureFormat::UINT_10_10_10_2:
322 case TextureFormat::UFLOAT_11_11_10:
323 case TextureFormat::SRGBA_8_8_8_8:
324 case TextureFormat::SNORM_8_8_8_8:
325 case TextureFormat::SNORM_16_16_16_16:
326 case TextureFormat::UINT_8_8_8:
327 case TextureFormat::SINT_8_8_8:
328 case TextureFormat::UNORM_8_8_8:
329 case TextureFormat::SNORM_8_8_8:
330 case TextureFormat::SINT_16_16_16:
331 case TextureFormat::SFLOAT_16_16_16:
332 case TextureFormat::UNORM_16_16_16:
333 case TextureFormat::SNORM_16_16_16:
334 case TextureFormat::UINT_32_32_32:
335 case TextureFormat::SINT_32_32_32:
336 case TextureFormat::SFLOAT_32_32_32:
337 case TextureFormat::SNORM_8_8:
338 case TextureFormat::SNORM_16_16:
339 case TextureFormat::SNORM_8:
340 case TextureFormat::SNORM_16:
341 case TextureFormat::SRGB_DXT1:
342 case TextureFormat::SRGB_DXT3:
343 case TextureFormat::SRGB_DXT5:
344 case TextureFormat::SNORM_DXT1:
345 case TextureFormat::SNORM_DXT3:
346 case TextureFormat::SNORM_DXT5:
347 case TextureFormat::SRGBA_8_8_8:
348 case TextureFormat::UFLOAT_9_9_9_EXP_5:
349 case TextureFormat::UNORM_16_DEPTH:
361 switch (device_format) {
362 case TextureFormat::SFLOAT_16_16_16_16:
363 case TextureFormat::SFLOAT_16_16:
364 case TextureFormat::SFLOAT_16:
367 case TextureFormat::UINT_8_8_8_8:
368 case TextureFormat::SINT_8_8_8_8:
369 case TextureFormat::UNORM_8_8_8_8:
370 case TextureFormat::UINT_16_16_16_16:
371 case TextureFormat::SINT_16_16_16_16:
372 case TextureFormat::UNORM_16_16_16_16:
373 case TextureFormat::UINT_32_32_32_32:
374 case TextureFormat::SINT_32_32_32_32:
375 case TextureFormat::SFLOAT_32_32_32_32:
376 case TextureFormat::UINT_8_8:
377 case TextureFormat::SINT_8_8:
378 case TextureFormat::UNORM_8_8:
379 case TextureFormat::UINT_16_16:
380 case TextureFormat::SINT_16_16:
381 case TextureFormat::UNORM_16_16:
382 case TextureFormat::UINT_32_32:
383 case TextureFormat::SINT_32_32:
384 case TextureFormat::SFLOAT_32_32:
385 case TextureFormat::UINT_8:
386 case TextureFormat::SINT_8:
387 case TextureFormat::UNORM_8:
388 case TextureFormat::UINT_16:
389 case TextureFormat::SINT_16:
390 case TextureFormat::UNORM_16:
391 case TextureFormat::UINT_32:
392 case TextureFormat::SINT_32:
393 case TextureFormat::SFLOAT_32:
394 case TextureFormat::UNORM_10_10_10_2:
395 case TextureFormat::UINT_10_10_10_2:
396 case TextureFormat::UFLOAT_11_11_10:
397 case TextureFormat::SFLOAT_32_DEPTH_UINT_8:
398 case TextureFormat::SRGBA_8_8_8_8:
399 case TextureFormat::SNORM_8_8_8_8:
400 case TextureFormat::SNORM_16_16_16_16:
401 case TextureFormat::UINT_8_8_8:
402 case TextureFormat::SINT_8_8_8:
403 case TextureFormat::UNORM_8_8_8:
404 case TextureFormat::SNORM_8_8_8:
405 case TextureFormat::UINT_16_16_16:
406 case TextureFormat::SINT_16_16_16:
407 case TextureFormat::SFLOAT_16_16_16:
408 case TextureFormat::UNORM_16_16_16:
409 case TextureFormat::SNORM_16_16_16:
410 case TextureFormat::UINT_32_32_32:
411 case TextureFormat::SINT_32_32_32:
412 case TextureFormat::SFLOAT_32_32_32:
413 case TextureFormat::SNORM_8_8:
414 case TextureFormat::SNORM_16_16:
415 case TextureFormat::SNORM_8:
416 case TextureFormat::SNORM_16:
417 case TextureFormat::SRGB_DXT1:
418 case TextureFormat::SRGB_DXT3:
419 case TextureFormat::SRGB_DXT5:
420 case TextureFormat::SNORM_DXT1:
421 case TextureFormat::SNORM_DXT3:
422 case TextureFormat::SNORM_DXT5:
423 case TextureFormat::SRGBA_8_8_8:
424 case TextureFormat::UFLOAT_9_9_9_EXP_5:
425 case TextureFormat::SFLOAT_32_DEPTH:
426 case TextureFormat::UNORM_16_DEPTH:
438 switch (device_format) {
439 case TextureFormat::UINT_8_8_8_8:
440 case TextureFormat::UNORM_8_8_8_8:
441 case TextureFormat::UINT_8_8:
442 case TextureFormat::UNORM_8_8:
443 case TextureFormat::UINT_8:
444 case TextureFormat::UNORM_8:
445 case TextureFormat::SRGBA_8_8_8_8:
448 case TextureFormat::SFLOAT_16_16_16_16:
449 case TextureFormat::SFLOAT_16_16:
450 case TextureFormat::SFLOAT_16:
453 case TextureFormat::SINT_8_8_8_8:
454 case TextureFormat::UINT_16_16_16_16:
455 case TextureFormat::SINT_16_16_16_16:
456 case TextureFormat::UNORM_16_16_16_16:
457 case TextureFormat::UINT_32_32_32_32:
458 case TextureFormat::SINT_32_32_32_32:
459 case TextureFormat::SFLOAT_32_32_32_32:
460 case TextureFormat::SINT_8_8:
461 case TextureFormat::UINT_16_16:
462 case TextureFormat::SINT_16_16:
463 case TextureFormat::UNORM_16_16:
464 case TextureFormat::UINT_32_32:
465 case TextureFormat::SINT_32_32:
466 case TextureFormat::SFLOAT_32_32:
467 case TextureFormat::SINT_8:
468 case TextureFormat::UINT_16:
469 case TextureFormat::SINT_16:
470 case TextureFormat::UNORM_16:
471 case TextureFormat::UINT_32:
472 case TextureFormat::SINT_32:
473 case TextureFormat::SFLOAT_32:
474 case TextureFormat::UNORM_10_10_10_2:
475 case TextureFormat::UINT_10_10_10_2:
476 case TextureFormat::UFLOAT_11_11_10:
477 case TextureFormat::SFLOAT_32_DEPTH_UINT_8:
478 case TextureFormat::SNORM_8_8_8_8:
479 case TextureFormat::SNORM_16_16_16_16:
480 case TextureFormat::UINT_8_8_8:
481 case TextureFormat::SINT_8_8_8:
482 case TextureFormat::UNORM_8_8_8:
483 case TextureFormat::SNORM_8_8_8:
484 case TextureFormat::UINT_16_16_16:
485 case TextureFormat::SINT_16_16_16:
486 case TextureFormat::SFLOAT_16_16_16:
487 case TextureFormat::UNORM_16_16_16:
488 case TextureFormat::SNORM_16_16_16:
489 case TextureFormat::UINT_32_32_32:
490 case TextureFormat::SINT_32_32_32:
491 case TextureFormat::SFLOAT_32_32_32:
492 case TextureFormat::SNORM_8_8:
493 case TextureFormat::SNORM_16_16:
494 case TextureFormat::SNORM_8:
495 case TextureFormat::SNORM_16:
496 case TextureFormat::SRGB_DXT1:
497 case TextureFormat::SRGB_DXT3:
498 case TextureFormat::SRGB_DXT5:
499 case TextureFormat::SNORM_DXT1:
500 case TextureFormat::SNORM_DXT3:
501 case TextureFormat::SNORM_DXT5:
502 case TextureFormat::SRGBA_8_8_8:
503 case TextureFormat::UFLOAT_9_9_9_EXP_5:
504 case TextureFormat::SFLOAT_32_DEPTH:
505 case TextureFormat::UNORM_16_DEPTH:
517 switch (device_format) {
518 case TextureFormat::SFLOAT_32_DEPTH_UINT_8:
521 case TextureFormat::SFLOAT_32_32_32_32:
522 case TextureFormat::SFLOAT_32_32:
523 case TextureFormat::SFLOAT_32:
524 case TextureFormat::SFLOAT_16_16_16_16:
525 case TextureFormat::SFLOAT_16_16:
526 case TextureFormat::SFLOAT_16:
527 case TextureFormat::SFLOAT_16_16_16:
528 case TextureFormat::UNORM_8_8_8_8:
529 case TextureFormat::UNORM_8_8:
530 case TextureFormat::UNORM_8:
531 case TextureFormat::SNORM_8_8_8_8:
532 case TextureFormat::SNORM_8_8_8:
533 case TextureFormat::SNORM_8_8:
534 case TextureFormat::SNORM_8:
535 case TextureFormat::UNORM_16_16_16_16:
536 case TextureFormat::UNORM_16_16:
537 case TextureFormat::UNORM_16:
538 case TextureFormat::SNORM_16_16_16_16:
539 case TextureFormat::SNORM_16_16_16:
540 case TextureFormat::SNORM_16_16:
541 case TextureFormat::SNORM_16:
542 case TextureFormat::SRGBA_8_8_8_8:
543 case TextureFormat::SFLOAT_32_DEPTH:
544 case TextureFormat::UFLOAT_11_11_10:
545 case TextureFormat::SRGB_DXT1:
546 case TextureFormat::SRGB_DXT3:
547 case TextureFormat::SRGB_DXT5:
548 case TextureFormat::SNORM_DXT1:
549 case TextureFormat::SNORM_DXT3:
550 case TextureFormat::SNORM_DXT5:
553 case TextureFormat::SFLOAT_32_32_32:
555 case TextureFormat::UINT_8_8_8_8:
556 case TextureFormat::SINT_8_8_8_8:
557 case TextureFormat::UINT_16_16_16_16:
558 case TextureFormat::SINT_16_16_16_16:
559 case TextureFormat::UINT_32_32_32_32:
560 case TextureFormat::SINT_32_32_32_32:
561 case TextureFormat::UINT_8_8:
562 case TextureFormat::SINT_8_8:
563 case TextureFormat::UINT_16_16:
564 case TextureFormat::SINT_16_16:
565 case TextureFormat::UINT_32_32:
566 case TextureFormat::SINT_32_32:
567 case TextureFormat::UINT_8:
568 case TextureFormat::SINT_8:
569 case TextureFormat::UINT_16:
570 case TextureFormat::SINT_16:
571 case TextureFormat::UINT_32:
572 case TextureFormat::SINT_32:
573 case TextureFormat::UNORM_10_10_10_2:
574 case TextureFormat::UINT_10_10_10_2:
575 case TextureFormat::UINT_8_8_8:
576 case TextureFormat::SINT_8_8_8:
577 case TextureFormat::UNORM_8_8_8:
578 case TextureFormat::UINT_16_16_16:
579 case TextureFormat::SINT_16_16_16:
580 case TextureFormat::UNORM_16_16_16:
581 case TextureFormat::UINT_32_32_32:
582 case TextureFormat::SINT_32_32_32:
583 case TextureFormat::SRGBA_8_8_8:
584 case TextureFormat::UFLOAT_9_9_9_EXP_5:
585 case TextureFormat::UNORM_16_DEPTH:
597 if (device_format == TextureFormat::UFLOAT_11_11_10) {
605 if (
ELEM(device_format, TextureFormat::UNORM_10_10_10_2, TextureFormat::UINT_10_10_10_2)) {
615 switch (host_format) {
639#define CASE_SINGLE(a, b) \
640 case ConversionType::a##_TO_##b: \
641 return ConversionType::b##_TO_##a;
643#define CASE_PAIR(a, b) \
691 float_to_bits.fl = value;
692 return float_to_bits.u;
701 float_to_bits.u = value;
702 return float_to_bits.fl;
729 return value & 0xffff;
734 value = (
value & 0xffffffffffff0000) | (new_value & 0xffff);
738 return (
value >> 16) & 0xffff;
743 value = (
value & 0xffffffff0000ffff) | ((new_value & 0xffff) << 16);
747 return (
value >> 32) & 0xffff;
752 value = (
value & 0xffff0000ffffffff) | ((new_value & 0xffff) << 32);
757 value = (
value & 0xffffffffffff) | ((new_value & 0xffff) << 48);
765 static_assert(std::is_same<InnerType, uint8_t>() || std::is_same<InnerType, uint16_t>());
770 return (1 << (
sizeof(InnerType) * 8 - 1));
775 return (1 << (
sizeof(InnerType) * 8 - 1)) - 1;
780 return ((1 << (
sizeof(InnerType) * 8)) - 1);
785 static_assert(std::is_same<InnerType, uint8_t>() || std::is_same<InnerType, uint16_t>() ||
786 std::is_same<InnerType, uint32_t>());
791 return sizeof(InnerType);
796 return std::numeric_limits<InnerType>::max();
801 return std::numeric_limits<InnerType>::max();
836template<
typename StorageType>
849template<
typename DestinationType,
typename SourceType>
850void convert(DestinationType &dst,
const SourceType &src)
852 static_assert(std::is_same<DestinationType, UI8>() || std::is_same<DestinationType, UI16>() ||
853 std::is_same<DestinationType, UI32>() || std::is_same<DestinationType, I8>() ||
854 std::is_same<DestinationType, I16>() || std::is_same<DestinationType, I32>());
855 static_assert(std::is_same<SourceType, UI8>() || std::is_same<SourceType, UI16>() ||
856 std::is_same<SourceType, UI32>() || std::is_same<SourceType, I8>() ||
857 std::is_same<SourceType, I16>() || std::is_same<SourceType, I32>());
858 static_assert(!std::is_same<DestinationType, SourceType>());
859 dst.value = src.value;
931 dst.
value = (depth << 8);
940template<
typename DestinationType,
typename SourceType>
949template<
typename DestinationType,
typename SourceType>
951 const void *src_memory,
959 static_cast<DestinationType *
>(dst_memory), total_components);
963template<
typename DestinationType,
typename SourceType>
969 static_cast<DestinationType *
>(dst_memory), buffer_size);
977template<
typename ComponentType>
983 const int src_index =
index * 3 + size;
984 const int dst_index =
index * 4;
985 components[dst_index] = components[src_index];
986 components[dst_index + 1] = components[src_index + 1];
987 components[dst_index + 2] = components[src_index + 2];
988 components[dst_index + 3] = component_4_value;
993 const void *src_memory,
1003 memcpy(dst_memory, src_memory, buffer_size *
to_bytesize(device_format));
1007 memcpy(dst_memory, src_memory, buffer_size *
to_bytesize(TextureFormat::SFLOAT_32_DEPTH));
1044 dst_memory, src_memory, buffer_size, device_format);
1048 dst_memory, src_memory, buffer_size, device_format);
1053 dst_memory, src_memory, buffer_size, device_format);
1057 dst_memory, src_memory, buffer_size, device_format);
1062 dst_memory, src_memory, buffer_size, device_format);
1066 dst_memory, src_memory, buffer_size, device_format);
1071 dst_memory, src_memory, buffer_size, device_format);
1075 dst_memory, src_memory, buffer_size, device_format);
1080 dst_memory, src_memory, buffer_size, device_format);
1084 dst_memory, src_memory, buffer_size, device_format);
1096 Span<float> src(
static_cast<const float *
>(src_memory), element_len);
1099 constexpr int64_t chunk_size = 4 * 1024 * 1024;
1113 static_cast<float *
>(dst_memory),
1133 size_t element_len = buffer_size;
1134 constexpr int64_t src_component_len = 3;
1135 constexpr int64_t dst_component_len = 4;
1136 Span<float> src(
static_cast<const float *
>(src_memory), element_len * src_component_len);
1138 element_len * dst_component_len);
1141 constexpr int64_t chunk_size = 16 * 1024;
1145 range.
size() * src_component_len);
1147 range.
size() * dst_component_len);
1149 range.
size() * src_component_len);
1189 const void *src_buffer,
1197 convert_buffer(dst_buffer, src_buffer, buffer_size, device_format, conversion_type);
1201 const void *src_buffer,
1208 host_to_device(host_format, host_texture_format, device_format));
1210 "Data conversion between host_format and device_format isn't supported (yet).");
1211 convert_buffer(dst_buffer, src_buffer, buffer_size, device_format, conversion_type);
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
#define CASE_PAIR(value_src, value_dst)
constexpr int64_t size() const
constexpr IndexRange()=default
constexpr int64_t start() const
constexpr MutableSpan()=default
constexpr int64_t size() const
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
constexpr T * data() const
constexpr Span slice(int64_t start, int64_t size) const
constexpr const T * data() const
constexpr int64_t size() const
void set_g(uint64_t new_value)
void set_r(uint64_t new_value)
void set_a(uint64_t new_value)
void set_b(uint64_t new_value)
ComponentValue< int16_t > I16
ComponentValue< uint16_t > F16
ComponentValue< uint8_t > UI8
constexpr uint32_t MASK_10_BITS
void convert_per_component(void *dst_memory, const void *src_memory, size_t buffer_size, TextureFormat device_format)
void remap_components_3to4_front_to_back(MutableSpan< ComponentType > components, int64_t size, ComponentType component_4_value)
Inline remapping from 3 components to 4 components where the data is stored at the end of the buffer.
ComponentValue< uint32_t > UI32
constexpr uint8_t SHIFT_B
static ConversionType reversed(ConversionType type)
@ B10F_G11F_R11F_TO_FLOAT
@ FLOAT_TO_B10F_G11F_R11F
@ UINT_TO_DEPTH32F_STENCIL8
@ DEPTH32F_STENCIL8_TO_UINT
static ConversionType host_to_device(const eGPUDataFormat host_format, const TextureFormat host_texture_format, const TextureFormat device_format)
static ConversionType type_of_conversion_uint(TextureFormat device_format)
constexpr uint16_t HALF_VALUE_1
static uint32_t float_to_uint32_t(float value)
void convert(SignedNormalized< StorageType > &dst, const F32 &src)
ComponentValue< uint16_t > UI16
constexpr uint8_t SHIFT_R
static ConversionType type_of_conversion_float(const TextureFormat host_format, const TextureFormat device_format)
constexpr uint8_t SHIFT_G
PixelValue< float3 > FLOAT3
static ConversionType type_of_conversion_uint248(const TextureFormat device_format)
int to_bytesize(const DataFormat format)
static ConversionType type_of_conversion_ubyte(TextureFormat device_format)
ComponentValue< float > F32
void convert_host_to_device(void *dst_buffer, const void *src_buffer, size_t buffer_size, eGPUDataFormat host_format, TextureFormat host_texture_format, TextureFormat device_format)
bool needs_conversion(eGPUDataFormat host_format, TextureFormat host_texture_format, TextureFormat device_format)
Check if data conversion is needed when uploading host_format to a device_format.
ComponentValue< int32_t > I32
PixelValue< ColorSceneLinear4f< eAlpha::Premultiplied > > FLOAT4
ComponentValue< int8_t > I8
static ConversionType type_of_conversion_r10g10b10a2(TextureFormat device_format)
static void convert_buffer(void *dst_memory, const void *src_memory, size_t buffer_size, TextureFormat device_format, ConversionType type)
int to_component_len(TextureFormat format)
static ConversionType type_of_conversion_r11g11b10(TextureFormat device_format)
uint32_t convert_float_formats(uint32_t value)
static float uint32_t_to_float(uint32_t value)
void convert_per_pixel(void *dst_memory, const void *src_memory, size_t buffer_size)
static ConversionType type_of_conversion_half(TextureFormat device_format)
void convert_device_to_host(void *dst_buffer, const void *src_buffer, size_t buffer_size, eGPUDataFormat host_format, TextureFormat host_texture_format, TextureFormat device_format)
constexpr uint32_t MASK_11_BITS
static ConversionType type_of_conversion_int(TextureFormat device_format)
uint16_t float_to_half(float v)
void half_to_float_array(const uint16_t *src, float *dst, size_t length)
void float_to_half_make_finite_array(const float *src, uint16_t *dst, size_t length)
float half_to_float(uint16_t v)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
unsigned __int64 uint64_t
@ GPU_DATA_2_10_10_10_REV
@ GPU_DATA_UINT_24_8_DEPRECATED
MINLINE float max_ff(float a, float b)
MINLINE int clamp_i(int value, int min, int max)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
static constexpr int32_t scalar()
static constexpr int32_t delta()
static constexpr int32_t max()
static constexpr uint32_t max()
static constexpr size_t used_byte_size()
static constexpr uint32_t scalar()