2 * Copyright 2015 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
27 #include "dev/gen_device_info.h"
29 struct surface_format_info
{
33 uint8_t shadow_compare
;
35 uint8_t render_target
;
38 uint8_t streamed_output_vb
;
39 uint8_t color_processing
;
45 /* This macro allows us to write the table almost as it appears in the PRM,
46 * while restructuring it to turn it into the C code we want.
48 #define SF(sampl, filt, shad, ck, rt, ab, vb, so, color, tw, tr, ccs_e, sf) \
49 [ISL_FORMAT_##sf] = { true, sampl, filt, shad, ck, rt, ab, vb, so, color, tw, tr, ccs_e},
54 * This is the table of support for surface (texture, renderbuffer, and vertex
55 * buffer, but not depthbuffer) formats across the various hardware generations.
57 * The table is formatted to match the documentation, except that the docs have
58 * this ridiculous mapping of Y[*+~^#&] for "supported on DevWhatever". To put
59 * it in our table, here's the mapping:
67 * The abbreviations in the header below are:
68 * smpl - Sampling Engine
69 * filt - Sampling Engine Filtering
70 * shad - Sampling Engine Shadow Map
71 * CK - Sampling Engine Chroma Key
73 * AB - Alpha Blend Render Target
74 * VB - Input Vertex Buffer
75 * SO - Steamed Output Vertex Buffers (transform feedback)
76 * color - Color Processing
77 * ccs_e - Lossless Compression Support (gen9+ only)
80 * See page 88 of the Sandybridge PRM VOL4_Part1 PDF.
82 * As of Ivybridge, the columns are no longer in that table and the
83 * information can be found spread across:
85 * - VOL2_Part1 section 2.5.11 Format Conversion (vertex fetch).
86 * - VOL4_Part1 section 2.12.2.1.2 Sampler Output Channel Mapping.
87 * - VOL4_Part1 section 3.9.11 Render Target Write.
88 * - Render Target Surface Types [SKL+]
90 static const struct surface_format_info format_info
[] = {
91 /* smpl filt shad CK RT AB VB SO color TW TR ccs_e */
92 SF( Y
, 50, x
, x
, Y
, Y
, Y
, Y
, x
, 70, 90, 90, R32G32B32A32_FLOAT
)
93 SF( Y
, x
, x
, x
, Y
, x
, Y
, Y
, x
, 70, 90, 90, R32G32B32A32_SINT
)
94 SF( Y
, x
, x
, x
, Y
, x
, Y
, Y
, x
, 70, 90, 90, R32G32B32A32_UINT
)
95 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32G32B32A32_UNORM
)
96 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32G32B32A32_SNORM
)
97 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R64G64_FLOAT
)
98 SF( Y
, 50, x
, x
, 100, 100, x
, x
, x
, x
, x
, 100, R32G32B32X32_FLOAT
)
99 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32G32B32A32_SSCALED
)
100 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32G32B32A32_USCALED
)
101 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, R32G32B32A32_SFIXED
)
102 SF( x
, x
, x
, x
, x
, x
, 80, x
, x
, x
, x
, x
, R64G64_PASSTHRU
)
103 SF( Y
, 50, x
, x
, x
, x
, Y
, Y
, x
, x
, x
, x
, R32G32B32_FLOAT
)
104 SF( Y
, x
, x
, x
, x
, x
, Y
, Y
, x
, x
, x
, x
, R32G32B32_SINT
)
105 SF( Y
, x
, x
, x
, x
, x
, Y
, Y
, x
, x
, x
, x
, R32G32B32_UINT
)
106 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32G32B32_UNORM
)
107 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32G32B32_SNORM
)
108 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32G32B32_SSCALED
)
109 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32G32B32_USCALED
)
110 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, R32G32B32_SFIXED
)
111 SF( Y
, Y
, x
, x
, Y
, 45, Y
, x
, 60, 70, x
, 90, R16G16B16A16_UNORM
)
112 SF( Y
, Y
, x
, x
, Y
, 60, Y
, x
, x
, 70, x
, 90, R16G16B16A16_SNORM
)
113 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 70, 90, 90, R16G16B16A16_SINT
)
114 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 70, 75, 90, R16G16B16A16_UINT
)
115 SF( Y
, Y
, x
, x
, Y
, Y
, Y
, x
, x
, 70, 90, 90, R16G16B16A16_FLOAT
)
116 SF( Y
, 50, x
, x
, Y
, Y
, Y
, Y
, x
, 70, 90, 90, R32G32_FLOAT
)
117 SF( Y
, 70, x
, x
, Y
, Y
, Y
, Y
, x
, x
, x
, x
, R32G32_FLOAT_LD
)
118 SF( Y
, x
, x
, x
, Y
, x
, Y
, Y
, x
, 70, 90, 90, R32G32_SINT
)
119 SF( Y
, x
, x
, x
, Y
, x
, Y
, Y
, x
, 70, 90, 90, R32G32_UINT
)
120 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, R32_FLOAT_X8X24_TYPELESS
)
121 SF( Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, X32_TYPELESS_G8X24_UINT
)
122 SF( Y
, 50, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, L32A32_FLOAT
)
123 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32G32_UNORM
)
124 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32G32_SNORM
)
125 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R64_FLOAT
)
126 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, R16G16B16X16_UNORM
)
127 SF( Y
, Y
, x
, x
, 90, 90, x
, x
, x
, x
, x
, 90, R16G16B16X16_FLOAT
)
128 SF( Y
, 50, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, A32X32_FLOAT
)
129 SF( Y
, 50, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, L32X32_FLOAT
)
130 SF( Y
, 50, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, I32X32_FLOAT
)
131 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R16G16B16A16_SSCALED
)
132 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R16G16B16A16_USCALED
)
133 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32G32_SSCALED
)
134 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32G32_USCALED
)
135 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, R32G32_SFIXED
)
136 SF( x
, x
, x
, x
, x
, x
, 80, x
, x
, x
, x
, x
, R64_PASSTHRU
)
137 SF( Y
, Y
, x
, Y
, Y
, Y
, Y
, x
, 60, 70, x
, 90, B8G8R8A8_UNORM
)
138 SF( Y
, Y
, x
, x
, Y
, Y
, x
, x
, x
, x
, x
, 100, B8G8R8A8_UNORM_SRGB
)
139 /* smpl filt shad CK RT AB VB SO color TW TR ccs_e */
140 SF( Y
, Y
, x
, x
, Y
, Y
, Y
, x
, 60, 70, x
, 100, R10G10B10A2_UNORM
)
141 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, 60, x
, x
, x
, R10G10B10A2_UNORM_SRGB
)
142 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 70, x
, 100, R10G10B10A2_UINT
)
143 SF( Y
, Y
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R10G10B10_SNORM_A2_UNORM
)
144 SF( Y
, Y
, x
, x
, Y
, Y
, Y
, x
, 60, 70, x
, 90, R8G8B8A8_UNORM
)
145 SF( Y
, Y
, x
, x
, Y
, Y
, x
, x
, 60, x
, x
, 100, R8G8B8A8_UNORM_SRGB
)
146 SF( Y
, Y
, x
, x
, Y
, 60, Y
, x
, x
, 70, x
, 90, R8G8B8A8_SNORM
)
147 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 70, 90, 90, R8G8B8A8_SINT
)
148 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 70, 75, 90, R8G8B8A8_UINT
)
149 SF( Y
, Y
, x
, x
, Y
, 45, Y
, x
, x
, 70, x
, 90, R16G16_UNORM
)
150 SF( Y
, Y
, x
, x
, Y
, 60, Y
, x
, x
, 70, x
, 90, R16G16_SNORM
)
151 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 70, 90, 90, R16G16_SINT
)
152 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 70, 75, 90, R16G16_UINT
)
153 SF( Y
, Y
, x
, x
, Y
, Y
, Y
, x
, x
, 70, 90, 90, R16G16_FLOAT
)
154 SF( Y
, Y
, x
, x
, Y
, Y
, 75, x
, 60, 70, x
, 100, B10G10R10A2_UNORM
)
155 SF( Y
, Y
, x
, x
, Y
, Y
, x
, x
, 60, x
, x
, 100, B10G10R10A2_UNORM_SRGB
)
156 SF( Y
, Y
, x
, x
, Y
, Y
, Y
, x
, x
, 70, x
, 100, R11G11B10_FLOAT
)
157 SF( Y
, x
, x
, x
, Y
, x
, Y
, Y
, x
, 70, 70, 90, R32_SINT
)
158 SF( Y
, x
, x
, x
, Y
, x
, Y
, Y
, x
, 70, 70, 90, R32_UINT
)
159 SF( Y
, 50, Y
, x
, Y
, Y
, Y
, Y
, x
, 70, 70, 90, R32_FLOAT
)
160 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, R24_UNORM_X8_TYPELESS
)
161 SF( Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, X24_TYPELESS_G8_UINT
)
162 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, L16A16_UNORM
)
163 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, I24X8_UNORM
)
164 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, L24X8_UNORM
)
165 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, A24X8_UNORM
)
166 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, I32_FLOAT
)
167 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, L32_FLOAT
)
168 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, A32_FLOAT
)
169 SF( Y
, Y
, x
, Y
, 80, 80, x
, x
, 60, x
, x
, 90, B8G8R8X8_UNORM
)
170 SF( Y
, Y
, x
, x
, 80, 80, x
, x
, x
, x
, x
, 100, B8G8R8X8_UNORM_SRGB
)
171 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, R8G8B8X8_UNORM
)
172 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, R8G8B8X8_UNORM_SRGB
)
173 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, R9G9B9E5_SHAREDEXP
)
174 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, B10G10R10X2_UNORM
)
175 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, L16A16_FLOAT
)
176 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32_UNORM
)
177 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32_SNORM
)
178 /* smpl filt shad CK RT AB VB SO color TW TR ccs_e */
179 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R10G10B10X2_USCALED
)
180 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R8G8B8A8_SSCALED
)
181 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R8G8B8A8_USCALED
)
182 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R16G16_SSCALED
)
183 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R16G16_USCALED
)
184 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32_SSCALED
)
185 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R32_USCALED
)
186 SF( Y
, Y
, x
, Y
, Y
, Y
, x
, x
, x
, 70, x
, x
, B5G6R5_UNORM
)
187 SF( Y
, Y
, x
, x
, Y
, Y
, x
, x
, x
, x
, x
, x
, B5G6R5_UNORM_SRGB
)
188 SF( Y
, Y
, x
, Y
, Y
, Y
, x
, x
, x
, 70, x
, x
, B5G5R5A1_UNORM
)
189 SF( Y
, Y
, x
, x
, Y
, Y
, x
, x
, x
, x
, x
, x
, B5G5R5A1_UNORM_SRGB
)
190 SF( Y
, Y
, x
, Y
, Y
, Y
, x
, x
, x
, 70, x
, x
, B4G4R4A4_UNORM
)
191 SF( Y
, Y
, x
, x
, Y
, Y
, x
, x
, x
, x
, x
, x
, B4G4R4A4_UNORM_SRGB
)
192 SF( Y
, Y
, x
, x
, Y
, Y
, Y
, x
, x
, 70, x
, x
, R8G8_UNORM
)
193 SF( Y
, Y
, x
, Y
, Y
, 60, Y
, x
, x
, 70, x
, x
, R8G8_SNORM
)
194 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 70, 90, x
, R8G8_SINT
)
195 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 70, 75, x
, R8G8_UINT
)
196 SF( Y
, Y
, Y
, x
, Y
, 45, Y
, x
, 70, 70, x
, x
, R16_UNORM
)
197 SF( Y
, Y
, x
, x
, Y
, 60, Y
, x
, x
, 70, x
, x
, R16_SNORM
)
198 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 70, 90, x
, R16_SINT
)
199 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 70, 75, x
, R16_UINT
)
200 SF( Y
, Y
, x
, x
, Y
, Y
, Y
, x
, x
, 70, 90, x
, R16_FLOAT
)
201 SF( 50, 50, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, A8P8_UNORM_PALETTE0
)
202 SF( 50, 50, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, A8P8_UNORM_PALETTE1
)
203 SF( Y
, Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, I16_UNORM
)
204 SF( Y
, Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, L16_UNORM
)
205 SF( Y
, Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, A16_UNORM
)
206 SF( Y
, Y
, x
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, L8A8_UNORM
)
207 SF( Y
, Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, I16_FLOAT
)
208 SF( Y
, Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, L16_FLOAT
)
209 SF( Y
, Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, A16_FLOAT
)
210 SF( 45, 45, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, L8A8_UNORM_SRGB
)
211 SF( Y
, Y
, x
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, R5G5_SNORM_B6_UNORM
)
212 SF( x
, x
, x
, x
, Y
, Y
, x
, x
, x
, 70, x
, x
, B5G5R5X1_UNORM
)
213 SF( x
, x
, x
, x
, Y
, Y
, x
, x
, x
, x
, x
, x
, B5G5R5X1_UNORM_SRGB
)
214 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R8G8_SSCALED
)
215 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R8G8_USCALED
)
216 /* smpl filt shad CK RT AB VB SO color TW TR ccs_e */
217 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R16_SSCALED
)
218 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R16_USCALED
)
219 SF( 50, 50, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, P8A8_UNORM_PALETTE0
)
220 SF( 50, 50, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, P8A8_UNORM_PALETTE1
)
221 SF( x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, A1B5G5R5_UNORM
)
222 /* According to the PRM, A4B4G4R4_UNORM isn't supported until Sky Lake
223 * but empirical testing indicates that at least sampling works just fine
226 SF( 80, 80, x
, x
, 90, x
, x
, x
, x
, x
, x
, x
, A4B4G4R4_UNORM
)
227 SF( 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, L8A8_UINT
)
228 SF( 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, L8A8_SINT
)
229 SF( Y
, Y
, x
, 45, Y
, Y
, Y
, x
, x
, 70, x
, x
, R8_UNORM
)
230 SF( Y
, Y
, x
, x
, Y
, 60, Y
, x
, x
, 70, x
, x
, R8_SNORM
)
231 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 70, 90, x
, R8_SINT
)
232 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 70, 75, x
, R8_UINT
)
233 SF( Y
, Y
, x
, Y
, Y
, Y
, x
, x
, x
, 70, x
, x
, A8_UNORM
)
234 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, I8_UNORM
)
235 SF( Y
, Y
, x
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, L8_UNORM
)
236 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, P4A4_UNORM_PALETTE0
)
237 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, A4P4_UNORM_PALETTE0
)
238 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R8_SSCALED
)
239 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R8_USCALED
)
240 SF( 45, 45, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, P8_UNORM_PALETTE0
)
241 SF( 45, 45, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, L8_UNORM_SRGB
)
242 SF( 45, 45, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, P8_UNORM_PALETTE1
)
243 SF( 45, 45, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, P4A4_UNORM_PALETTE1
)
244 SF( 45, 45, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, A4P4_UNORM_PALETTE1
)
245 SF( x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, Y8_UNORM
)
246 SF( 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, L8_UINT
)
247 SF( 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, L8_SINT
)
248 SF( 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, I8_UINT
)
249 SF( 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, I8_SINT
)
250 SF( 45, 45, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, DXT1_RGB_SRGB
)
251 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, R1_UNORM
)
252 SF( Y
, Y
, x
, Y
, Y
, x
, x
, x
, 60, x
, x
, x
, YCRCB_NORMAL
)
253 SF( Y
, Y
, x
, Y
, Y
, x
, x
, x
, 60, x
, x
, x
, YCRCB_SWAPUVY
)
254 SF( 45, 45, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, P2_UNORM_PALETTE0
)
255 SF( 45, 45, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, P2_UNORM_PALETTE1
)
256 SF( Y
, Y
, x
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, BC1_UNORM
)
257 SF( Y
, Y
, x
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, BC2_UNORM
)
258 SF( Y
, Y
, x
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, BC3_UNORM
)
259 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, BC4_UNORM
)
260 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, BC5_UNORM
)
261 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, BC1_UNORM_SRGB
)
262 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, BC2_UNORM_SRGB
)
263 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, BC3_UNORM_SRGB
)
264 SF( Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, MONO8
)
265 SF( Y
, Y
, x
, x
, Y
, x
, x
, x
, 60, x
, x
, x
, YCRCB_SWAPUV
)
266 SF( Y
, Y
, x
, x
, Y
, x
, x
, x
, 60, x
, x
, x
, YCRCB_SWAPY
)
267 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, DXT1_RGB
)
268 /* smpl filt shad CK RT AB VB SO color TW TR ccs_e */
269 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, FXT1
)
270 SF( 75, 75, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R8G8B8_UNORM
)
271 SF( 75, 75, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R8G8B8_SNORM
)
272 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R8G8B8_SSCALED
)
273 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R8G8B8_USCALED
)
274 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R64G64B64A64_FLOAT
)
275 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R64G64B64_FLOAT
)
276 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, BC4_SNORM
)
277 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, BC5_SNORM
)
278 SF( 50, 50, x
, x
, x
, x
, 60, x
, x
, x
, x
, x
, R16G16B16_FLOAT
)
279 SF( 75, 75, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R16G16B16_UNORM
)
280 SF( 75, 75, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R16G16B16_SNORM
)
281 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R16G16B16_SSCALED
)
282 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, x
, x
, R16G16B16_USCALED
)
283 SF( 70, 70, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, BC6H_SF16
)
284 SF( 70, 70, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, BC7_UNORM
)
285 SF( 70, 70, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, BC7_UNORM_SRGB
)
286 SF( 70, 70, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, BC6H_UF16
)
287 SF( x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, PLANAR_420_8
)
288 SF( 75, 75, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, R8G8B8_UNORM_SRGB
)
289 SF( 80, 80, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ETC1_RGB8
)
290 SF( 80, 80, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ETC2_RGB8
)
291 SF( 80, 80, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, EAC_R11
)
292 SF( 80, 80, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, EAC_RG11
)
293 SF( 80, 80, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, EAC_SIGNED_R11
)
294 SF( 80, 80, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, EAC_SIGNED_RG11
)
295 SF( 80, 80, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ETC2_SRGB8
)
296 SF( 90, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, R16G16B16_UINT
)
297 SF( 90, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, R16G16B16_SINT
)
298 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, R32_SFIXED
)
299 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, R10G10B10A2_SNORM
)
300 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, R10G10B10A2_USCALED
)
301 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, R10G10B10A2_SSCALED
)
302 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, R10G10B10A2_SINT
)
303 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, B10G10R10A2_SNORM
)
304 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, B10G10R10A2_USCALED
)
305 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, B10G10R10A2_SSCALED
)
306 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, B10G10R10A2_UINT
)
307 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, B10G10R10A2_SINT
)
308 SF( x
, x
, x
, x
, x
, x
, 80, x
, x
, x
, x
, x
, R64G64B64A64_PASSTHRU
)
309 SF( x
, x
, x
, x
, x
, x
, 80, x
, x
, x
, x
, x
, R64G64B64_PASSTHRU
)
310 SF( 80, 80, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ETC2_RGB8_PTA
)
311 SF( 80, 80, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ETC2_SRGB8_PTA
)
312 SF( 80, 80, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ETC2_EAC_RGBA8
)
313 SF( 80, 80, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ETC2_EAC_SRGB8_A8
)
314 SF( 90, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, R8G8B8_UINT
)
315 SF( 90, x
, x
, x
, x
, x
, 75, x
, x
, x
, x
, x
, R8G8B8_SINT
)
316 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_4X4_FLT16
)
317 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_5X4_FLT16
)
318 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_5X5_FLT16
)
319 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_6X5_FLT16
)
320 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_6X6_FLT16
)
321 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_8X5_FLT16
)
322 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_8X6_FLT16
)
323 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_8X8_FLT16
)
324 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X5_FLT16
)
325 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X6_FLT16
)
326 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X8_FLT16
)
327 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X10_FLT16
)
328 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_12X10_FLT16
)
329 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_12X12_FLT16
)
330 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_4X4_U8SRGB
)
331 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_5X4_U8SRGB
)
332 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_5X5_U8SRGB
)
333 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_6X5_U8SRGB
)
334 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_6X6_U8SRGB
)
335 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_8X5_U8SRGB
)
336 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_8X6_U8SRGB
)
337 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_8X8_U8SRGB
)
338 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X5_U8SRGB
)
339 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X6_U8SRGB
)
340 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X8_U8SRGB
)
341 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X10_U8SRGB
)
342 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_12X10_U8SRGB
)
343 SF( 90, 90, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_12X12_U8SRGB
)
344 SF(100, 100, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_HDR_2D_4X4_FLT16
)
345 SF(100, 100, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_HDR_2D_5X4_FLT16
)
346 SF(100, 100, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_HDR_2D_5X5_FLT16
)
347 SF(100, 100, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_HDR_2D_6X5_FLT16
)
348 SF(100, 100, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_HDR_2D_6X6_FLT16
)
349 SF(100, 100, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_HDR_2D_8X5_FLT16
)
350 SF(100, 100, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_HDR_2D_8X6_FLT16
)
351 SF(100, 100, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_HDR_2D_8X8_FLT16
)
352 SF(100, 100, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_HDR_2D_10X5_FLT16
)
353 SF(100, 100, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_HDR_2D_10X6_FLT16
)
354 SF(100, 100, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_HDR_2D_10X8_FLT16
)
355 SF(100, 100, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_HDR_2D_10X10_FLT16
)
356 SF(100, 100, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_HDR_2D_12X10_FLT16
)
357 SF(100, 100, x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_HDR_2D_12X12_FLT16
)
363 format_gen(const struct gen_device_info
*devinfo
)
365 return devinfo
->gen
* 10 + (devinfo
->is_g4x
|| devinfo
->is_haswell
) * 5;
369 isl_format_supports_rendering(const struct gen_device_info
*devinfo
,
370 enum isl_format format
)
372 if (!format_info
[format
].exists
)
375 return format_gen(devinfo
) >= format_info
[format
].render_target
;
379 isl_format_supports_alpha_blending(const struct gen_device_info
*devinfo
,
380 enum isl_format format
)
382 if (!format_info
[format
].exists
)
385 return format_gen(devinfo
) >= format_info
[format
].alpha_blend
;
389 isl_format_supports_sampling(const struct gen_device_info
*devinfo
,
390 enum isl_format format
)
392 if (!format_info
[format
].exists
)
395 if (devinfo
->is_baytrail
) {
396 const struct isl_format_layout
*fmtl
= isl_format_get_layout(format
);
397 /* Support for ETC1 and ETC2 exists on Bay Trail even though big-core
398 * GPUs didn't get it until Broadwell.
400 if (fmtl
->txc
== ISL_TXC_ETC1
|| fmtl
->txc
== ISL_TXC_ETC2
)
402 } else if (devinfo
->is_cherryview
) {
403 const struct isl_format_layout
*fmtl
= isl_format_get_layout(format
);
404 /* Support for ASTC LDR exists on Cherry View even though big-core
405 * GPUs didn't get it until Skylake.
407 if (fmtl
->txc
== ISL_TXC_ASTC
)
408 return format
< ISL_FORMAT_ASTC_HDR_2D_4X4_FLT16
;
409 } else if (gen_device_info_is_9lp(devinfo
)) {
410 const struct isl_format_layout
*fmtl
= isl_format_get_layout(format
);
411 /* Support for ASTC HDR exists on Broxton even though big-core
412 * GPUs didn't get it until Cannonlake.
414 if (fmtl
->txc
== ISL_TXC_ASTC
)
418 return format_gen(devinfo
) >= format_info
[format
].sampling
;
422 isl_format_supports_filtering(const struct gen_device_info
*devinfo
,
423 enum isl_format format
)
425 if (!format_info
[format
].exists
)
428 if (devinfo
->is_baytrail
) {
429 const struct isl_format_layout
*fmtl
= isl_format_get_layout(format
);
430 /* Support for ETC1 and ETC2 exists on Bay Trail even though big-core
431 * GPUs didn't get it until Broadwell.
433 if (fmtl
->txc
== ISL_TXC_ETC1
|| fmtl
->txc
== ISL_TXC_ETC2
)
435 } else if (devinfo
->is_cherryview
) {
436 const struct isl_format_layout
*fmtl
= isl_format_get_layout(format
);
437 /* Support for ASTC LDR exists on Cherry View even though big-core
438 * GPUs didn't get it until Skylake.
440 if (fmtl
->txc
== ISL_TXC_ASTC
)
441 return format
< ISL_FORMAT_ASTC_HDR_2D_4X4_FLT16
;
442 } else if (gen_device_info_is_9lp(devinfo
)) {
443 const struct isl_format_layout
*fmtl
= isl_format_get_layout(format
);
444 /* Support for ASTC HDR exists on Broxton even though big-core
445 * GPUs didn't get it until Cannonlake.
447 if (fmtl
->txc
== ISL_TXC_ASTC
)
451 return format_gen(devinfo
) >= format_info
[format
].filtering
;
455 isl_format_supports_vertex_fetch(const struct gen_device_info
*devinfo
,
456 enum isl_format format
)
458 if (!format_info
[format
].exists
)
461 /* For vertex fetch, Bay Trail supports the same set of formats as Haswell
462 * but is a superset of Ivy Bridge.
464 if (devinfo
->is_baytrail
)
465 return 75 >= format_info
[format
].input_vb
;
467 return format_gen(devinfo
) >= format_info
[format
].input_vb
;
471 * Returns true if the given format can support typed writes.
474 isl_format_supports_typed_writes(const struct gen_device_info
*devinfo
,
475 enum isl_format format
)
477 if (!format_info
[format
].exists
)
480 return format_gen(devinfo
) >= format_info
[format
].typed_write
;
485 * Returns true if the given format can support typed reads with format
486 * conversion fully handled by hardware. On Sky Lake, all formats which are
487 * supported for typed writes also support typed reads but some of them return
488 * the raw image data and don't provide format conversion.
490 * For anyone looking to find this data in the PRM, the easiest way to find
491 * format tables is to search for R11G11B10. There are only a few
495 isl_format_supports_typed_reads(const struct gen_device_info
*devinfo
,
496 enum isl_format format
)
498 if (!format_info
[format
].exists
)
501 return format_gen(devinfo
) >= format_info
[format
].typed_read
;
505 * Returns true if the given format can support single-sample fast clears.
506 * This function only checks the format. In order to determine if a surface
507 * supports CCS_E, several other factors need to be considered such as tiling
508 * and sample count. See isl_surf_get_ccs_surf for details.
511 isl_format_supports_ccs_d(const struct gen_device_info
*devinfo
,
512 enum isl_format format
)
514 /* Fast clears were first added on Ivy Bridge */
515 if (devinfo
->gen
< 7)
518 if (!isl_format_supports_rendering(devinfo
, format
))
521 const struct isl_format_layout
*fmtl
= isl_format_get_layout(format
);
523 return fmtl
->bpb
== 32 || fmtl
->bpb
== 64 || fmtl
->bpb
== 128;
527 * Returns true if the given format can support single-sample color
528 * compression. This function only checks the format. In order to determine
529 * if a surface supports CCS_E, several other factors need to be considered
530 * such as tiling and sample count. See isl_surf_get_ccs_surf for details.
533 isl_format_supports_ccs_e(const struct gen_device_info
*devinfo
,
534 enum isl_format format
)
536 if (!format_info
[format
].exists
)
539 /* For simplicity, only report that a format supports CCS_E if blorp can
540 * perform bit-for-bit copies with an image of that format while compressed.
541 * This allows ISL users to avoid having to resolve the image before
542 * performing such a copy. We may want to change this behavior in the
545 * R11G11B10_FLOAT has no equivalent UINT format. Given how blorp_copy
546 * currently works, bit-for-bit copy operations are not possible without an
547 * intermediate resolve.
549 if (format
== ISL_FORMAT_R11G11B10_FLOAT
)
552 /* blorp_copy currently doesn't support formats with different bit-widths
553 * per-channel. Until that support is added, report that these formats don't
554 * support CCS_E. FIXME: Add support for these formats.
556 if (format
== ISL_FORMAT_B10G10R10A2_UNORM
||
557 format
== ISL_FORMAT_B10G10R10A2_UNORM_SRGB
||
558 format
== ISL_FORMAT_R10G10B10A2_UNORM
||
559 format
== ISL_FORMAT_R10G10B10A2_UINT
) {
563 return format_gen(devinfo
) >= format_info
[format
].ccs_e
;
567 isl_format_supports_multisampling(const struct gen_device_info
*devinfo
,
568 enum isl_format format
)
570 /* From the Sandybridge PRM, Volume 4 Part 1 p72, SURFACE_STATE, Surface
573 * If Number of Multisamples is set to a value other than
574 * MULTISAMPLECOUNT_1, this field cannot be set to the following
577 * - any format with greater than 64 bits per element
578 * - any compressed texture format (BC*)
579 * - any YCRCB* format
581 * The restriction on the format's size is removed on Broadwell. Moreover,
582 * empirically it looks that even IvyBridge can handle multisampled surfaces
583 * with format sizes all the way to 128-bits (RGBA32F, RGBA32I, RGBA32UI).
585 * Also, there is an exception for HiZ which we treat as a compressed
586 * format and is allowed to be multisampled on Broadwell and earlier.
588 if (format
== ISL_FORMAT_HIZ
) {
589 /* On SKL+, HiZ is always single-sampled even when the primary surface
590 * is multisampled. See also isl_surf_get_hiz_surf().
592 return devinfo
->gen
<= 8;
593 } else if (devinfo
->gen
< 7 && isl_format_get_layout(format
)->bpb
> 64) {
595 } else if (isl_format_is_compressed(format
)) {
597 } else if (isl_format_is_yuv(format
)) {
605 * Returns true if the two formats are "CCS_E compatible" meaning that you can
606 * render in one format with CCS_E enabled and then texture using the other
607 * format without needing a resolve.
609 * Note: Even if the formats are compatible, special care must be taken if a
610 * clear color is involved because the encoding of the clear color is heavily
614 isl_formats_are_ccs_e_compatible(const struct gen_device_info
*devinfo
,
615 enum isl_format format1
,
616 enum isl_format format2
)
618 /* They must support CCS_E */
619 if (!isl_format_supports_ccs_e(devinfo
, format1
) ||
620 !isl_format_supports_ccs_e(devinfo
, format2
))
623 const struct isl_format_layout
*fmtl1
= isl_format_get_layout(format1
);
624 const struct isl_format_layout
*fmtl2
= isl_format_get_layout(format2
);
626 /* The compression used by CCS is not dependent on the actual data encoding
627 * of the format but only depends on the bit-layout of the channels.
629 return fmtl1
->channels
.r
.bits
== fmtl2
->channels
.r
.bits
&&
630 fmtl1
->channels
.g
.bits
== fmtl2
->channels
.g
.bits
&&
631 fmtl1
->channels
.b
.bits
== fmtl2
->channels
.b
.bits
&&
632 fmtl1
->channels
.a
.bits
== fmtl2
->channels
.a
.bits
;
636 isl_format_has_channel_type(enum isl_format fmt
, enum isl_base_type type
)
638 const struct isl_format_layout
*fmtl
= isl_format_get_layout(fmt
);
640 return fmtl
->channels
.r
.type
== type
||
641 fmtl
->channels
.g
.type
== type
||
642 fmtl
->channels
.b
.type
== type
||
643 fmtl
->channels
.a
.type
== type
||
644 fmtl
->channels
.l
.type
== type
||
645 fmtl
->channels
.i
.type
== type
||
646 fmtl
->channels
.p
.type
== type
;
650 isl_format_has_unorm_channel(enum isl_format fmt
)
652 return isl_format_has_channel_type(fmt
, ISL_UNORM
);
656 isl_format_has_snorm_channel(enum isl_format fmt
)
658 return isl_format_has_channel_type(fmt
, ISL_SNORM
);
662 isl_format_has_ufloat_channel(enum isl_format fmt
)
664 return isl_format_has_channel_type(fmt
, ISL_UFLOAT
);
668 isl_format_has_sfloat_channel(enum isl_format fmt
)
670 return isl_format_has_channel_type(fmt
, ISL_SFLOAT
);
674 isl_format_has_uint_channel(enum isl_format fmt
)
676 return isl_format_has_channel_type(fmt
, ISL_UINT
);
680 isl_format_has_sint_channel(enum isl_format fmt
)
682 return isl_format_has_channel_type(fmt
, ISL_SINT
);
686 isl_format_get_num_channels(enum isl_format fmt
)
688 const struct isl_format_layout
*fmtl
= isl_format_get_layout(fmt
);
690 assert(fmtl
->channels
.p
.bits
== 0);
692 return (fmtl
->channels
.r
.bits
> 0) +
693 (fmtl
->channels
.g
.bits
> 0) +
694 (fmtl
->channels
.b
.bits
> 0) +
695 (fmtl
->channels
.a
.bits
> 0) +
696 (fmtl
->channels
.l
.bits
> 0) +
697 (fmtl
->channels
.i
.bits
> 0);
701 isl_format_get_depth_format(enum isl_format fmt
, bool has_stencil
)
705 unreachable("bad isl depth format");
706 case ISL_FORMAT_R32_FLOAT_X8X24_TYPELESS
:
708 return 0; /* D32_FLOAT_S8X24_UINT */
709 case ISL_FORMAT_R32_FLOAT
:
710 assert(!has_stencil
);
711 return 1; /* D32_FLOAT */
712 case ISL_FORMAT_R24_UNORM_X8_TYPELESS
:
714 return 2; /* D24_UNORM_S8_UINT */
716 return 3; /* D24_UNORM_X8_UINT */
718 case ISL_FORMAT_R16_UNORM
:
719 assert(!has_stencil
);
720 return 5; /* D16_UNORM */
725 isl_format_rgb_to_rgba(enum isl_format rgb
)
727 assert(isl_format_is_rgb(rgb
));
730 case ISL_FORMAT_R32G32B32_FLOAT
: return ISL_FORMAT_R32G32B32A32_FLOAT
;
731 case ISL_FORMAT_R32G32B32_SINT
: return ISL_FORMAT_R32G32B32A32_SINT
;
732 case ISL_FORMAT_R32G32B32_UINT
: return ISL_FORMAT_R32G32B32A32_UINT
;
733 case ISL_FORMAT_R32G32B32_UNORM
: return ISL_FORMAT_R32G32B32A32_UNORM
;
734 case ISL_FORMAT_R32G32B32_SNORM
: return ISL_FORMAT_R32G32B32A32_SNORM
;
735 case ISL_FORMAT_R32G32B32_SSCALED
: return ISL_FORMAT_R32G32B32A32_SSCALED
;
736 case ISL_FORMAT_R32G32B32_USCALED
: return ISL_FORMAT_R32G32B32A32_USCALED
;
737 case ISL_FORMAT_R32G32B32_SFIXED
: return ISL_FORMAT_R32G32B32A32_SFIXED
;
738 case ISL_FORMAT_R8G8B8_UNORM
: return ISL_FORMAT_R8G8B8A8_UNORM
;
739 case ISL_FORMAT_R8G8B8_SNORM
: return ISL_FORMAT_R8G8B8A8_SNORM
;
740 case ISL_FORMAT_R8G8B8_SSCALED
: return ISL_FORMAT_R8G8B8A8_SSCALED
;
741 case ISL_FORMAT_R8G8B8_USCALED
: return ISL_FORMAT_R8G8B8A8_USCALED
;
742 case ISL_FORMAT_R16G16B16_FLOAT
: return ISL_FORMAT_R16G16B16A16_FLOAT
;
743 case ISL_FORMAT_R16G16B16_UNORM
: return ISL_FORMAT_R16G16B16A16_UNORM
;
744 case ISL_FORMAT_R16G16B16_SNORM
: return ISL_FORMAT_R16G16B16A16_SNORM
;
745 case ISL_FORMAT_R16G16B16_SSCALED
: return ISL_FORMAT_R16G16B16A16_SSCALED
;
746 case ISL_FORMAT_R16G16B16_USCALED
: return ISL_FORMAT_R16G16B16A16_USCALED
;
747 case ISL_FORMAT_R8G8B8_UNORM_SRGB
: return ISL_FORMAT_R8G8B8A8_UNORM_SRGB
;
748 case ISL_FORMAT_R16G16B16_UINT
: return ISL_FORMAT_R16G16B16A16_UINT
;
749 case ISL_FORMAT_R16G16B16_SINT
: return ISL_FORMAT_R16G16B16A16_SINT
;
750 case ISL_FORMAT_R8G8B8_UINT
: return ISL_FORMAT_R8G8B8A8_UINT
;
751 case ISL_FORMAT_R8G8B8_SINT
: return ISL_FORMAT_R8G8B8A8_SINT
;
753 return ISL_FORMAT_UNSUPPORTED
;
758 isl_format_rgb_to_rgbx(enum isl_format rgb
)
760 assert(isl_format_is_rgb(rgb
));
763 case ISL_FORMAT_R32G32B32_FLOAT
:
764 return ISL_FORMAT_R32G32B32X32_FLOAT
;
765 case ISL_FORMAT_R16G16B16_UNORM
:
766 return ISL_FORMAT_R16G16B16X16_UNORM
;
767 case ISL_FORMAT_R16G16B16_FLOAT
:
768 return ISL_FORMAT_R16G16B16X16_FLOAT
;
769 case ISL_FORMAT_R8G8B8_UNORM
:
770 return ISL_FORMAT_R8G8B8X8_UNORM
;
771 case ISL_FORMAT_R8G8B8_UNORM_SRGB
:
772 return ISL_FORMAT_R8G8B8X8_UNORM_SRGB
;
774 return ISL_FORMAT_UNSUPPORTED
;