Khronos Data Format Specification
Total Page:16
File Type:pdf, Size:1020Kb
Khronos Data Format Specification Andrew Garrard Version 1.3.1 2020-04-03 1 / 281 Khronos Data Format Specification License Information Copyright (C) 2014-2019 The Khronos Group Inc. All Rights Reserved. This specification is protected by copyright laws and contains material proprietary to the Khronos Group, Inc. It or any components may not be reproduced, republished, distributed, transmitted, displayed, broadcast, or otherwise exploited in any manner without the express prior written permission of Khronos Group. You may use this specification for implementing the functionality therein, without altering or removing any trademark, copyright or other notice from the specification, but the receipt or possession of this specification does not convey any rights to reproduce, disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe, in whole or in part. This version of the Data Format Specification is published and copyrighted by Khronos, but is not a Khronos ratified specification. Accordingly, it does not fall within the scope of the Khronos IP policy, except to the extent that sections of it are normatively referenced in ratified Khronos specifications. Such references incorporate the referenced sections into the ratified specifications, and bring those sections into the scope of the policy for those specifications. Khronos Group grants express permission to any current Promoter, Contributor or Adopter member of Khronos to copy and redistribute UNMODIFIED versions of this specification in any fashion, provided that NO CHARGE is made for the specification and the latest available update of the specification for any version of the API is used whenever possible. Such distributed specification may be reformatted AS LONG AS the contents of the specification are not changed in any way. The specification may be incorporated into a product that is sold as long as such product includes significant independent work developed by the seller. A link to the current version of this specification on the Khronos Group website should be included whenever possible with specification distributions. Khronos Group makes no, and expressly disclaims any, representations or warranties, express or implied, regarding this specification, including, without limitation, any implied warranties of merchantability or fitness for a particular purpose or non-infringement of any intellectual property. Khronos Group makes no, and expressly disclaims any, warranties, express or implied, regarding the correctness, accuracy, completeness, timeliness, and reliability of the specification. Under no circumstances will the Khronos Group, or any of its Promoters, Contributors or Members or their respective partners, officers, directors, employees, agents, or representatives be liable for any damages, whether direct, indirect, special or consequential damages for lost revenues, lost profits, or otherwise, arising from or in connection with these materials. Khronos, SYCL, SPIR, WebGL, EGL, COLLADA, StreamInput, OpenVX, OpenKCam, glTF, OpenKODE, OpenVG, OpenWF, OpenSL ES, OpenMAX, OpenMAX AL, OpenMAX IL and OpenMAX DL are trademarks and WebCL is a certification mark of the Khronos Group Inc. OpenCL is a trademark of Apple Inc. and OpenGL and OpenML are registered trademarks and the OpenGL ES and OpenGL SC logos are trademarks of Silicon Graphics International used under license by Khronos. All other product names, trademarks, and/or company names are used solely for identification and belong to their respective owners. 2 / 281 Revision number Date Release Info Author 0.1 Jan 2015 Initial sharing AG 0.2 Feb 2015 Added clarification, tables, examples AG 0.3 Feb 2015 Further cleanup AG 0.4 Apr 2015 Channel ordering standardized AG 0.5 Apr 2015 Typos and clarification AG 1.0 rev 1 May 2015 Submission for 1.0 release AG 1.0 rev 2 Jun 2015 Clarifications for 1.0 release AG 1.0 rev 3 Jul 2015 Added KHR_DF_SAMPLE_DATATYPE_LINEAR AG 1.0 rev 4 Jul 2015 Clarified KHR_DF_SAMPLE_DATATYPE_LINEAR AG 1.0 rev 5 Mar 2019 Clarification and typography AG 1.1 rev 1 Nov 2015 Added definitions of compressed texture formats AG 1.1 rev 2 Jan 2016 Added definitions of floating point formats AG 1.1 rev 3 Feb 2016 Fixed typo in sRGB conversion (thank you, Tom Grim!) AG 1.1 rev 4 Mar 2016 Fixed typo/clarified sRGB in ASTC, typographical improvements AG 1.1 rev 5 Mar 2016 Switch to official Khronos logo, removed scripts, restored title AG 1.1 rev 6 Jun 2016 ASTC block footprint note, fixed credits/changelog/contents AG 1.1 rev 7 Sep 2016 ASTC multi-point part and quint decode typo fixes AG 1.1 rev 8 Jun 2017 ETC2 legibility and table typo fix AG 1.1 rev 9 Mar 2019 Typo fixes and much reformatting AG 1.2 rev 0 Sep 2017 Added color conversion formulae and extra options AG 1.2 rev 1 Mar 2019 Typo fixes and much reformatting AG 1.3 Oct 2019 Updates for KTX2/glTF. BC6h and ASTC table fixes and typo fixes. More examples. AG/MC 1.3.1 Mar 2020 Fix swapped pre-multiplied alpha in DXT[2345] examples. Fix incorrect positions in BC7 bit layout table. Rewrite Unsized formats section. MC 3 / 281 Contents I Introduction 3 1 Introduction 4 II The Khronos Data Format Descriptor Block5 2 Formats and texel access 6 2.1 1-D texel addressing . .7 2.2 Simple 2-D texel addressing . .8 2.3 More complex 2-D texel addressing . 10 2.4 3-dimensional texel addressing . 13 2.5 Downsampled channels . 14 3 The Khronos Data Format Descriptor overview 19 3.1 Texel blocks in the Khronos Data Format Descriptor . 20 3.2 Planes in the Khronos Data Format Specification . 21 3.3 Bit pattern interpretation and samples .................................... 23 3.4 Canonical representation . 25 3.5 Related concepts outside the “format” . 27 3.6 Translation to API-specific representations . 28 3.7 Glossary . 29 4 Khronos Data Format Descriptor 30 4.1 Descriptor block . 31 5 Khronos Basic Data Format Descriptor Block 33 5.1 vendorId ................................................... 35 5.2 descriptorType ................................................ 35 5.3 versionNumber ............................................... 36 5.4 descriptorBlockSize ............................................. 36 5.5 colorModel ................................................. 37 5.5.1 KHR_DF_MODEL_UNSPECIFIED (=0) ............................ 37 5.5.2 KHR_DF_MODEL_RGBSDA (=1) ................................ 38 5.5.3 KHR_DF_MODEL_YUVSDA (=2) ................................ 38 5.5.4 KHR_DF_MODEL_YIQSDA (=3) ................................ 39 5.5.5 KHR_DF_MODEL_LABSDA (=4) ................................ 39 5.5.6 KHR_DF_MODEL_CMYKA (=5) ................................. 39 5.5.7 KHR_DF_MODEL_XYZW (=6).................................. 40 4 / 281 5.5.8 KHR_DF_MODEL_HSVA_ANG (=7)............................... 40 5.5.9 KHR_DF_MODEL_HSLA_ANG (=8)............................... 40 5.5.10 KHR_DF_MODEL_HSVA_HEX (=9)............................... 41 5.5.11 KHR_DF_MODEL_HSLA_HEX (= 10) . 41 5.5.12 KHR_DF_MODEL_YCGCOA (= 11) . 41 5.5.13 KHR_DF_MODEL_YCCBCCRC (= 12) . 42 5.5.14 KHR_DF_MODEL_ICTCP (= 13) . 42 5.5.15 KHR_DF_MODEL_CIEXYZ (= 14) . 43 5.5.16 KHR_DF_MODEL_CIEXYY (= 15) . 43 5.6 colorModel for compressed formats . 44 5.6.1 KHR_DF_MODEL_DXT1A/KHR_DF_MODEL_BC1A (= 128) . 45 5.6.2 KHR_DF_MODEL_DXT2/3/KHR_DF_MODEL_BC2 (= 129) . 47 5.6.3 KHR_DF_MODEL_DXT4/5/KHR_DF_MODEL_BC3 (= 130) . 49 5.6.4 KHR_DF_MODEL_BC4 (= 131) . 51 5.6.5 KHR_DF_MODEL_BC5 (= 132) . 52 5.6.6 KHR_DF_MODEL_BC6H (= 133) . 55 5.6.7 KHR_DF_MODEL_BC7 (= 134) . 57 5.6.8 KHR_DF_MODEL_ETC1 (= 160) . 58 5.6.9 KHR_DF_MODEL_ETC2 (= 161) . 59 5.6.10 KHR_DF_MODEL_ASTC (= 162) . 64 5.6.11 KHR_DF_MODEL_ETC1S (= 163) . 66 5.6.12 KHR_DF_MODEL_PVRTC (= 164) . 67 5.6.13 KHR_DF_MODEL_PVRTC2 (= 165) . 69 5.7 colorPrimaries ................................................ 71 5.7.1 KHR_DF_PRIMARIES_UNSPECIFIED (= 0) . 71 5.7.2 KHR_DF_PRIMARIES_BT709 (=1).............................. 71 5.7.3 KHR_DF_PRIMARIES_BT601_EBU (=2)........................... 71 5.7.4 KHR_DF_PRIMARIES_BT601_SMPTE (= 3) . 71 5.7.5 KHR_DF_PRIMARIES_BT2020 (=4) ............................. 72 5.7.6 KHR_DF_PRIMARIES_CIEXYZ (=5) ............................. 72 5.7.7 KHR_DF_PRIMARIES_ACES (=6)............................... 72 5.7.8 KHR_DF_PRIMARIES_ACESCC (=7) ............................. 72 5.7.9 KHR_DF_PRIMARIES_NTSC1953 (=8)............................ 72 5.7.10 KHR_DF_PRIMARIES_PAL525 (=9) ............................. 72 5.7.11 KHR_DF_PRIMARIES_DISPLAYP3 (= 10) . 72 5.7.12 KHR_DF_PRIMARIES_ADOBERGB (= 11) . 72 5.8 transferFunction .............................................. 73 5.8.1 KHR_DF_TRANSFER_UNSPECIFIED (= 0) . 73 5.8.2 KHR_DF_TRANSFER_LINEAR (=1).............................. 73 5.8.3 KHR_DF_TRANSFER_SRGB (=2)................................ 73 5.8.4 KHR_DF_TRANSFER_ITU (=3) ................................ 74 5.8.5 KHR_DF_TRANSFER_NTSC (=4)................................ 74 5.8.6 KHR_DF_TRANSFER_SLOG (=5)................................ 74 5.8.7 KHR_DF_TRANSFER_SLOG2 (=6)............................... 74 5.8.8 KHR_DF_TRANSFER_BT1886 (=7).............................. 74 5.8.9 KHR_DF_TRANSFER_HLG_OETF (=8) ............................ 75 5.8.10 KHR_DF_TRANSFER_HLG_EOTF (=9) ............................ 75 5.8.11 KHR_DF_TRANSFER_PQ_EOTF (= 10) . 75 5.8.12 KHR_DF_TRANSFER_PQ_OETF (= 11) . 75 5.8.13 KHR_DF_TRANSFER_DCIP3 (= 12) . 75 5.8.14 KHR_DF_TRANSFER_PAL_OETF (= 13) . 76 5 / 281 5.8.15 KHR_DF_TRANSFER_PAL625_EOTF (= 14) . 76 5.8.16 KHR_DF_TRANSFER_ST240 (= 15) . 76 5.8.17 KHR_DF_TRANSFER_ACESCC (= 16) . 76 5.8.18 KHR_DF_TRANSFER_ACESCCT