Lines Matching refs:TextureFormat

274 inline float channelToFloat (const deUint8* value, TextureFormat::ChannelType type)
277 DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40);
281 case TextureFormat::SNORM_INT8: return de::max(-1.0f, (float)*((const deInt8*)value) / 127.0f);
282 case TextureFormat::SNORM_INT16: return de::max(-1.0f, (float)*((const deInt16*)value) / 32767.0f);
283 case TextureFormat::SNORM_INT32: return de::max(-1.0f, (float)*((const deInt32*)value) / 2147483647.0f);
284 case TextureFormat::UNORM_INT8: return (float)*((const deUint8*)value) / 255.0f;
285 case TextureFormat::UNORM_INT16: return (float)*((const deUint16*)value) / 65535.0f;
286 case TextureFormat::UNORM_INT24: return (float)readUint24(value) / 16777215.0f;
287 case TextureFormat::UNORM_INT32: return (float)*((const deUint32*)value) / 4294967295.0f;
288 case TextureFormat::SIGNED_INT8: return (float)*((const deInt8*)value);
289 case TextureFormat::SIGNED_INT16: return (float)*((const deInt16*)value);
290 case TextureFormat::SIGNED_INT32: return (float)*((const deInt32*)value);
291 case TextureFormat::UNSIGNED_INT8: return (float)*((const deUint8*)value);
292 case TextureFormat::UNSIGNED_INT16: return (float)*((const deUint16*)value);
293 case TextureFormat::UNSIGNED_INT24: return (float)readUint24(value);
294 case TextureFormat::UNSIGNED_INT32: return (float)*((const deUint32*)value);
295 case TextureFormat::HALF_FLOAT: return deFloat16To32(*(const deFloat16*)value);
296 case TextureFormat::FLOAT: return *((const float*)value);
297 case TextureFormat::FLOAT64: return (float)*((const double*)value);
298 case TextureFormat::UNORM_SHORT_10: return (float)((*((const deUint16*)value)) >> 6u) / 1023.0f;
299 case TextureFormat::UNORM_SHORT_12: return (float)((*((const deUint16*)value)) >> 4u) / 4095.0f;
306 inline int channelToInt (const deUint8* value, TextureFormat::ChannelType type)
309 DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40);
313 case TextureFormat::SNORM_INT8: return (int)*((const deInt8*)value);
314 case TextureFormat::SNORM_INT16: return (int)*((const deInt16*)value);
315 case TextureFormat::SNORM_INT32: return (int)*((const deInt32*)value);
316 case TextureFormat::UNORM_INT8: return (int)*((const deUint8*)value);
317 case TextureFormat::UNORM_INT16: return (int)*((const deUint16*)value);
318 case TextureFormat::UNORM_INT24: return (int)readUint24(value);
319 case TextureFormat::UNORM_INT32: return (int)*((const deUint32*)value);
320 case TextureFormat::SIGNED_INT8: return (int)*((const deInt8*)value);
321 case TextureFormat::SIGNED_INT16: return (int)*((const deInt16*)value);
322 case TextureFormat::SIGNED_INT32: return (int)*((const deInt32*)value);
323 case TextureFormat::UNSIGNED_INT8: return (int)*((const deUint8*)value);
324 case TextureFormat::UNSIGNED_INT16: return (int)*((const deUint16*)value);
325 case TextureFormat::UNSIGNED_INT24: return (int)readUint24(value);
326 case TextureFormat::UNSIGNED_INT32: return (int)*((const deUint32*)value);
327 case TextureFormat::HALF_FLOAT: return (int)deFloat16To32(*(const deFloat16*)value);
328 case TextureFormat::FLOAT: return (int)*((const float*)value);
329 case TextureFormat::FLOAT64: return (int)*((const double*)value);
330 case TextureFormat::UNORM_SHORT_10: return (int)((*(((const deUint16*)value))) >> 6u);
331 case TextureFormat::UNORM_SHORT_12: return (int)((*(((const deUint16*)value))) >> 4u);
338 void floatToChannel (deUint8* dst, float src, TextureFormat::ChannelType type)
341 DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40);
345 case TextureFormat::SNORM_INT8: *((deInt8*)dst) = convertSatRte<deInt8> (src * 127.0f); break;
346 case TextureFormat::SNORM_INT16: *((deInt16*)dst) = convertSatRte<deInt16> (src * 32767.0f); break;
347 case TextureFormat::SNORM_INT32: *((deInt32*)dst) = convertSatRte<deInt32> (src * 2147483647.0f); break;
348 case TextureFormat::UNORM_INT8: *((deUint8*)dst) = convertSatRte<deUint8> (src * 255.0f); break;
349 case TextureFormat::UNORM_INT16: *((deUint16*)dst) = convertSatRte<deUint16> (src * 65535.0f); break;
350 case TextureFormat::UNORM_INT24: writeUint24(dst, convertSatRteUint24 (src * 16777215.0f)); break;
351 case TextureFormat::UNORM_INT32: *((deUint32*)dst) = convertSatRte<deUint32> (src * 4294967295.0f); break;
352 case TextureFormat::SIGNED_INT8: *((deInt8*)dst) = convertSatRte<deInt8> (src); break;
353 case TextureFormat::SIGNED_INT16: *((deInt16*)dst) = convertSatRte<deInt16> (src); break;
354 case TextureFormat::SIGNED_INT32: *((deInt32*)dst) = convertSatRte<deInt32> (src); break;
355 case TextureFormat::UNSIGNED_INT8: *((deUint8*)dst) = convertSatRte<deUint8> (src); break;
356 case TextureFormat::UNSIGNED_INT16: *((deUint16*)dst) = convertSatRte<deUint16> (src); break;
357 case TextureFormat::UNSIGNED_INT24: writeUint24(dst, convertSatRteUint24 (src)); break;
358 case TextureFormat::UNSIGNED_INT32: *((deUint32*)dst) = convertSatRte<deUint32> (src); break;
359 case TextureFormat::HALF_FLOAT: *((deFloat16*)dst) = deFloat32To16 (src); break;
360 case TextureFormat::FLOAT: *((float*)dst) = src; break;
361 case TextureFormat::FLOAT64: *((double*)dst) = (double)src; break;
362 case TextureFormat::UNORM_SHORT_10: *((deUint16*)dst) = (deUint16)(convertSatRteUint10(src * 1023.0f) << 6u); break;
363 case TextureFormat::UNORM_SHORT_12: *((deUint16*)dst) = (deUint16)(convertSatRteUint12(src * 4095.0f) << 4u); break;
425 void intToChannel (deUint8* dst, int src, TextureFormat::ChannelType type)
428 DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40);
432 case TextureFormat::SNORM_INT8: *((deInt8*)dst) = convertSat<deInt8> (src); break;
433 case TextureFormat::SNORM_INT16: *((deInt16*)dst) = convertSat<deInt16> (src); break;
434 case TextureFormat::UNORM_INT8: *((deUint8*)dst) = convertSat<deUint8> (src); break;
435 case TextureFormat::UNORM_INT16: *((deUint16*)dst) = convertSat<deUint16> (src); break;
436 case TextureFormat::UNORM_INT24: writeUint24(dst, convertSatUint24 (src)); break;
437 case TextureFormat::SIGNED_INT8: *((deInt8*)dst) = convertSat<deInt8> (src); break;
438 case TextureFormat::SIGNED_INT16: *((deInt16*)dst) = convertSat<deInt16> (src); break;
439 case TextureFormat::SIGNED_INT32: *((deInt32*)dst) = convertSat<deInt32> (src); break;
440 case TextureFormat::UNSIGNED_INT8: *((deUint8*)dst) = convertSat<deUint8> ((deUint32)src); break;
441 case TextureFormat::UNSIGNED_INT16: *((deUint16*)dst) = convertSat<deUint16> ((deUint32)src); break;
442 case TextureFormat::UNSIGNED_INT24: writeUint24(dst, convertSatUint24 ((deUint32)src)); break;
443 case TextureFormat::UNSIGNED_INT32: *((deUint32*)dst) = convertSat<deUint32> ((deUint32)src); break;
444 case TextureFormat::HALF_FLOAT: *((deFloat16*)dst) = deFloat32To16((float)src); break;
445 case TextureFormat::FLOAT: *((float*)dst) = (float)src; break;
446 case TextureFormat::FLOAT64: *((double*)dst) = (double)src; break;
447 case TextureFormat::UNORM_SHORT_10: *((deUint16*)dst) = (deUint16)(convertSatUint10(src) << 6u); break;
448 case TextureFormat::UNORM_SHORT_12: *((deUint16*)dst) = (deUint16)(convertSatUint12(src) << 4u); break;
530 bool isColorOrder (TextureFormat::ChannelOrder order)
532 DE_STATIC_ASSERT(TextureFormat::CHANNELORDER_LAST == 21);
536 case TextureFormat::R:
537 case TextureFormat::A:
538 case TextureFormat::I:
539 case TextureFormat::L:
540 case TextureFormat::LA:
541 case TextureFormat::RG:
542 case TextureFormat::RA:
543 case TextureFormat::RGB:
544 case TextureFormat::RGBA:
545 case TextureFormat::ARGB:
546 case TextureFormat::BGR:
547 case TextureFormat::BGRA:
548 case TextureFormat::sR:
549 case TextureFormat::sRG:
550 case TextureFormat::sRGB:
551 case TextureFormat::sRGBA:
552 case TextureFormat::sBGR:
553 case TextureFormat::sBGRA:
563 bool isValid (TextureFormat format)
569 case TextureFormat::SNORM_INT8:
570 case TextureFormat::SNORM_INT16:
571 case TextureFormat::SNORM_INT32:
574 case TextureFormat::UNORM_INT8:
575 case TextureFormat::UNORM_INT16:
576 case TextureFormat::UNORM_INT24:
577 case TextureFormat::UNORM_INT32:
578 return isColor || format.order == TextureFormat::D;
580 case TextureFormat::UNORM_BYTE_44:
581 case TextureFormat::UNSIGNED_BYTE_44:
582 return format.order == TextureFormat::RG;
584 case TextureFormat::UNORM_SHORT_565:
585 case TextureFormat::UNORM_SHORT_555:
586 case TextureFormat::UNSIGNED_SHORT_565:
587 return format.order == TextureFormat::RGB || format.order == TextureFormat::BGR;
589 case TextureFormat::UNORM_SHORT_4444:
590 case TextureFormat::UNORM_SHORT_5551:
591 case TextureFormat::UNSIGNED_SHORT_4444:
592 case TextureFormat::UNSIGNED_SHORT_5551:
593 return format.order == TextureFormat::RGBA || format.order == TextureFormat::BGRA;
595 case TextureFormat::UNORM_SHORT_1555:
596 return format.order == TextureFormat::ARGB;
598 case TextureFormat::UNORM_INT_101010:
599 return format.order == TextureFormat::RGB;
601 case TextureFormat::SNORM_INT_1010102_REV:
602 case TextureFormat::UNORM_INT_1010102_REV:
603 case TextureFormat::SIGNED_INT_1010102_REV:
604 case TextureFormat::UNSIGNED_INT_1010102_REV:
605 return format.order == TextureFormat::RGBA || format.order == TextureFormat::BGRA;
607 case TextureFormat::UNSIGNED_INT_11F_11F_10F_REV:
608 case TextureFormat::UNSIGNED_INT_999_E5_REV:
609 return format.order == TextureFormat::RGB;
611 case TextureFormat::UNSIGNED_INT_16_8_8:
612 return format.order == TextureFormat::DS;
614 case TextureFormat::UNSIGNED_INT_24_8:
615 case TextureFormat::UNSIGNED_INT_24_8_REV:
616 return format.order == TextureFormat::D || format.order == TextureFormat::DS;
618 case TextureFormat::SIGNED_INT8:
619 case TextureFormat::SIGNED_INT16:
620 case TextureFormat::SIGNED_INT32:
623 case TextureFormat::UNSIGNED_INT8:
624 case TextureFormat::UNSIGNED_INT16:
625 case TextureFormat::UNSIGNED_INT24:
626 case TextureFormat::UNSIGNED_INT32:
627 return isColor || format.order == TextureFormat::S;
629 case TextureFormat::HALF_FLOAT:
630 case TextureFormat::FLOAT:
631 case TextureFormat::FLOAT64:
632 return isColor || format.order == TextureFormat::D;
634 case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
635 return format.order == TextureFormat::DS;
637 case TextureFormat::UNORM_SHORT_10:
638 case TextureFormat::UNORM_SHORT_12:
646 DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40);
649 int getNumUsedChannels (TextureFormat::ChannelOrder order)
652 DE_STATIC_ASSERT(TextureFormat::CHANNELORDER_LAST == 21);
656 case TextureFormat::R: return 1;
657 case TextureFormat::A: return 1;
658 case TextureFormat::I: return 1;
659 case TextureFormat::L: return 1;
660 case TextureFormat::LA: return 2;
661 case TextureFormat::RG: return 2;
662 case TextureFormat::RA: return 2;
663 case TextureFormat::RGB: return 3;
664 case TextureFormat::RGBA: return 4;
665 case TextureFormat::ARGB: return 4;
666 case TextureFormat::BGR: return 3;
667 case TextureFormat::BGRA: return 4;
668 case TextureFormat::sR: return 1;
669 case TextureFormat::sRG: return 2;
670 case TextureFormat::sRGB: return 3;
671 case TextureFormat::sRGBA: return 4;
672 case TextureFormat::sBGR: return 3;
673 case TextureFormat::sBGRA: return 4;
674 case TextureFormat::D: return 1;
675 case TextureFormat::S: return 1;
676 case TextureFormat::DS: return 2;
683 int getChannelSize (TextureFormat::ChannelType type)
686 DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40);
690 case TextureFormat::SNORM_INT8: return 1;
691 case TextureFormat::SNORM_INT16: return 2;
692 case TextureFormat::SNORM_INT32: return 4;
693 case TextureFormat::UNORM_INT8: return 1;
694 case TextureFormat::UNORM_INT16: return 2;
695 case TextureFormat::UNORM_INT24: return 3;
696 case TextureFormat::UNORM_INT32: return 4;
697 case TextureFormat::SIGNED_INT8: return 1;
698 case TextureFormat::SIGNED_INT16: return 2;
699 case TextureFormat::SIGNED_INT32: return 4;
700 case TextureFormat::UNSIGNED_INT8: return 1;
701 case TextureFormat::UNSIGNED_INT16: return 2;
702 case TextureFormat::UNSIGNED_INT24: return 3;
703 case TextureFormat::UNSIGNED_INT32: return 4;
704 case TextureFormat::HALF_FLOAT: return 2;
705 case TextureFormat::FLOAT: return 4;
706 case TextureFormat::FLOAT64: return 8;
707 case TextureFormat::UNORM_SHORT_10: return 2;
708 case TextureFormat::UNORM_SHORT_12: return 2;
716 int getPixelSize (TextureFormat format)
718 const TextureFormat::ChannelOrder order = format.order;
719 const TextureFormat::ChannelType type = format.type;
724 DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40);
728 case TextureFormat::UNORM_BYTE_44:
729 case TextureFormat::UNSIGNED_BYTE_44:
732 case TextureFormat::UNORM_SHORT_565:
733 case TextureFormat::UNORM_SHORT_555:
734 case TextureFormat::UNORM_SHORT_4444:
735 case TextureFormat::UNORM_SHORT_5551:
736 case TextureFormat::UNORM_SHORT_1555:
737 case TextureFormat::UNSIGNED_SHORT_565:
738 case TextureFormat::UNSIGNED_SHORT_4444:
739 case TextureFormat::UNSIGNED_SHORT_5551:
742 case TextureFormat::UNORM_INT_101010:
743 case TextureFormat::UNSIGNED_INT_999_E5_REV:
744 case TextureFormat::UNSIGNED_INT_11F_11F_10F_REV:
745 case TextureFormat::SNORM_INT_1010102_REV:
746 case TextureFormat::UNORM_INT_1010102_REV:
747 case TextureFormat::SIGNED_INT_1010102_REV:
748 case TextureFormat::UNSIGNED_INT_1010102_REV:
749 case TextureFormat::UNSIGNED_INT_24_8:
750 case TextureFormat::UNSIGNED_INT_24_8_REV:
751 case TextureFormat::UNSIGNED_INT_16_8_8:
754 case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
762 int TextureFormat::getPixelSize (void) const
767 const TextureSwizzle& getChannelReadSwizzle (TextureFormat::ChannelOrder order)
770 DE_STATIC_ASSERT(TextureFormat::CHANNELORDER_LAST == 21);
790 case TextureFormat::R: return R;
791 case TextureFormat::A: return A;
792 case TextureFormat::I: return I;
793 case TextureFormat::L: return L;
794 case TextureFormat::LA: return LA;
795 case TextureFormat::RG: return RG;
796 case TextureFormat::RA: return RA;
797 case TextureFormat::RGB: return RGB;
798 case TextureFormat::RGBA: return RGBA;
799 case TextureFormat::ARGB: return ARGB;
800 case TextureFormat::BGR: return BGR;
801 case TextureFormat::BGRA: return BGRA;
802 case TextureFormat::sR: return R;
803 case TextureFormat::sRG: return RG;
804 case TextureFormat::sRGB: return RGB;
805 case TextureFormat::sRGBA: return RGBA;
806 case TextureFormat::sBGR: return BGR;
807 case TextureFormat::sBGRA: return BGRA;
808 case TextureFormat::D: return D;
809 case TextureFormat::S: return S;
811 case TextureFormat::DS:
821 const TextureSwizzle& getChannelWriteSwizzle (TextureFormat::ChannelOrder order)
824 DE_STATIC_ASSERT(TextureFormat::CHANNELORDER_LAST == 21);
844 case TextureFormat::R: return R;
845 case TextureFormat::A: return A;
846 case TextureFormat::I: return I;
847 case TextureFormat::L: return L;
848 case TextureFormat::LA: return LA;
849 case TextureFormat::RG: return RG;
850 case TextureFormat::RA: return RA;
851 case TextureFormat::RGB: return RGB;
852 case TextureFormat::RGBA: return RGBA;
853 case TextureFormat::ARGB: return ARGB;
854 case TextureFormat::BGR: return BGR;
855 case TextureFormat::BGRA: return BGRA;
856 case TextureFormat::sR: return R;
857 case TextureFormat::sRG: return RG;
858 case TextureFormat::sRGB: return RGB;
859 case TextureFormat::sRGBA: return RGBA;
860 case TextureFormat::sBGR: return BGR;
861 case TextureFormat::sBGRA: return BGRA;
862 case TextureFormat::D: return D;
863 case TextureFormat::S: return S;
865 case TextureFormat::DS:
875 IVec3 calculatePackedPitch (const TextureFormat& format, const IVec3& size)
891 ConstPixelBufferAccess::ConstPixelBufferAccess (const TextureFormat& format, int width, int height, int depth, const void* data)
900 ConstPixelBufferAccess::ConstPixelBufferAccess (const TextureFormat& format, const IVec3& size, const void* data)
909 ConstPixelBufferAccess::ConstPixelBufferAccess (const TextureFormat& format, int width, int height, int depth, int rowPitch, int slicePitch, const void* data)
918 ConstPixelBufferAccess::ConstPixelBufferAccess (const TextureFormat& format, const IVec3& size, const IVec3& pitch, const void* data)
936 PixelBufferAccess::PixelBufferAccess (const TextureFormat& format, int width, int height, int depth, void* data)
941 PixelBufferAccess::PixelBufferAccess (const TextureFormat& format, const IVec3& size, void* data)
946 PixelBufferAccess::PixelBufferAccess (const TextureFormat& format, int width, int height, int depth, int rowPitch, int slicePitch, void* data)
951 PixelBufferAccess::PixelBufferAccess (const TextureFormat& format, const IVec3& size, const IVec3& pitch, void* data)
963 Vector<T, 4> swizzleRB (const Vector<T, 4>& v, TextureFormat::ChannelOrder src, TextureFormat::ChannelOrder dst)
969 DE_ASSERT((src == TextureFormat::RGB && dst == TextureFormat::BGR) ||
970 (src == TextureFormat::BGR && dst == TextureFormat::RGB) ||
971 (src == TextureFormat::RGBA && dst == TextureFormat::BGRA) ||
972 (src == TextureFormat::BGRA && dst == TextureFormat::RGBA));
983 DE_ASSERT(m_format.order != TextureFormat::DS); // combined formats cannot be accessed directly
988 if (m_format.type == TextureFormat::UNORM_INT8)
990 if (m_format.order == TextureFormat::RGBA || m_format.order == TextureFormat::sRGBA)
992 else if (m_format.order == TextureFormat::RGB || m_format.order == TextureFormat::sRGB)
1008 case TextureFormat::UNORM_BYTE_44: return Vec4(UN8 (4, 4), UN8 ( 0, 4), 0.0f, 1.0f);
1009 case TextureFormat::UNSIGNED_BYTE_44: return UVec4(UI8 (4, 4), UI8 ( 0, 4), 0u, 1u).cast<float>();
1010 case TextureFormat::UNORM_SHORT_565: return swizzleRB( Vec4(UN16(11, 5), UN16( 5, 6), UN16( 0, 5), 1.0f), m_format.order, TextureFormat::RGB);
1011 case TextureFormat::UNSIGNED_SHORT_565: return swizzleRB(UVec4(UI16(11, 5), UI16( 5, 6), UI16( 0, 5), 1u), m_format.order, TextureFormat::RGB).cast<float>();
1012 case TextureFormat::UNORM_SHORT_555: return swizzleRB( Vec4(UN16(10, 5), UN16( 5, 5), UN16( 0, 5), 1.0f), m_format.order, TextureFormat::RGB);
1013 case TextureFormat::UNORM_SHORT_4444: return swizzleRB( Vec4(UN16(12, 4), UN16( 8, 4), UN16( 4, 4), UN16( 0, 4)), m_format.order, TextureFormat::RGBA);
1014 case TextureFormat::UNSIGNED_SHORT_4444: return swizzleRB(UVec4(UI16(12, 4), UI16( 8, 4), UI16( 4, 4), UI16( 0, 4)), m_format.order, TextureFormat::RGBA).cast<float>();
1015 case TextureFormat::UNORM_SHORT_5551: return swizzleRB( Vec4(UN16(11, 5), UN16( 6, 5), UN16( 1, 5), UN16( 0, 1)), m_format.order, TextureFormat::RGBA);
1016 case TextureFormat::UNSIGNED_SHORT_5551: return swizzleRB(UVec4(UI16(11, 5), UI16( 6, 5), UI16( 1, 5), UI16( 0, 1)), m_format.order, TextureFormat::RGBA).cast<float>();
1017 case TextureFormat::UNORM_INT_101010: return Vec4(UN32(22, 10), UN32(12, 10), UN32( 2, 10), 1.0f);
1018 case TextureFormat::UNORM_INT_1010102_REV: return swizzleRB( Vec4(UN32( 0, 10), UN32(10, 10), UN32(20, 10), UN32(30, 2)), m_format.order, TextureFormat::RGBA);
1019 case TextureFormat::SNORM_INT_1010102_REV: return swizzleRB( Vec4(SN32( 0, 10), SN32(10, 10), SN32(20, 10), SN32(30, 2)), m_format.order, TextureFormat::RGBA);
1020 case TextureFormat::UNSIGNED_INT_1010102_REV: return swizzleRB( UVec4(UI32(0, 10), UI32(10, 10), UI32(20, 10), UI32(30, 2)), m_format.order, TextureFormat::RGBA).cast<float>();
1021 case TextureFormat::SIGNED_INT_1010102_REV: return swizzleRB( UVec4(SI32(0, 10), SI32(10, 10), SI32(20, 10), SI32(30, 2)), m_format.order, TextureFormat::RGBA).cast<float>();
1022 case TextureFormat::UNSIGNED_INT_999_E5_REV: return unpackRGB999E5(*((const deUint32*)pixelPtr));
1024 case TextureFormat::UNORM_SHORT_1555:
1025 DE_ASSERT(m_format.order == TextureFormat::ARGB);
1028 case TextureFormat::UNSIGNED_INT_11F_11F_10F_REV:
1082 DE_ASSERT(m_format.order != TextureFormat::DS); // combined formats cannot be accessed directly
1088 if (m_format.type == TextureFormat::UNORM_INT8)
1090 if (m_format.order == TextureFormat::RGBA || m_format.order == TextureFormat::sRGBA)
1092 else if (m_format.order == TextureFormat::RGB || m_format.order == TextureFormat::sRGB)
1103 case TextureFormat::UNSIGNED_BYTE_44: // Fall-through
1104 case TextureFormat::UNORM_BYTE_44: return UVec4(U8 ( 4, 4), U8 ( 0, 4), 0u, 1u).cast<int>();
1105 case TextureFormat::UNSIGNED_SHORT_565: // Fall-through
1106 case TextureFormat::UNORM_SHORT_565: return swizzleRB(UVec4(U16(11, 5), U16( 5, 6), U16( 0, 5), 1).cast<int>(), m_format.order, TextureFormat::RGB);
1107 case TextureFormat::UNORM_SHORT_555: return swizzleRB(UVec4(U16(10, 5), U16( 5, 5), U16( 0, 5), 1).cast<int>(), m_format.order, TextureFormat::RGB);
1108 case TextureFormat::UNSIGNED_SHORT_4444: // Fall-through
1109 case TextureFormat::UNORM_SHORT_4444: return swizzleRB(UVec4(U16(12, 4), U16( 8, 4), U16( 4, 4), U16( 0, 4)).cast<int>(), m_format.order, TextureFormat::RGBA);
1110 case TextureFormat::UNSIGNED_SHORT_5551: // Fall-through
1111 case TextureFormat::UNORM_SHORT_5551: return swizzleRB(UVec4(U16(11, 5), U16( 6, 5), U16( 1, 5), U16( 0, 1)).cast<int>(), m_format.order, TextureFormat::RGBA);
1112 case TextureFormat::UNORM_INT_101010: return UVec4(U32(22, 10), U32(12, 10), U32( 2, 10), 1).cast<int>();
1113 case TextureFormat::UNORM_INT_1010102_REV: // Fall-through
1114 case TextureFormat::UNSIGNED_INT_1010102_REV: return swizzleRB(UVec4(U32( 0, 10), U32(10, 10), U32(20, 10), U32(30, 2)), m_format.order, TextureFormat::RGBA).cast<int>();
1115 case TextureFormat::SNORM_INT_1010102_REV: // Fall-through
1116 case TextureFormat::SIGNED_INT_1010102_REV: return swizzleRB(IVec4(S32( 0, 10), S32(10, 10), S32(20, 10), S32(30, 2)), m_format.order, TextureFormat::RGBA);
1118 case TextureFormat::UNORM_SHORT_1555:
1119 DE_ASSERT(m_format.order == TextureFormat::ARGB);
1190 case TextureFormat::UNSIGNED_INT_16_8_8:
1191 DE_ASSERT(m_format.order == TextureFormat::DS);
1194 case TextureFormat::UNSIGNED_INT_24_8:
1195 DE_ASSERT(m_format.order == TextureFormat::D || m_format.order == TextureFormat::DS);
1198 case TextureFormat::UNSIGNED_INT_24_8_REV:
1199 DE_ASSERT(m_format.order == TextureFormat::D || m_format.order == TextureFormat::DS);
1202 case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
1203 DE_ASSERT(m_format.order == TextureFormat::DS);
1207 DE_ASSERT(m_format.order == TextureFormat::D); // no other combined depth stencil types
1222 case TextureFormat::UNSIGNED_INT_24_8_REV:
1223 DE_ASSERT(m_format.order == TextureFormat::DS);
1226 case TextureFormat::UNSIGNED_INT_16_8_8:
1227 case TextureFormat::UNSIGNED_INT_24_8:
1228 DE_ASSERT(m_format.order == TextureFormat::DS);
1231 case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
1232 DE_ASSERT(m_format.order == TextureFormat::DS);
1237 DE_ASSERT(m_format.order == TextureFormat::S); // no other combined depth stencil types
1249 DE_ASSERT(m_format.order != TextureFormat::DS); // combined formats cannot be accessed directly
1254 if (m_format.type == TextureFormat::UNORM_INT8)
1256 if (m_format.order == TextureFormat::RGBA || m_format.order == TextureFormat::sRGBA)
1261 else if (m_format.order == TextureFormat::RGB || m_format.order == TextureFormat::sRGB)
1275 case TextureFormat::UNORM_BYTE_44: *((deUint8 *)pixelPtr) = (deUint8)(PN(color[0], 4, 4) | PN(color[1], 0, 4)); break;
1276 case TextureFormat::UNSIGNED_BYTE_44: *((deUint8 *)pixelPtr) = (deUint8)(PU((deUint32)color[0], 4, 4) | PU((deUint32)color[1], 0, 4)); break;
1277 case TextureFormat::UNORM_INT_101010: *((deUint32*)pixelPtr) = PN(color[0], 22, 10) | PN(color[1], 12, 10) | PN(color[2], 2, 10); break;
1279 case TextureFormat::UNORM_SHORT_565:
1281 const Vec4 swizzled = swizzleRB(color, TextureFormat::RGB, m_format.order);
1286 case TextureFormat::UNSIGNED_SHORT_565:
1288 const UVec4 swizzled = swizzleRB(color.cast<deUint32>(), TextureFormat::RGB, m_format.order);
1293 case TextureFormat::UNORM_SHORT_555:
1295 const Vec4 swizzled = swizzleRB(color, TextureFormat::RGB, m_format.order);
1300 case TextureFormat::UNORM_SHORT_4444:
1302 const Vec4 swizzled = swizzleRB(color, TextureFormat::RGBA, m_format.order);
1307 case TextureFormat::UNSIGNED_SHORT_4444:
1309 const UVec4 swizzled = swizzleRB(color.cast<deUint32>(), TextureFormat::RGBA, m_format.order);
1314 case TextureFormat::UNORM_SHORT_5551:
1316 const Vec4 swizzled = swizzleRB(color, TextureFormat::RGBA, m_format.order);
1321 case TextureFormat::UNORM_SHORT_1555:
1328 case TextureFormat::UNSIGNED_SHORT_5551:
1330 const UVec4 swizzled = swizzleRB(color.cast<deUint32>(), TextureFormat::RGBA, m_format.order);
1335 case TextureFormat::UNORM_INT_1010102_REV:
1337 const Vec4 u = swizzleRB(color, TextureFormat::RGBA, m_format.order);
1342 case TextureFormat::SNORM_INT_1010102_REV:
1344 const Vec4 u = swizzleRB(color, TextureFormat::RGBA, m_format.order);
1349 case TextureFormat::UNSIGNED_INT_1010102_REV:
1351 const UVec4 u = swizzleRB(color.cast<deUint32>(), TextureFormat::RGBA, m_format.order);
1356 case TextureFormat::SIGNED_INT_1010102_REV:
1358 const IVec4 u = swizzleRB(color.cast<deInt32>(), TextureFormat::RGBA, m_format.order);
1363 case TextureFormat::UNSIGNED_INT_11F_11F_10F_REV:
1367 case TextureFormat::UNSIGNED_INT_999_E5_REV:
1399 DE_ASSERT(m_format.order != TextureFormat::DS); // combined formats cannot be accessed directly
1404 if (m_format.type == TextureFormat::UNORM_INT8)
1406 if (m_format.order == TextureFormat::RGBA || m_format.order == TextureFormat::sRGBA)
1411 else if (m_format.order == TextureFormat::RGB || m_format.order == TextureFormat::sRGB)
1423 case TextureFormat::UNSIGNED_BYTE_44: // Fall-through
1424 case TextureFormat::UNORM_BYTE_44: *((deUint8 *)pixelPtr) = (deUint8 )(PU(color[0], 4, 4) | PU(color[1], 0, 4)); break;
1425 case TextureFormat::UNORM_INT_101010: *((deUint32*)pixelPtr) = PU(color[0], 22, 10) | PU(color[1], 12, 10) | PU(color[2], 2, 10); break;
1427 case TextureFormat::UNORM_SHORT_565:
1428 case TextureFormat::UNSIGNED_SHORT_565:
1430 const IVec4 swizzled = swizzleRB(color, TextureFormat::RGB, m_format.order);
1435 case TextureFormat::UNORM_SHORT_555:
1437 const IVec4 swizzled = swizzleRB(color, TextureFormat::RGB, m_format.order);
1442 case TextureFormat::UNORM_SHORT_4444:
1443 case TextureFormat::UNSIGNED_SHORT_4444:
1445 const IVec4 swizzled = swizzleRB(color, TextureFormat::RGBA, m_format.order);
1450 case TextureFormat::UNORM_SHORT_5551:
1451 case TextureFormat::UNSIGNED_SHORT_5551:
1453 const IVec4 swizzled = swizzleRB(color, TextureFormat::RGBA, m_format.order);
1458 case TextureFormat::UNORM_SHORT_1555:
1465 case TextureFormat::UNORM_INT_1010102_REV:
1466 case TextureFormat::UNSIGNED_INT_1010102_REV:
1468 const IVec4 swizzled = swizzleRB(color, TextureFormat::RGBA, m_format.order);
1473 case TextureFormat::SNORM_INT_1010102_REV:
1474 case TextureFormat::SIGNED_INT_1010102_REV:
1476 const IVec4 swizzled = swizzleRB(color, TextureFormat::RGBA, m_format.order);
1511 case TextureFormat::UNSIGNED_INT_16_8_8:
1512 DE_ASSERT(m_format.order == TextureFormat::DS);
1516 case TextureFormat::UNSIGNED_INT_24_8:
1517 DE_ASSERT(m_format.order == TextureFormat::D || m_format.order == TextureFormat::DS);
1521 case TextureFormat::UNSIGNED_INT_24_8_REV:
1522 DE_ASSERT(m_format.order == TextureFormat::D || m_format.order == TextureFormat::DS);
1526 case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
1527 DE_ASSERT(m_format.order == TextureFormat::DS);
1532 DE_ASSERT(m_format.order == TextureFormat::D); // no other combined depth stencil types
1548 case TextureFormat::UNSIGNED_INT_16_8_8:
1549 case TextureFormat::UNSIGNED_INT_24_8:
1550 DE_ASSERT(m_format.order == TextureFormat::DS);
1554 case TextureFormat::UNSIGNED_INT_24_8_REV:
1555 DE_ASSERT(m_format.order == TextureFormat::DS);
1559 case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
1560 DE_ASSERT(m_format.order == TextureFormat::DS);
1565 DE_ASSERT(m_format.order == TextureFormat::S); // no other combined depth stencil types
1654 static bool isFixedPointDepthTextureFormat (const tcu::TextureFormat& format)
1656 DE_ASSERT(format.order == TextureFormat::D);
1673 const TextureFormat& format = access.getFormat();
1677 if (format.type == TextureFormat::UNORM_INT8 && format.order == TextureFormat::sRGB)
1679 else if (format.type == TextureFormat::UNORM_INT8 && format.order == TextureFormat::sRGBA)
1691 static inline Vec4 lookupBorder (const tcu::TextureFormat& format, const tcu::Sampler& sampler)
2130 TextureLevel::TextureLevel (const TextureFormat& format)
2136 TextureLevel::TextureLevel (const TextureFormat& format, int width, int height, int depth)
2147 void TextureLevel::setStorage (const TextureFormat& format, int width, int height, int depth)
2418 DE_ASSERT(src.getFormat().order == TextureFormat::D || src.getFormat().order == TextureFormat::DS);
3110 TextureLevelPyramid::TextureLevelPyramid (const TextureFormat& format, int numLevels)
3183 Texture1D::Texture1D (const TextureFormat& format, int width)
3225 Texture2D::Texture2D (const TextureFormat& format, int width, int height)
3343 DE_ASSERT(m_levels[0][0].getFormat().order == TextureFormat::D || m_levels[0][0].getFormat().order == TextureFormat::DS);
3360 TextureCube::TextureCube (const TextureFormat& format, int size)
3546 Texture1DArray::Texture1DArray (const TextureFormat& format, int width, int numLayers)
3591 Texture2DArray::Texture2DArray (const TextureFormat& format, int width, int height, int numLayers)
3648 Texture3D::Texture3D (const TextureFormat& format, int width, int height, int depth)
3742 TextureCubeArray::TextureCubeArray (const TextureFormat& format, int size, int depth)
3789 std::ostream& operator<< (std::ostream& str, TextureFormat::ChannelOrder order)
3818 return str << de::getSizedArrayElement<TextureFormat::CHANNELORDER_LAST>(orderStrings, order);
3821 std::ostream& operator<< (std::ostream& str, TextureFormat::ChannelType type)
3867 return str << de::getSizedArrayElement<TextureFormat::CHANNELTYPE_LAST>(typeStrings, type);
3885 std::ostream& operator<< (std::ostream& str, TextureFormat format)