From ccc6442d6f0539571c413222e0d6aadc78bc5d4d Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Thu, 6 Jun 2024 12:36:00 +0100 Subject: [PATCH] u_format: Rewrite format table to use YAML u_format has always had its format table in CSV. This is kind of nice for some things, but is a serious pain to extend, especially with optional fields. In going through our many (many, many) duplicated tables of format mappings, it would've been nice to add some descriptions to our central u_format table, such as mapping to DRM FourCC, to EGLImage mappings, and to GL internalformats for EGLImage imports. Unfortunately, doing so with more additional fields would just make the CSV totally unreadable. Move the CSV table to a YAML-based table and adjust the Python parsers to suit. The resulting generated files are identical before and after the transition. The new parser also has a significant amount of format validation to make it easier to catch common errors. Signed-off-by: Daniel Stone Part-of: --- .gitlab-ci/container/alpine/x86_64_build.sh | 1 + .../container/debian/x86_64_build-base.sh | 1 + .gitlab-ci/container/fedora/x86_64_build.sh | 1 + .gitlab-ci/image-tags.yml | 14 +- .gitlab-ci/windows/mesa_deps_choco.ps1 | 2 +- src/amd/common/meson.build | 2 +- src/util/format/meson.build | 4 +- src/util/format/u_format.csv | 597 ---- src/util/format/u_format.yaml | 2786 +++++++++++++++++ src/util/format/u_format_parse.py | 278 +- src/util/format/u_format_table.py | 20 +- 11 files changed, 3000 insertions(+), 706 deletions(-) delete mode 100644 src/util/format/u_format.csv create mode 100644 src/util/format/u_format.yaml diff --git a/.gitlab-ci/container/alpine/x86_64_build.sh b/.gitlab-ci/container/alpine/x86_64_build.sh index d72cc87aa1b..1c9ec1f0a24 100644 --- a/.gitlab-ci/container/alpine/x86_64_build.sh +++ b/.gitlab-ci/container/alpine/x86_64_build.sh @@ -50,6 +50,7 @@ DEPS=( py3-packaging py3-pip py3-ply + py3-yaml vulkan-headers spirv-tools-dev util-macros diff --git a/.gitlab-ci/container/debian/x86_64_build-base.sh b/.gitlab-ci/container/debian/x86_64_build-base.sh index 65713695117..7df7f18f67d 100644 --- a/.gitlab-ci/container/debian/x86_64_build-base.sh +++ b/.gitlab-ci/container/debian/x86_64_build-base.sh @@ -74,6 +74,7 @@ DEPS=( python3-pycparser python3-requests python3-setuptools + python3-yaml qemu-user valgrind x11proto-dri2-dev diff --git a/.gitlab-ci/container/fedora/x86_64_build.sh b/.gitlab-ci/container/fedora/x86_64_build.sh index 00493c6d78b..7a1bee5082f 100644 --- a/.gitlab-ci/container/fedora/x86_64_build.sh +++ b/.gitlab-ci/container/fedora/x86_64_build.sh @@ -78,6 +78,7 @@ DEPS=( python3-mako python3-ply python3-pycparser + python3-yaml rust-packaging vulkan-headers spirv-tools-devel diff --git a/.gitlab-ci/image-tags.yml b/.gitlab-ci/image-tags.yml index 34d8fe4b051..90500fb3835 100644 --- a/.gitlab-ci/image-tags.yml +++ b/.gitlab-ci/image-tags.yml @@ -13,10 +13,10 @@ variables: DEBIAN_X86_64_BUILD_BASE_IMAGE: "debian/x86_64_build-base" - DEBIAN_BASE_TAG: "20240704-libdir" + DEBIAN_BASE_TAG: "20240717-pyyaml-3" DEBIAN_X86_64_BUILD_IMAGE_PATH: "debian/x86_64_build" - DEBIAN_BUILD_TAG: "20240704-libdrm" + DEBIAN_BUILD_TAG: "20240717-pyyaml-3" DEBIAN_X86_64_TEST_BASE_IMAGE: "debian/x86_64_test-base" DEBIAN_ARM64_TEST_BASE_IMAGE: "debian/arm64_test-base" @@ -32,18 +32,18 @@ variables: DEBIAN_TEST_VK_TAG: "20240713-piglit-58" KERNEL_ROOTFS_TAG: "20240713-piglit-58" - ALPINE_X86_64_BUILD_TAG: "20240620-sphinx" + ALPINE_X86_64_BUILD_TAG: "20240717-pyyaml" ALPINE_X86_64_LAVA_SSH_TAG: "20240401-wlproto" - FEDORA_X86_64_BUILD_TAG: "20240704-libdrm" + FEDORA_X86_64_BUILD_TAG: "20240717-pyyaml" KERNEL_TAG: "v6.6.21-mesa-f8ea" KERNEL_REPO: "gfx-ci/linux" PKG_REPO_REV: "bca9635d" WINDOWS_X64_MSVC_PATH: "windows/x86_64_msvc" - WINDOWS_X64_MSVC_TAG: "20231222-msvc" + WINDOWS_X64_MSVC_TAG: "20240717-pyyaml-3" WINDOWS_X64_BUILD_PATH: "windows/x86_64_build" - WINDOWS_X64_BUILD_TAG: "20240405-vainfo-ci-1" + WINDOWS_X64_BUILD_TAG: "20240717-pyyaml-3" WINDOWS_X64_TEST_PATH: "windows/x86_64_test" - WINDOWS_X64_TEST_TAG: "20240405-vainfo-ci-1" + WINDOWS_X64_TEST_TAG: "20240717-pyyaml-3" diff --git a/.gitlab-ci/windows/mesa_deps_choco.ps1 b/.gitlab-ci/windows/mesa_deps_choco.ps1 index 68be6654e0c..b3481de67dd 100644 --- a/.gitlab-ci/windows/mesa_deps_choco.ps1 +++ b/.gitlab-ci/windows/mesa_deps_choco.ps1 @@ -68,7 +68,7 @@ Get-Date python -m pip install --upgrade pip --progress-bar off Write-Host "Installing python packages at:" Get-Date -pip3 install packaging meson mako "numpy < 2.0" --progress-bar off +pip3 install packaging meson mako "numpy < 2.0" pyyaml --progress-bar off if (!$?) { Write-Host "Failed to install dependencies from pip" Exit 1 diff --git a/src/amd/common/meson.build b/src/amd/common/meson.build index 6ac700c414d..bb9934e0a77 100644 --- a/src/amd/common/meson.build +++ b/src/amd/common/meson.build @@ -43,7 +43,7 @@ gfx10_format_table_c = custom_target( 'gfx10_format_table.c', input : files( 'gfx10_format_table.py', - '../../util/format/u_format.csv', '../registers/gfx10-rsrc.json', '../registers/gfx11-rsrc.json' + '../../util/format/u_format.yaml', '../registers/gfx10-rsrc.json', '../registers/gfx11-rsrc.json' ), output : 'gfx10_format_table.c', command : [prog_python, '@INPUT@'], diff --git a/src/util/format/meson.build b/src/util/format/meson.build index bde704ef4ab..3060f1dc245 100644 --- a/src/util/format/meson.build +++ b/src/util/format/meson.build @@ -18,7 +18,7 @@ files_mesa_format = files( u_format_pack_h = custom_target( 'u_format_pack.h', - input : ['u_format_table.py', 'u_format.csv'], + input : ['u_format_table.py', 'u_format.yaml'], output : 'u_format_pack.h', command : [prog_python, '@INPUT@', '--header'], depend_files : files('u_format_pack.py', 'u_format_parse.py'), @@ -27,7 +27,7 @@ u_format_pack_h = custom_target( u_format_table_c = custom_target( 'u_format_table.c', - input : ['u_format_table.py', 'u_format.csv'], + input : ['u_format_table.py', 'u_format.yaml'], output : 'u_format_table.c', command : [prog_python, '@INPUT@'], depend_files : files('u_format_pack.py', 'u_format_parse.py'), diff --git a/src/util/format/u_format.csv b/src/util/format/u_format.csv deleted file mode 100644 index fa75a318edf..00000000000 --- a/src/util/format/u_format.csv +++ /dev/null @@ -1,597 +0,0 @@ -########################################################################### -# -# Copyright 2009-2010 VMware, Inc. -# All Rights Reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sub license, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice (including the -# next paragraph) shall be included in all copies or substantial portions -# of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR -# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -########################################################################### - -# This CSV file has the input data for u_format.h's struct -# util_format_description. It is also used as input for radeonsi's format -# mapping. -# -# Each format entry contains: -# - name, per enum pipe_format -# - layout, per enum util_format_layout, in shortened lower caps -# - pixel block's width -# - pixel block's height -# - pixel block's depth, in number of pixels -# - channel encoding (only meaningful for plain layout), containing for each -# channel the following information: -# - type, one of -# - 'x': void -# - 'u': unsigned -# - 's': signed -# - 'h': fixed -# - 'f': FLOAT -# - optionally followed by 'n' if it is normalized -# - optionally followed by 'p' if it is pure -# - number of bits -# - channel swizzle -# - color space: rgb, srgb, yuv, zs -# - (optional) channel encoding for big-endian targets -# - (optional) channel swizzle for big-endian targets -# -# See also: -# - http://msdn.microsoft.com/en-us/library/bb172558.aspx (D3D9) -# - http://msdn.microsoft.com/en-us/library/bb205073.aspx#mapping_texture_formats (D3D9 -> D3D10) -# - http://msdn.microsoft.com/en-us/library/bb173059.aspx (D3D10) -# -# Note that GL doesn't really specify the layout of internal formats. See -# OpenGL 2.1 specification, Table 3.16, on the "Correspondence of sized -# internal formats to base in- ternal formats, and desired component -# resolutions for each sized internal format." - -# None -# Described as regular uint_8 bytes, i.e. PIPE_FORMAT_R8_USCALED -PIPE_FORMAT_NONE , plain, 1, 1, 1, u8 , , , , x001, rgb - -# Typical rendertarget formats -PIPE_FORMAT_B8G8R8A8_UNORM , plain, 1, 1, 1, un8 , un8 , un8 , un8 , zyxw, rgb -PIPE_FORMAT_B8G8R8X8_UNORM , plain, 1, 1, 1, un8 , un8 , un8 , x8 , zyx1, rgb -PIPE_FORMAT_B8G8R8X8_SNORM , plain, 1, 1, 1, sn8 , sn8 , sn8 , x8 , zyx1, rgb -PIPE_FORMAT_B8G8R8X8_UINT , plain, 1, 1, 1, up8 , up8 , up8 , x8 , zyx1, rgb -PIPE_FORMAT_B8G8R8X8_SINT , plain, 1, 1, 1, sp8 , sp8 , sp8 , x8 , zyx1, rgb -PIPE_FORMAT_A8R8G8B8_UNORM , plain, 1, 1, 1, un8 , un8 , un8 , un8 , yzwx, rgb -PIPE_FORMAT_A8R8G8B8_SNORM , plain, 1, 1, 1, sn8 , sn8 , sn8 , sn8 , yzwx, rgb -PIPE_FORMAT_A8R8G8B8_SINT , plain, 1, 1, 1, sp8 , sp8 , sp8 , sp8 , yzwx, rgb -PIPE_FORMAT_X8R8G8B8_UNORM , plain, 1, 1, 1, x8 , un8 , un8 , un8 , yzw1, rgb -PIPE_FORMAT_X8R8G8B8_SNORM , plain, 1, 1, 1, x8 , sn8 , sn8 , sn8 , yzw1, rgb -PIPE_FORMAT_X8R8G8B8_SINT , plain, 1, 1, 1, x8 , sp8 , sp8 , sp8 , yzw1, rgb -PIPE_FORMAT_A8B8G8R8_UNORM , plain, 1, 1, 1, un8 , un8 , un8 , un8 , wzyx, rgb -PIPE_FORMAT_X8B8G8R8_UNORM , plain, 1, 1, 1, x8 , un8 , un8 , un8 , wzy1, rgb -# PIPE_FORMAT_R8G8B8A8_UNORM is below -PIPE_FORMAT_R8G8B8X8_UNORM , plain, 1, 1, 1, un8 , un8 , un8 , x8 , xyz1, rgb -PIPE_FORMAT_R5G5B5A1_UNORM , plain, 1, 1, 1, un5 , un5 , un5 , un1 , xyzw, rgb -PIPE_FORMAT_R5G5B5X1_UNORM , plain, 1, 1, 1, un5 , un5 , un5 , x1 , xyz1, rgb -PIPE_FORMAT_B5G5R5X1_UNORM , plain, 1, 1, 1, un5 , un5 , un5 , x1 , zyx1, rgb -PIPE_FORMAT_B5G5R5A1_UNORM , plain, 1, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb -PIPE_FORMAT_X1B5G5R5_UNORM , plain, 1, 1, 1, x1 , un5 , un5 , un5 , wzy1, rgb -PIPE_FORMAT_A1R5G5B5_UNORM , plain, 1, 1, 1, un1 , un5 , un5 , un5 , yzwx, rgb -PIPE_FORMAT_X1R5G5B5_UNORM , plain, 1, 1, 1, x1 , un5 , un5 , un5 , yzw1, rgb -PIPE_FORMAT_A1B5G5R5_UNORM , plain, 1, 1, 1, un1 , un5 , un5 , un5 , wzyx, rgb -PIPE_FORMAT_R4G4B4A4_UNORM , plain, 1, 1, 1, un4 , un4 , un4 , un4 , xyzw, rgb -PIPE_FORMAT_R4G4B4X4_UNORM , plain, 1, 1, 1, un4 , un4 , un4 , x4 , xyz1, rgb -PIPE_FORMAT_B4G4R4A4_UNORM , plain, 1, 1, 1, un4 , un4 , un4 , un4 , zyxw, rgb -PIPE_FORMAT_B4G4R4X4_UNORM , plain, 1, 1, 1, un4 , un4 , un4 , x4 , zyx1, rgb -PIPE_FORMAT_A4R4G4B4_UNORM , plain, 1, 1, 1, un4 , un4 , un4 , un4 , yzwx, rgb -PIPE_FORMAT_A4B4G4R4_UNORM , plain, 1, 1, 1, un4 , un4 , un4 , un4 , wzyx, rgb -PIPE_FORMAT_R5G6B5_UNORM , plain, 1, 1, 1, un5 , un6 , un5 , , xyz1, rgb -PIPE_FORMAT_B5G6R5_UNORM , plain, 1, 1, 1, un5 , un6 , un5 , , zyx1, rgb -PIPE_FORMAT_R10G10B10A2_UNORM , plain, 1, 1, 1, un10, un10, un10, un2 , xyzw, rgb -PIPE_FORMAT_R10G10B10X2_UNORM , plain, 1, 1, 1, un10, un10, un10, x2, xyz1, rgb -PIPE_FORMAT_B10G10R10A2_UNORM , plain, 1, 1, 1, un10, un10, un10, un2 , zyxw, rgb -PIPE_FORMAT_A2R10G10B10_UNORM , plain, 1, 1, 1, un2 , un10, un10, un10, yzwx, rgb -PIPE_FORMAT_A2B10G10R10_UNORM , plain, 1, 1, 1, un2 , un10, un10, un10, wzyx, rgb -PIPE_FORMAT_R3G3B2_UNORM , plain, 1, 1, 1, un3 , un3 , un2 , , xyz1, rgb -PIPE_FORMAT_B2G3R3_UNORM , plain, 1, 1, 1, un2 , un3 , un3 , , zyx1, rgb - -# Luminance/Intensity/Alpha formats -PIPE_FORMAT_L8_UNORM , plain, 1, 1, 1, un8 , , , , xxx1, rgb -PIPE_FORMAT_A8_UNORM , plain, 1, 1, 1, un8 , , , , 000x, rgb -PIPE_FORMAT_I8_UNORM , plain, 1, 1, 1, un8 , , , , xxxx, rgb -PIPE_FORMAT_L4A4_UNORM , plain, 1, 1, 1, un4 , un4 , , , xxxy, rgb -PIPE_FORMAT_L8A8_UNORM , plain, 1, 1, 1, un8 , un8 , , , xxxy, rgb -PIPE_FORMAT_L16_UNORM , plain, 1, 1, 1, un16, , , , xxx1, rgb -PIPE_FORMAT_A16_UNORM , plain, 1, 1, 1, un16, , , , 000x, rgb -PIPE_FORMAT_I16_UNORM , plain, 1, 1, 1, un16, , , , xxxx, rgb -PIPE_FORMAT_L16A16_UNORM , plain, 1, 1, 1, un16, un16, , , xxxy, rgb -PIPE_FORMAT_A8_SNORM , plain, 1, 1, 1, sn8 , , , , 000x, rgb -PIPE_FORMAT_L8_SNORM , plain, 1, 1, 1, sn8 , , , , xxx1, rgb -PIPE_FORMAT_L8A8_SNORM , plain, 1, 1, 1, sn8 , sn8 , , , xxxy, rgb -PIPE_FORMAT_I8_SNORM , plain, 1, 1, 1, sn8 , , , , xxxx, rgb -PIPE_FORMAT_A16_SNORM , plain, 1, 1, 1, sn16, , , , 000x, rgb -PIPE_FORMAT_L16_SNORM , plain, 1, 1, 1, sn16, , , , xxx1, rgb -PIPE_FORMAT_L16A16_SNORM , plain, 1, 1, 1, sn16, sn16, , , xxxy, rgb -PIPE_FORMAT_I16_SNORM , plain, 1, 1, 1, sn16, , , , xxxx, rgb -PIPE_FORMAT_A16_FLOAT , plain, 1, 1, 1, f16 , , , , 000x, rgb -PIPE_FORMAT_L16_FLOAT , plain, 1, 1, 1, f16 , , , , xxx1, rgb -PIPE_FORMAT_L16A16_FLOAT , plain, 1, 1, 1, f16 , f16 , , , xxxy, rgb -PIPE_FORMAT_I16_FLOAT , plain, 1, 1, 1, f16 , , , , xxxx, rgb -PIPE_FORMAT_A32_FLOAT , plain, 1, 1, 1, f32 , , , , 000x, rgb -PIPE_FORMAT_L32_FLOAT , plain, 1, 1, 1, f32 , , , , xxx1, rgb -PIPE_FORMAT_L32A32_FLOAT , plain, 1, 1, 1, f32 , f32 , , , xxxy, rgb -PIPE_FORMAT_I32_FLOAT , plain, 1, 1, 1, f32 , , , , xxxx, rgb - -# SRGB formats -PIPE_FORMAT_L8_SRGB , plain, 1, 1, 1, un8 , , , , xxx1, srgb -PIPE_FORMAT_R8_SRGB , plain, 1, 1, 1, un8 , , , , x001, srgb -PIPE_FORMAT_L8A8_SRGB , plain, 1, 1, 1, un8 , un8 , , , xxxy, srgb -PIPE_FORMAT_R8G8_SRGB , plain, 1, 1, 1, un8 , un8 , , , xy01, srgb -PIPE_FORMAT_R8G8B8_SRGB , plain, 1, 1, 1, un8 , un8 , un8 , , xyz1, srgb -PIPE_FORMAT_B8G8R8_SRGB , plain, 1, 1, 1, un8 , un8 , un8 , , zyx1, srgb -PIPE_FORMAT_R8G8B8A8_SRGB , plain, 1, 1, 1, un8 , un8 , un8 , un8 , xyzw, srgb -PIPE_FORMAT_A8B8G8R8_SRGB , plain, 1, 1, 1, un8 , un8 , un8 , un8 , wzyx, srgb -PIPE_FORMAT_X8B8G8R8_SRGB , plain, 1, 1, 1, x8 , un8 , un8 , un8 , wzy1, srgb -PIPE_FORMAT_B8G8R8A8_SRGB , plain, 1, 1, 1, un8 , un8 , un8 , un8 , zyxw, srgb -PIPE_FORMAT_B8G8R8X8_SRGB , plain, 1, 1, 1, un8 , un8 , un8 , x8 , zyx1, srgb -PIPE_FORMAT_A8R8G8B8_SRGB , plain, 1, 1, 1, un8 , un8 , un8 , un8 , yzwx, srgb -PIPE_FORMAT_X8R8G8B8_SRGB , plain, 1, 1, 1, x8 , un8 , un8 , un8 , yzw1, srgb - -# Mixed-sign formats (typically used for bump map textures) -PIPE_FORMAT_R8SG8SB8UX8U_NORM , plain, 1, 1, 1, sn8 , sn8 , un8 , x8 , xyz1, rgb -PIPE_FORMAT_R10SG10SB10SA2U_NORM , plain, 1, 1, 1, sn10, sn10, sn10, un2 , xyzw, rgb -PIPE_FORMAT_R5SG5SB6U_NORM , plain, 1, 1, 1, sn5 , sn5 , un6 , , xyz1, rgb - -# Depth-stencil formats -PIPE_FORMAT_S8_UINT , plain, 1, 1, 1, up8 , , , , _x__, zs -PIPE_FORMAT_Z16_UNORM , plain, 1, 1, 1, un16, , , , x___, zs -PIPE_FORMAT_Z16_UNORM_S8_UINT , plain, 1, 1, 1, un16, up8 , , , xy__, zs -PIPE_FORMAT_Z32_UNORM , plain, 1, 1, 1, un32, , , , x___, zs -PIPE_FORMAT_Z32_FLOAT , plain, 1, 1, 1, f32 , , , , x___, zs -PIPE_FORMAT_Z24_UNORM_S8_UINT , plain, 1, 1, 1, un24, up8 , , , xy__, zs -PIPE_FORMAT_S8_UINT_Z24_UNORM , plain, 1, 1, 1, up8 , un24, , , yx__, zs -PIPE_FORMAT_X24S8_UINT , plain, 1, 1, 1, x24 , up8 , , , _y__, zs -PIPE_FORMAT_S8X24_UINT , plain, 1, 1, 1, up8 , x24 , , , _x__, zs -PIPE_FORMAT_Z24X8_UNORM , plain, 1, 1, 1, un24, x8 , , , x___, zs -PIPE_FORMAT_X8Z24_UNORM , plain, 1, 1, 1, x8 , un24, , , y___, zs -PIPE_FORMAT_Z32_FLOAT_S8X24_UINT , plain, 1, 1, 1, f32 , up8 , x24, , xy__, zs, f32 , x24 , up8, , xz__ -PIPE_FORMAT_X32_S8X24_UINT , plain, 1, 1, 1, x32 , up8 , x24, , _y__, zs, x32 , x24 , up8, , _z__ - -# Depth-stencil formats equivalent to blitting PIPE_FORMAT_Z24_UNORM_S8_UINT -# as PIPE_FORMAT_R8G8B8A8_*, in that it is an equivalent size to the z/s -# format. This is mainly for hw that has some sort of bandwidth compressed -# format where the compression for z24s8 is not equivalent to r8g8b8a8, -# and therefore some special handling is required for blits. -PIPE_FORMAT_Z24_UNORM_S8_UINT_AS_R8G8B8A8 , plain, 1, 1, 1, un8 , un8 , un8 , un8 , xyzw, rgb - -# YUV formats -# http://www.fourcc.org/yuv.php#UYVY -PIPE_FORMAT_UYVY , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , xyz1, yuv -PIPE_FORMAT_VYUY , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , xyz1, yuv -# http://www.fourcc.org/yuv.php#YUYV (a.k.a http://www.fourcc.org/yuv.php#YUY2) -PIPE_FORMAT_YUYV , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , xyz1, yuv -PIPE_FORMAT_YVYU , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , xyz1, yuv - -PIPE_FORMAT_AYUV , other, 4, 4, 1, un8 , , , , xyzw, yuv -PIPE_FORMAT_XYUV , other, 4, 4, 1, un8 , , , , xyz1, yuv - -# same subsampling but with rgb channels -PIPE_FORMAT_R8G8_B8G8_UNORM , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , xyz1, rgb -PIPE_FORMAT_G8R8_G8B8_UNORM , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , xyz1, rgb -PIPE_FORMAT_G8R8_B8R8_UNORM , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , zyx1, rgb -PIPE_FORMAT_R8G8_R8B8_UNORM , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , zyx1, rgb -PIPE_FORMAT_B8R8_G8R8_UNORM , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , yxz1, rgb -PIPE_FORMAT_R8B8_R8G8_UNORM , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , yxz1, rgb -PIPE_FORMAT_G8B8_G8R8_UNORM , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , xyz1, rgb -PIPE_FORMAT_B8G8_R8G8_UNORM , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , xyz1, rgb - -# some special formats not fitting anywhere else -PIPE_FORMAT_R11G11B10_FLOAT , other, 1, 1, 1, f11 , f11 , f10 , , xyz1, rgb -PIPE_FORMAT_R9G9B9E5_FLOAT , other, 1, 1, 1, f9 , f9 , f9 , x5 , xyz1, rgb -PIPE_FORMAT_R1_UNORM , other, 8, 1, 1, x8 , , , , x001, rgb -# A.k.a. D3DFMT_CxV8U8 -PIPE_FORMAT_R8G8Bx_SNORM , other, 1, 1, 1, sn8 , sn8 , , , xyz1, rgb - -# Compressed formats -# - http://en.wikipedia.org/wiki/S3_Texture_Compression -# - http://www.opengl.org/registry/specs/EXT/texture_compression_s3tc.txt -# - http://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt -# - http://www.opengl.org/registry/specs/EXT/texture_compression_latc.txt -# - http://www.opengl.org/registry/specs/ARB/texture_compression_bptc.txt -# - http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt -# - http://msdn.microsoft.com/en-us/library/bb694531.aspx -PIPE_FORMAT_DXT1_RGB , s3tc, 4, 4, 1, x64 , , , , xyz1, rgb -PIPE_FORMAT_DXT1_RGBA , s3tc, 4, 4, 1, x64 , , , , xyzw, rgb -PIPE_FORMAT_DXT3_RGBA , s3tc, 4, 4, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_DXT5_RGBA , s3tc, 4, 4, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_DXT1_SRGB , s3tc, 4, 4, 1, x64 , , , , xyz1, srgb -PIPE_FORMAT_DXT1_SRGBA , s3tc, 4, 4, 1, x64 , , , , xyzw, srgb -PIPE_FORMAT_DXT3_SRGBA , s3tc, 4, 4, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_DXT5_SRGBA , s3tc, 4, 4, 1, x128, , , , xyzw, srgb - -# FXT1 compressed formats -PIPE_FORMAT_FXT1_RGB , fxt1, 8, 4, 1, x128, , , , xyz1, rgb -PIPE_FORMAT_FXT1_RGBA , fxt1, 8, 4, 1, x128, , , , xyzw, rgb - -PIPE_FORMAT_RGTC1_UNORM , rgtc, 4, 4, 1, x64, , , , x001, rgb -PIPE_FORMAT_RGTC1_SNORM , rgtc, 4, 4, 1, x64, , , , x001, rgb -PIPE_FORMAT_RGTC2_UNORM , rgtc, 4, 4, 1, x128, , , , xy01, rgb -PIPE_FORMAT_RGTC2_SNORM , rgtc, 4, 4, 1, x128, , , , xy01, rgb - -PIPE_FORMAT_LATC1_UNORM , rgtc, 4, 4, 1, x64, , , , xxx1, rgb -PIPE_FORMAT_LATC1_SNORM , rgtc, 4, 4, 1, x64, , , , xxx1, rgb -PIPE_FORMAT_LATC2_UNORM , rgtc, 4, 4, 1, x128, , , , xxxy, rgb -PIPE_FORMAT_LATC2_SNORM , rgtc, 4, 4, 1, x128, , , , xxxy, rgb - -PIPE_FORMAT_ETC1_RGB8 , etc, 4, 4, 1, x64, , , , xyz1, rgb - -PIPE_FORMAT_ETC2_RGB8 , etc, 4, 4, 1, x64, , , , xyz1, rgb -PIPE_FORMAT_ETC2_SRGB8 , etc, 4, 4, 1, x64, , , , xyz1, srgb -PIPE_FORMAT_ETC2_RGB8A1 , etc, 4, 4, 1, x64, , , , xyzw, rgb -PIPE_FORMAT_ETC2_SRGB8A1 , etc, 4, 4, 1, x64, , , , xyzw, srgb -PIPE_FORMAT_ETC2_RGBA8 , etc, 4, 4, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_ETC2_SRGBA8 , etc, 4, 4, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_ETC2_R11_UNORM , etc, 4, 4, 1, x64, , , , x001, rgb -PIPE_FORMAT_ETC2_R11_SNORM , etc, 4, 4, 1, x64, , , , x001, rgb -PIPE_FORMAT_ETC2_RG11_UNORM , etc, 4, 4, 1, x128, , , , xy01, rgb -PIPE_FORMAT_ETC2_RG11_SNORM , etc, 4, 4, 1, x128, , , , xy01, rgb - -PIPE_FORMAT_BPTC_RGBA_UNORM , bptc, 4, 4, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_BPTC_SRGBA , bptc, 4, 4, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_BPTC_RGB_FLOAT , bptc, 4, 4, 1, x128, , , , xyz1, rgb -PIPE_FORMAT_BPTC_RGB_UFLOAT , bptc, 4, 4, 1, x128, , , , xyz1, rgb - -PIPE_FORMAT_ASTC_4x4 , astc, 4, 4, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_5x4 , astc, 5, 4, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_5x5 , astc, 5, 5, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_6x5 , astc, 6, 5, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_6x6 , astc, 6, 6, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_8x5 , astc, 8, 5, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_8x6 , astc, 8, 6, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_8x8 , astc, 8, 8, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_10x5 , astc,10, 5, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_10x6 , astc,10, 6, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_10x8 , astc,10, 8, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_10x10 , astc,10,10, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_12x10 , astc,12,10, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_12x12 , astc,12,12, 1, x128, , , , xyzw, rgb - -PIPE_FORMAT_ASTC_4x4_SRGB , astc, 4, 4, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_5x4_SRGB , astc, 5, 4, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_5x5_SRGB , astc, 5, 5, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_6x5_SRGB , astc, 6, 5, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_6x6_SRGB , astc, 6, 6, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_8x5_SRGB , astc, 8, 5, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_8x6_SRGB , astc, 8, 6, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_8x8_SRGB , astc, 8, 8, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_10x5_SRGB , astc,10, 5, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_10x6_SRGB , astc,10, 6, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_10x8_SRGB , astc,10, 8, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_10x10_SRGB , astc,10,10, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_12x10_SRGB , astc,12,10, 1, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_12x12_SRGB , astc,12,12, 1, x128, , , , xyzw, srgb - -PIPE_FORMAT_ASTC_3x3x3 , astc, 3, 3, 3, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_4x3x3 , astc, 4, 3, 3, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_4x4x3 , astc, 4, 4, 3, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_4x4x4 , astc, 4, 4, 4, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_5x4x4 , astc, 5, 4, 4, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_5x5x4 , astc, 5, 5, 4, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_5x5x5 , astc, 5, 5, 5, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_6x5x5 , astc, 6, 5, 5, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_6x6x5 , astc, 6, 6, 5, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_6x6x6 , astc, 6, 6, 6, x128, , , , xyzw, rgb -PIPE_FORMAT_ASTC_3x3x3_SRGB , astc, 3, 3, 3, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_4x3x3_SRGB , astc, 4, 3, 3, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_4x4x3_SRGB , astc, 4, 4, 3, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_4x4x4_SRGB , astc, 4, 4, 4, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_5x4x4_SRGB , astc, 5, 4, 4, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_5x5x4_SRGB , astc, 5, 5, 4, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_5x5x5_SRGB , astc, 5, 5, 5, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_6x5x5_SRGB , astc, 6, 5, 5, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_6x6x5_SRGB , astc, 6, 6, 5, x128, , , , xyzw, srgb -PIPE_FORMAT_ASTC_6x6x6_SRGB , astc, 6, 6, 6, x128, , , , xyzw, srgb - -PIPE_FORMAT_ATC_RGB , atc, 4, 4, 1, x64, , , , xyz1, rgb -PIPE_FORMAT_ATC_RGBA_EXPLICIT , atc, 4, 4, 1, x128, , , , xyzw, rgb -PIPE_FORMAT_ATC_RGBA_INTERPOLATED , atc, 4, 4, 1, x128, , , , xyzw, rgb - -# Straightforward D3D10-like formats (also used for -# vertex buffer element description) -# -# See also: -# - src/gallium/auxiliary/translate/translate_generic.c -# - src/mesa/state_tracker/st_draw.c -PIPE_FORMAT_R64_FLOAT , plain, 1, 1, 1, f64 , , , , x001, rgb -PIPE_FORMAT_R64G64_FLOAT , plain, 1, 1, 1, f64 , f64 , , , xy01, rgb -PIPE_FORMAT_R64G64B64_FLOAT , plain, 1, 1, 1, f64 , f64 , f64 , , xyz1, rgb -PIPE_FORMAT_R64G64B64A64_FLOAT , plain, 1, 1, 1, f64 , f64 , f64 , f64 , xyzw, rgb -PIPE_FORMAT_R32_FLOAT , plain, 1, 1, 1, f32 , , , , x001, rgb -PIPE_FORMAT_R32G32_FLOAT , plain, 1, 1, 1, f32 , f32 , , , xy01, rgb -PIPE_FORMAT_R32G32B32_FLOAT , plain, 1, 1, 1, f32 , f32 , f32 , , xyz1, rgb -PIPE_FORMAT_R32G32B32A32_FLOAT , plain, 1, 1, 1, f32 , f32 , f32 , f32 , xyzw, rgb -PIPE_FORMAT_R32_UNORM , plain, 1, 1, 1, un32, , , , x001, rgb -PIPE_FORMAT_R32G32_UNORM , plain, 1, 1, 1, un32, un32, , , xy01, rgb -PIPE_FORMAT_R32G32B32_UNORM , plain, 1, 1, 1, un32, un32, un32, , xyz1, rgb -PIPE_FORMAT_R32G32B32A32_UNORM , plain, 1, 1, 1, un32, un32, un32, un32, xyzw, rgb -PIPE_FORMAT_R32_USCALED , plain, 1, 1, 1, u32 , , , , x001, rgb -PIPE_FORMAT_R32G32_USCALED , plain, 1, 1, 1, u32 , u32 , , , xy01, rgb -PIPE_FORMAT_R32G32B32_USCALED , plain, 1, 1, 1, u32 , u32 , u32 , , xyz1, rgb -PIPE_FORMAT_R32G32B32A32_USCALED , plain, 1, 1, 1, u32 , u32 , u32 , u32 , xyzw, rgb -PIPE_FORMAT_R32_SNORM , plain, 1, 1, 1, sn32, , , , x001, rgb -PIPE_FORMAT_R32G32_SNORM , plain, 1, 1, 1, sn32, sn32, , , xy01, rgb -PIPE_FORMAT_R32G32B32_SNORM , plain, 1, 1, 1, sn32, sn32, sn32, , xyz1, rgb -PIPE_FORMAT_R32G32B32A32_SNORM , plain, 1, 1, 1, sn32, sn32, sn32, sn32, xyzw, rgb -PIPE_FORMAT_R32_SSCALED , plain, 1, 1, 1, s32 , , , , x001, rgb -PIPE_FORMAT_R32G32_SSCALED , plain, 1, 1, 1, s32 , s32 , , , xy01, rgb -PIPE_FORMAT_R32G32B32_SSCALED , plain, 1, 1, 1, s32 , s32 , s32 , , xyz1, rgb -PIPE_FORMAT_R32G32B32A32_SSCALED , plain, 1, 1, 1, s32 , s32 , s32 , s32 , xyzw, rgb -PIPE_FORMAT_R16_FLOAT , plain, 1, 1, 1, f16 , , , , x001, rgb -PIPE_FORMAT_R16G16_FLOAT , plain, 1, 1, 1, f16 , f16 , , , xy01, rgb -PIPE_FORMAT_R16G16B16_FLOAT , plain, 1, 1, 1, f16 , f16 , f16 , , xyz1, rgb -PIPE_FORMAT_R16G16B16A16_FLOAT , plain, 1, 1, 1, f16 , f16 , f16 , f16 , xyzw, rgb -PIPE_FORMAT_R16_UNORM , plain, 1, 1, 1, un16, , , , x001, rgb -PIPE_FORMAT_R16G16_UNORM , plain, 1, 1, 1, un16, un16, , , xy01, rgb -PIPE_FORMAT_R16G16B16_UNORM , plain, 1, 1, 1, un16, un16, un16, , xyz1, rgb -PIPE_FORMAT_R16G16B16A16_UNORM , plain, 1, 1, 1, un16, un16, un16, un16, xyzw, rgb -PIPE_FORMAT_R16_USCALED , plain, 1, 1, 1, u16 , , , , x001, rgb -PIPE_FORMAT_R16G16_USCALED , plain, 1, 1, 1, u16 , u16 , , , xy01, rgb -PIPE_FORMAT_R16G16B16_USCALED , plain, 1, 1, 1, u16 , u16 , u16 , , xyz1, rgb -PIPE_FORMAT_R16G16B16A16_USCALED , plain, 1, 1, 1, u16 , u16 , u16 , u16 , xyzw, rgb -PIPE_FORMAT_R16_SNORM , plain, 1, 1, 1, sn16, , , , x001, rgb -PIPE_FORMAT_R16G16_SNORM , plain, 1, 1, 1, sn16, sn16, , , xy01, rgb -PIPE_FORMAT_R16G16B16_SNORM , plain, 1, 1, 1, sn16, sn16, sn16, , xyz1, rgb -PIPE_FORMAT_R16G16B16A16_SNORM , plain, 1, 1, 1, sn16, sn16, sn16, sn16, xyzw, rgb -PIPE_FORMAT_R16_SSCALED , plain, 1, 1, 1, s16 , , , , x001, rgb -PIPE_FORMAT_R16G16_SSCALED , plain, 1, 1, 1, s16 , s16 , , , xy01, rgb -PIPE_FORMAT_R16G16B16_SSCALED , plain, 1, 1, 1, s16 , s16 , s16 , , xyz1, rgb -PIPE_FORMAT_R16G16B16A16_SSCALED , plain, 1, 1, 1, s16 , s16 , s16 , s16 , xyzw, rgb -PIPE_FORMAT_R8_UNORM , plain, 1, 1, 1, un8 , , , , x001, rgb -PIPE_FORMAT_R8G8_UNORM , plain, 1, 1, 1, un8 , un8 , , , xy01, rgb -PIPE_FORMAT_R8G8B8_UNORM , plain, 1, 1, 1, un8 , un8 , un8 , , xyz1, rgb -PIPE_FORMAT_B8G8R8_UNORM , plain, 1, 1, 1, un8 , un8 , un8 , , zyx1, rgb -PIPE_FORMAT_R8G8B8A8_UNORM , plain, 1, 1, 1, un8 , un8 , un8 , un8 , xyzw, rgb -PIPE_FORMAT_R8_USCALED , plain, 1, 1, 1, u8 , , , , x001, rgb -PIPE_FORMAT_R8G8_USCALED , plain, 1, 1, 1, u8 , u8 , , , xy01, rgb -PIPE_FORMAT_R8G8B8_USCALED , plain, 1, 1, 1, u8 , u8 , u8 , , xyz1, rgb -PIPE_FORMAT_B8G8R8_USCALED , plain, 1, 1, 1, u8 , u8 , u8 , , zyx1, rgb -PIPE_FORMAT_R8G8B8A8_USCALED , plain, 1, 1, 1, u8 , u8 , u8 , u8 , xyzw, rgb -PIPE_FORMAT_B8G8R8A8_USCALED , plain, 1, 1, 1, u8 , u8 , u8 , u8 , zyxw, rgb -PIPE_FORMAT_A8B8G8R8_USCALED , plain, 1, 1, 1, u8 , u8 , u8 , u8 , wzyx, rgb -PIPE_FORMAT_R8_SNORM , plain, 1, 1, 1, sn8 , , , , x001, rgb -PIPE_FORMAT_R8G8_SNORM , plain, 1, 1, 1, sn8 , sn8 , , , xy01, rgb -PIPE_FORMAT_R8G8B8_SNORM , plain, 1, 1, 1, sn8 , sn8 , sn8 , , xyz1, rgb -PIPE_FORMAT_B8G8R8_SNORM , plain, 1, 1, 1, sn8 , sn8 , sn8 , , zyx1, rgb -PIPE_FORMAT_R8G8B8A8_SNORM , plain, 1, 1, 1, sn8 , sn8 , sn8 , sn8 , xyzw, rgb -PIPE_FORMAT_B8G8R8A8_SNORM , plain, 1, 1, 1, sn8 , sn8 , sn8 , sn8 , zyxw, rgb -PIPE_FORMAT_R8_SSCALED , plain, 1, 1, 1, s8 , , , , x001, rgb -PIPE_FORMAT_R8G8_SSCALED , plain, 1, 1, 1, s8 , s8 , , , xy01, rgb -PIPE_FORMAT_R8G8B8_SSCALED , plain, 1, 1, 1, s8 , s8 , s8 , , xyz1, rgb -PIPE_FORMAT_B8G8R8_SSCALED , plain, 1, 1, 1, s8 , s8 , s8 , , zyx1, rgb -PIPE_FORMAT_R8G8B8A8_SSCALED , plain, 1, 1, 1, s8 , s8 , s8 , s8 , xyzw, rgb -PIPE_FORMAT_B8G8R8A8_SSCALED , plain, 1, 1, 1, s8 , s8 , s8 , s8 , zyxw, rgb -PIPE_FORMAT_A8B8G8R8_SSCALED , plain, 1, 1, 1, s8 , s8 , s8 , s8 , wzyx, rgb - -# GL-specific vertex buffer element formats -# A.k.a. GL_FIXED -PIPE_FORMAT_R32_FIXED , plain, 1, 1, 1, h32 , , , , x001, rgb -PIPE_FORMAT_R32G32_FIXED , plain, 1, 1, 1, h32 , h32 , , , xy01, rgb -PIPE_FORMAT_R32G32B32_FIXED , plain, 1, 1, 1, h32 , h32 , h32 , , xyz1, rgb -PIPE_FORMAT_R32G32B32A32_FIXED , plain, 1, 1, 1, h32 , h32 , h32 , h32 , xyzw, rgb - -# D3D9-specific vertex buffer element formats -# See also: -# - http://msdn.microsoft.com/en-us/library/bb172533.aspx -# A.k.a. D3DDECLTYPE_UDEC3 -PIPE_FORMAT_R10G10B10X2_USCALED , plain, 1, 1, 1, u10 , u10 , u10 , x2 , xyz1, rgb -# A.k.a. D3DDECLTYPE_DEC3N -PIPE_FORMAT_R10G10B10X2_SNORM , plain, 1, 1, 1, sn10, sn10, sn10 , x2 , xyz1, rgb -PIPE_FORMAT_R10G10B10X2_SINT , plain, 1, 1, 1, sp10, sp10, sp10 , x2 , xyz1, rgb - -PIPE_FORMAT_YV12 , planar3, 1, 1, 1, , , , , xyzw, yuv -PIPE_FORMAT_YV16 , planar3, 1, 1, 1, , , , , xyzw, yuv -PIPE_FORMAT_IYUV , planar3, 1, 1, 1, , , , , xyzw, yuv -PIPE_FORMAT_NV12 , planar2, 1, 1, 1, , , , , xyzw, yuv -PIPE_FORMAT_NV21 , planar2, 1, 1, 1, , , , , xyzw, yuv -PIPE_FORMAT_Y8_400_UNORM , other , 1, 1, 1, un8, , , , x001, yuv - -# RGB version of NV12 and YV12 for hardware that supports sampling from -# multiplane textures but needs color-space conversion in the shader. -PIPE_FORMAT_R8_G8B8_420_UNORM , planar2, 1, 1, 1, un8, , , , xyzw, rgb -PIPE_FORMAT_R8_B8G8_420_UNORM , planar2, 1, 1, 1, un8, , , , xyzw, rgb -PIPE_FORMAT_G8_B8R8_420_UNORM , planar2, 1, 1, 1, un8, , , , xyzw, rgb -PIPE_FORMAT_R8_G8_B8_420_UNORM , planar3, 1, 1, 1, un8, , , , xyzw, rgb -PIPE_FORMAT_R8_B8_G8_420_UNORM , planar3, 1, 1, 1, un8, , , , xyzw, rgb -PIPE_FORMAT_G8_B8_R8_420_UNORM , planar3, 1, 1, 1, un8, , , , xyzw, rgb -PIPE_FORMAT_R8_G8_B8_UNORM , planar3, 1, 1, 1, un8, , , , xyzw, rgb - -# While most of Mesa uses R8 for Y, U, and V planes, freedreno requires distinguishing -# between tiled Y8 data and tiled R8 data. -PIPE_FORMAT_Y8_UNORM , other, 1, 1, 1, un8, , , , x001, yuv - -PIPE_FORMAT_Y8_U8_V8_422_UNORM , planar3, 1, 1, 1, , , , , xyzw, yuv -PIPE_FORMAT_Y8_U8V8_422_UNORM , planar2, 1, 1, 1, , , , , xyzw, yuv -PIPE_FORMAT_Y8_U8_V8_444_UNORM , planar3, 1, 1, 1, , , , , xyzw, yuv -PIPE_FORMAT_Y8_U8_V8_440_UNORM , planar3, 1, 1, 1, , , , , xyzw, yuv - -PIPE_FORMAT_Y16_U16_V16_420_UNORM , planar3, 1, 1, 1, , , , , xyzw, yuv -PIPE_FORMAT_Y16_U16_V16_422_UNORM , planar3, 1, 1, 1, , , , , xyzw, yuv -PIPE_FORMAT_Y16_U16V16_422_UNORM , planar2, 1, 1, 1, , , , , xyzw, yuv -PIPE_FORMAT_Y16_U16_V16_444_UNORM , planar3, 1, 1, 1, , , , , xyzw, yuv - -PIPE_FORMAT_P010 , planar2, 1, 1, 1, , , , , xyzw, yuv -PIPE_FORMAT_P012 , planar2, 1, 1, 1, , , , , xyzw, yuv -PIPE_FORMAT_P016 , planar2, 1, 1, 1, , , , , xyzw, yuv -PIPE_FORMAT_P030 , planar2, 1, 1, 1, , , , , xyzw, yuv - -PIPE_FORMAT_Y210 , subsampled, 2, 1, 1, x64 , , , , xyz1, yuv -PIPE_FORMAT_Y212 , subsampled, 2, 1, 1, x64 , , , , xyz1, yuv -PIPE_FORMAT_Y216 , subsampled, 2, 1, 1, x64 , , , , xyz1, yuv - -PIPE_FORMAT_Y410 , other, 1, 1, 1, un10, un10, un10, un2 , yzxw, yuv -PIPE_FORMAT_Y412 , other, 1, 1, 1, un16, un16, un16, un16, yzxw, yuv -PIPE_FORMAT_Y416 , other, 1, 1, 1, un16, un16, un16, un16, yzxw, yuv - -# Usually used to implement IA44 and AI44 formats in video decoding -PIPE_FORMAT_A4R4_UNORM , plain, 1, 1, 1, un4 , un4 , , , y00x, rgb -PIPE_FORMAT_R4A4_UNORM , plain, 1, 1, 1, un4 , un4 , , , x00y, rgb -PIPE_FORMAT_R8A8_UNORM , plain, 1, 1, 1, un8 , un8 , , , x00y, rgb -PIPE_FORMAT_A8R8_UNORM , plain, 1, 1, 1, un8 , un8 , , , y00x, rgb - -# ARB_vertex_type_10_10_10_2_REV -PIPE_FORMAT_R10G10B10A2_USCALED , plain, 1, 1, 1, u10 , u10 , u10 , u2 , xyzw, rgb -PIPE_FORMAT_R10G10B10A2_SSCALED , plain, 1, 1, 1, s10 , s10 , s10 , s2 , xyzw, rgb -PIPE_FORMAT_R10G10B10A2_SNORM , plain, 1, 1, 1, sn10, sn10, sn10, sn2 , xyzw, rgb -PIPE_FORMAT_B10G10R10A2_USCALED , plain, 1, 1, 1, u10 , u10 , u10 , u2 , zyxw, rgb -PIPE_FORMAT_B10G10R10A2_SSCALED , plain, 1, 1, 1, s10 , s10 , s10 , s2 , zyxw, rgb -PIPE_FORMAT_B10G10R10A2_SNORM , plain, 1, 1, 1, sn10, sn10, sn10, sn2 , zyxw, rgb - -PIPE_FORMAT_R8_UINT , plain, 1, 1, 1, up8, , , , x001, rgb -PIPE_FORMAT_R8G8_UINT , plain, 1, 1, 1, up8, up8, , , xy01, rgb -PIPE_FORMAT_R8G8B8_UINT , plain, 1, 1, 1, up8, up8, up8, , xyz1, rgb -PIPE_FORMAT_R8G8B8A8_UINT , plain, 1, 1, 1, up8, up8, up8, up8, xyzw, rgb - -PIPE_FORMAT_R8_SINT , plain, 1, 1, 1, sp8, , , , x001, rgb -PIPE_FORMAT_R8G8_SINT , plain, 1, 1, 1, sp8, sp8, , , xy01, rgb -PIPE_FORMAT_R8G8B8_SINT , plain, 1, 1, 1, sp8, sp8, sp8, , xyz1, rgb -PIPE_FORMAT_R8G8B8A8_SINT , plain, 1, 1, 1, sp8, sp8, sp8, sp8, xyzw, rgb - -PIPE_FORMAT_R16_UINT , plain, 1, 1, 1, up16, , , , x001, rgb -PIPE_FORMAT_R16G16_UINT , plain, 1, 1, 1, up16, up16, , , xy01, rgb -PIPE_FORMAT_R16G16B16_UINT , plain, 1, 1, 1, up16, up16, up16, , xyz1, rgb -PIPE_FORMAT_R16G16B16A16_UINT , plain, 1, 1, 1, up16, up16, up16, up16, xyzw, rgb - -PIPE_FORMAT_R16_SINT , plain, 1, 1, 1, sp16, , , , x001, rgb -PIPE_FORMAT_R16G16_SINT , plain, 1, 1, 1, sp16, sp16, , , xy01, rgb -PIPE_FORMAT_R16G16B16_SINT , plain, 1, 1, 1, sp16, sp16, sp16, , xyz1, rgb -PIPE_FORMAT_R16G16B16A16_SINT , plain, 1, 1, 1, sp16, sp16, sp16, sp16, xyzw, rgb - -PIPE_FORMAT_R32_UINT , plain, 1, 1, 1, up32, , , , x001, rgb -PIPE_FORMAT_R32G32_UINT , plain, 1, 1, 1, up32, up32, , , xy01, rgb -PIPE_FORMAT_R32G32B32_UINT , plain, 1, 1, 1, up32, up32, up32, , xyz1, rgb -PIPE_FORMAT_R32G32B32A32_UINT , plain, 1, 1, 1, up32, up32, up32, up32, xyzw, rgb - -PIPE_FORMAT_R32_SINT , plain, 1, 1, 1, sp32, , , , x001, rgb -PIPE_FORMAT_R32G32_SINT , plain, 1, 1, 1, sp32, sp32, , , xy01, rgb -PIPE_FORMAT_R32G32B32_SINT , plain, 1, 1, 1, sp32, sp32, sp32, , xyz1, rgb -PIPE_FORMAT_R32G32B32A32_SINT , plain, 1, 1, 1, sp32, sp32, sp32, sp32, xyzw, rgb - -PIPE_FORMAT_R64_UINT , plain, 1, 1, 1, up64, , , , x001, rgb -PIPE_FORMAT_R64G64_UINT , plain, 1, 1, 1, up64, up64, , , xy01, rgb -PIPE_FORMAT_R64G64B64_UINT , plain, 1, 1, 1, up64, up64, up64, , xyz1, rgb -PIPE_FORMAT_R64G64B64A64_UINT , plain, 1, 1, 1, up64, up64, up64, up64, xyzw, rgb - -PIPE_FORMAT_R64_SINT , plain, 1, 1, 1, sp64, , , , x001, rgb -PIPE_FORMAT_R64G64_SINT , plain, 1, 1, 1, sp64, sp64, , , xy01, rgb -PIPE_FORMAT_R64G64B64_SINT , plain, 1, 1, 1, sp64, sp64, sp64, , xyz1, rgb -PIPE_FORMAT_R64G64B64A64_SINT , plain, 1, 1, 1, sp64, sp64, sp64, sp64, xyzw, rgb - -PIPE_FORMAT_A8_UINT , plain, 1, 1, 1, up8, , , , 000x, rgb -PIPE_FORMAT_I8_UINT , plain, 1, 1, 1, up8, , , , xxxx, rgb -PIPE_FORMAT_L8_UINT , plain, 1, 1, 1, up8, , , , xxx1, rgb -PIPE_FORMAT_L8A8_UINT , plain, 1, 1, 1, up8, up8, , , xxxy, rgb - -PIPE_FORMAT_A8_SINT , plain, 1, 1, 1, sp8, , , , 000x, rgb -PIPE_FORMAT_I8_SINT , plain, 1, 1, 1, sp8, , , , xxxx, rgb -PIPE_FORMAT_L8_SINT , plain, 1, 1, 1, sp8, , , , xxx1, rgb -PIPE_FORMAT_L8A8_SINT , plain, 1, 1, 1, sp8, sp8, , , xxxy, rgb - -PIPE_FORMAT_A16_UINT , plain, 1, 1, 1, up16, , , , 000x, rgb -PIPE_FORMAT_I16_UINT , plain, 1, 1, 1, up16, , , , xxxx, rgb -PIPE_FORMAT_L16_UINT , plain, 1, 1, 1, up16, , , , xxx1, rgb -PIPE_FORMAT_L16A16_UINT , plain, 1, 1, 1, up16, up16, , , xxxy, rgb - -PIPE_FORMAT_A16_SINT , plain, 1, 1, 1, sp16, , , , 000x, rgb -PIPE_FORMAT_I16_SINT , plain, 1, 1, 1, sp16, , , , xxxx, rgb -PIPE_FORMAT_L16_SINT , plain, 1, 1, 1, sp16, , , , xxx1, rgb -PIPE_FORMAT_L16A16_SINT , plain, 1, 1, 1, sp16, sp16, , , xxxy, rgb - -PIPE_FORMAT_A32_UINT , plain, 1, 1, 1, up32, , , , 000x, rgb -PIPE_FORMAT_I32_UINT , plain, 1, 1, 1, up32, , , , xxxx, rgb -PIPE_FORMAT_L32_UINT , plain, 1, 1, 1, up32, , , , xxx1, rgb -PIPE_FORMAT_L32A32_UINT , plain, 1, 1, 1, up32, up32, , , xxxy, rgb - -PIPE_FORMAT_A32_SINT , plain, 1, 1, 1, sp32, , , , 000x, rgb -PIPE_FORMAT_I32_SINT , plain, 1, 1, 1, sp32, , , , xxxx, rgb -PIPE_FORMAT_L32_SINT , plain, 1, 1, 1, sp32, , , , xxx1, rgb -PIPE_FORMAT_L32A32_SINT , plain, 1, 1, 1, sp32, sp32, , , xxxy, rgb - -PIPE_FORMAT_B8G8R8_UINT , plain, 1, 1, 1, up8 , up8 , up8 , , zyx1, rgb -PIPE_FORMAT_B8G8R8A8_UINT , plain, 1, 1, 1, up8 , up8 , up8 , up8 , zyxw, rgb - -PIPE_FORMAT_B8G8R8_SINT , plain, 1, 1, 1, sp8 , sp8 , sp8 , , zyx1, rgb -PIPE_FORMAT_B8G8R8A8_SINT , plain, 1, 1, 1, sp8 , sp8 , sp8 , sp8 , zyxw, rgb - -PIPE_FORMAT_A8R8G8B8_UINT , plain, 1, 1, 1, up8 , up8 , up8 , up8 , yzwx, rgb -PIPE_FORMAT_A8B8G8R8_UINT , plain, 1, 1, 1, up8 , up8 , up8 , up8 , wzyx, rgb -PIPE_FORMAT_A2R10G10B10_UINT , plain, 1, 1, 1, up2 , up10, up10, up10, yzwx, rgb -PIPE_FORMAT_A2B10G10R10_UINT , plain, 1, 1, 1, up2 , up10, up10, up10, wzyx, rgb -PIPE_FORMAT_B10G10R10A2_UINT , plain, 1, 1, 1, up10, up10, up10, up2, zyxw, rgb -PIPE_FORMAT_B10G10R10A2_SINT , plain, 1, 1, 1, sp10, sp10, sp10, sp2, zyxw, rgb -PIPE_FORMAT_R5G6B5_UINT , plain, 1, 1, 1, up5 , up6 , up5 , , xyz1, rgb -PIPE_FORMAT_B5G6R5_UINT , plain, 1, 1, 1, up5 , up6 , up5 , , zyx1, rgb -PIPE_FORMAT_R3G3B2_UINT , plain, 1, 1, 1, up3 , up3 , up2 , , xyz1, rgb -PIPE_FORMAT_B2G3R3_UINT , plain, 1, 1, 1, up2 , up3 , up3 , , zyx1, rgb -PIPE_FORMAT_R4G4B4A4_UINT , plain, 1, 1, 1, up4 , up4 , up4 , up4 , xyzw, rgb -PIPE_FORMAT_B4G4R4A4_UINT , plain, 1, 1, 1, up4 , up4 , up4 , up4 , zyxw, rgb -PIPE_FORMAT_A4R4G4B4_UINT , plain, 1, 1, 1, up4 , up4 , up4 , up4 , yzwx, rgb -PIPE_FORMAT_A4B4G4R4_UINT , plain, 1, 1, 1, up4 , up4 , up4 , up4 , wzyx, rgb -PIPE_FORMAT_A1R5G5B5_UINT , plain, 1, 1, 1, up1 , up5 , up5 , up5 , yzwx, rgb -PIPE_FORMAT_A1B5G5R5_UINT , plain, 1, 1, 1, up1 , up5 , up5 , up5 , wzyx, rgb -PIPE_FORMAT_R5G5B5A1_UINT , plain, 1, 1, 1, up5 , up5 , up5 , up1 , xyzw, rgb -PIPE_FORMAT_B5G5R5A1_UINT , plain, 1, 1, 1, up5 , up5 , up5 , up1 , zyxw, rgb - -PIPE_FORMAT_R8G8B8X8_SNORM , plain, 1, 1, 1, sn8, sn8, sn8, x8, xyz1, rgb -PIPE_FORMAT_R8G8B8X8_SRGB , plain, 1, 1, 1, un8, un8, un8, x8, xyz1, srgb -PIPE_FORMAT_R8G8B8X8_UINT , plain, 1, 1, 1, up8, up8, up8, x8, xyz1, rgb -PIPE_FORMAT_R8G8B8X8_SINT , plain, 1, 1, 1, sp8, sp8, sp8, x8, xyz1, rgb -PIPE_FORMAT_B10G10R10X2_UNORM , plain, 1, 1, 1, un10, un10, un10, x2, zyx1, rgb -PIPE_FORMAT_B10G10R10X2_SNORM , plain, 1, 1, 1, sn10, sn10, sn10, x2, zyx1, rgb -PIPE_FORMAT_B10G10R10X2_SINT , plain, 1, 1, 1, sp10, sp10, sp10, x2, zyx1, rgb -PIPE_FORMAT_R16G16B16X16_UNORM , plain, 1, 1, 1, un16, un16, un16, x16, xyz1, rgb -PIPE_FORMAT_R16G16B16X16_SNORM , plain, 1, 1, 1, sn16, sn16, sn16, x16, xyz1, rgb -PIPE_FORMAT_R16G16B16X16_FLOAT , plain, 1, 1, 1, f16, f16, f16, x16, xyz1, rgb -PIPE_FORMAT_R16G16B16X16_UINT , plain, 1, 1, 1, up16, up16, up16, x16, xyz1, rgb -PIPE_FORMAT_R16G16B16X16_SINT , plain, 1, 1, 1, sp16, sp16, sp16, x16, xyz1, rgb -PIPE_FORMAT_R32G32B32X32_FLOAT , plain, 1, 1, 1, f32, f32, f32, x32, xyz1, rgb -PIPE_FORMAT_R32G32B32X32_UINT , plain, 1, 1, 1, up32, up32, up32, x32, xyz1, rgb -PIPE_FORMAT_R32G32B32X32_SINT , plain, 1, 1, 1, sp32, sp32, sp32, x32, xyz1, rgb - -PIPE_FORMAT_R8A8_SNORM , plain, 1, 1, 1, sn8 , sn8 , , , x00y, rgb -PIPE_FORMAT_R16A16_UNORM , plain, 1, 1, 1, un16 , un16 , , , x00y, rgb -PIPE_FORMAT_R16A16_SNORM , plain, 1, 1, 1, sn16 , sn16 , , , x00y, rgb -PIPE_FORMAT_R16A16_FLOAT , plain, 1, 1, 1, f16 , f16 , , , x00y, rgb -PIPE_FORMAT_R32A32_FLOAT , plain, 1, 1, 1, f32 , f32 , , , x00y, rgb -PIPE_FORMAT_R8A8_UINT , plain, 1, 1, 1, up8 , up8 , , , x00y, rgb -PIPE_FORMAT_R8A8_SINT , plain, 1, 1, 1, sp8 , sp8 , , , x00y, rgb -PIPE_FORMAT_R16A16_UINT , plain, 1, 1, 1, up16 , up16 , , , x00y, rgb -PIPE_FORMAT_R16A16_SINT , plain, 1, 1, 1, sp16 , sp16 , , , x00y, rgb -PIPE_FORMAT_R32A32_UINT , plain, 1, 1, 1, up32 , up32 , , , x00y, rgb -PIPE_FORMAT_R32A32_SINT , plain, 1, 1, 1, sp32 , sp32 , , , x00y, rgb -PIPE_FORMAT_R10G10B10A2_UINT , plain, 1, 1, 1, up10 , up10 , up10, up2 , xyzw, rgb -PIPE_FORMAT_R10G10B10A2_SINT , plain, 1, 1, 1, sp10 , sp10 , sp10, sp2 , xyzw, rgb - -PIPE_FORMAT_B5G6R5_SRGB , plain, 1, 1, 1, un5 , un6 , un5 , , zyx1, srgb -PIPE_FORMAT_R5G6B5_SRGB , plain, 1, 1, 1, un5 , un6 , un5 , , xyz1, srgb - -PIPE_FORMAT_G8R8_UNORM , plain, 1, 1, 1, un8 , un8 , , , yx01, rgb -PIPE_FORMAT_G8R8_SNORM , plain, 1, 1, 1, sn8 , sn8 , , , yx01, rgb -PIPE_FORMAT_G8R8_SINT , plain, 1, 1, 1, sp8 , sp8 , , , yx01, rgb -PIPE_FORMAT_G16R16_UNORM , plain, 1, 1, 1, un16, un16, , , yx01, rgb -PIPE_FORMAT_G16R16_SNORM , plain, 1, 1, 1, sn16, sn16, , , yx01, rgb -PIPE_FORMAT_G16R16_SINT , plain, 1, 1, 1, sp16, sp16, , , yx01, rgb - -PIPE_FORMAT_A8B8G8R8_SNORM , plain, 1, 1, 1, sn8 , sn8 , sn8 , sn8 , wzyx, rgb -PIPE_FORMAT_A8B8G8R8_SINT , plain, 1, 1, 1, sp8 , sp8 , sp8 , sp8 , wzyx, rgb -PIPE_FORMAT_X8B8G8R8_SNORM , plain, 1, 1, 1, x8, sn8, sn8, sn8, wzy1, rgb -PIPE_FORMAT_X8B8G8R8_SINT , plain, 1, 1, 1, x8, sp8, sp8, sp8, wzy1, rgb diff --git a/src/util/format/u_format.yaml b/src/util/format/u_format.yaml new file mode 100644 index 00000000000..7bd94398afe --- /dev/null +++ b/src/util/format/u_format.yaml @@ -0,0 +1,2786 @@ +# This document describes Mesa's supported pipe_formats as a YAML document, +# with one list entry per format. +# +# When adding new format entries, enum pipe_format in +# src/util/format/u_formats.h must be updated along with it. +# +# Each format entry contains: +# - name, per enum pipe_format +# - layout, per enum util_format_layout, in shortened lower caps +# - pixel block's width +# - pixel block's height +# - pixel block's depth, in number of pixels +# - channel encoding (only meaningful for plain layout), containing for each +# channel the following information: +# - type, one of +# - 'x': void +# - 'u': unsigned +# - 's': signed +# - 'h': fixed +# - 'f': FLOAT +# - optionally followed by 'n' if it is normalized +# - optionally followed by 'p' if it is pure +# - number of bits +# - channel swizzle +# - color space: rgb, srgb, yuv, zs +# +# The channel encoding and swizzle may be defined separately for little-endian +# and big-endian hosts when using a packed (non-array/bitmask) format. +# +# See also: +# - http://msdn.microsoft.com/en-us/library/bb172558.aspx (D3D9) +# - http://msdn.microsoft.com/en-us/library/bb205073.aspx#mapping_texture_formats (D3D9 -> D3D10) +# - http://msdn.microsoft.com/en-us/library/bb173059.aspx (D3D10) +# +# Note that GL doesn't really specify the layout of internal formats. See +# OpenGL 2.1 specification, Table 3.16, on the "Correspondence of sized +# internal formats to base in- ternal formats, and desired component +# resolutions for each sized internal format." + +# None +# Described as regular uint_8 bytes, i.e. PIPE_FORMAT_R8_USCALED +- name: NONE + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U8] + swizzles: [X, 0, 0, 1] + + +# Typical rendertarget formats +- name: B8G8R8A8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [Z, Y, X, W] +- name: B8G8R8X8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8, X8] + swizzles: [Z, Y, X, 1] +- name: B8G8R8X8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8, SN8, SN8, X8] + swizzles: [Z, Y, X, 1] +- name: B8G8R8X8_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP8, UP8, UP8, X8] + swizzles: [Z, Y, X, 1] +- name: B8G8R8X8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8, SP8, SP8, X8] + swizzles: [Z, Y, X, 1] +- name: A8R8G8B8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [Y, Z, W, X] +- name: A8R8G8B8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8, SN8, SN8, SN8] + swizzles: [Y, Z, W, X] +- name: A8R8G8B8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8, SP8, SP8, SP8] + swizzles: [Y, Z, W, X] +- name: X8R8G8B8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [X8, UN8, UN8, UN8] + swizzles: [Y, Z, W, 1] +- name: X8R8G8B8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [X8, SN8, SN8, SN8] + swizzles: [Y, Z, W, 1] +- name: X8R8G8B8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [X8, SP8, SP8, SP8] + swizzles: [Y, Z, W, 1] +- name: A8B8G8R8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [W, Z, Y, X] +- name: X8B8G8R8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [X8, UN8, UN8, UN8] + swizzles: [W, Z, Y, 1] +# PIPE_FORMAT_R8G8B8A8_UNORM is below +- name: R8G8B8X8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8, X8] + swizzles: [X, Y, Z, 1] +- name: R5G5B5A1_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN5, UN5, UN5, UN1] + swizzles: [X, Y, Z, W] +- name: R5G5B5X1_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN5, UN5, UN5, X1] + swizzles: [X, Y, Z, 1] +- name: B5G5R5X1_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN5, UN5, UN5, X1] + swizzles: [Z, Y, X, 1] +- name: B5G5R5A1_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN5, UN5, UN5, UN1] + swizzles: [Z, Y, X, W] +- name: X1B5G5R5_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [X1, UN5, UN5, UN5] + swizzles: [W, Z, Y, 1] +- name: A1R5G5B5_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN1, UN5, UN5, UN5] + swizzles: [Y, Z, W, X] +- name: X1R5G5B5_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [X1, UN5, UN5, UN5] + swizzles: [Y, Z, W, 1] +- name: A1B5G5R5_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN1, UN5, UN5, UN5] + swizzles: [W, Z, Y, X] +- name: R4G4B4A4_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN4, UN4, UN4, UN4] + swizzles: [X, Y, Z, W] +- name: R4G4B4X4_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN4, UN4, UN4, X4] + swizzles: [X, Y, Z, 1] +- name: B4G4R4A4_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN4, UN4, UN4, UN4] + swizzles: [Z, Y, X, W] +- name: B4G4R4X4_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN4, UN4, UN4, X4] + swizzles: [Z, Y, X, 1] +- name: A4R4G4B4_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN4, UN4, UN4, UN4] + swizzles: [Y, Z, W, X] +- name: A4B4G4R4_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN4, UN4, UN4, UN4] + swizzles: [W, Z, Y, X] +- name: R5G6B5_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN5, UN6, UN5] + swizzles: [X, Y, Z, 1] +- name: B5G6R5_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN5, UN6, UN5] + swizzles: [Z, Y, X, 1] +- name: R10G10B10A2_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN10, UN10, UN10, UN2] + swizzles: [X, Y, Z, W] +- name: R10G10B10X2_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN10, UN10, UN10, X2] + swizzles: [X, Y, Z, 1] +- name: B10G10R10A2_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN10, UN10, UN10, UN2] + swizzles: [Z, Y, X, W] +- name: A2R10G10B10_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN2, UN10, UN10, UN10] + swizzles: [Y, Z, W, X] +- name: A2B10G10R10_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN2, UN10, UN10, UN10] + swizzles: [W, Z, Y, X] +- name: R3G3B2_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN3, UN3, UN2] + swizzles: [X, Y, Z, 1] +- name: B2G3R3_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN2, UN3, UN3] + swizzles: [Z, Y, X, 1] + + +# Luminance/Intensity/Alpha formats +- name: L8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8] + swizzles: [X, X, X, 1] +- name: A8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8] + swizzles: [0, 0, 0, X] +- name: I8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8] + swizzles: [X, X, X, X] +- name: L4A4_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN4, UN4] + swizzles: [X, X, X, Y] +- name: L8A8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8] + swizzles: [X, X, X, Y] +- name: L16_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN16] + swizzles: [X, X, X, 1] +- name: A16_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN16] + swizzles: [0, 0, 0, X] +- name: I16_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN16] + swizzles: [X, X, X, X] +- name: L16A16_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN16, UN16] + swizzles: [X, X, X, Y] +- name: A8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8] + swizzles: [0, 0, 0, X] +- name: L8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8] + swizzles: [X, X, X, 1] +- name: L8A8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8, SN8] + swizzles: [X, X, X, Y] +- name: I8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8] + swizzles: [X, X, X, X] +- name: A16_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN16] + swizzles: [0, 0, 0, X] +- name: L16_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN16] + swizzles: [X, X, X, 1] +- name: L16A16_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN16, SN16] + swizzles: [X, X, X, Y] +- name: I16_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN16] + swizzles: [X, X, X, X] +- name: A16_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F16] + swizzles: [0, 0, 0, X] +- name: L16_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F16] + swizzles: [X, X, X, 1] +- name: L16A16_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F16, F16] + swizzles: [X, X, X, Y] +- name: I16_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F16] + swizzles: [X, X, X, X] +- name: A32_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F32] + swizzles: [0, 0, 0, X] +- name: L32_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F32] + swizzles: [X, X, X, 1] +- name: L32A32_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F32, F32] + swizzles: [X, X, X, Y] +- name: I32_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F32] + swizzles: [X, X, X, X] + + +# SRGB formats +- name: L8_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8] + swizzles: [X, X, X, 1] +- name: R8_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8] + swizzles: [X, 0, 0, 1] +- name: L8A8_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8] + swizzles: [X, X, X, Y] +- name: R8G8_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8] + swizzles: [X, Y, 0, 1] +- name: R8G8B8_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8] + swizzles: [X, Y, Z, 1] +- name: B8G8R8_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8] + swizzles: [Z, Y, X, 1] +- name: R8G8B8A8_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [X, Y, Z, W] +- name: A8B8G8R8_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [W, Z, Y, X] +- name: X8B8G8R8_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [X8, UN8, UN8, UN8] + swizzles: [W, Z, Y, 1] +- name: B8G8R8A8_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [Z, Y, X, W] +- name: B8G8R8X8_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8, X8] + swizzles: [Z, Y, X, 1] +- name: A8R8G8B8_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [Y, Z, W, X] +- name: X8R8G8B8_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [X8, UN8, UN8, UN8] + swizzles: [Y, Z, W, 1] + + +# Mixed-sign formats (typically used for bump map textures) +- name: R8SG8SB8UX8U_NORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8, SN8, UN8, X8] + swizzles: [X, Y, Z, 1] +- name: R10SG10SB10SA2U_NORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN10, SN10, SN10, UN2] + swizzles: [X, Y, Z, W] +- name: R5SG5SB6U_NORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN5, SN5, UN6] + swizzles: [X, Y, Z, 1] + + +# Depth-stencil formats +- name: S8_UINT + layout: plain + colorspace: ZS + block: {width: 1, height: 1, depth: 1} + channels: [UP8] + swizzles: [_, X, _, _] +- name: Z16_UNORM + layout: plain + colorspace: ZS + block: {width: 1, height: 1, depth: 1} + channels: [UN16] + swizzles: [X, _, _, _] +- name: Z16_UNORM_S8_UINT + layout: plain + colorspace: ZS + block: {width: 1, height: 1, depth: 1} + channels: [UN16, UP8] + swizzles: [X, Y, _, _] +- name: Z32_UNORM + layout: plain + colorspace: ZS + block: {width: 1, height: 1, depth: 1} + channels: [UN32] + swizzles: [X, _, _, _] +- name: Z32_FLOAT + layout: plain + colorspace: ZS + block: {width: 1, height: 1, depth: 1} + channels: [F32] + swizzles: [X, _, _, _] +- name: Z24_UNORM_S8_UINT + layout: plain + colorspace: ZS + block: {width: 1, height: 1, depth: 1} + channels: [UN24, UP8] + swizzles: [X, Y, _, _] +- name: S8_UINT_Z24_UNORM + layout: plain + colorspace: ZS + block: {width: 1, height: 1, depth: 1} + channels: [UP8, UN24] + swizzles: [Y, X, _, _] +- name: X24S8_UINT + layout: plain + colorspace: ZS + block: {width: 1, height: 1, depth: 1} + channels: [X24, UP8] + swizzles: [_, Y, _, _] +- name: S8X24_UINT + layout: plain + colorspace: ZS + block: {width: 1, height: 1, depth: 1} + channels: [UP8, X24] + swizzles: [_, X, _, _] +- name: Z24X8_UNORM + layout: plain + colorspace: ZS + block: {width: 1, height: 1, depth: 1} + channels: [UN24, X8] + swizzles: [X, _, _, _] +- name: X8Z24_UNORM + layout: plain + colorspace: ZS + block: {width: 1, height: 1, depth: 1} + channels: [X8, UN24] + swizzles: [Y, _, _, _] +- name: Z32_FLOAT_S8X24_UINT + layout: plain + colorspace: ZS + block: {width: 1, height: 1, depth: 1} + little_endian: + channels: [F32, UP8, X24] + swizzles: [X, Y, _, _] + big_endian: + channels: [F32, X24, UP8] + swizzles: [X, Z, _, _] +- name: X32_S8X24_UINT + layout: plain + colorspace: ZS + block: {width: 1, height: 1, depth: 1} + little_endian: + channels: [X32, UP8, X24] + swizzles: [_, Y, _, _] + big_endian: + channels: [X32, X24, UP8] + swizzles: [_, Z, _, _] + +# Depth-stencil formats equivalent to blitting PIPE_FORMAT_Z24_UNORM_S8_UINT +# as PIPE_FORMAT_R8G8B8A8_*, in that it is an equivalent size to the z/s +# format. This is mainly for hw that has some sort of bandwidth compressed +# format where the compression for z24s8 is not equivalent to r8g8b8a8, +# and therefore some special handling is required for blits. +- name: Z24_UNORM_S8_UINT_AS_R8G8B8A8 + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [X, Y, Z, W] + + +# YUV formats +# http://www.fourcc.org/yuv.php#UYVY +- name: UYVY + layout: subsampled + colorspace: YUV + block: {width: 2, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [X, Y, Z, 1] +- name: VYUY + layout: subsampled + colorspace: YUV + block: {width: 2, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [X, Y, Z, 1] +# http://www.fourcc.org/yuv.php#YUYV (a.k.a http://www.fourcc.org/yuv.php#YUY2) +- name: YUYV + layout: subsampled + colorspace: YUV + block: {width: 2, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [X, Y, Z, 1] +- name: YVYU + layout: subsampled + colorspace: YUV + block: {width: 2, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [X, Y, Z, 1] + +- name: AYUV + layout: other + colorspace: YUV + block: {width: 4, height: 4, depth: 1} + channels: [UN8] + swizzles: [X, Y, Z, W] +- name: XYUV + layout: other + colorspace: YUV + block: {width: 4, height: 4, depth: 1} + channels: [UN8] + swizzles: [X, Y, Z, 1] + +# same subsampling but with rgb channels +- name: R8G8_B8G8_UNORM + layout: subsampled + colorspace: RGB + block: {width: 2, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [X, Y, Z, 1] +- name: G8R8_G8B8_UNORM + layout: subsampled + colorspace: RGB + block: {width: 2, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [X, Y, Z, 1] +- name: G8R8_B8R8_UNORM + layout: subsampled + colorspace: RGB + block: {width: 2, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [Z, Y, X, 1] +- name: R8G8_R8B8_UNORM + layout: subsampled + colorspace: RGB + block: {width: 2, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [Z, Y, X, 1] +- name: B8R8_G8R8_UNORM + layout: subsampled + colorspace: RGB + block: {width: 2, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [Y, X, Z, 1] +- name: R8B8_R8G8_UNORM + layout: subsampled + colorspace: RGB + block: {width: 2, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [Y, X, Z, 1] +- name: G8B8_G8R8_UNORM + layout: subsampled + colorspace: RGB + block: {width: 2, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [X, Y, Z, 1] +- name: B8G8_R8G8_UNORM + layout: subsampled + colorspace: RGB + block: {width: 2, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [X, Y, Z, 1] + + +# some special formats not fitting anywhere else +- name: R11G11B10_FLOAT + layout: other + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F11, F11, F10] + swizzles: [X, Y, Z, 1] +- name: R9G9B9E5_FLOAT + layout: other + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F9, F9, F9, X5] + swizzles: [X, Y, Z, 1] +- name: R1_UNORM + layout: other + colorspace: RGB + block: {width: 8, height: 1, depth: 1} + channels: [X8] + swizzles: [X, 0, 0, 1] +# A.k.a. D3DFMT_CxV8U8 +- name: R8G8Bx_SNORM + layout: other + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8, SN8] + swizzles: [X, Y, Z, 1] + + +# Compressed formats +# - http://en.wikipedia.org/wiki/S3_Texture_Compression +# - http://www.opengl.org/registry/specs/EXT/texture_compression_s3tc.txt +# - http://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt +# - http://www.opengl.org/registry/specs/EXT/texture_compression_latc.txt +# - http://www.opengl.org/registry/specs/ARB/texture_compression_bptc.txt +# - http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt +# - http://msdn.microsoft.com/en-us/library/bb694531.aspx +- name: DXT1_RGB + layout: s3tc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, Y, Z, 1] +- name: DXT1_RGBA + layout: s3tc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, Y, Z, W] +- name: DXT3_RGBA + layout: s3tc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: DXT5_RGBA + layout: s3tc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: DXT1_SRGB + layout: s3tc + colorspace: SRGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, Y, Z, 1] +- name: DXT1_SRGBA + layout: s3tc + colorspace: SRGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, Y, Z, W] +- name: DXT3_SRGBA + layout: s3tc + colorspace: SRGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: DXT5_SRGBA + layout: s3tc + colorspace: SRGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] + + +# FXT1 compressed formats +- name: FXT1_RGB + layout: fxt1 + colorspace: RGB + block: {width: 8, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, 1] +- name: FXT1_RGBA + layout: fxt1 + colorspace: RGB + block: {width: 8, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] + + +- name: RGTC1_UNORM + layout: rgtc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, 0, 0, 1] +- name: RGTC1_SNORM + layout: rgtc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, 0, 0, 1] +- name: RGTC2_UNORM + layout: rgtc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, 0, 1] +- name: RGTC2_SNORM + layout: rgtc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, 0, 1] + + +- name: LATC1_UNORM + layout: rgtc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, X, X, 1] +- name: LATC1_SNORM + layout: rgtc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, X, X, 1] +- name: LATC2_UNORM + layout: rgtc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, X, X, Y] +- name: LATC2_SNORM + layout: rgtc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, X, X, Y] + + +- name: ETC1_RGB8 + layout: etc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, Y, Z, 1] + +- name: ETC2_RGB8 + layout: etc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, Y, Z, 1] +- name: ETC2_SRGB8 + layout: etc + colorspace: SRGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, Y, Z, 1] +- name: ETC2_RGB8A1 + layout: etc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, Y, Z, W] +- name: ETC2_SRGB8A1 + layout: etc + colorspace: SRGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, Y, Z, W] +- name: ETC2_RGBA8 + layout: etc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ETC2_SRGBA8 + layout: etc + colorspace: SRGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ETC2_R11_UNORM + layout: etc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, 0, 0, 1] +- name: ETC2_R11_SNORM + layout: etc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, 0, 0, 1] +- name: ETC2_RG11_UNORM + layout: etc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, 0, 1] +- name: ETC2_RG11_SNORM + layout: etc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, 0, 1] + + +- name: BPTC_RGBA_UNORM + layout: bptc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: BPTC_SRGBA + layout: bptc + colorspace: SRGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: BPTC_RGB_FLOAT + layout: bptc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, 1] +- name: BPTC_RGB_UFLOAT + layout: bptc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, 1] + + +- name: ASTC_4x4 + layout: astc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_5x4 + layout: astc + colorspace: RGB + block: {width: 5, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_5x5 + layout: astc + colorspace: RGB + block: {width: 5, height: 5, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_6x5 + layout: astc + colorspace: RGB + block: {width: 6, height: 5, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_6x6 + layout: astc + colorspace: RGB + block: {width: 6, height: 6, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_8x5 + layout: astc + colorspace: RGB + block: {width: 8, height: 5, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_8x6 + layout: astc + colorspace: RGB + block: {width: 8, height: 6, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_8x8 + layout: astc + colorspace: RGB + block: {width: 8, height: 8, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_10x5 + layout: astc + colorspace: RGB + block: {width: 10, height: 5, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_10x6 + layout: astc + colorspace: RGB + block: {width: 10, height: 6, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_10x8 + layout: astc + colorspace: RGB + block: {width: 10, height: 8, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_10x10 + layout: astc + colorspace: RGB + block: {width: 10, height: 10, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_12x10 + layout: astc + colorspace: RGB + block: {width: 12, height: 10, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_12x12 + layout: astc + colorspace: RGB + block: {width: 12, height: 12, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] + + +- name: ASTC_4x4_SRGB + layout: astc + colorspace: SRGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_5x4_SRGB + layout: astc + colorspace: SRGB + block: {width: 5, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_5x5_SRGB + layout: astc + colorspace: SRGB + block: {width: 5, height: 5, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_6x5_SRGB + layout: astc + colorspace: SRGB + block: {width: 6, height: 5, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_6x6_SRGB + layout: astc + colorspace: SRGB + block: {width: 6, height: 6, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_8x5_SRGB + layout: astc + colorspace: SRGB + block: {width: 8, height: 5, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_8x6_SRGB + layout: astc + colorspace: SRGB + block: {width: 8, height: 6, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_8x8_SRGB + layout: astc + colorspace: SRGB + block: {width: 8, height: 8, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_10x5_SRGB + layout: astc + colorspace: SRGB + block: {width: 10, height: 5, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_10x6_SRGB + layout: astc + colorspace: SRGB + block: {width: 10, height: 6, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_10x8_SRGB + layout: astc + colorspace: SRGB + block: {width: 10, height: 8, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_10x10_SRGB + layout: astc + colorspace: SRGB + block: {width: 10, height: 10, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_12x10_SRGB + layout: astc + colorspace: SRGB + block: {width: 12, height: 10, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_12x12_SRGB + layout: astc + colorspace: SRGB + block: {width: 12, height: 12, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] + + +- name: ASTC_3x3x3 + layout: astc + colorspace: RGB + block: {width: 3, height: 3, depth: 3} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_4x3x3 + layout: astc + colorspace: RGB + block: {width: 4, height: 3, depth: 3} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_4x4x3 + layout: astc + colorspace: RGB + block: {width: 4, height: 4, depth: 3} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_4x4x4 + layout: astc + colorspace: RGB + block: {width: 4, height: 4, depth: 4} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_5x4x4 + layout: astc + colorspace: RGB + block: {width: 5, height: 4, depth: 4} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_5x5x4 + layout: astc + colorspace: RGB + block: {width: 5, height: 5, depth: 4} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_5x5x5 + layout: astc + colorspace: RGB + block: {width: 5, height: 5, depth: 5} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_6x5x5 + layout: astc + colorspace: RGB + block: {width: 6, height: 5, depth: 5} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_6x6x5 + layout: astc + colorspace: RGB + block: {width: 6, height: 6, depth: 5} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_6x6x6 + layout: astc + colorspace: RGB + block: {width: 6, height: 6, depth: 6} + channels: [X128] + swizzles: [X, Y, Z, W] + +- name: ASTC_3x3x3_SRGB + layout: astc + colorspace: SRGB + block: {width: 3, height: 3, depth: 3} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_4x3x3_SRGB + layout: astc + colorspace: SRGB + block: {width: 4, height: 3, depth: 3} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_4x4x3_SRGB + layout: astc + colorspace: SRGB + block: {width: 4, height: 4, depth: 3} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_4x4x4_SRGB + layout: astc + colorspace: SRGB + block: {width: 4, height: 4, depth: 4} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_5x4x4_SRGB + layout: astc + colorspace: SRGB + block: {width: 5, height: 4, depth: 4} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_5x5x4_SRGB + layout: astc + colorspace: SRGB + block: {width: 5, height: 5, depth: 4} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_5x5x5_SRGB + layout: astc + colorspace: SRGB + block: {width: 5, height: 5, depth: 5} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_6x5x5_SRGB + layout: astc + colorspace: SRGB + block: {width: 6, height: 5, depth: 5} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_6x6x5_SRGB + layout: astc + colorspace: SRGB + block: {width: 6, height: 6, depth: 5} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ASTC_6x6x6_SRGB + layout: astc + colorspace: SRGB + block: {width: 6, height: 6, depth: 6} + channels: [X128] + swizzles: [X, Y, Z, W] + + +- name: ATC_RGB + layout: atc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X64] + swizzles: [X, Y, Z, 1] +- name: ATC_RGBA_EXPLICIT + layout: atc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] +- name: ATC_RGBA_INTERPOLATED + layout: atc + colorspace: RGB + block: {width: 4, height: 4, depth: 1} + channels: [X128] + swizzles: [X, Y, Z, W] + + +# Straightforward D3D10-like formats (also used for +# vertex buffer element description) +# +# See also: +# - src/gallium/auxiliary/translate/translate_generic.c +# - src/mesa/state_tracker/st_draw.c +- name: R64_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F64] + swizzles: [X, 0, 0, 1] +- name: R64G64_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F64, F64] + swizzles: [X, Y, 0, 1] +- name: R64G64B64_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F64, F64, F64] + swizzles: [X, Y, Z, 1] +- name: R64G64B64A64_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F64, F64, F64, F64] + swizzles: [X, Y, Z, W] +- name: R32_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F32] + swizzles: [X, 0, 0, 1] +- name: R32G32_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F32, F32] + swizzles: [X, Y, 0, 1] +- name: R32G32B32_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F32, F32, F32] + swizzles: [X, Y, Z, 1] +- name: R32G32B32A32_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F32, F32, F32, F32] + swizzles: [X, Y, Z, W] +- name: R32_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN32] + swizzles: [X, 0, 0, 1] +- name: R32G32_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN32, UN32] + swizzles: [X, Y, 0, 1] +- name: R32G32B32_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN32, UN32, UN32] + swizzles: [X, Y, Z, 1] +- name: R32G32B32A32_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN32, UN32, UN32, UN32] + swizzles: [X, Y, Z, W] +- name: R32_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U32] + swizzles: [X, 0, 0, 1] +- name: R32G32_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U32, U32] + swizzles: [X, Y, 0, 1] +- name: R32G32B32_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U32, U32, U32] + swizzles: [X, Y, Z, 1] +- name: R32G32B32A32_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U32, U32, U32, U32] + swizzles: [X, Y, Z, W] +- name: R32_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN32] + swizzles: [X, 0, 0, 1] +- name: R32G32_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN32, SN32] + swizzles: [X, Y, 0, 1] +- name: R32G32B32_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN32, SN32, SN32] + swizzles: [X, Y, Z, 1] +- name: R32G32B32A32_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN32, SN32, SN32, SN32] + swizzles: [X, Y, Z, W] +- name: R32_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S32] + swizzles: [X, 0, 0, 1] +- name: R32G32_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S32, S32] + swizzles: [X, Y, 0, 1] +- name: R32G32B32_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S32, S32, S32] + swizzles: [X, Y, Z, 1] +- name: R32G32B32A32_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S32, S32, S32, S32] + swizzles: [X, Y, Z, W] +- name: R16_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F16] + swizzles: [X, 0, 0, 1] +- name: R16G16_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F16, F16] + swizzles: [X, Y, 0, 1] +- name: R16G16B16_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F16, F16, F16] + swizzles: [X, Y, Z, 1] +- name: R16G16B16A16_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F16, F16, F16, F16] + swizzles: [X, Y, Z, W] +- name: R16_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN16] + swizzles: [X, 0, 0, 1] +- name: R16G16_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN16, UN16] + swizzles: [X, Y, 0, 1] +- name: R16G16B16_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN16, UN16, UN16] + swizzles: [X, Y, Z, 1] +- name: R16G16B16A16_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN16, UN16, UN16, UN16] + swizzles: [X, Y, Z, W] +- name: R16_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U16] + swizzles: [X, 0, 0, 1] +- name: R16G16_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U16, U16] + swizzles: [X, Y, 0, 1] +- name: R16G16B16_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U16, U16, U16] + swizzles: [X, Y, Z, 1] +- name: R16G16B16A16_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U16, U16, U16, U16] + swizzles: [X, Y, Z, W] +- name: R16_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN16] + swizzles: [X, 0, 0, 1] +- name: R16G16_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN16, SN16] + swizzles: [X, Y, 0, 1] +- name: R16G16B16_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN16, SN16, SN16] + swizzles: [X, Y, Z, 1] +- name: R16G16B16A16_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN16, SN16, SN16, SN16] + swizzles: [X, Y, Z, W] +- name: R16_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S16] + swizzles: [X, 0, 0, 1] +- name: R16G16_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S16, S16] + swizzles: [X, Y, 0, 1] +- name: R16G16B16_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S16, S16, S16] + swizzles: [X, Y, Z, 1] +- name: R16G16B16A16_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S16, S16, S16, S16] + swizzles: [X, Y, Z, W] +- name: R8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8] + swizzles: [X, 0, 0, 1] +- name: R8G8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8] + swizzles: [X, Y, 0, 1] +- name: R8G8B8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8] + swizzles: [X, Y, Z, 1] +- name: B8G8R8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8] + swizzles: [Z, Y, X, 1] +- name: R8G8B8A8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8, UN8] + swizzles: [X, Y, Z, W] +- name: R8_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U8] + swizzles: [X, 0, 0, 1] +- name: R8G8_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U8, U8] + swizzles: [X, Y, 0, 1] +- name: R8G8B8_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U8, U8, U8] + swizzles: [X, Y, Z, 1] +- name: B8G8R8_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U8, U8, U8] + swizzles: [Z, Y, X, 1] +- name: R8G8B8A8_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U8, U8, U8, U8] + swizzles: [X, Y, Z, W] +- name: B8G8R8A8_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U8, U8, U8, U8] + swizzles: [Z, Y, X, W] +- name: A8B8G8R8_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U8, U8, U8, U8] + swizzles: [W, Z, Y, X] +- name: R8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8] + swizzles: [X, 0, 0, 1] +- name: R8G8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8, SN8] + swizzles: [X, Y, 0, 1] +- name: R8G8B8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8, SN8, SN8] + swizzles: [X, Y, Z, 1] +- name: B8G8R8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8, SN8, SN8] + swizzles: [Z, Y, X, 1] +- name: R8G8B8A8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8, SN8, SN8, SN8] + swizzles: [X, Y, Z, W] +- name: B8G8R8A8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8, SN8, SN8, SN8] + swizzles: [Z, Y, X, W] +- name: R8_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S8] + swizzles: [X, 0, 0, 1] +- name: R8G8_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S8, S8] + swizzles: [X, Y, 0, 1] +- name: R8G8B8_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S8, S8, S8] + swizzles: [X, Y, Z, 1] +- name: B8G8R8_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S8, S8, S8] + swizzles: [Z, Y, X, 1] +- name: R8G8B8A8_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S8, S8, S8, S8] + swizzles: [X, Y, Z, W] +- name: B8G8R8A8_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S8, S8, S8, S8] + swizzles: [Z, Y, X, W] +- name: A8B8G8R8_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S8, S8, S8, S8] + swizzles: [W, Z, Y, X] + + +# GL-specific vertex buffer element formats +# A.k.a. GL_FIXED +- name: R32_FIXED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [H32] + swizzles: [X, 0, 0, 1] +- name: R32G32_FIXED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [H32, H32] + swizzles: [X, Y, 0, 1] +- name: R32G32B32_FIXED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [H32, H32, H32] + swizzles: [X, Y, Z, 1] +- name: R32G32B32A32_FIXED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [H32, H32, H32, H32] + swizzles: [X, Y, Z, W] + + +# D3D9-specific vertex buffer element formats +# See also: +# - http://msdn.microsoft.com/en-us/library/bb172533.aspx +# A.k.a. D3DDECLTYPE_UDEC3 +- name: R10G10B10X2_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U10, U10, U10, X2] + swizzles: [X, Y, Z, 1] +# A.k.a. D3DDECLTYPE_DEC3N +- name: R10G10B10X2_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN10, SN10, SN10, X2] + swizzles: [X, Y, Z, 1] +- name: R10G10B10X2_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP10, SP10, SP10, X2] + swizzles: [X, Y, Z, 1] + + +- name: YV12 + layout: planar3 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] +- name: YV16 + layout: planar3 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] +- name: IYUV + layout: planar3 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] +- name: NV12 + layout: planar2 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] +- name: NV21 + layout: planar2 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] +- name: Y8_400_UNORM + layout: other + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [UN8] + swizzles: [X, 0, 0, 1] + + +# RGB version of NV12 and YV12 for hardware that supports sampling from +# multiplane textures but needs color-space conversion in the shader. +- name: R8_G8B8_420_UNORM + layout: planar2 + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8] + swizzles: [X, Y, Z, W] +- name: R8_B8G8_420_UNORM + layout: planar2 + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8] + swizzles: [X, Y, Z, W] +- name: G8_B8R8_420_UNORM + layout: planar2 + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8] + swizzles: [X, Y, Z, W] +- name: R8_G8_B8_420_UNORM + layout: planar3 + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8] + swizzles: [X, Y, Z, W] +- name: R8_B8_G8_420_UNORM + layout: planar3 + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8] + swizzles: [X, Y, Z, W] +- name: G8_B8_R8_420_UNORM + layout: planar3 + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8] + swizzles: [X, Y, Z, W] +- name: R8_G8_B8_UNORM + layout: planar3 + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8] + swizzles: [X, Y, Z, W] + +# While most of Mesa uses R8 for Y, U, and V planes, freedreno requires distinguishing +# between tiled Y8 data and tiled R8 data. +- name: Y8_UNORM + layout: other + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [UN8] + swizzles: [X, 0, 0, 1] + +- name: Y8_U8_V8_422_UNORM + layout: planar3 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] +- name: Y8_U8V8_422_UNORM + layout: planar2 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] +- name: Y8_U8_V8_444_UNORM + layout: planar3 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] +- name: Y8_U8_V8_440_UNORM + layout: planar3 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] + + +- name: Y16_U16_V16_420_UNORM + layout: planar3 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] +- name: Y16_U16_V16_422_UNORM + layout: planar3 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] +- name: Y16_U16V16_422_UNORM + layout: planar2 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] +- name: Y16_U16_V16_444_UNORM + layout: planar3 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] + + +- name: P010 + layout: planar2 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] +- name: P012 + layout: planar2 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] +- name: P016 + layout: planar2 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] +- name: P030 + layout: planar2 + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [] + swizzles: [X, Y, Z, W] + + +- name: Y210 + layout: subsampled + colorspace: YUV + block: {width: 2, height: 1, depth: 1} + channels: [X64] + swizzles: [X, Y, Z, 1] +- name: Y212 + layout: subsampled + colorspace: YUV + block: {width: 2, height: 1, depth: 1} + channels: [X64] + swizzles: [X, Y, Z, 1] +- name: Y216 + layout: subsampled + colorspace: YUV + block: {width: 2, height: 1, depth: 1} + channels: [X64] + swizzles: [X, Y, Z, 1] + + +- name: Y410 + layout: other + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [UN10, UN10, UN10, UN2] + swizzles: [Y, Z, X, W] +- name: Y412 + layout: other + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [UN16, UN16, UN16, UN16] + swizzles: [Y, Z, X, W] +- name: Y416 + layout: other + colorspace: YUV + block: {width: 1, height: 1, depth: 1} + channels: [UN16, UN16, UN16, UN16] + swizzles: [Y, Z, X, W] + + +# Usually used to implement IA44 and AI44 formats in video decoding +- name: A4R4_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN4, UN4] + swizzles: [Y, 0, 0, X] +- name: R4A4_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN4, UN4] + swizzles: [X, 0, 0, Y] +- name: R8A8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8] + swizzles: [X, 0, 0, Y] +- name: A8R8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8] + swizzles: [Y, 0, 0, X] + + +# ARB_vertex_type_10_10_10_2_REV +- name: R10G10B10A2_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U10, U10, U10, U2] + swizzles: [X, Y, Z, W] +- name: R10G10B10A2_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S10, S10, S10, S2] + swizzles: [X, Y, Z, W] +- name: R10G10B10A2_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN10, SN10, SN10, SN2] + swizzles: [X, Y, Z, W] +- name: B10G10R10A2_USCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [U10, U10, U10, U2] + swizzles: [Z, Y, X, W] +- name: B10G10R10A2_SSCALED + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [S10, S10, S10, S2] + swizzles: [Z, Y, X, W] +- name: B10G10R10A2_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN10, SN10, SN10, SN2] + swizzles: [Z, Y, X, W] + + +- name: R8_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP8] + swizzles: [X, 0, 0, 1] +- name: R8G8_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP8, UP8] + swizzles: [X, Y, 0, 1] +- name: R8G8B8_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP8, UP8, UP8] + swizzles: [X, Y, Z, 1] +- name: R8G8B8A8_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP8, UP8, UP8, UP8] + swizzles: [X, Y, Z, W] + + +- name: R8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8] + swizzles: [X, 0, 0, 1] +- name: R8G8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8, SP8] + swizzles: [X, Y, 0, 1] +- name: R8G8B8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8, SP8, SP8] + swizzles: [X, Y, Z, 1] +- name: R8G8B8A8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8, SP8, SP8, SP8] + swizzles: [X, Y, Z, W] + + +- name: R16_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP16] + swizzles: [X, 0, 0, 1] +- name: R16G16_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP16, UP16] + swizzles: [X, Y, 0, 1] +- name: R16G16B16_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP16, UP16, UP16] + swizzles: [X, Y, Z, 1] +- name: R16G16B16A16_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP16, UP16, UP16, UP16] + swizzles: [X, Y, Z, W] + + +- name: R16_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP16] + swizzles: [X, 0, 0, 1] +- name: R16G16_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP16, SP16] + swizzles: [X, Y, 0, 1] +- name: R16G16B16_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP16, SP16, SP16] + swizzles: [X, Y, Z, 1] +- name: R16G16B16A16_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP16, SP16, SP16, SP16] + swizzles: [X, Y, Z, W] + + +- name: R32_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP32] + swizzles: [X, 0, 0, 1] +- name: R32G32_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP32, UP32] + swizzles: [X, Y, 0, 1] +- name: R32G32B32_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP32, UP32, UP32] + swizzles: [X, Y, Z, 1] +- name: R32G32B32A32_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP32, UP32, UP32, UP32] + swizzles: [X, Y, Z, W] + + +- name: R32_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP32] + swizzles: [X, 0, 0, 1] +- name: R32G32_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP32, SP32] + swizzles: [X, Y, 0, 1] +- name: R32G32B32_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP32, SP32, SP32] + swizzles: [X, Y, Z, 1] +- name: R32G32B32A32_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP32, SP32, SP32, SP32] + swizzles: [X, Y, Z, W] + + +- name: R64_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP64] + swizzles: [X, 0, 0, 1] +- name: R64G64_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP64, UP64] + swizzles: [X, Y, 0, 1] +- name: R64G64B64_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP64, UP64, UP64] + swizzles: [X, Y, Z, 1] +- name: R64G64B64A64_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP64, UP64, UP64, UP64] + swizzles: [X, Y, Z, W] + + +- name: R64_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP64] + swizzles: [X, 0, 0, 1] +- name: R64G64_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP64, SP64] + swizzles: [X, Y, 0, 1] +- name: R64G64B64_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP64, SP64, SP64] + swizzles: [X, Y, Z, 1] +- name: R64G64B64A64_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP64, SP64, SP64, SP64] + swizzles: [X, Y, Z, W] + + +- name: A8_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP8] + swizzles: [0, 0, 0, X] +- name: I8_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP8] + swizzles: [X, X, X, X] +- name: L8_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP8] + swizzles: [X, X, X, 1] +- name: L8A8_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP8, UP8] + swizzles: [X, X, X, Y] + + +- name: A8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8] + swizzles: [0, 0, 0, X] +- name: I8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8] + swizzles: [X, X, X, X] +- name: L8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8] + swizzles: [X, X, X, 1] +- name: L8A8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8, SP8] + swizzles: [X, X, X, Y] + + +- name: A16_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP16] + swizzles: [0, 0, 0, X] +- name: I16_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP16] + swizzles: [X, X, X, X] +- name: L16_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP16] + swizzles: [X, X, X, 1] +- name: L16A16_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP16, UP16] + swizzles: [X, X, X, Y] + +- name: A16_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP16] + swizzles: [0, 0, 0, X] +- name: I16_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP16] + swizzles: [X, X, X, X] +- name: L16_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP16] + swizzles: [X, X, X, 1] +- name: L16A16_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP16, SP16] + swizzles: [X, X, X, Y] + + +- name: A32_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP32] + swizzles: [0, 0, 0, X] +- name: I32_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP32] + swizzles: [X, X, X, X] +- name: L32_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP32] + swizzles: [X, X, X, 1] +- name: L32A32_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP32, UP32] + swizzles: [X, X, X, Y] + + +- name: A32_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP32] + swizzles: [0, 0, 0, X] +- name: I32_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP32] + swizzles: [X, X, X, X] +- name: L32_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP32] + swizzles: [X, X, X, 1] +- name: L32A32_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP32, SP32] + swizzles: [X, X, X, Y] + + +- name: B8G8R8_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP8, UP8, UP8] + swizzles: [Z, Y, X, 1] +- name: B8G8R8A8_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP8, UP8, UP8, UP8] + swizzles: [Z, Y, X, W] + + +- name: B8G8R8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8, SP8, SP8] + swizzles: [Z, Y, X, 1] +- name: B8G8R8A8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8, SP8, SP8, SP8] + swizzles: [Z, Y, X, W] + + +- name: A8R8G8B8_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP8, UP8, UP8, UP8] + swizzles: [Y, Z, W, X] +- name: A8B8G8R8_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP8, UP8, UP8, UP8] + swizzles: [W, Z, Y, X] +- name: A2R10G10B10_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP2, UP10, UP10, UP10] + swizzles: [Y, Z, W, X] +- name: A2B10G10R10_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP2, UP10, UP10, UP10] + swizzles: [W, Z, Y, X] +- name: B10G10R10A2_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP10, UP10, UP10, UP2] + swizzles: [Z, Y, X, W] +- name: B10G10R10A2_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP10, SP10, SP10, SP2] + swizzles: [Z, Y, X, W] +- name: R5G6B5_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP5, UP6, UP5] + swizzles: [X, Y, Z, 1] +- name: B5G6R5_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP5, UP6, UP5] + swizzles: [Z, Y, X, 1] +- name: R3G3B2_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP3, UP3, UP2] + swizzles: [X, Y, Z, 1] +- name: B2G3R3_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP2, UP3, UP3] + swizzles: [Z, Y, X, 1] +- name: R4G4B4A4_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP4, UP4, UP4, UP4] + swizzles: [X, Y, Z, W] +- name: B4G4R4A4_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP4, UP4, UP4, UP4] + swizzles: [Z, Y, X, W] +- name: A4R4G4B4_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP4, UP4, UP4, UP4] + swizzles: [Y, Z, W, X] +- name: A4B4G4R4_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP4, UP4, UP4, UP4] + swizzles: [W, Z, Y, X] +- name: A1R5G5B5_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP1, UP5, UP5, UP5] + swizzles: [Y, Z, W, X] +- name: A1B5G5R5_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP1, UP5, UP5, UP5] + swizzles: [W, Z, Y, X] +- name: R5G5B5A1_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP5, UP5, UP5, UP1] + swizzles: [X, Y, Z, W] +- name: B5G5R5A1_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP5, UP5, UP5, UP1] + swizzles: [Z, Y, X, W] + + +- name: R8G8B8X8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8, SN8, SN8, X8] + swizzles: [X, Y, Z, 1] +- name: R8G8B8X8_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8, UN8, X8] + swizzles: [X, Y, Z, 1] +- name: R8G8B8X8_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP8, UP8, UP8, X8] + swizzles: [X, Y, Z, 1] +- name: R8G8B8X8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8, SP8, SP8, X8] + swizzles: [X, Y, Z, 1] +- name: B10G10R10X2_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN10, UN10, UN10, X2] + swizzles: [Z, Y, X, 1] +- name: B10G10R10X2_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN10, SN10, SN10, X2] + swizzles: [Z, Y, X, 1] +- name: B10G10R10X2_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP10, SP10, SP10, X2] + swizzles: [Z, Y, X, 1] +- name: R16G16B16X16_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN16, UN16, UN16, X16] + swizzles: [X, Y, Z, 1] +- name: R16G16B16X16_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN16, SN16, SN16, X16] + swizzles: [X, Y, Z, 1] +- name: R16G16B16X16_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F16, F16, F16, X16] + swizzles: [X, Y, Z, 1] +- name: R16G16B16X16_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP16, UP16, UP16, X16] + swizzles: [X, Y, Z, 1] +- name: R16G16B16X16_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP16, SP16, SP16, X16] + swizzles: [X, Y, Z, 1] +- name: R32G32B32X32_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F32, F32, F32, X32] + swizzles: [X, Y, Z, 1] +- name: R32G32B32X32_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP32, UP32, UP32, X32] + swizzles: [X, Y, Z, 1] +- name: R32G32B32X32_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP32, SP32, SP32, X32] + swizzles: [X, Y, Z, 1] + + +- name: R8A8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8, SN8] + swizzles: [X, 0, 0, Y] +- name: R16A16_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN16, UN16] + swizzles: [X, 0, 0, Y] +- name: R16A16_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN16, SN16] + swizzles: [X, 0, 0, Y] +- name: R16A16_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F16, F16] + swizzles: [X, 0, 0, Y] +- name: R32A32_FLOAT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [F32, F32] + swizzles: [X, 0, 0, Y] +- name: R8A8_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP8, UP8] + swizzles: [X, 0, 0, Y] +- name: R8A8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8, SP8] + swizzles: [X, 0, 0, Y] +- name: R16A16_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP16, UP16] + swizzles: [X, 0, 0, Y] +- name: R16A16_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP16, SP16] + swizzles: [X, 0, 0, Y] +- name: R32A32_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP32, UP32] + swizzles: [X, 0, 0, Y] +- name: R32A32_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP32, SP32] + swizzles: [X, 0, 0, Y] +- name: R10G10B10A2_UINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UP10, UP10, UP10, UP2] + swizzles: [X, Y, Z, W] +- name: R10G10B10A2_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP10, SP10, SP10, SP2] + swizzles: [X, Y, Z, W] + + +- name: B5G6R5_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [UN5, UN6, UN5] + swizzles: [Z, Y, X, 1] +- name: R5G6B5_SRGB + layout: plain + colorspace: SRGB + block: {width: 1, height: 1, depth: 1} + channels: [UN5, UN6, UN5] + swizzles: [X, Y, Z, 1] + + +- name: G8R8_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN8, UN8] + swizzles: [Y, X, 0, 1] +- name: G8R8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8, SN8] + swizzles: [Y, X, 0, 1] +- name: G8R8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8, SP8] + swizzles: [Y, X, 0, 1] +- name: G16R16_UNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [UN16, UN16] + swizzles: [Y, X, 0, 1] +- name: G16R16_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN16, SN16] + swizzles: [Y, X, 0, 1] +- name: G16R16_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP16, SP16] + swizzles: [Y, X, 0, 1] + + +- name: A8B8G8R8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SN8, SN8, SN8, SN8] + swizzles: [W, Z, Y, X] +- name: A8B8G8R8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [SP8, SP8, SP8, SP8] + swizzles: [W, Z, Y, X] +- name: X8B8G8R8_SNORM + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [X8, SN8, SN8, SN8] + swizzles: [W, Z, Y, 1] +- name: X8B8G8R8_SINT + layout: plain + colorspace: RGB + block: {width: 1, height: 1, depth: 1} + channels: [X8, SP8, SP8, SP8] + swizzles: [W, Z, Y, 1] diff --git a/src/util/format/u_format_parse.py b/src/util/format/u_format_parse.py index 8571a0fd970..bceabbd4ed7 100644 --- a/src/util/format/u_format_parse.py +++ b/src/util/format/u_format_parse.py @@ -30,6 +30,13 @@ import copy +import yaml +import sys + +try: + from yaml import CSafeLoader as YAMLSafeLoader +except: + from yaml import SafeLoader as YAMLSafeLoader VOID, UNSIGNED, SIGNED, FIXED, FLOAT = range(5) @@ -37,10 +44,30 @@ SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, SWIZZLE_0, SWIZZLE_1, SWIZZLE_NONE, PLAIN = 'plain' -RGB = 'rgb' -SRGB = 'srgb' -YUV = 'yuv' -ZS = 'zs' +RGB = 'RGB' +SRGB = 'SRGB' +YUV = 'YUV' +ZS = 'ZS' + + +_type_parse_map = { + '': VOID, + 'X': VOID, + 'U': UNSIGNED, + 'S': SIGNED, + 'H': FIXED, + 'F': FLOAT, +} + +_swizzle_parse_map = { + 'X': SWIZZLE_X, + 'Y': SWIZZLE_Y, + 'Z': SWIZZLE_Z, + 'W': SWIZZLE_W, + '0': SWIZZLE_0, + '1': SWIZZLE_1, + '_': SWIZZLE_NONE, +} def is_pot(x): @@ -49,6 +76,86 @@ def is_pot(x): VERY_LARGE = 99999999999999999999999 +def validate_str(x): + if not isinstance(x, str): + raise ValueError(type(x)) + +def validate_int(x): + if not isinstance(x, int): + raise ValueError(f"invalid type {type(x)}") + +def validate_list_str_4(x): + if not isinstance(x, list): + raise ValueError(f"invalid type {type(x)}") + if len(x) != 4: + raise ValueError(f"invalid length {len(x)}") + for i in range(len(x)): + if isinstance(x[i], int): + x[i] = str(x[i]) + if not isinstance(x[i], str): + raise ValueError(f"invalid member type {type(x[i])}") + +def validate_list_str_le4(x): + if not isinstance(x, list): + raise ValueError(f"invalid type {type(x)}") + if len(x) > 4: + raise ValueError(f"invalid length {len(x)}") + for i in range(len(x)): + if isinstance(x[i], int): + x[i] = str(x[i]) + if not isinstance(x[i], str): + raise ValueError(f"invalid member type {type(x[i])}") + + +def get_and_delete(d, k): + ret = d[k] + del(d[k]) + return ret + +def do_consume(d, *args): + if len(args) == 1: + return get_and_delete(d, args[0]) + else: + return do_consume(d[args[0]], *args[1:]) + +def consume(f, validate, d, *args): + if len(args) > 1: + sub = " under " + ".".join([f"'{a}'" for a in args[:-1]]) + else: + sub = "" + + try: + ret = do_consume(d, *args) + validate(ret) + return ret + except KeyError: + raise RuntimeError(f"Key '{args[-1]}' not present{sub} in format {f.name}") + except ValueError as e: + raise RuntimeError(f"Key '{args[-1]}' invalid{sub} in format {f.name}: {e.args[0]}") + +def consume_str(f, d, *args): + return consume(f, validate_str, d, *args) + +def consume_int(f, d, *args): + return consume(f, validate_int, d, *args) + +def consume_list_str_4(f, d, *args): + return consume(f, validate_list_str_4, d, *args) + +def consume_list_str_le4(f, d, *args): + return consume(f, validate_list_str_le4, d, *args) + +def consumed(f, d, *args): + if args: + d = do_consume(d, *args) + if len(d) > 0: + keys = ", ".join([f"'{k}'" for k in d.keys()]) + if args: + sub = " under " + ".".join([f"'{a}'" for a in args]) + else: + sub = "" + raise RuntimeError(f"Unknown keys ({keys}) present in format {f.name}{sub}") + class Channel: '''Describe the channel of a color channel.''' @@ -114,34 +221,54 @@ class Channel: class Format: '''Describe a pixel format.''' - def __init__(self, name, layout, block_width, block_height, block_depth, le_channels, le_swizzles, be_channels, be_swizzles, colorspace): - self.name = name - self.layout = layout - self.block_width = block_width - self.block_height = block_height - self.block_depth = block_depth - self.colorspace = colorspace + def __init__(self, source): + self.name = "unknown" + self.name = f"PIPE_FORMAT_{consume_str(self, source, 'name')}" + self.layout = consume_str(self, source, 'layout') + self.block_width = consume_int(self, source, 'block', 'width') + self.block_height = consume_int(self, source, 'block', 'height') + self.block_depth = consume_int(self, source, 'block', 'depth') + consumed(self, source, 'block') + self.colorspace = consume_str(self, source, 'colorspace') - self.le_channels = le_channels - self.le_swizzles = le_swizzles - - le_shift = 0 - for channel in self.le_channels: - channel.shift = le_shift - le_shift += channel.size - - if be_channels: + # Formats with no endian-dependent swizzling declare their channel and + # swizzle layout at the top level. Else they can declare an + # endian-dependent swizzle. This only applies to packed formats, + # however we can't use is_array() or is_bitmask() to test because they + # depend on the channels having already been parsed. + if 'swizzles' in source: + self.le_swizzles = list(map(lambda x: _swizzle_parse_map[x], + consume_list_str_4(self, source, 'swizzles'))) + self.le_channels = _parse_channels(consume_list_str_le4(self, source, 'channels'), + self.layout, self.colorspace, self.le_swizzles) + self.be_swizzles = None + self.be_channels = None + if source.get('little_endian', {}).get('swizzles') or \ + source.get('big_endian', {}).get('swizzles'): + raise RuntimeError(f"Format {self.name} must not declare endian-dependent and endian-independent swizzles") + else: + self.le_swizzles = list(map(lambda x: _swizzle_parse_map[x], + consume_list_str_4(self, source, 'little_endian', 'swizzles'))) + self.le_channels = _parse_channels(consume_list_str_le4(self, source, 'little_endian', 'channels'), + self.layout, self.colorspace, self.le_swizzles) + self.be_swizzles = list(map(lambda x: _swizzle_parse_map[x], + consume_list_str_4(self, source, 'big_endian', 'swizzles'))) + self.be_channels = _parse_channels(consume_list_str_le4(self, source, 'big_endian', 'channels'), + self.layout, self.colorspace, self.be_swizzles) if self.is_array(): - print( - "{} is an array format and should not include BE swizzles in the CSV".format(self.name)) - exit(1) + raise RuntimeError("Array format {self.name} must not define endian-specific swizzles") if self.is_bitmask(): - print( - "{} is a bitmask format and should not include BE swizzles in the CSV".format(self.name)) - exit(1) - self.be_channels = be_channels - self.be_swizzles = be_swizzles - elif self.is_bitmask() and not self.is_array(): + raise RuntimeError("Bitmask format {self.name} must not define endian-specific swizzles") + + if 'little_endian' in source: + consumed(self, source, 'little_endian') + if 'big_endian' in source: + consumed(self, source, 'big_endian') + + consumed(self, source) + del(source) + + if self.is_bitmask() and not self.is_array(): # Bitmask formats are "load a word the size of the block and # bitshift channels out of it." However, the channel shifts # defined in u_format_table.c are numbered right-to-left on BE @@ -167,9 +294,14 @@ class Format: SWIZZLE_0: SWIZZLE_0, SWIZZLE_NONE: SWIZZLE_NONE} self.be_swizzles = [chan_map[s] for s in self.le_swizzles] - else: - self.be_channels = copy.deepcopy(le_channels) - self.be_swizzles = le_swizzles + elif not self.be_channels: + self.be_channels = copy.deepcopy(self.le_channels) + self.be_swizzles = self.le_swizzles + + le_shift = 0 + for channel in self.le_channels: + channel.shift = le_shift + le_shift += channel.size be_shift = 0 for channel in reversed(self.be_channels): @@ -184,6 +316,12 @@ class Format: def __str__(self): return self.name + def __eq__(self, other): + return self.name == other.name + + def __hash__(self): + return hash(self.name) + def short_name(self): '''Make up a short norm for a format, suitable to be used as suffix in function names.''' @@ -330,25 +468,6 @@ class Format: return self.block_size()/8 -_type_parse_map = { - '': VOID, - 'x': VOID, - 'u': UNSIGNED, - 's': SIGNED, - 'h': FIXED, - 'f': FLOAT, -} - -_swizzle_parse_map = { - 'x': SWIZZLE_X, - 'y': SWIZZLE_Y, - 'z': SWIZZLE_Z, - 'w': SWIZZLE_W, - '0': SWIZZLE_0, - '1': SWIZZLE_1, - '_': SWIZZLE_NONE, -} - def _parse_channels(fields, layout, colorspace, swizzles): if layout == PLAIN: @@ -373,14 +492,14 @@ def _parse_channels(fields, layout, colorspace, swizzles): channels = [] for i in range(0, 4): - field = fields[i] - if field: + if i < len(fields): + field = fields[i] type = _type_parse_map[field[0]] - if field[1] == 'n': + if field[1] == 'N': norm = True pure = False size = int(field[2:]) - elif field[1] == 'p': + elif field[1] == 'P': pure = True norm = False size = int(field[2:]) @@ -400,43 +519,22 @@ def _parse_channels(fields, layout, colorspace, swizzles): def parse(filename): - '''Parse the format description in CSV format in terms of the + '''Parse the format description in YAML format in terms of the Channel and Format classes above.''' stream = open(filename) - formats = [] - for line in stream: + doc = yaml.load(stream, Loader=YAMLSafeLoader) + assert(isinstance(doc, list)) + + ret = [] + for entry in doc: + assert(isinstance(entry, dict)) try: - comment = line.index('#') - except ValueError: - pass - else: - line = line[:comment] - line = line.strip() - if not line: - continue + f = Format(copy.deepcopy(entry)) + except Exception as e: + raise RuntimeError(f"Failed to parse entry {entry}: {e}") + if f in ret: + raise RuntimeError(f"Duplicate format entry {f.name}") + ret.append(f) - fields = [field.strip() for field in line.split(',')] - assert(len(fields) == 11 or len(fields) == 16) - - name = fields[0] - layout = fields[1] - block_width, block_height, block_depth = map(int, fields[2:5]) - colorspace = fields[10] - - le_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[9]] - le_channels = _parse_channels(fields[5:9], layout, colorspace, le_swizzles) - - be_swizzles = None - be_channels = None - if len(fields) == 16: - be_swizzles = [_swizzle_parse_map[swizzle] - - for swizzle in fields[15]] - be_channels = _parse_channels( - - fields[11:15], layout, colorspace, be_swizzles) - - format = Format(name, layout, block_width, block_height, block_depth, le_channels, le_swizzles, be_channels, be_swizzles, colorspace) - formats.append(format) - return formats + return ret diff --git a/src/util/format/u_format_table.py b/src/util/format/u_format_table.py index 11f8bfda8a7..189dc6a9318 100644 --- a/src/util/format/u_format_table.py +++ b/src/util/format/u_format_table.py @@ -43,10 +43,10 @@ def colorspace_map(colorspace): colorspace_channels_map = { - 'rgb': ['r', 'g', 'b', 'a'], - 'srgb': ['sr', 'sg', 'sb', 'a'], - 'zs': ['z', 's'], - 'yuv': ['y', 'u', 'v'], + 'RGB': ['r', 'g', 'b', 'a'], + 'SRGB': ['sr', 'sg', 'sb', 'a'], + 'ZS': ['z', 's'], + 'YUV': ['y', 'u', 'v'], } @@ -133,7 +133,7 @@ def has_access(format): return True def write_format_table_header(file): - print('/* This file is autogenerated by u_format_table.py from u_format.csv. Do not edit directly. */', file=file) + print('/* This file is autogenerated by u_format_table.py from u_format.yaml. Do not edit directly. */', file=file) print(file=file) # This will print the copyright message on the top of this file print(CopyRight.strip(), file=file) @@ -324,7 +324,7 @@ def write_format_table(formats): generate_function_getter("fetch_rgba") def main(): - formats = [] + formats = {} sys.stdout2 = open(os.devnull, "w") @@ -334,9 +334,13 @@ def main(): sys.stdout = open(os.devnull, "w") continue - formats.extend(parse(arg)) + to_add = parse(arg) + duplicates = [x.name for x in to_add if x.name in formats] + if len(duplicates): + raise RuntimeError(f"Duplicate format entries {', '.join(duplicates)}") + formats.update({ x.name: x for x in to_add }) - write_format_table(formats) + write_format_table(formats.values()) if __name__ == '__main__': main()