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 "common/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
;
40 uint8_t lossless_compression
;
43 /* This macro allows us to write the table almost as it appears in the PRM,
44 * while restructuring it to turn it into the C code we want.
46 #define SF(sampl, filt, shad, ck, rt, ab, vb, so, color, ccs_e, sf) \
47 [ISL_FORMAT_##sf] = { true, sampl, filt, shad, ck, rt, ab, vb, so, color, ccs_e},
52 * This is the table of support for surface (texture, renderbuffer, and vertex
53 * buffer, but not depthbuffer) formats across the various hardware generations.
55 * The table is formatted to match the documentation, except that the docs have
56 * this ridiculous mapping of Y[*+~^#&] for "supported on DevWhatever". To put
57 * it in our table, here's the mapping:
65 * The abbreviations in the header below are:
66 * smpl - Sampling Engine
67 * filt - Sampling Engine Filtering
68 * shad - Sampling Engine Shadow Map
69 * CK - Sampling Engine Chroma Key
71 * AB - Alpha Blend Render Target
72 * VB - Input Vertex Buffer
73 * SO - Steamed Output Vertex Buffers (transform feedback)
74 * color - Color Processing
75 * ccs_e - Lossless Compression Support (gen9+ only)
78 * See page 88 of the Sandybridge PRM VOL4_Part1 PDF.
80 * As of Ivybridge, the columns are no longer in that table and the
81 * information can be found spread across:
83 * - VOL2_Part1 section 2.5.11 Format Conversion (vertex fetch).
84 * - VOL4_Part1 section 2.12.2.1.2 Sampler Output Channel Mapping.
85 * - VOL4_Part1 section 3.9.11 Render Target Write.
86 * - Render Target Surface Types [SKL+]
88 static const struct surface_format_info format_info
[] = {
89 /* smpl filt shad CK RT AB VB SO color ccs_e */
90 SF( Y
, 50, x
, x
, Y
, Y
, Y
, Y
, x
, 90, R32G32B32A32_FLOAT
)
91 SF( Y
, x
, x
, x
, Y
, x
, Y
, Y
, x
, 90, R32G32B32A32_SINT
)
92 SF( Y
, x
, x
, x
, Y
, x
, Y
, Y
, x
, 90, R32G32B32A32_UINT
)
93 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32G32B32A32_UNORM
)
94 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32G32B32A32_SNORM
)
95 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R64G64_FLOAT
)
96 SF( Y
, 50, x
, x
, x
, x
, x
, x
, x
, x
, R32G32B32X32_FLOAT
)
97 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32G32B32A32_SSCALED
)
98 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32G32B32A32_USCALED
)
99 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, R32G32B32A32_SFIXED
)
100 SF( x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, R64G64_PASSTHRU
)
101 SF( Y
, 50, x
, x
, x
, x
, Y
, Y
, x
, x
, R32G32B32_FLOAT
)
102 SF( Y
, x
, x
, x
, x
, x
, Y
, Y
, x
, x
, R32G32B32_SINT
)
103 SF( Y
, x
, x
, x
, x
, x
, Y
, Y
, x
, x
, R32G32B32_UINT
)
104 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32G32B32_UNORM
)
105 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32G32B32_SNORM
)
106 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32G32B32_SSCALED
)
107 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32G32B32_USCALED
)
108 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, R32G32B32_SFIXED
)
109 SF( Y
, Y
, x
, x
, Y
, 45, Y
, x
, 60, 90, R16G16B16A16_UNORM
)
110 SF( Y
, Y
, x
, x
, Y
, 60, Y
, x
, x
, 90, R16G16B16A16_SNORM
)
111 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 90, R16G16B16A16_SINT
)
112 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 90, R16G16B16A16_UINT
)
113 SF( Y
, Y
, x
, x
, Y
, Y
, Y
, x
, x
, 90, R16G16B16A16_FLOAT
)
114 SF( Y
, 50, x
, x
, Y
, Y
, Y
, Y
, x
, 90, R32G32_FLOAT
)
115 SF( Y
, 70, x
, x
, Y
, Y
, Y
, Y
, x
, x
, R32G32_FLOAT_LD
)
116 SF( Y
, x
, x
, x
, Y
, x
, Y
, Y
, x
, 90, R32G32_SINT
)
117 SF( Y
, x
, x
, x
, Y
, x
, Y
, Y
, x
, 90, R32G32_UINT
)
118 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, R32_FLOAT_X8X24_TYPELESS
)
119 SF( Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, X32_TYPELESS_G8X24_UINT
)
120 SF( Y
, 50, x
, x
, x
, x
, x
, x
, x
, x
, L32A32_FLOAT
)
121 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32G32_UNORM
)
122 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32G32_SNORM
)
123 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R64_FLOAT
)
124 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, R16G16B16X16_UNORM
)
125 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, 90, R16G16B16X16_FLOAT
)
126 SF( Y
, 50, x
, x
, x
, x
, x
, x
, x
, x
, A32X32_FLOAT
)
127 SF( Y
, 50, x
, x
, x
, x
, x
, x
, x
, x
, L32X32_FLOAT
)
128 SF( Y
, 50, x
, x
, x
, x
, x
, x
, x
, x
, I32X32_FLOAT
)
129 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R16G16B16A16_SSCALED
)
130 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R16G16B16A16_USCALED
)
131 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32G32_SSCALED
)
132 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32G32_USCALED
)
133 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, R32G32_SFIXED
)
134 SF( x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, R64_PASSTHRU
)
135 SF( Y
, Y
, x
, Y
, Y
, Y
, Y
, x
, 60, 90, B8G8R8A8_UNORM
)
136 SF( Y
, Y
, x
, x
, Y
, Y
, x
, x
, x
, x
, B8G8R8A8_UNORM_SRGB
)
137 /* smpl filt shad CK RT AB VB SO color ccs_e */
138 SF( Y
, Y
, x
, x
, Y
, Y
, Y
, x
, 60, x
, R10G10B10A2_UNORM
)
139 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, 60, x
, R10G10B10A2_UNORM_SRGB
)
140 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, x
, R10G10B10A2_UINT
)
141 SF( Y
, Y
, x
, x
, x
, x
, Y
, x
, x
, x
, R10G10B10_SNORM_A2_UNORM
)
142 SF( Y
, Y
, x
, x
, Y
, Y
, Y
, x
, 60, 90, R8G8B8A8_UNORM
)
143 SF( Y
, Y
, x
, x
, Y
, Y
, x
, x
, 60, x
, R8G8B8A8_UNORM_SRGB
)
144 SF( Y
, Y
, x
, x
, Y
, 60, Y
, x
, x
, 90, R8G8B8A8_SNORM
)
145 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 90, R8G8B8A8_SINT
)
146 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 90, R8G8B8A8_UINT
)
147 SF( Y
, Y
, x
, x
, Y
, 45, Y
, x
, x
, 90, R16G16_UNORM
)
148 SF( Y
, Y
, x
, x
, Y
, 60, Y
, x
, x
, 90, R16G16_SNORM
)
149 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 90, R16G16_SINT
)
150 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, 90, R16G16_UINT
)
151 SF( Y
, Y
, x
, x
, Y
, Y
, Y
, x
, x
, 90, R16G16_FLOAT
)
152 SF( Y
, Y
, x
, x
, Y
, Y
, 75, x
, 60, x
, B10G10R10A2_UNORM
)
153 SF( Y
, Y
, x
, x
, Y
, Y
, x
, x
, 60, x
, B10G10R10A2_UNORM_SRGB
)
154 SF( Y
, Y
, x
, x
, Y
, Y
, Y
, x
, x
, x
, R11G11B10_FLOAT
)
155 SF( Y
, x
, x
, x
, Y
, x
, Y
, Y
, x
, 90, R32_SINT
)
156 SF( Y
, x
, x
, x
, Y
, x
, Y
, Y
, x
, 90, R32_UINT
)
157 SF( Y
, 50, Y
, x
, Y
, Y
, Y
, Y
, x
, 90, R32_FLOAT
)
158 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, R24_UNORM_X8_TYPELESS
)
159 SF( Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, X24_TYPELESS_G8_UINT
)
160 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, L16A16_UNORM
)
161 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, I24X8_UNORM
)
162 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, L24X8_UNORM
)
163 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, A24X8_UNORM
)
164 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, I32_FLOAT
)
165 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, L32_FLOAT
)
166 SF( Y
, 50, Y
, x
, x
, x
, x
, x
, x
, x
, A32_FLOAT
)
167 SF( Y
, Y
, x
, Y
, 80, 80, x
, x
, 60, 90, B8G8R8X8_UNORM
)
168 SF( Y
, Y
, x
, x
, 80, 80, x
, x
, x
, x
, B8G8R8X8_UNORM_SRGB
)
169 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, R8G8B8X8_UNORM
)
170 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, R8G8B8X8_UNORM_SRGB
)
171 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, R9G9B9E5_SHAREDEXP
)
172 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, B10G10R10X2_UNORM
)
173 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, L16A16_FLOAT
)
174 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32_UNORM
)
175 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32_SNORM
)
176 /* smpl filt shad CK RT AB VB SO color ccs_e */
177 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R10G10B10X2_USCALED
)
178 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R8G8B8A8_SSCALED
)
179 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R8G8B8A8_USCALED
)
180 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R16G16_SSCALED
)
181 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R16G16_USCALED
)
182 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32_SSCALED
)
183 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R32_USCALED
)
184 SF( Y
, Y
, x
, Y
, Y
, Y
, x
, x
, x
, x
, B5G6R5_UNORM
)
185 SF( Y
, Y
, x
, x
, Y
, Y
, x
, x
, x
, x
, B5G6R5_UNORM_SRGB
)
186 SF( Y
, Y
, x
, Y
, Y
, Y
, x
, x
, x
, x
, B5G5R5A1_UNORM
)
187 SF( Y
, Y
, x
, x
, Y
, Y
, x
, x
, x
, x
, B5G5R5A1_UNORM_SRGB
)
188 SF( Y
, Y
, x
, Y
, Y
, Y
, x
, x
, x
, x
, B4G4R4A4_UNORM
)
189 SF( Y
, Y
, x
, x
, Y
, Y
, x
, x
, x
, x
, B4G4R4A4_UNORM_SRGB
)
190 SF( Y
, Y
, x
, x
, Y
, Y
, Y
, x
, x
, x
, R8G8_UNORM
)
191 SF( Y
, Y
, x
, Y
, Y
, 60, Y
, x
, x
, x
, R8G8_SNORM
)
192 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, x
, R8G8_SINT
)
193 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, x
, R8G8_UINT
)
194 SF( Y
, Y
, Y
, x
, Y
, 45, Y
, x
, 70, x
, R16_UNORM
)
195 SF( Y
, Y
, x
, x
, Y
, 60, Y
, x
, x
, x
, R16_SNORM
)
196 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, x
, R16_SINT
)
197 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, x
, R16_UINT
)
198 SF( Y
, Y
, x
, x
, Y
, Y
, Y
, x
, x
, x
, R16_FLOAT
)
199 SF(50, 50, x
, x
, x
, x
, x
, x
, x
, x
, A8P8_UNORM_PALETTE0
)
200 SF(50, 50, x
, x
, x
, x
, x
, x
, x
, x
, A8P8_UNORM_PALETTE1
)
201 SF( Y
, Y
, Y
, x
, x
, x
, x
, x
, x
, x
, I16_UNORM
)
202 SF( Y
, Y
, Y
, x
, x
, x
, x
, x
, x
, x
, L16_UNORM
)
203 SF( Y
, Y
, Y
, x
, x
, x
, x
, x
, x
, x
, A16_UNORM
)
204 SF( Y
, Y
, x
, Y
, x
, x
, x
, x
, x
, x
, L8A8_UNORM
)
205 SF( Y
, Y
, Y
, x
, x
, x
, x
, x
, x
, x
, I16_FLOAT
)
206 SF( Y
, Y
, Y
, x
, x
, x
, x
, x
, x
, x
, L16_FLOAT
)
207 SF( Y
, Y
, Y
, x
, x
, x
, x
, x
, x
, x
, A16_FLOAT
)
208 SF(45, 45, x
, x
, x
, x
, x
, x
, x
, x
, L8A8_UNORM_SRGB
)
209 SF( Y
, Y
, x
, Y
, x
, x
, x
, x
, x
, x
, R5G5_SNORM_B6_UNORM
)
210 SF( x
, x
, x
, x
, Y
, Y
, x
, x
, x
, x
, B5G5R5X1_UNORM
)
211 SF( x
, x
, x
, x
, Y
, Y
, x
, x
, x
, x
, B5G5R5X1_UNORM_SRGB
)
212 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R8G8_SSCALED
)
213 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R8G8_USCALED
)
214 /* smpl filt shad CK RT AB VB SO color ccs_e */
215 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R16_SSCALED
)
216 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R16_USCALED
)
217 SF(50, 50, x
, x
, x
, x
, x
, x
, x
, x
, P8A8_UNORM_PALETTE0
)
218 SF(50, 50, x
, x
, x
, x
, x
, x
, x
, x
, P8A8_UNORM_PALETTE1
)
219 SF( x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, A1B5G5R5_UNORM
)
220 /* According to the PRM, A4B4G4R4_UNORM isn't supported until Sky Lake
221 * but empirical testing indicates that it works just fine on Broadwell.
223 SF(80, 80, x
, x
, 80, x
, x
, x
, x
, x
, A4B4G4R4_UNORM
)
224 SF(90, x
, x
, x
, x
, x
, x
, x
, x
, x
, L8A8_UINT
)
225 SF(90, x
, x
, x
, x
, x
, x
, x
, x
, x
, L8A8_SINT
)
226 SF( Y
, Y
, x
, 45, Y
, Y
, Y
, x
, x
, x
, R8_UNORM
)
227 SF( Y
, Y
, x
, x
, Y
, 60, Y
, x
, x
, x
, R8_SNORM
)
228 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, x
, R8_SINT
)
229 SF( Y
, x
, x
, x
, Y
, x
, Y
, x
, x
, x
, R8_UINT
)
230 SF( Y
, Y
, x
, Y
, Y
, Y
, x
, x
, x
, x
, A8_UNORM
)
231 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, I8_UNORM
)
232 SF( Y
, Y
, x
, Y
, x
, x
, x
, x
, x
, x
, L8_UNORM
)
233 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, P4A4_UNORM_PALETTE0
)
234 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, A4P4_UNORM_PALETTE0
)
235 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R8_SSCALED
)
236 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R8_USCALED
)
237 SF(45, 45, x
, x
, x
, x
, x
, x
, x
, x
, P8_UNORM_PALETTE0
)
238 SF(45, 45, x
, x
, x
, x
, x
, x
, x
, x
, L8_UNORM_SRGB
)
239 SF(45, 45, x
, x
, x
, x
, x
, x
, x
, x
, P8_UNORM_PALETTE1
)
240 SF(45, 45, x
, x
, x
, x
, x
, x
, x
, x
, P4A4_UNORM_PALETTE1
)
241 SF(45, 45, x
, x
, x
, x
, x
, x
, x
, x
, A4P4_UNORM_PALETTE1
)
242 SF( x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, Y8_UNORM
)
243 SF(90, x
, x
, x
, x
, x
, x
, x
, x
, x
, L8_UINT
)
244 SF(90, x
, x
, x
, x
, x
, x
, x
, x
, x
, L8_SINT
)
245 SF(90, x
, x
, x
, x
, x
, x
, x
, x
, x
, I8_UINT
)
246 SF(90, x
, x
, x
, x
, x
, x
, x
, x
, x
, I8_SINT
)
247 SF(45, 45, x
, x
, x
, x
, x
, x
, x
, x
, DXT1_RGB_SRGB
)
248 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, R1_UNORM
)
249 SF( Y
, Y
, x
, Y
, Y
, x
, x
, x
, 60, x
, YCRCB_NORMAL
)
250 SF( Y
, Y
, x
, Y
, Y
, x
, x
, x
, 60, x
, YCRCB_SWAPUVY
)
251 SF(45, 45, x
, x
, x
, x
, x
, x
, x
, x
, P2_UNORM_PALETTE0
)
252 SF(45, 45, x
, x
, x
, x
, x
, x
, x
, x
, P2_UNORM_PALETTE1
)
253 SF( Y
, Y
, x
, Y
, x
, x
, x
, x
, x
, x
, BC1_UNORM
)
254 SF( Y
, Y
, x
, Y
, x
, x
, x
, x
, x
, x
, BC2_UNORM
)
255 SF( Y
, Y
, x
, Y
, x
, x
, x
, x
, x
, x
, BC3_UNORM
)
256 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, BC4_UNORM
)
257 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, BC5_UNORM
)
258 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, BC1_UNORM_SRGB
)
259 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, BC2_UNORM_SRGB
)
260 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, BC3_UNORM_SRGB
)
261 SF( Y
, x
, x
, x
, x
, x
, x
, x
, x
, x
, MONO8
)
262 SF( Y
, Y
, x
, x
, Y
, x
, x
, x
, 60, x
, YCRCB_SWAPUV
)
263 SF( Y
, Y
, x
, x
, Y
, x
, x
, x
, 60, x
, YCRCB_SWAPY
)
264 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, DXT1_RGB
)
265 /* smpl filt shad CK RT AB VB SO color ccs_e */
266 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, FXT1
)
267 SF(75, 75, x
, x
, x
, x
, Y
, x
, x
, x
, R8G8B8_UNORM
)
268 SF(75, 75, x
, x
, x
, x
, Y
, x
, x
, x
, R8G8B8_SNORM
)
269 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R8G8B8_SSCALED
)
270 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R8G8B8_USCALED
)
271 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R64G64B64A64_FLOAT
)
272 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R64G64B64_FLOAT
)
273 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, BC4_SNORM
)
274 SF( Y
, Y
, x
, x
, x
, x
, x
, x
, x
, x
, BC5_SNORM
)
275 SF(50, 50, x
, x
, x
, x
, 60, x
, x
, x
, R16G16B16_FLOAT
)
276 SF(75, 75, x
, x
, x
, x
, Y
, x
, x
, x
, R16G16B16_UNORM
)
277 SF(75, 75, x
, x
, x
, x
, Y
, x
, x
, x
, R16G16B16_SNORM
)
278 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R16G16B16_SSCALED
)
279 SF( x
, x
, x
, x
, x
, x
, Y
, x
, x
, x
, R16G16B16_USCALED
)
280 SF(70, 70, x
, x
, x
, x
, x
, x
, x
, x
, BC6H_SF16
)
281 SF(70, 70, x
, x
, x
, x
, x
, x
, x
, x
, BC7_UNORM
)
282 SF(70, 70, x
, x
, x
, x
, x
, x
, x
, x
, BC7_UNORM_SRGB
)
283 SF(70, 70, x
, x
, x
, x
, x
, x
, x
, x
, BC6H_UF16
)
284 SF( x
, x
, x
, x
, x
, x
, x
, x
, x
, x
, PLANAR_420_8
)
285 SF(75, 75, x
, x
, x
, x
, x
, x
, x
, x
, R8G8B8_UNORM_SRGB
)
286 SF(80, 80, x
, x
, x
, x
, x
, x
, x
, x
, ETC1_RGB8
)
287 SF(80, 80, x
, x
, x
, x
, x
, x
, x
, x
, ETC2_RGB8
)
288 SF(80, 80, x
, x
, x
, x
, x
, x
, x
, x
, EAC_R11
)
289 SF(80, 80, x
, x
, x
, x
, x
, x
, x
, x
, EAC_RG11
)
290 SF(80, 80, x
, x
, x
, x
, x
, x
, x
, x
, EAC_SIGNED_R11
)
291 SF(80, 80, x
, x
, x
, x
, x
, x
, x
, x
, EAC_SIGNED_RG11
)
292 SF(80, 80, x
, x
, x
, x
, x
, x
, x
, x
, ETC2_SRGB8
)
293 SF(90, x
, x
, x
, x
, x
, 75, x
, x
, x
, R16G16B16_UINT
)
294 SF(90, x
, x
, x
, x
, x
, 75, x
, x
, x
, R16G16B16_SINT
)
295 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, R32_SFIXED
)
296 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, R10G10B10A2_SNORM
)
297 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, R10G10B10A2_USCALED
)
298 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, R10G10B10A2_SSCALED
)
299 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, R10G10B10A2_SINT
)
300 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, B10G10R10A2_SNORM
)
301 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, B10G10R10A2_USCALED
)
302 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, B10G10R10A2_SSCALED
)
303 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, B10G10R10A2_UINT
)
304 SF( x
, x
, x
, x
, x
, x
, 75, x
, x
, x
, B10G10R10A2_SINT
)
305 SF( x
, x
, x
, x
, x
, x
, 80, x
, x
, x
, R64G64B64A64_PASSTHRU
)
306 SF( x
, x
, x
, x
, x
, x
, 80, x
, x
, x
, R64G64B64_PASSTHRU
)
307 SF(80, 80, x
, x
, x
, x
, x
, x
, x
, x
, ETC2_RGB8_PTA
)
308 SF(80, 80, x
, x
, x
, x
, x
, x
, x
, x
, ETC2_SRGB8_PTA
)
309 SF(80, 80, x
, x
, x
, x
, x
, x
, x
, x
, ETC2_EAC_RGBA8
)
310 SF(80, 80, x
, x
, x
, x
, x
, x
, x
, x
, ETC2_EAC_SRGB8_A8
)
311 SF(90, x
, x
, x
, x
, x
, 75, x
, x
, x
, R8G8B8_UINT
)
312 SF(90, x
, x
, x
, x
, x
, 75, x
, x
, x
, R8G8B8_SINT
)
313 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_4X4_FLT16
)
314 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_5X4_FLT16
)
315 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_5X5_FLT16
)
316 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_6X5_FLT16
)
317 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_6X6_FLT16
)
318 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_8X5_FLT16
)
319 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_8X6_FLT16
)
320 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_8X8_FLT16
)
321 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X5_FLT16
)
322 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X6_FLT16
)
323 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X8_FLT16
)
324 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X10_FLT16
)
325 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_12X10_FLT16
)
326 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_12X12_FLT16
)
327 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_4X4_U8SRGB
)
328 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_5X4_U8SRGB
)
329 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_5X5_U8SRGB
)
330 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_6X5_U8SRGB
)
331 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_6X6_U8SRGB
)
332 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_8X5_U8SRGB
)
333 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_8X6_U8SRGB
)
334 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_8X8_U8SRGB
)
335 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X5_U8SRGB
)
336 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X6_U8SRGB
)
337 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X8_U8SRGB
)
338 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_10X10_U8SRGB
)
339 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_12X10_U8SRGB
)
340 SF(90, 90, x
, x
, x
, x
, x
, x
, x
, x
, ASTC_LDR_2D_12X12_U8SRGB
)
346 format_gen(const struct gen_device_info
*devinfo
)
348 return devinfo
->gen
* 10 + (devinfo
->is_g4x
|| devinfo
->is_haswell
) * 5;
352 isl_format_supports_rendering(const struct gen_device_info
*devinfo
,
353 enum isl_format format
)
355 if (!format_info
[format
].exists
)
358 return format_gen(devinfo
) >= format_info
[format
].render_target
;
362 isl_format_supports_alpha_blending(const struct gen_device_info
*devinfo
,
363 enum isl_format format
)
365 if (!format_info
[format
].exists
)
368 return format_gen(devinfo
) >= format_info
[format
].alpha_blend
;
372 isl_format_supports_sampling(const struct gen_device_info
*devinfo
,
373 enum isl_format format
)
375 if (!format_info
[format
].exists
)
378 if (devinfo
->is_baytrail
) {
379 const struct isl_format_layout
*fmtl
= isl_format_get_layout(format
);
380 /* Support for ETC1 and ETC2 exists on Bay Trail even though big-core
381 * GPUs didn't get it until Broadwell.
383 if (fmtl
->txc
== ISL_TXC_ETC1
|| fmtl
->txc
== ISL_TXC_ETC2
)
385 } else if (devinfo
->is_cherryview
) {
386 const struct isl_format_layout
*fmtl
= isl_format_get_layout(format
);
387 /* Support for ASTC exists on Cherry View even though big-core
388 * GPUs didn't get it until Skylake.
390 if (fmtl
->txc
== ISL_TXC_ASTC
)
394 return format_gen(devinfo
) >= format_info
[format
].sampling
;
398 isl_format_supports_filtering(const struct gen_device_info
*devinfo
,
399 enum isl_format format
)
401 if (!format_info
[format
].exists
)
404 if (devinfo
->is_baytrail
) {
405 const struct isl_format_layout
*fmtl
= isl_format_get_layout(format
);
406 /* Support for ETC1 and ETC2 exists on Bay Trail even though big-core
407 * GPUs didn't get it until Broadwell.
409 if (fmtl
->txc
== ISL_TXC_ETC1
|| fmtl
->txc
== ISL_TXC_ETC2
)
411 } else if (devinfo
->is_cherryview
) {
412 const struct isl_format_layout
*fmtl
= isl_format_get_layout(format
);
413 /* Support for ASTC exists on Cherry View even though big-core
414 * GPUs didn't get it until Skylake.
416 if (fmtl
->txc
== ISL_TXC_ASTC
)
420 return format_gen(devinfo
) >= format_info
[format
].filtering
;
424 isl_format_supports_vertex_fetch(const struct gen_device_info
*devinfo
,
425 enum isl_format format
)
427 if (!format_info
[format
].exists
)
430 /* For vertex fetch, Bay Trail supports the same set of formats as Haswell
431 * but is a superset of Ivy Bridge.
433 if (devinfo
->is_baytrail
)
434 return 75 >= format_info
[format
].input_vb
;
436 return format_gen(devinfo
) >= format_info
[format
].input_vb
;
440 isl_format_supports_lossless_compression(const struct gen_device_info
*devinfo
,
441 enum isl_format format
)
443 if (!format_info
[format
].exists
)
446 return format_gen(devinfo
) >= format_info
[format
].lossless_compression
;
450 isl_format_supports_multisampling(const struct gen_device_info
*devinfo
,
451 enum isl_format format
)
453 /* From the Sandybridge PRM, Volume 4 Part 1 p72, SURFACE_STATE, Surface
456 * If Number of Multisamples is set to a value other than
457 * MULTISAMPLECOUNT_1, this field cannot be set to the following
460 * - any format with greater than 64 bits per element
461 * - any compressed texture format (BC*)
462 * - any YCRCB* format
464 * The restriction on the format's size is removed on Broadwell. Also,
465 * there is an exception for HiZ which we treat as a compressed format and
466 * is allowed to be multisampled on Broadwell and earlier.
468 if (format
== ISL_FORMAT_HIZ
) {
469 /* On SKL+, HiZ is always single-sampled even when the primary surface
470 * is multisampled. See also isl_surf_get_hiz_surf().
472 return devinfo
->gen
<= 8;
473 } else if (devinfo
->gen
< 8 && isl_format_get_layout(format
)->bpb
> 64) {
475 } else if (isl_format_is_compressed(format
)) {
477 } else if (isl_format_is_yuv(format
)) {
485 isl_format_has_channel_type(enum isl_format fmt
, enum isl_base_type type
)
487 const struct isl_format_layout
*fmtl
= isl_format_get_layout(fmt
);
489 return fmtl
->channels
.r
.type
== type
||
490 fmtl
->channels
.g
.type
== type
||
491 fmtl
->channels
.b
.type
== type
||
492 fmtl
->channels
.a
.type
== type
||
493 fmtl
->channels
.l
.type
== type
||
494 fmtl
->channels
.i
.type
== type
||
495 fmtl
->channels
.p
.type
== type
;
499 isl_format_has_unorm_channel(enum isl_format fmt
)
501 return isl_format_has_channel_type(fmt
, ISL_UNORM
);
505 isl_format_has_snorm_channel(enum isl_format fmt
)
507 return isl_format_has_channel_type(fmt
, ISL_SNORM
);
511 isl_format_has_ufloat_channel(enum isl_format fmt
)
513 return isl_format_has_channel_type(fmt
, ISL_UFLOAT
);
517 isl_format_has_sfloat_channel(enum isl_format fmt
)
519 return isl_format_has_channel_type(fmt
, ISL_SFLOAT
);
523 isl_format_has_uint_channel(enum isl_format fmt
)
525 return isl_format_has_channel_type(fmt
, ISL_UINT
);
529 isl_format_has_sint_channel(enum isl_format fmt
)
531 return isl_format_has_channel_type(fmt
, ISL_SINT
);
535 isl_format_get_num_channels(enum isl_format fmt
)
537 const struct isl_format_layout
*fmtl
= isl_format_get_layout(fmt
);
539 assert(fmtl
->channels
.p
.bits
== 0);
541 return (fmtl
->channels
.r
.bits
> 0) +
542 (fmtl
->channels
.g
.bits
> 0) +
543 (fmtl
->channels
.b
.bits
> 0) +
544 (fmtl
->channels
.a
.bits
> 0) +
545 (fmtl
->channels
.l
.bits
> 0) +
546 (fmtl
->channels
.i
.bits
> 0);
550 isl_format_get_depth_format(enum isl_format fmt
, bool has_stencil
)
554 unreachable("bad isl depth format");
555 case ISL_FORMAT_R32_FLOAT_X8X24_TYPELESS
:
557 return 0; /* D32_FLOAT_S8X24_UINT */
558 case ISL_FORMAT_R32_FLOAT
:
559 assert(!has_stencil
);
560 return 1; /* D32_FLOAT */
561 case ISL_FORMAT_R24_UNORM_X8_TYPELESS
:
563 return 2; /* D24_UNORM_S8_UINT */
565 return 3; /* D24_UNORM_X8_UINT */
567 case ISL_FORMAT_R16_UNORM
:
568 assert(!has_stencil
);
569 return 5; /* D16_UNORM */
574 isl_format_rgb_to_rgba(enum isl_format rgb
)
576 assert(isl_format_is_rgb(rgb
));
579 case ISL_FORMAT_R32G32B32_FLOAT
: return ISL_FORMAT_R32G32B32A32_FLOAT
;
580 case ISL_FORMAT_R32G32B32_SINT
: return ISL_FORMAT_R32G32B32A32_SINT
;
581 case ISL_FORMAT_R32G32B32_UINT
: return ISL_FORMAT_R32G32B32A32_UINT
;
582 case ISL_FORMAT_R32G32B32_UNORM
: return ISL_FORMAT_R32G32B32A32_UNORM
;
583 case ISL_FORMAT_R32G32B32_SNORM
: return ISL_FORMAT_R32G32B32A32_SNORM
;
584 case ISL_FORMAT_R32G32B32_SSCALED
: return ISL_FORMAT_R32G32B32A32_SSCALED
;
585 case ISL_FORMAT_R32G32B32_USCALED
: return ISL_FORMAT_R32G32B32A32_USCALED
;
586 case ISL_FORMAT_R32G32B32_SFIXED
: return ISL_FORMAT_R32G32B32A32_SFIXED
;
587 case ISL_FORMAT_R8G8B8_UNORM
: return ISL_FORMAT_R8G8B8A8_UNORM
;
588 case ISL_FORMAT_R8G8B8_SNORM
: return ISL_FORMAT_R8G8B8A8_SNORM
;
589 case ISL_FORMAT_R8G8B8_SSCALED
: return ISL_FORMAT_R8G8B8A8_SSCALED
;
590 case ISL_FORMAT_R8G8B8_USCALED
: return ISL_FORMAT_R8G8B8A8_USCALED
;
591 case ISL_FORMAT_R16G16B16_FLOAT
: return ISL_FORMAT_R16G16B16A16_FLOAT
;
592 case ISL_FORMAT_R16G16B16_UNORM
: return ISL_FORMAT_R16G16B16A16_UNORM
;
593 case ISL_FORMAT_R16G16B16_SNORM
: return ISL_FORMAT_R16G16B16A16_SNORM
;
594 case ISL_FORMAT_R16G16B16_SSCALED
: return ISL_FORMAT_R16G16B16A16_SSCALED
;
595 case ISL_FORMAT_R16G16B16_USCALED
: return ISL_FORMAT_R16G16B16A16_USCALED
;
596 case ISL_FORMAT_R8G8B8_UNORM_SRGB
: return ISL_FORMAT_R8G8B8A8_UNORM_SRGB
;
597 case ISL_FORMAT_R16G16B16_UINT
: return ISL_FORMAT_R16G16B16A16_UINT
;
598 case ISL_FORMAT_R16G16B16_SINT
: return ISL_FORMAT_R16G16B16A16_SINT
;
599 case ISL_FORMAT_R8G8B8_UINT
: return ISL_FORMAT_R8G8B8A8_UINT
;
600 case ISL_FORMAT_R8G8B8_SINT
: return ISL_FORMAT_R8G8B8A8_SINT
;
602 return ISL_FORMAT_UNSUPPORTED
;
607 isl_format_rgb_to_rgbx(enum isl_format rgb
)
609 assert(isl_format_is_rgb(rgb
));
612 case ISL_FORMAT_R32G32B32_FLOAT
:
613 return ISL_FORMAT_R32G32B32X32_FLOAT
;
614 case ISL_FORMAT_R16G16B16_UNORM
:
615 return ISL_FORMAT_R16G16B16X16_UNORM
;
616 case ISL_FORMAT_R16G16B16_FLOAT
:
617 return ISL_FORMAT_R16G16B16X16_FLOAT
;
618 case ISL_FORMAT_R8G8B8_UNORM
:
619 return ISL_FORMAT_R8G8B8X8_UNORM
;
620 case ISL_FORMAT_R8G8B8_UNORM_SRGB
:
621 return ISL_FORMAT_R8G8B8X8_UNORM_SRGB
;
623 return ISL_FORMAT_UNSUPPORTED
;