3 # Copyright 2015 Intel Corporation
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the "Software"),
7 # to deal in the Software without restriction, including without limitation
8 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 # and/or sell copies of the Software, and to permit persons to whom the
10 # Software is furnished to do so, subject to the following conditions:
12 # The above copyright notice and this permission notice (including the next
13 # paragraph) shall be included in all copies or substantial portions of the
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
29 * Copyright 2015 Intel Corporation
31 * Permission is hereby granted, free of charge, to any person obtaining a
32 * copy of this software and associated documentation files (the "Software"),
33 * to deal in the Software without restriction, including without limitation
34 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
35 * and/or sell copies of the Software, and to permit persons to whom the
36 * Software is furnished to do so, subject to the following conditions:
38 * The above copyright notice and this permission notice (including the next
39 * paragraph) shall be included in all copies or substantial portions of the
42 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
45 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
47 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
53 const struct isl_format_layout
54 isl_format_layouts[] = {
58 # Delete comment lines and empty lines
66 s/^([A-Za-z0-9_]+),*/ISL_FORMAT_\1,/
68 # Translate data type of channels
69 s/\<x([0-9]+),/ISL_VOID@\1,/g
70 s/\<r([0-9]+),/ISL_RAW@\1,/g
71 s/\<un([0-9]+),/ISL_UNORM@\1,/g
72 s/\<sn([0-9]+),/ISL_SNORM@\1,/g
73 s/\<uf([0-9]+),/ISL_UFLOAT@\1,/g
74 s/\<sf([0-9]+),/ISL_SFLOAT@\1,/g
75 s/\<ux([0-9]+),/ISL_UFIXED@\1,/g
76 s/\<sx([0-9]+),/ISL_SFIXED@\1,/g
77 s/\<ui([0-9]+),/ISL_UINT@\1,/g
78 s/\<si([0-9]+),/ISL_SINT@\1,/g
79 s/\<us([0-9]+),/ISL_USCALED@\1,/g
80 s/\<ss([0-9]+),/ISL_SSCALED@\1,/g
82 # Translate colorspaces
83 # Interpret alpha-only formats as having no colorspace.
84 s/\<(linear|srgb|yuv)\>/ISL_COLORSPACE_\1/
87 # Translate texture compression
88 s/\<(dxt|fxt|rgtc|bptc|etc)([0-9]*)\>/ISL_TXC_\1\2/
90 tr 'a-z' 'A-Z' |
# Convert to uppersace
91 while IFS
=, read -r format bpb bw bh bd \
92 red green blue alpha \
93 luminance intensity palette \
96 : ${colorspace:=ISL_COLORSPACE_NONE}
97 : ${txc:=ISL_TXC_NONE}
102 .bs = $((bpb/8)), .bpb = $bpb,
103 .bw = $bw, .bh = $bh, .bd = $bd,
113 .colorspace = $colorspace,
120 # Collapse empty channels
123 # Split non-empty channels into two members: base type and bit size
127 # Terminate the table