formats.h revision 488d7fc67d36bc0e5247f5d011e8ad4c2dceb5a7
1afade9294af43c6b947b9aeaa1555883d5f853e3Chris Lattner/* 23da94aec4d429b2ba0f65fa040c33650cade196bMisha Brukman * Mesa 3-D graphics library 37c0e022c5c4be4b11e199a53f73bbdd84e34aa80John Criswell * Version: 7.7 47c0e022c5c4be4b11e199a53f73bbdd84e34aa80John Criswell * 57c0e022c5c4be4b11e199a53f73bbdd84e34aa80John Criswell * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. 67c0e022c5c4be4b11e199a53f73bbdd84e34aa80John Criswell * Copyright (c) 2008-2009 VMware, Inc. 73da94aec4d429b2ba0f65fa040c33650cade196bMisha Brukman * 87c0e022c5c4be4b11e199a53f73bbdd84e34aa80John Criswell * Permission is hereby granted, free of charge, to any person obtaining a 9afade9294af43c6b947b9aeaa1555883d5f853e3Chris Lattner * copy of this software and associated documentation files (the "Software"), 10efdc0b505712d1ca4460def27e51c430f033d58dChris Lattner * to deal in the Software without restriction, including without limitation 11efdc0b505712d1ca4460def27e51c430f033d58dChris Lattner * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12afade9294af43c6b947b9aeaa1555883d5f853e3Chris Lattner * and/or sell copies of the Software, and to permit persons to whom the 13afade9294af43c6b947b9aeaa1555883d5f853e3Chris Lattner * Software is furnished to do so, subject to the following conditions: 14afade9294af43c6b947b9aeaa1555883d5f853e3Chris Lattner * 15afade9294af43c6b947b9aeaa1555883d5f853e3Chris Lattner * The above copyright notice and this permission notice shall be included 165a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner * in all copies or substantial portions of the Software. 175a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner * 18afade9294af43c6b947b9aeaa1555883d5f853e3Chris Lattner * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19afade9294af43c6b947b9aeaa1555883d5f853e3Chris Lattner * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20d1a85a744cc1001c2b7fc37cf37aca266964f519Brian Gaeke * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21e49603d79d220a795bd50684c8b1f503ee40f97fMisha Brukman * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 22afade9294af43c6b947b9aeaa1555883d5f853e3Chris Lattner * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 236520785dcd22012535934098942d57c07c7631c2Chris Lattner * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24afade9294af43c6b947b9aeaa1555883d5f853e3Chris Lattner */ 255e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 265da69c79f9c4490c6657c207430dfeb1060fc4ddChris Lattner/* 27551ccae044b0ff658fe629dd67edd5ffe75d10e8Reid Spencer * Authors: 28551ccae044b0ff658fe629dd67edd5ffe75d10e8Reid Spencer * Brian Paul 29551ccae044b0ff658fe629dd67edd5ffe75d10e8Reid Spencer */ 30fb4b96e77e2930bf3d0c148f1c3685b6a4434666Chris Lattner 31e31a9ccb9c7568e6f185f667b53c274c0be9e603Chris Lattner 32c6b519d64ef55d39e66a49510d4703a49bf228ccChris Lattner#ifndef FORMATS_H 33d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke#define FORMATS_H 34d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke 35c6b519d64ef55d39e66a49510d4703a49bf228ccChris Lattner 36d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke#include <GL/gl.h> 37d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke 386db70ef879916e6115ac97eb76e4fea973652e2cChris Lattner 396db70ef879916e6115ac97eb76e4fea973652e2cChris Lattner#ifdef __cplusplus 406db70ef879916e6115ac97eb76e4fea973652e2cChris Lattnerextern "C" { 416db70ef879916e6115ac97eb76e4fea973652e2cChris Lattner#endif 4247ae4a1cee5eec5767a11403c0fac7c91ec45461Chris Lattner 4347ae4a1cee5eec5767a11403c0fac7c91ec45461Chris Lattner 446db70ef879916e6115ac97eb76e4fea973652e2cChris Lattner/* OpenGL doesn't have GL_UNSIGNED_BYTE_4_4, so we must define our own type 456db70ef879916e6115ac97eb76e4fea973652e2cChris Lattner * for GL_LUMINANCE4_ALPHA4. */ 46afade9294af43c6b947b9aeaa1555883d5f853e3Chris Lattner#define MESA_UNSIGNED_BYTE_4_4 (GL_UNSIGNED_BYTE<<1) 476520785dcd22012535934098942d57c07c7631c2Chris Lattner 486520785dcd22012535934098942d57c07c7631c2Chris Lattner 496520785dcd22012535934098942d57c07c7631c2Chris Lattner/** 506520785dcd22012535934098942d57c07c7631c2Chris Lattner * Max number of bytes for any non-compressed pixel format below, or for 516520785dcd22012535934098942d57c07c7631c2Chris Lattner * intermediate pixel storage in Mesa. This should never be less than 520cc8807029f577996a442b96d24c3346ed6de091Chris Lattner * 16. Maybe 32 someday? 536520785dcd22012535934098942d57c07c7631c2Chris Lattner */ 546520785dcd22012535934098942d57c07c7631c2Chris Lattner#define MAX_PIXEL_BYTES 16 556520785dcd22012535934098942d57c07c7631c2Chris Lattner 560cc8807029f577996a442b96d24c3346ed6de091Chris Lattner 570cc8807029f577996a442b96d24c3346ed6de091Chris Lattner/** 586520785dcd22012535934098942d57c07c7631c2Chris Lattner * Mesa texture/renderbuffer image formats. 596520785dcd22012535934098942d57c07c7631c2Chris Lattner */ 600cc8807029f577996a442b96d24c3346ed6de091Chris Lattnertypedef enum 610cc8807029f577996a442b96d24c3346ed6de091Chris Lattner{ 626520785dcd22012535934098942d57c07c7631c2Chris Lattner MESA_FORMAT_NONE = 0, 636520785dcd22012535934098942d57c07c7631c2Chris Lattner 640cc8807029f577996a442b96d24c3346ed6de091Chris Lattner /** 656520785dcd22012535934098942d57c07c7631c2Chris Lattner * \name Basic hardware formats 666520785dcd22012535934098942d57c07c7631c2Chris Lattner */ 670cc8807029f577996a442b96d24c3346ed6de091Chris Lattner /*@{*/ 680cc8807029f577996a442b96d24c3346ed6de091Chris Lattner /* msb <------ TEXEL BITS -----------> lsb */ 696520785dcd22012535934098942d57c07c7631c2Chris Lattner /* ---- ---- ---- ---- ---- ---- ---- ---- */ 706520785dcd22012535934098942d57c07c7631c2Chris Lattner MESA_FORMAT_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ 710cc8807029f577996a442b96d24c3346ed6de091Chris Lattner MESA_FORMAT_RGBA8888_REV, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ 720cc8807029f577996a442b96d24c3346ed6de091Chris Lattner MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ 736520785dcd22012535934098942d57c07c7631c2Chris Lattner MESA_FORMAT_ARGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ 746520785dcd22012535934098942d57c07c7631c2Chris Lattner MESA_FORMAT_RGBX8888, /* RRRR RRRR GGGG GGGG BBBB BBBB XXXX XXXX */ 750cc8807029f577996a442b96d24c3346ed6de091Chris Lattner MESA_FORMAT_RGBX8888_REV, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ 766520785dcd22012535934098942d57c07c7631c2Chris Lattner MESA_FORMAT_XRGB8888, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */ 775a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_XRGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */ 785a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */ 795a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */ 8044be25716628941b4cccccf56a28ee0ba2606850Chris Lattner MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */ 816520785dcd22012535934098942d57c07c7631c2Chris Lattner MESA_FORMAT_RGB565_REV, /* GGGB BBBB RRRR RGGG */ 825da69c79f9c4490c6657c207430dfeb1060fc4ddChris Lattner MESA_FORMAT_ARGB4444, /* AAAA RRRR GGGG BBBB */ 83831b1210390b3a00f68de9a79be0f4e13d6287b0Chris Lattner MESA_FORMAT_ARGB4444_REV, /* GGGG BBBB AAAA RRRR */ 845da69c79f9c4490c6657c207430dfeb1060fc4ddChris Lattner MESA_FORMAT_RGBA5551, /* RRRR RGGG GGBB BBBA */ 85efdc0b505712d1ca4460def27e51c430f033d58dChris Lattner MESA_FORMAT_ARGB1555, /* ARRR RRGG GGGB BBBB */ 86efdc0b505712d1ca4460def27e51c430f033d58dChris Lattner MESA_FORMAT_ARGB1555_REV, /* GGGB BBBB ARRR RRGG */ 876db70ef879916e6115ac97eb76e4fea973652e2cChris Lattner MESA_FORMAT_AL44, /* AAAA LLLL */ 886520785dcd22012535934098942d57c07c7631c2Chris Lattner MESA_FORMAT_AL88, /* AAAA AAAA LLLL LLLL */ 8947ae4a1cee5eec5767a11403c0fac7c91ec45461Chris Lattner MESA_FORMAT_AL88_REV, /* LLLL LLLL AAAA AAAA */ 906520785dcd22012535934098942d57c07c7631c2Chris Lattner MESA_FORMAT_AL1616, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */ 9110f22cb1a0f2755050218cd0e07221a0985c6b63Chris Lattner MESA_FORMAT_AL1616_REV, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */ 9210f22cb1a0f2755050218cd0e07221a0985c6b63Chris Lattner MESA_FORMAT_RGB332, /* RRRG GGBB */ 936520785dcd22012535934098942d57c07c7631c2Chris Lattner MESA_FORMAT_A8, /* AAAA AAAA */ 946520785dcd22012535934098942d57c07c7631c2Chris Lattner MESA_FORMAT_A16, /* AAAA AAAA AAAA AAAA */ 956520785dcd22012535934098942d57c07c7631c2Chris Lattner MESA_FORMAT_L8, /* LLLL LLLL */ 96ba386d943f4a83095d9c625cb0d46c1afe45ed1fChris Lattner MESA_FORMAT_L16, /* LLLL LLLL LLLL LLLL */ 97fcb6ec0c7e37c2d15ddb04878f05cbd69d1da036Chris Lattner MESA_FORMAT_I8, /* IIII IIII */ 98fcb6ec0c7e37c2d15ddb04878f05cbd69d1da036Chris Lattner MESA_FORMAT_I16, /* IIII IIII IIII IIII */ 99fcb6ec0c7e37c2d15ddb04878f05cbd69d1da036Chris Lattner MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ 100fcb6ec0c7e37c2d15ddb04878f05cbd69d1da036Chris Lattner MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ 101fcb6ec0c7e37c2d15ddb04878f05cbd69d1da036Chris Lattner MESA_FORMAT_R8, /* RRRR RRRR */ 102fcb6ec0c7e37c2d15ddb04878f05cbd69d1da036Chris Lattner MESA_FORMAT_GR88, /* GGGG GGGG RRRR RRRR */ 103ba386d943f4a83095d9c625cb0d46c1afe45ed1fChris Lattner MESA_FORMAT_RG88, /* RRRR RRRR GGGG GGGG */ 104ba386d943f4a83095d9c625cb0d46c1afe45ed1fChris Lattner MESA_FORMAT_R16, /* RRRR RRRR RRRR RRRR */ 1059b5b1905dbad19de374e7617f615ba522ffe0468Chris Lattner MESA_FORMAT_RG1616, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ 106ba386d943f4a83095d9c625cb0d46c1afe45ed1fChris Lattner MESA_FORMAT_RG1616_REV, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ 107fcb6ec0c7e37c2d15ddb04878f05cbd69d1da036Chris Lattner MESA_FORMAT_ARGB2101010, /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ 10828b8ed90c75ce6c271500fa778fef252f267a5ffChris Lattner MESA_FORMAT_Z24_S8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */ 10928b8ed90c75ce6c271500fa778fef252f267a5ffChris Lattner MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ 11028b8ed90c75ce6c271500fa778fef252f267a5ffChris Lattner MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */ 1113da94aec4d429b2ba0f65fa040c33650cade196bMisha Brukman MESA_FORMAT_X8_Z24, /* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ 112fcb6ec0c7e37c2d15ddb04878f05cbd69d1da036Chris Lattner MESA_FORMAT_Z24_X8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */ 113fcb6ec0c7e37c2d15ddb04878f05cbd69d1da036Chris Lattner MESA_FORMAT_Z32, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ 114fcb6ec0c7e37c2d15ddb04878f05cbd69d1da036Chris Lattner MESA_FORMAT_S8, /* SSSS SSSS */ 115fcb6ec0c7e37c2d15ddb04878f05cbd69d1da036Chris Lattner /*@}*/ 116fcb6ec0c7e37c2d15ddb04878f05cbd69d1da036Chris Lattner 117c6b519d64ef55d39e66a49510d4703a49bf228ccChris Lattner /** 118c6b519d64ef55d39e66a49510d4703a49bf228ccChris Lattner * \name 8-bit/channel sRGB formats 119c6b519d64ef55d39e66a49510d4703a49bf228ccChris Lattner */ 120c6b519d64ef55d39e66a49510d4703a49bf228ccChris Lattner /*@{*/ 121fcb6ec0c7e37c2d15ddb04878f05cbd69d1da036Chris Lattner MESA_FORMAT_SRGB8, /* RRRR RRRR GGGG GGGG BBBB BBBB */ 122a75766a6c14b364b74b30546802e26d4b4b36a9bChris Lattner MESA_FORMAT_SRGBA8, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ 123a75766a6c14b364b74b30546802e26d4b4b36a9bChris Lattner MESA_FORMAT_SARGB8, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ 1247546c3884a400b72d10fc19f120c6798b294a39dChris Lattner MESA_FORMAT_SL8, /* LLLL LLLL */ 1259b5b1905dbad19de374e7617f615ba522ffe0468Chris Lattner MESA_FORMAT_SLA8, /* AAAA AAAA LLLL LLLL */ 126fcb6ec0c7e37c2d15ddb04878f05cbd69d1da036Chris Lattner MESA_FORMAT_SRGB_DXT1, 127a75766a6c14b364b74b30546802e26d4b4b36a9bChris Lattner MESA_FORMAT_SRGBA_DXT1, 128a75766a6c14b364b74b30546802e26d4b4b36a9bChris Lattner MESA_FORMAT_SRGBA_DXT3, 129ba386d943f4a83095d9c625cb0d46c1afe45ed1fChris Lattner MESA_FORMAT_SRGBA_DXT5, 130be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner /*@}*/ 131be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner 1327546c3884a400b72d10fc19f120c6798b294a39dChris Lattner /** 1337546c3884a400b72d10fc19f120c6798b294a39dChris Lattner * \name Compressed texture formats. 1347546c3884a400b72d10fc19f120c6798b294a39dChris Lattner */ 1357546c3884a400b72d10fc19f120c6798b294a39dChris Lattner /*@{*/ 1367546c3884a400b72d10fc19f120c6798b294a39dChris Lattner MESA_FORMAT_RGB_FXT1, 1377546c3884a400b72d10fc19f120c6798b294a39dChris Lattner MESA_FORMAT_RGBA_FXT1, 1387546c3884a400b72d10fc19f120c6798b294a39dChris Lattner MESA_FORMAT_RGB_DXT1, 139a75766a6c14b364b74b30546802e26d4b4b36a9bChris Lattner MESA_FORMAT_RGBA_DXT1, 140a75766a6c14b364b74b30546802e26d4b4b36a9bChris Lattner MESA_FORMAT_RGBA_DXT3, 141a1cf1c8c87f10f12343ff6ae75f332390e7205abChris Lattner MESA_FORMAT_RGBA_DXT5, 142a1cf1c8c87f10f12343ff6ae75f332390e7205abChris Lattner /*@}*/ 143a1cf1c8c87f10f12343ff6ae75f332390e7205abChris Lattner 144a1cf1c8c87f10f12343ff6ae75f332390e7205abChris Lattner /** 145a1cf1c8c87f10f12343ff6ae75f332390e7205abChris Lattner * \name Floating point texture formats. 1467546c3884a400b72d10fc19f120c6798b294a39dChris Lattner */ 1477546c3884a400b72d10fc19f120c6798b294a39dChris Lattner /*@{*/ 148a75766a6c14b364b74b30546802e26d4b4b36a9bChris Lattner MESA_FORMAT_RGBA_FLOAT32, 149a75766a6c14b364b74b30546802e26d4b4b36a9bChris Lattner MESA_FORMAT_RGBA_FLOAT16, 150a269ec7b0a83d3b20730fd2d9f7c3ed5a552da90Chris Lattner MESA_FORMAT_RGB_FLOAT32, 151a269ec7b0a83d3b20730fd2d9f7c3ed5a552da90Chris Lattner MESA_FORMAT_RGB_FLOAT16, 152a269ec7b0a83d3b20730fd2d9f7c3ed5a552da90Chris Lattner MESA_FORMAT_ALPHA_FLOAT32, 15390c18c5c69d9c451e5fdca1e4b4b95e8ed13291aChris Lattner MESA_FORMAT_ALPHA_FLOAT16, 154a75766a6c14b364b74b30546802e26d4b4b36a9bChris Lattner MESA_FORMAT_LUMINANCE_FLOAT32, 155a75766a6c14b364b74b30546802e26d4b4b36a9bChris Lattner MESA_FORMAT_LUMINANCE_FLOAT16, 15690c18c5c69d9c451e5fdca1e4b4b95e8ed13291aChris Lattner MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, 15790c18c5c69d9c451e5fdca1e4b4b95e8ed13291aChris Lattner MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, 15890c18c5c69d9c451e5fdca1e4b4b95e8ed13291aChris Lattner MESA_FORMAT_INTENSITY_FLOAT32, 15990c18c5c69d9c451e5fdca1e4b4b95e8ed13291aChris Lattner MESA_FORMAT_INTENSITY_FLOAT16, 16090c18c5c69d9c451e5fdca1e4b4b95e8ed13291aChris Lattner MESA_FORMAT_R_FLOAT32, 161a75766a6c14b364b74b30546802e26d4b4b36a9bChris Lattner MESA_FORMAT_R_FLOAT16, 1623da94aec4d429b2ba0f65fa040c33650cade196bMisha Brukman MESA_FORMAT_RG_FLOAT32, 163a75766a6c14b364b74b30546802e26d4b4b36a9bChris Lattner MESA_FORMAT_RG_FLOAT16, 1647546c3884a400b72d10fc19f120c6798b294a39dChris Lattner /*@}*/ 1657546c3884a400b72d10fc19f120c6798b294a39dChris Lattner 1667546c3884a400b72d10fc19f120c6798b294a39dChris Lattner /** 167be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner * \name Non-normalized signed integer formats. 168be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner * XXX Note: these are just stand-ins for some better hardware 169be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner * formats TBD such as BGRA or ARGB. 170be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner */ 171be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner MESA_FORMAT_ALPHA_UINT8, 172be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner MESA_FORMAT_ALPHA_UINT16, 1735cbf985dcbc89fba3208e7baf8b6f488b06d3ec9Reid Spencer MESA_FORMAT_ALPHA_UINT32, 174be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner MESA_FORMAT_ALPHA_INT8, 175be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner MESA_FORMAT_ALPHA_INT16, 1765a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_ALPHA_INT32, 1775a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner 1785a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_INTENSITY_UINT8, 1795a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_INTENSITY_UINT16, 1805a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_INTENSITY_UINT32, 1815a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_INTENSITY_INT8, 1825a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_INTENSITY_INT16, 18371d2ec9e6d20bd8701471bc6e6db620838ce3539Reid Spencer MESA_FORMAT_INTENSITY_INT32, 1845a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner 1855a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_LUMINANCE_UINT8, 1865a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_LUMINANCE_UINT16, 1875a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_LUMINANCE_UINT32, 1885a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_LUMINANCE_INT8, 1895a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_LUMINANCE_INT16, 1905a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_LUMINANCE_INT32, 1915a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner 1925a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_LUMINANCE_ALPHA_UINT8, 1935a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_LUMINANCE_ALPHA_UINT16, 1945a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_LUMINANCE_ALPHA_UINT32, 1955a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_LUMINANCE_ALPHA_INT8, 1965a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_LUMINANCE_ALPHA_INT16, 1975a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_LUMINANCE_ALPHA_INT32, 1985cbf985dcbc89fba3208e7baf8b6f488b06d3ec9Reid Spencer 1995a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_R_INT8, 2005a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RG_INT8, 2015a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RGB_INT8, 2025a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RGBA_INT8, 2035a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_R_INT16, 2045a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RG_INT16, 2055a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RGB_INT16, 2065a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RGBA_INT16, 2075a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_R_INT32, 2085a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RG_INT32, 2095a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RGB_INT32, 2105a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RGBA_INT32, 2115a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner 212b83eb6447ba155342598f0fabe1f08f5baa9164aReid Spencer /** 213b83eb6447ba155342598f0fabe1f08f5baa9164aReid Spencer * \name Non-normalized unsigned integer formats. 2145a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner */ 2155a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_R_UINT8, 2165a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RG_UINT8, 2173da59db637a887474c1b1346c1f3ccf53b6c4663Reid Spencer MESA_FORMAT_RGB_UINT8, 2185a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RGBA_UINT8, 2195a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_R_UINT16, 2205cbf985dcbc89fba3208e7baf8b6f488b06d3ec9Reid Spencer MESA_FORMAT_RG_UINT16, 2215a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RGB_UINT16, 2225a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RGBA_UINT16, 2235a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_R_UINT32, 2245a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RG_UINT32, 2255a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RGB_UINT32, 2265a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RGBA_UINT32, 2275a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner 2285a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner /* msb <------ TEXEL BITS -----------> lsb */ 2295a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner /* ---- ---- ---- ---- ---- ---- ---- ---- */ 2305a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner /** 2315a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner * \name Signed fixed point texture formats. 2325a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner */ 2335a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner /*@{*/ 2345a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_DUDV8, /* DUDU DUDU DVDV DVDV */ 2355a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_SIGNED_R8, /* RRRR RRRR */ 2365a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_SIGNED_RG88_REV, /* GGGG GGGG RRRR RRRR */ 2375a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_SIGNED_RGBX8888, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ 2385a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_SIGNED_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ 2395a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_SIGNED_RGBA8888_REV,/*AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ 2405a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_SIGNED_R16, /* RRRR RRRR RRRR RRRR */ 2415a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_SIGNED_GR1616, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ 2425a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_SIGNED_RGB_16, /* ushort[0]=R, ushort[1]=G, ushort[2]=B */ 2435a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_SIGNED_RGBA_16, /* ... */ 2445a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RGBA_16, /* ... */ 2455a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner /*@}*/ 2465a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner 2475a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner /*@{*/ 2485a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_RED_RGTC1, 2495a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_SIGNED_RED_RGTC1, 250e47863e212e0af6239f6f40b2496ede29847bbcePatrick Jenkins MESA_FORMAT_RG_RGTC2, 251be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner MESA_FORMAT_SIGNED_RG_RGTC2, 252be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner /*@}*/ 253be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner 254be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner /*@{*/ 255be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner MESA_FORMAT_L_LATC1, 256be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner MESA_FORMAT_SIGNED_L_LATC1, 257be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner MESA_FORMAT_LA_LATC2, 258be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner MESA_FORMAT_SIGNED_LA_LATC2, 259be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner /*@}*/ 2605a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner 2615a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner MESA_FORMAT_ETC1_RGB8, 262be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner 263be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner MESA_FORMAT_SIGNED_A8, /* AAAA AAAA */ 264fef02427cda8dc0b3e6aedd6d78c4ba3e1e48069Chris Lattner MESA_FORMAT_SIGNED_L8, /* LLLL LLLL */ 265be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner MESA_FORMAT_SIGNED_AL88, /* AAAA AAAA LLLL LLLL */ 266fef02427cda8dc0b3e6aedd6d78c4ba3e1e48069Chris Lattner MESA_FORMAT_SIGNED_I8, /* IIII IIII */ 267fef02427cda8dc0b3e6aedd6d78c4ba3e1e48069Chris Lattner MESA_FORMAT_SIGNED_A16, /* AAAA AAAA AAAA AAAA */ 268fef02427cda8dc0b3e6aedd6d78c4ba3e1e48069Chris Lattner MESA_FORMAT_SIGNED_L16, /* LLLL LLLL LLLL LLLL */ 269fef02427cda8dc0b3e6aedd6d78c4ba3e1e48069Chris Lattner MESA_FORMAT_SIGNED_AL1616, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */ 270be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner MESA_FORMAT_SIGNED_I16, /* IIII IIII IIII IIII */ 271fef02427cda8dc0b3e6aedd6d78c4ba3e1e48069Chris Lattner 272fb4b96e77e2930bf3d0c148f1c3685b6a4434666Chris Lattner MESA_FORMAT_RGB9_E5_FLOAT, 273be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner MESA_FORMAT_R11_G11_B10_FLOAT, 274e47863e212e0af6239f6f40b2496ede29847bbcePatrick Jenkins 275fef02427cda8dc0b3e6aedd6d78c4ba3e1e48069Chris Lattner MESA_FORMAT_Z32_FLOAT, 276fef02427cda8dc0b3e6aedd6d78c4ba3e1e48069Chris Lattner MESA_FORMAT_Z32_FLOAT_X24S8, 277fef02427cda8dc0b3e6aedd6d78c4ba3e1e48069Chris Lattner 278fef02427cda8dc0b3e6aedd6d78c4ba3e1e48069Chris Lattner MESA_FORMAT_ARGB2101010_UINT, 279e47863e212e0af6239f6f40b2496ede29847bbcePatrick Jenkins 280e47863e212e0af6239f6f40b2496ede29847bbcePatrick Jenkins MESA_FORMAT_COUNT 2815a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner} gl_format; 282fef02427cda8dc0b3e6aedd6d78c4ba3e1e48069Chris Lattner 283fef02427cda8dc0b3e6aedd6d78c4ba3e1e48069Chris Lattner 284fef02427cda8dc0b3e6aedd6d78c4ba3e1e48069Chris Lattnerextern const char * 285fef02427cda8dc0b3e6aedd6d78c4ba3e1e48069Chris Lattner_mesa_get_format_name(gl_format format); 286fef02427cda8dc0b3e6aedd6d78c4ba3e1e48069Chris Lattner 287e47863e212e0af6239f6f40b2496ede29847bbcePatrick Jenkinsextern GLint 2885a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner_mesa_get_format_bytes(gl_format format); 2895a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner 2905a7a9e53861188ad84cb0e08e34562da744a907aChris Lattnerextern GLint 2915a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner_mesa_get_format_bits(gl_format format, GLenum pname); 2925a7a9e53861188ad84cb0e08e34562da744a907aChris Lattner 293be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattnerextern GLuint 294be21ca54e08339ede5dd4bbb882182d22e274988Chris Lattner_mesa_get_format_max_bits(gl_format format); 2955e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 2965e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattnerextern GLenum 2975e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner_mesa_get_format_datatype(gl_format format); 2985e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 2995e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattnerextern GLenum 3005e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner_mesa_get_format_base_format(gl_format format); 3015e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 3025e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattnerextern void 3035e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner_mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh); 3045e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 3055e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattnerextern GLboolean 306b12914bfc0f76a7a48357162d5f4c39a1343e69bChris Lattner_mesa_is_format_compressed(gl_format format); 307b12914bfc0f76a7a48357162d5f4c39a1343e69bChris Lattner 3085e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattnerextern GLboolean 3097f8897f22e88271cfa114998a4d6088e7c8e8e11Chris Lattner_mesa_is_format_packed_depth_stencil(gl_format format); 3105e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 3115e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattnerextern GLboolean 3125e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner_mesa_is_format_integer_color(gl_format format); 313b12914bfc0f76a7a48357162d5f4c39a1343e69bChris Lattner 3145e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattnerextern GLenum 3155e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner_mesa_get_format_color_encoding(gl_format format); 3165e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 3175e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattnerextern GLuint 3185e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner_mesa_format_image_size(gl_format format, GLsizei width, 3195e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner GLsizei height, GLsizei depth); 3205e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 3215e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattnerextern uint64_t 3225e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner_mesa_format_image_size64(gl_format format, GLsizei width, 3235e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner GLsizei height, GLsizei depth); 3245e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 3255e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattnerextern GLint 3265e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner_mesa_format_row_stride(gl_format format, GLsizei width); 3275e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 3285e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattnerextern void 3295e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner_mesa_format_to_type_and_comps(gl_format format, 3305e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner GLenum *datatype, GLuint *comps); 3315e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 3325e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattnerextern void 3335e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner_mesa_test_formats(void); 3345e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 3355e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattnerextern gl_format 3365e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner_mesa_get_srgb_format_linear(gl_format format); 3375e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 3383da94aec4d429b2ba0f65fa040c33650cade196bMisha Brukmanextern gl_format 3395e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner_mesa_get_uncompressed_format(gl_format format); 3405e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 3415e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattnerextern GLuint 3425e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner_mesa_format_num_components(gl_format format); 3435e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 3445e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris LattnerGLboolean 3455e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner_mesa_format_matches_format_and_type(gl_format gl_format, 3465e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner GLenum format, GLenum type); 3475e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 3485e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 3495e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner#ifdef __cplusplus 3505e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner} 3515e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner#endif 3525e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner 3535e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner#endif /* FORMATS_H */ 3545e783ab0b5fc3407ec59f1a598fdb9ef3b96b287Chris Lattner