Last active
February 5, 2023 21:33
-
-
Save tomilov/5006c0d70c380c93cd73d4edac73787e to your computer and use it in GitHub Desktop.
full pythonic re for VkFormat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FORMAT_REGEX = re.compile(r''' | |
VK_FORMAT | |
(?: | |
# NVIDIA optical flow | |
_R16G16_S10_5_NV | |
| | |
# PVRTC | |
_(?P<pvrtc>PVRTC[12]) | |
_(?P<pvrtc_bpp>[24])BPP | |
_(?P<pvrtc_numeric_format>UNORM|SRGB) | |
_BLOCK | |
_IMG | |
| | |
# ASTC | |
_(?P<astc>ASTC) | |
_(?P<astc_width>[4568]|10|12)x(?P<astc_height>[4568]|10|12) | |
_(?P<astc_numeric_format>UNORM|SRGB|SFLOAT) | |
_BLOCK | |
| | |
# EAC | |
_(?P<eac>EAC) | |
_(?P<eac_components>R11|R11G11) | |
_(?P<eac_numeric_format>UNORM|SNORM) | |
_BLOCK | |
| | |
# ETC2 | |
_(?P<etc>ETC2) | |
_(?P<etc_components>R8G8B8|R8G8B8A[18]) | |
_(?P<etc_numeric_format>UNORM|SRGB) | |
_BLOCK | |
| | |
# BC | |
_(?P<bc>BC(?:[123457]|6H)) | |
(?:_(?P<bc_components>RGB|RGBA))? | |
_(?P<bc_numeric_format>UNORM|SRGB|SNORM|UFLOAT|SFLOAT) | |
_BLOCK | |
| | |
# Depth and|or stencil | |
(?: | |
(?:_X(?P<depth_padding>8))? | |
_D(?P<depth_bits>16|24|32) | |
_(?P<depth_numeric_format>UNORM|SFLOAT) | |
)? | |
(?: | |
_S(?P<stencil_bits>8) | |
_(?P<stencil_numeric_format>UINT) | |
)? | |
(?:_PACK(?P<depth_pack>32))? | |
| | |
# all image formats including multiplane | |
_(?P<component0>[ERGBA])(?P<component0bits>1|2|4|5|6|8|9|10|12|16|32|64)(?:X(?P<component0padding>[46]))? | |
(?:(?P<plane1>_)?(?P<component1>[RGB])(?P<component1bits>4|5|6|8|9|10|11|12|16|32|64)(?:X(?P<component1padding>[46]))?)? | |
(?:(?P<plane2>_)?(?P<component2>[RGB])(?P<component2bits>4|5|6|8|9|10|11|12|16|32|64)(?:X(?P<component2padding>[46]))?)? | |
(?:(?P<component3>[RGBA])(?P<component3bits>1|4|5|6|8|9|10|12|16|32|64)(?:X(?P<component3padding>[46]))?)? | |
(?:_(?P<plane_count>[23])PLANE)? | |
(?:_(?P<chroma>420|422|444))? | |
_(?P<numeric_format>USCALED|UINT|UFLOAT|SINT|SFLOAT|SSCALED|SRGB|SNORM|UNORM) | |
(?:_(?P<batch>[234])?PACK(?P<pack>8|16|32))? | |
)$ | |
''', re.VERBOSE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment