1 /* 2 * Copyright (C) 2019 Collabora, Ltd. 3 * 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: 10 * 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 13 * Software. 14 * 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 FROM, 20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 * SOFTWARE. 22 * 23 * Authors: 24 * Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> 25 */ 26 27 #include "genxml/gen_macros.h" 28 #include "pan_format.h" 29 #include "util/format/u_format.h" 30 31 /* Convenience */ 32 33 #define MALI_BLEND_AU_R8G8B8A8 (MALI_RGBA8_TB << 12) 34 #define MALI_BLEND_PU_R8G8B8A8 (MALI_RGBA8_TB << 12) 35 #define MALI_BLEND_AU_R10G10B10A2 (MALI_RGB10_A2_TB << 12) 36 #define MALI_BLEND_PU_R10G10B10A2 (MALI_RGB10_A2_TB << 12) 37 #define MALI_BLEND_AU_R8G8B8A2 (MALI_RGB8_A2_AU << 12) 38 #define MALI_BLEND_PU_R8G8B8A2 (MALI_RGB8_A2_PU << 12) 39 #define MALI_BLEND_AU_R4G4B4A4 (MALI_RGBA4_AU << 12) 40 #define MALI_BLEND_PU_R4G4B4A4 (MALI_RGBA4_PU << 12) 41 #define MALI_BLEND_AU_R5G6B5A0 (MALI_R5G6B5_AU << 12) 42 #define MALI_BLEND_PU_R5G6B5A0 (MALI_R5G6B5_PU << 12) 43 #define MALI_BLEND_AU_R5G5B5A1 (MALI_RGB5_A1_AU << 12) 44 #define MALI_BLEND_PU_R5G5B5A1 (MALI_RGB5_A1_PU << 12) 45 46 #if PAN_ARCH <= 6 47 #define BFMT2(pipe, internal, writeback, srgb) \ 48 [PIPE_FORMAT_##pipe] = { \ 49 MALI_COLOR_BUFFER_INTERNAL_FORMAT_## internal, \ 50 MALI_COLOR_FORMAT_## writeback, \ 51 { MALI_BLEND_PU_ ## internal | (srgb ? (1 << 20) : 0) | \ 52 PAN_V6_SWIZZLE(R, G, B, A), \ 53 MALI_BLEND_AU_ ## internal | (srgb ? (1 << 20) : 0) | \ 54 PAN_V6_SWIZZLE(R, G, B, A) } \ 55 } 56 #else 57 #define BFMT2(pipe, internal, writeback, srgb) \ 58 [PIPE_FORMAT_##pipe] = { \ 59 MALI_COLOR_BUFFER_INTERNAL_FORMAT_## internal, \ 60 MALI_COLOR_FORMAT_## writeback, \ 61 { MALI_BLEND_PU_ ## internal | (srgb ? (1 << 20) : 0), \ 62 MALI_BLEND_AU_ ## internal | (srgb ? (1 << 20) : 0) } \ 63 } 64 #endif 65 66 #define BFMT(pipe, internal_and_writeback) \ 67 BFMT2(pipe, internal_and_writeback, internal_and_writeback, 0) 68 69 #define BFMT_SRGB(pipe, writeback) \ 70 BFMT2(pipe ##_UNORM, R8G8B8A8, writeback, 0), \ 71 BFMT2(pipe ##_SRGB, R8G8B8A8, writeback, 1) 72 73 const struct pan_blendable_format 74 GENX(panfrost_blendable_formats)[PIPE_FORMAT_COUNT] = { 75 BFMT_SRGB(L8, R8), 76 BFMT_SRGB(L8A8, R8G8), 77 BFMT_SRGB(R8, R8), 78 BFMT_SRGB(R8G8, R8G8), 79 BFMT_SRGB(R8G8B8, R8G8B8), 80 81 BFMT_SRGB(B8G8R8A8, R8G8B8A8), 82 BFMT_SRGB(B8G8R8X8, R8G8B8A8), 83 BFMT_SRGB(A8R8G8B8, R8G8B8A8), 84 BFMT_SRGB(X8R8G8B8, R8G8B8A8), 85 BFMT_SRGB(A8B8G8R8, R8G8B8A8), 86 BFMT_SRGB(X8B8G8R8, R8G8B8A8), 87 BFMT_SRGB(R8G8B8X8, R8G8B8A8), 88 BFMT_SRGB(R8G8B8A8, R8G8B8A8), 89 90 BFMT2(A8_UNORM, R8G8B8A8, R8, 0), 91 BFMT2(I8_UNORM, R8G8B8A8, R8, 0), 92 BFMT2(R5G6B5_UNORM, R5G6B5A0, R5G6B5, 0), 93 BFMT2(B5G6R5_UNORM, R5G6B5A0, R5G6B5, 0), 94 95 BFMT(A4B4G4R4_UNORM, R4G4B4A4), 96 BFMT(B4G4R4A4_UNORM, R4G4B4A4), 97 BFMT(R4G4B4A4_UNORM, R4G4B4A4), 98 99 BFMT(R10G10B10A2_UNORM, R10G10B10A2), 100 BFMT(B10G10R10A2_UNORM, R10G10B10A2), 101 BFMT(R10G10B10X2_UNORM, R10G10B10A2), 102 BFMT(B10G10R10X2_UNORM, R10G10B10A2), 103 104 BFMT(B5G5R5A1_UNORM, R5G5B5A1), 105 BFMT(R5G5B5A1_UNORM, R5G5B5A1), 106 BFMT(B5G5R5X1_UNORM, R5G5B5A1), 107 }; 108 109 /* Convenience */ 110 111 #define _V PIPE_BIND_VERTEX_BUFFER 112 #define _T PIPE_BIND_SAMPLER_VIEW 113 #define _R PIPE_BIND_RENDER_TARGET 114 #define _Z PIPE_BIND_DEPTH_STENCIL 115 116 #define FLAGS_V___ (_V) 117 #define FLAGS__T__ (_T) 118 #define FLAGS_VTR_ (_V | _T | _R) 119 #define FLAGS_VT__ (_V | _T) 120 #define FLAGS__T_Z (_T | _Z) 121 122 #define SRGB_L (0) 123 #define SRGB_S (1) 124 125 #if PAN_ARCH <= 6 126 #define V6_0000 PAN_V6_SWIZZLE(0, 0, 0, 0) 127 #define V6_000R PAN_V6_SWIZZLE(0, 0, 0, R) 128 #define V6_0R00 PAN_V6_SWIZZLE(0, R, 0, 0) 129 #define V6_0A00 PAN_V6_SWIZZLE(0, A, 0, 0) 130 #define V6_AAAA PAN_V6_SWIZZLE(A, A, A, A) 131 #define V6_A001 PAN_V6_SWIZZLE(A, 0, 0, 1) 132 #define V6_ABG1 PAN_V6_SWIZZLE(A, B, G, 1) 133 #define V6_ABGR PAN_V6_SWIZZLE(A, B, G, R) 134 #define V6_BGR1 PAN_V6_SWIZZLE(B, G, R, 1) 135 #define V6_BGRA PAN_V6_SWIZZLE(B, G, R, A) 136 #define V6_GBA1 PAN_V6_SWIZZLE(G, B, A, 1) 137 #define V6_GBAR PAN_V6_SWIZZLE(G, B, A, R) 138 #define V6_R000 PAN_V6_SWIZZLE(R, 0, 0, 0) 139 #define V6_R001 PAN_V6_SWIZZLE(R, 0, 0, 1) 140 #define V6_RG01 PAN_V6_SWIZZLE(R, G, 0, 1) 141 #define V6_RGB1 PAN_V6_SWIZZLE(R, G, B, 1) 142 #define V6_RGBA PAN_V6_SWIZZLE(R, G, B, A) 143 #define V6_RRR1 PAN_V6_SWIZZLE(R, R, R, 1) 144 #define V6_RRRG PAN_V6_SWIZZLE(R, R, R, G) 145 #define V6_RRRR PAN_V6_SWIZZLE(R, R, R, R) 146 #define V6_GGGG PAN_V6_SWIZZLE(G, G, G, G) 147 148 #define FMT(pipe, mali, swizzle, srgb, flags) \ 149 [PIPE_FORMAT_ ## pipe] = { \ 150 .hw = ( V6_ ## swizzle ) | \ 151 (( MALI_ ## mali ) << 12) | \ 152 ((( SRGB_ ## srgb)) << 20), \ 153 .bind = FLAGS_ ## flags \ 154 } 155 #else 156 157 #define MALI_RGB_COMPONENT_ORDER_R001 MALI_RGB_COMPONENT_ORDER_RGB1 158 #define MALI_RGB_COMPONENT_ORDER_RG01 MALI_RGB_COMPONENT_ORDER_RGB1 159 #define MALI_RGB_COMPONENT_ORDER_GBAR MALI_RGB_COMPONENT_ORDER_ARGB 160 #define MALI_RGB_COMPONENT_ORDER_GBA1 MALI_RGB_COMPONENT_ORDER_1RGB 161 #define MALI_RGB_COMPONENT_ORDER_ABG1 MALI_RGB_COMPONENT_ORDER_1BGR 162 163 #define FMT(pipe, mali, swizzle, srgb, flags) \ 164 [PIPE_FORMAT_ ## pipe] = { \ 165 .hw = ( MALI_RGB_COMPONENT_ORDER_ ## swizzle ) | \ 166 (( MALI_ ## mali ) << 12) | \ 167 ((( SRGB_ ## srgb)) << 20), \ 168 .bind = FLAGS_ ## flags \ 169 } 170 #endif 171 172 const struct panfrost_format GENX(panfrost_pipe_format)[PIPE_FORMAT_COUNT] = { 173 FMT(NONE, CONSTANT, 0000, L, VTR_), 174 175 #if PAN_ARCH <= 7 176 FMT(ETC1_RGB8, ETC2_RGB8, RGB1, L, _T__), 177 FMT(ETC2_RGB8, ETC2_RGB8, RGB1, L, _T__), 178 FMT(ETC2_SRGB8, ETC2_RGB8, RGB1, S, _T__), 179 FMT(ETC2_R11_UNORM, ETC2_R11_UNORM, R001, L, _T__), 180 FMT(ETC2_RGBA8, ETC2_RGBA8, RGBA, L, _T__), 181 FMT(ETC2_SRGBA8, ETC2_RGBA8, RGBA, S, _T__), 182 FMT(ETC2_RG11_UNORM, ETC2_RG11_UNORM, RG01, L, _T__), 183 FMT(ETC2_R11_SNORM, ETC2_R11_SNORM, R001, L, _T__), 184 FMT(ETC2_RG11_SNORM, ETC2_RG11_SNORM, RG01, L, _T__), 185 FMT(ETC2_RGB8A1, ETC2_RGB8A1, RGBA, L, _T__), 186 FMT(ETC2_SRGB8A1, ETC2_RGB8A1, RGBA, S, _T__), 187 FMT(DXT1_RGB, BC1_UNORM, RGB1, L, _T__), 188 FMT(DXT1_RGBA, BC1_UNORM, RGBA, L, _T__), 189 FMT(DXT1_SRGB, BC1_UNORM, RGB1, S, _T__), 190 FMT(DXT1_SRGBA, BC1_UNORM, RGBA, S, _T__), 191 FMT(DXT3_RGBA, BC2_UNORM, RGBA, L, _T__), 192 FMT(DXT3_SRGBA, BC2_UNORM, RGBA, S, _T__), 193 FMT(DXT5_RGBA, BC3_UNORM, RGBA, L, _T__), 194 FMT(DXT5_SRGBA, BC3_UNORM, RGBA, S, _T__), 195 FMT(RGTC1_UNORM, BC4_UNORM, R001, L, _T__), 196 FMT(RGTC1_SNORM, BC4_SNORM, R001, L, _T__), 197 FMT(RGTC2_UNORM, BC5_UNORM, RG01, L, _T__), 198 FMT(RGTC2_SNORM, BC5_SNORM, RG01, L, _T__), 199 FMT(BPTC_RGB_FLOAT, BC6H_SF16, RGB1, L, _T__), 200 FMT(BPTC_RGB_UFLOAT, BC6H_UF16, RGB1, L, _T__), 201 FMT(BPTC_RGBA_UNORM, BC7_UNORM, RGBA, L, _T__), 202 FMT(BPTC_SRGBA, BC7_UNORM, RGBA, S, _T__), 203 FMT(ASTC_4x4, ASTC_2D_HDR, RGBA, L, _T__), 204 FMT(ASTC_5x4, ASTC_2D_HDR, RGBA, L, _T__), 205 FMT(ASTC_5x5, ASTC_2D_HDR, RGBA, L, _T__), 206 FMT(ASTC_6x5, ASTC_2D_HDR, RGBA, L, _T__), 207 FMT(ASTC_6x6, ASTC_2D_HDR, RGBA, L, _T__), 208 FMT(ASTC_8x5, ASTC_2D_HDR, RGBA, L, _T__), 209 FMT(ASTC_8x6, ASTC_2D_HDR, RGBA, L, _T__), 210 FMT(ASTC_8x8, ASTC_2D_HDR, RGBA, L, _T__), 211 FMT(ASTC_10x5, ASTC_2D_HDR, RGBA, L, _T__), 212 FMT(ASTC_10x6, ASTC_2D_HDR, RGBA, L, _T__), 213 FMT(ASTC_10x8, ASTC_2D_HDR, RGBA, L, _T__), 214 FMT(ASTC_10x10, ASTC_2D_HDR, RGBA, L, _T__), 215 FMT(ASTC_12x10, ASTC_2D_HDR, RGBA, L, _T__), 216 FMT(ASTC_12x12, ASTC_2D_HDR, RGBA, L, _T__), 217 FMT(ASTC_4x4_SRGB, ASTC_2D_LDR, RGBA, S, _T__), 218 FMT(ASTC_5x4_SRGB, ASTC_2D_LDR, RGBA, S, _T__), 219 FMT(ASTC_5x5_SRGB, ASTC_2D_LDR, RGBA, S, _T__), 220 FMT(ASTC_6x5_SRGB, ASTC_2D_LDR, RGBA, S, _T__), 221 FMT(ASTC_6x6_SRGB, ASTC_2D_LDR, RGBA, S, _T__), 222 FMT(ASTC_8x5_SRGB, ASTC_2D_LDR, RGBA, S, _T__), 223 FMT(ASTC_8x6_SRGB, ASTC_2D_LDR, RGBA, S, _T__), 224 FMT(ASTC_8x8_SRGB, ASTC_2D_LDR, RGBA, S, _T__), 225 FMT(ASTC_10x5_SRGB, ASTC_2D_LDR, RGBA, S, _T__), 226 FMT(ASTC_10x6_SRGB, ASTC_2D_LDR, RGBA, S, _T__), 227 FMT(ASTC_10x8_SRGB, ASTC_2D_LDR, RGBA, S, _T__), 228 FMT(ASTC_10x10_SRGB, ASTC_2D_LDR, RGBA, S, _T__), 229 FMT(ASTC_12x10_SRGB, ASTC_2D_LDR, RGBA, S, _T__), 230 FMT(ASTC_12x12_SRGB, ASTC_2D_LDR, RGBA, S, _T__), 231 FMT(ASTC_3x3x3, ASTC_3D_HDR, RGBA, L, _T__), 232 FMT(ASTC_4x3x3, ASTC_3D_HDR, RGBA, L, _T__), 233 FMT(ASTC_4x4x3, ASTC_3D_HDR, RGBA, L, _T__), 234 FMT(ASTC_4x4x4, ASTC_3D_HDR, RGBA, L, _T__), 235 FMT(ASTC_5x4x4, ASTC_3D_HDR, RGBA, L, _T__), 236 FMT(ASTC_5x5x4, ASTC_3D_HDR, RGBA, L, _T__), 237 FMT(ASTC_5x5x5, ASTC_3D_HDR, RGBA, L, _T__), 238 FMT(ASTC_6x5x5, ASTC_3D_HDR, RGBA, L, _T__), 239 FMT(ASTC_6x6x5, ASTC_3D_HDR, RGBA, L, _T__), 240 FMT(ASTC_6x6x6, ASTC_3D_HDR, RGBA, L, _T__), 241 FMT(ASTC_3x3x3_SRGB, ASTC_3D_LDR, RGBA, S, _T__), 242 FMT(ASTC_4x3x3_SRGB, ASTC_3D_LDR, RGBA, S, _T__), 243 FMT(ASTC_4x4x3_SRGB, ASTC_3D_LDR, RGBA, S, _T__), 244 FMT(ASTC_4x4x4_SRGB, ASTC_3D_LDR, RGBA, S, _T__), 245 FMT(ASTC_5x4x4_SRGB, ASTC_3D_LDR, RGBA, S, _T__), 246 FMT(ASTC_5x5x4_SRGB, ASTC_3D_LDR, RGBA, S, _T__), 247 FMT(ASTC_5x5x5_SRGB, ASTC_3D_LDR, RGBA, S, _T__), 248 FMT(ASTC_6x5x5_SRGB, ASTC_3D_LDR, RGBA, S, _T__), 249 FMT(ASTC_6x6x5_SRGB, ASTC_3D_LDR, RGBA, S, _T__), 250 FMT(ASTC_6x6x6_SRGB, ASTC_3D_LDR, RGBA, S, _T__), 251 #else 252 /* Map to interchange format, as compression is specified in the plane 253 * descriptor on Valhall. 254 */ 255 FMT(ETC1_RGB8, RGBA8_UNORM, RGB1, L, _T__), 256 FMT(ETC2_RGB8, RGBA8_UNORM, RGB1, L, _T__), 257 FMT(ETC2_SRGB8, RGBA8_UNORM, RGB1, S, _T__), 258 FMT(ETC2_R11_UNORM, R16_UNORM, R001, L, _T__), 259 FMT(ETC2_RGBA8, RGBA8_UNORM, RGBA, L, _T__), 260 FMT(ETC2_SRGBA8, RGBA8_UNORM, RGBA, S, _T__), 261 FMT(ETC2_RG11_UNORM, RG16_UNORM, RG01, L, _T__), 262 FMT(ETC2_R11_SNORM, R16_SNORM, R001, L, _T__), 263 FMT(ETC2_RG11_SNORM, RG16_SNORM, RG01, L, _T__), 264 FMT(ETC2_RGB8A1, RGBA8_UNORM, RGBA, L, _T__), 265 FMT(ETC2_SRGB8A1, RGBA8_UNORM, RGBA, S, _T__), 266 FMT(DXT1_RGB, RGBA8_UNORM, RGB1, L, _T__), 267 FMT(DXT1_RGBA, RGBA8_UNORM, RGBA, L, _T__), 268 FMT(DXT1_SRGB, RGBA8_UNORM, RGB1, S, _T__), 269 FMT(DXT1_SRGBA, RGBA8_UNORM, RGBA, S, _T__), 270 FMT(DXT3_RGBA, RGBA8_UNORM, RGBA, L, _T__), 271 FMT(DXT3_SRGBA, RGBA8_UNORM, RGBA, S, _T__), 272 FMT(DXT5_RGBA, RGBA8_UNORM, RGBA, L, _T__), 273 FMT(DXT5_SRGBA, RGBA8_UNORM, RGBA, S, _T__), 274 FMT(RGTC1_UNORM, R16_UNORM, R001, L, _T__), 275 FMT(RGTC1_SNORM, R16_SNORM, R001, L, _T__), 276 FMT(RGTC2_UNORM, RG16_UNORM, RG01, L, _T__), 277 FMT(RGTC2_SNORM, RG16_SNORM, RG01, L, _T__), 278 FMT(BPTC_RGB_FLOAT, RGBA16F, RGB1, L, _T__), 279 FMT(BPTC_RGB_UFLOAT, RGBA16F, RGB1, L, _T__), 280 FMT(BPTC_RGBA_UNORM, RGBA8_UNORM, RGBA, L, _T__), 281 FMT(BPTC_SRGBA, RGBA8_UNORM, RGBA, S, _T__), 282 283 /* Mesa does not yet support astc_decode_mode extensions, so non-sRGB 284 * formats must be assumed to be wide. 285 */ 286 FMT(ASTC_4x4, RGBA16F, RGBA, L, _T__), 287 FMT(ASTC_5x4, RGBA16F, RGBA, L, _T__), 288 FMT(ASTC_5x5, RGBA16F, RGBA, L, _T__), 289 FMT(ASTC_6x5, RGBA16F, RGBA, L, _T__), 290 FMT(ASTC_6x6, RGBA16F, RGBA, L, _T__), 291 FMT(ASTC_8x5, RGBA16F, RGBA, L, _T__), 292 FMT(ASTC_8x6, RGBA16F, RGBA, L, _T__), 293 FMT(ASTC_8x8, RGBA16F, RGBA, L, _T__), 294 FMT(ASTC_10x5, RGBA16F, RGBA, L, _T__), 295 FMT(ASTC_10x6, RGBA16F, RGBA, L, _T__), 296 FMT(ASTC_10x8, RGBA16F, RGBA, L, _T__), 297 FMT(ASTC_10x10, RGBA16F, RGBA, L, _T__), 298 FMT(ASTC_12x10, RGBA16F, RGBA, L, _T__), 299 FMT(ASTC_12x12, RGBA16F, RGBA, L, _T__), 300 FMT(ASTC_3x3x3, RGBA16F, RGBA, L, _T__), 301 FMT(ASTC_4x3x3, RGBA16F, RGBA, L, _T__), 302 FMT(ASTC_4x4x3, RGBA16F, RGBA, L, _T__), 303 FMT(ASTC_4x4x4, RGBA16F, RGBA, L, _T__), 304 FMT(ASTC_5x4x4, RGBA16F, RGBA, L, _T__), 305 FMT(ASTC_5x5x4, RGBA16F, RGBA, L, _T__), 306 FMT(ASTC_5x5x5, RGBA16F, RGBA, L, _T__), 307 FMT(ASTC_6x5x5, RGBA16F, RGBA, L, _T__), 308 FMT(ASTC_6x6x5, RGBA16F, RGBA, L, _T__), 309 FMT(ASTC_6x6x6, RGBA16F, RGBA, L, _T__), 310 311 /* By definition, sRGB formats are narrow */ 312 FMT(ASTC_4x4_SRGB, RGBA8_UNORM, RGBA, S, _T__), 313 FMT(ASTC_5x4_SRGB, RGBA8_UNORM, RGBA, S, _T__), 314 FMT(ASTC_5x5_SRGB, RGBA8_UNORM, RGBA, S, _T__), 315 FMT(ASTC_6x5_SRGB, RGBA8_UNORM, RGBA, S, _T__), 316 FMT(ASTC_6x6_SRGB, RGBA8_UNORM, RGBA, S, _T__), 317 FMT(ASTC_8x5_SRGB, RGBA8_UNORM, RGBA, S, _T__), 318 FMT(ASTC_8x6_SRGB, RGBA8_UNORM, RGBA, S, _T__), 319 FMT(ASTC_8x8_SRGB, RGBA8_UNORM, RGBA, S, _T__), 320 FMT(ASTC_10x5_SRGB, RGBA8_UNORM, RGBA, S, _T__), 321 FMT(ASTC_10x6_SRGB, RGBA8_UNORM, RGBA, S, _T__), 322 FMT(ASTC_10x8_SRGB, RGBA8_UNORM, RGBA, S, _T__), 323 FMT(ASTC_10x10_SRGB, RGBA8_UNORM, RGBA, S, _T__), 324 FMT(ASTC_12x10_SRGB, RGBA8_UNORM, RGBA, S, _T__), 325 FMT(ASTC_12x12_SRGB, RGBA8_UNORM, RGBA, S, _T__), 326 FMT(ASTC_3x3x3_SRGB, RGBA8_UNORM, RGBA, S, _T__), 327 FMT(ASTC_4x3x3_SRGB, RGBA8_UNORM, RGBA, S, _T__), 328 FMT(ASTC_4x4x3_SRGB, RGBA8_UNORM, RGBA, S, _T__), 329 FMT(ASTC_4x4x4_SRGB, RGBA8_UNORM, RGBA, S, _T__), 330 FMT(ASTC_5x4x4_SRGB, RGBA8_UNORM, RGBA, S, _T__), 331 FMT(ASTC_5x5x4_SRGB, RGBA8_UNORM, RGBA, S, _T__), 332 FMT(ASTC_5x5x5_SRGB, RGBA8_UNORM, RGBA, S, _T__), 333 FMT(ASTC_6x5x5_SRGB, RGBA8_UNORM, RGBA, S, _T__), 334 FMT(ASTC_6x6x5_SRGB, RGBA8_UNORM, RGBA, S, _T__), 335 #endif 336 337 FMT(R5G6B5_UNORM, RGB565, RGB1, L, VTR_), 338 FMT(B5G6R5_UNORM, RGB565, BGR1, L, VTR_), 339 FMT(R5G5B5X1_UNORM, RGB5_A1_UNORM, RGB1, L, VT__), 340 FMT(B5G5R5X1_UNORM, RGB5_A1_UNORM, BGR1, L, VT__), 341 FMT(R5G5B5A1_UNORM, RGB5_A1_UNORM, RGBA, L, VTR_), 342 FMT(B5G5R5A1_UNORM, RGB5_A1_UNORM, BGRA, L, VTR_), 343 FMT(R10G10B10X2_UNORM, RGB10_A2_UNORM, RGB1, L, VTR_), 344 FMT(B10G10R10X2_UNORM, RGB10_A2_UNORM, BGR1, L, VTR_), 345 FMT(R10G10B10A2_UNORM, RGB10_A2_UNORM, RGBA, L, VTR_), 346 FMT(B10G10R10A2_UNORM, RGB10_A2_UNORM, BGRA, L, VTR_), 347 #if PAN_ARCH <= 5 348 FMT(R10G10B10X2_SNORM, RGB10_A2_SNORM, RGB1, L, VT__), 349 FMT(R10G10B10A2_SNORM, RGB10_A2_SNORM, RGBA, L, VT__), 350 FMT(B10G10R10A2_SNORM, RGB10_A2_SNORM, BGRA, L, VT__), 351 FMT(R3G3B2_UNORM, RGB332_UNORM, RGB1, L, VT__), 352 #else 353 FMT(R10G10B10X2_SNORM, RGB10_A2_SNORM, RGB1, L, V___), 354 FMT(R10G10B10A2_SNORM, RGB10_A2_SNORM, RGBA, L, V___), 355 FMT(B10G10R10A2_SNORM, RGB10_A2_SNORM, BGRA, L, V___), 356 #endif 357 FMT(R10G10B10A2_UINT, RGB10_A2UI, RGBA, L, VTR_), 358 FMT(B10G10R10A2_UINT, RGB10_A2UI, BGRA, L, VTR_), 359 FMT(R10G10B10A2_USCALED, RGB10_A2UI, RGBA, L, V___), 360 FMT(B10G10R10A2_USCALED, RGB10_A2UI, BGRA, L, V___), 361 FMT(R10G10B10A2_SINT, RGB10_A2I, RGBA, L, VTR_), 362 FMT(B10G10R10A2_SINT, RGB10_A2I, BGRA, L, VTR_), 363 FMT(R10G10B10A2_SSCALED, RGB10_A2I, RGBA, L, V___), 364 FMT(B10G10R10A2_SSCALED, RGB10_A2I, BGRA, L, V___), 365 FMT(R8_SSCALED, R8I, R001, L, V___), 366 FMT(R8G8_SSCALED, RG8I, RG01, L, V___), 367 FMT(R8G8B8_SSCALED, RGB8I, RGB1, L, V___), 368 FMT(B8G8R8_SSCALED, RGB8I, BGR1, L, V___), 369 FMT(R8G8B8A8_SSCALED, RGBA8I, RGBA, L, V___), 370 FMT(B8G8R8A8_SSCALED, RGBA8I, BGRA, L, V___), 371 FMT(A8B8G8R8_SSCALED, RGBA8I, ABGR, L, V___), 372 FMT(R8_USCALED, R8UI, R001, L, V___), 373 FMT(R8G8_USCALED, RG8UI, RG01, L, V___), 374 FMT(R8G8B8_USCALED, RGB8UI, RGB1, L, V___), 375 FMT(B8G8R8_USCALED, RGB8UI, BGR1, L, V___), 376 FMT(R8G8B8A8_USCALED, RGBA8UI, RGBA, L, V___), 377 FMT(B8G8R8A8_USCALED, RGBA8UI, BGRA, L, V___), 378 FMT(A8B8G8R8_USCALED, RGBA8UI, ABGR, L, V___), 379 FMT(R16_USCALED, R16UI, R001, L, V___), 380 FMT(R16G16_USCALED, RG16UI, RG01, L, V___), 381 FMT(R16G16B16A16_USCALED, RGBA16UI, RGBA, L, V___), 382 FMT(R16_SSCALED, R16I, R001, L, V___), 383 FMT(R16G16_SSCALED, RG16I, RG01, L, V___), 384 FMT(R16G16B16A16_SSCALED, RGBA16I, RGBA, L, V___), 385 FMT(R32_USCALED, R32UI, R001, L, V___), 386 FMT(R32G32_USCALED, RG32UI, RG01, L, V___), 387 FMT(R32G32B32_USCALED, RGB32UI, RGB1, L, V___), 388 FMT(R32G32B32A32_USCALED, RGBA32UI, RGBA, L, V___), 389 FMT(R32_SSCALED, R32I, R001, L, V___), 390 FMT(R32G32_SSCALED, RG32I, RG01, L, V___), 391 FMT(R32G32B32_SSCALED, RGB32I, RGB1, L, V___), 392 FMT(R32G32B32A32_SSCALED, RGBA32I, RGBA, L, V___), 393 FMT(R32_FIXED, R32_FIXED, R001, L, V___), 394 FMT(R32G32_FIXED, RG32_FIXED, RG01, L, V___), 395 FMT(R32G32B32_FIXED, RGB32_FIXED, RGB1, L, V___), 396 FMT(R32G32B32A32_FIXED, RGBA32_FIXED, RGBA, L, V___), 397 FMT(R11G11B10_FLOAT, R11F_G11F_B10F, RGB1, L, VTR_), 398 FMT(R9G9B9E5_FLOAT, R9F_G9F_B9F_E5F, RGB1, L, VT__), 399 FMT(R8_SNORM, R8_SNORM, R001, L, VT__), 400 FMT(R16_SNORM, R16_SNORM, R001, L, VT__), 401 FMT(R32_SNORM, R32_SNORM, R001, L, VT__), 402 FMT(R8G8_SNORM, RG8_SNORM, RG01, L, VT__), 403 FMT(R16G16_SNORM, RG16_SNORM, RG01, L, VT__), 404 FMT(R32G32_SNORM, RG32_SNORM, RG01, L, VT__), 405 FMT(R8G8B8_SNORM, RGB8_SNORM, RGB1, L, VT__), 406 FMT(R32G32B32_SNORM, RGB32_SNORM, RGB1, L, VT__), 407 FMT(R8G8B8A8_SNORM, RGBA8_SNORM, RGBA, L, VT__), 408 FMT(R16G16B16A16_SNORM, RGBA16_SNORM, RGBA, L, VT__), 409 FMT(R32G32B32A32_SNORM, RGBA32_SNORM, RGBA, L, VT__), 410 FMT(I8_SINT, R8I, RRRR, L, VTR_), 411 FMT(L8_SINT, R8I, RRR1, L, VTR_), 412 FMT(I8_UINT, R8UI, RRRR, L, VTR_), 413 FMT(L8_UINT, R8UI, RRR1, L, VTR_), 414 FMT(I16_SINT, R16I, RRRR, L, VTR_), 415 FMT(L16_SINT, R16I, RRR1, L, VTR_), 416 FMT(I16_UINT, R16UI, RRRR, L, VTR_), 417 FMT(L16_UINT, R16UI, RRR1, L, VTR_), 418 FMT(I32_SINT, R32I, RRRR, L, VTR_), 419 FMT(L32_SINT, R32I, RRR1, L, VTR_), 420 FMT(I32_UINT, R32UI, RRRR, L, VTR_), 421 FMT(L32_UINT, R32UI, RRR1, L, VTR_), 422 FMT(B8G8R8_UINT, RGB8UI, BGR1, L, VTR_), 423 FMT(B8G8R8A8_UINT, RGBA8UI, BGRA, L, VTR_), 424 FMT(B8G8R8_SINT, RGB8I, BGR1, L, VTR_), 425 FMT(B8G8R8A8_SINT, RGBA8I, BGRA, L, VTR_), 426 FMT(A8R8G8B8_UINT, RGBA8UI, GBAR, L, VTR_), 427 FMT(A8B8G8R8_UINT, RGBA8UI, ABGR, L, VTR_), 428 FMT(R8_UINT, R8UI, R001, L, VTR_), 429 FMT(R16_UINT, R16UI, R001, L, VTR_), 430 FMT(R32_UINT, R32UI, R001, L, VTR_), 431 FMT(R8G8_UINT, RG8UI, RG01, L, VTR_), 432 FMT(R16G16_UINT, RG16UI, RG01, L, VTR_), 433 FMT(R32G32_UINT, RG32UI, RG01, L, VTR_), 434 FMT(R8G8B8_UINT, RGB8UI, RGB1, L, VTR_), 435 FMT(R32G32B32_UINT, RGB32UI, RGB1, L, VTR_), 436 FMT(R8G8B8A8_UINT, RGBA8UI, RGBA, L, VTR_), 437 FMT(R16G16B16A16_UINT, RGBA16UI, RGBA, L, VTR_), 438 FMT(R32G32B32A32_UINT, RGBA32UI, RGBA, L, VTR_), 439 FMT(R32_FLOAT, R32F, R001, L, VTR_), 440 FMT(R32G32_FLOAT, RG32F, RG01, L, VTR_), 441 FMT(R32G32B32_FLOAT, RGB32F, RGB1, L, VTR_), 442 FMT(R32G32B32A32_FLOAT, RGBA32F, RGBA, L, VTR_), 443 FMT(R8_UNORM, R8_UNORM, R001, L, VTR_), 444 FMT(R16_UNORM, R16_UNORM, R001, L, VT__), 445 FMT(R32_UNORM, R32_UNORM, R001, L, VT__), 446 FMT(R8G8_UNORM, RG8_UNORM, RG01, L, VTR_), 447 FMT(R16G16_UNORM, RG16_UNORM, RG01, L, VT__), 448 FMT(R32G32_UNORM, RG32_UNORM, RG01, L, VT__), 449 FMT(R8G8B8_UNORM, RGB8_UNORM, RGB1, L, VTR_), 450 451 /* Don't allow render/texture for 48-bit */ 452 FMT(R16G16B16_UNORM, RGB16_UNORM, RGB1, L, V___), 453 FMT(R16G16B16_SINT, RGB16I, RGB1, L, V___), 454 FMT(R16G16B16_FLOAT, RGB16F, RGB1, L, V___), 455 FMT(R16G16B16_USCALED, RGB16UI, RGB1, L, V___), 456 FMT(R16G16B16_SSCALED, RGB16I, RGB1, L, V___), 457 FMT(R16G16B16_SNORM, RGB16_SNORM, RGB1, L, V___), 458 FMT(R16G16B16_UINT, RGB16UI, RGB1, L, V___), 459 460 #if PAN_ARCH <= 6 461 FMT(R32G32B32_UNORM, RGB32_UNORM, RGB1, L, VT__), 462 #else 463 FMT(R32G32B32_UNORM, RGB32_UNORM, RGB1, L, V___), 464 #endif 465 FMT(R4G4B4A4_UNORM, RGBA4_UNORM, RGBA, L, VTR_), 466 FMT(B4G4R4A4_UNORM, RGBA4_UNORM, BGRA, L, VTR_), 467 FMT(R16G16B16A16_UNORM, RGBA16_UNORM, RGBA, L, VT__), 468 FMT(R32G32B32A32_UNORM, RGBA32_UNORM, RGBA, L, VT__), 469 FMT(B8G8R8A8_UNORM, RGBA8_UNORM, BGRA, L, VTR_), 470 FMT(B8G8R8X8_UNORM, RGBA8_UNORM, BGR1, L, VTR_), 471 FMT(A8R8G8B8_UNORM, RGBA8_UNORM, GBAR, L, VTR_), 472 FMT(X8R8G8B8_UNORM, RGBA8_UNORM, GBA1, L, VTR_), 473 FMT(A8B8G8R8_UNORM, RGBA8_UNORM, ABGR, L, VTR_), 474 FMT(X8B8G8R8_UNORM, RGBA8_UNORM, ABG1, L, VTR_), 475 FMT(R8G8B8X8_UNORM, RGBA8_UNORM, RGB1, L, VTR_), 476 FMT(R8G8B8A8_UNORM, RGBA8_UNORM, RGBA, L, VTR_), 477 FMT(R8G8B8X8_SNORM, RGBA8_SNORM, RGB1, L, VT__), 478 FMT(R8G8B8X8_SRGB, RGBA8_UNORM, RGB1, S, VTR_), 479 FMT(R8G8B8X8_UINT, RGBA8UI, RGB1, L, VTR_), 480 FMT(R8G8B8X8_SINT, RGBA8I, RGB1, L, VTR_), 481 FMT(L8_UNORM, R8_UNORM, RRR1, L, VTR_), 482 FMT(I8_UNORM, R8_UNORM, RRRR, L, VTR_), 483 FMT(L16_UNORM, R16_UNORM, RRR1, L, VT__), 484 FMT(I16_UNORM, R16_UNORM, RRRR, L, VT__), 485 FMT(L8_SNORM, R8_SNORM, RRR1, L, VT__), 486 FMT(I8_SNORM, R8_SNORM, RRRR, L, VT__), 487 FMT(L16_SNORM, R16_SNORM, RRR1, L, VT__), 488 FMT(I16_SNORM, R16_SNORM, RRRR, L, VT__), 489 FMT(L16_FLOAT, R16F, RRR1, L, VTR_), 490 FMT(I16_FLOAT, RG16F, RRRR, L, VTR_), 491 FMT(L8_SRGB, R8_UNORM, RRR1, S, VTR_), 492 FMT(R8_SRGB, R8_UNORM, R001, S, VTR_), 493 FMT(R8G8_SRGB, RG8_UNORM, RG01, S, VTR_), 494 FMT(R8G8B8_SRGB, RGB8_UNORM, RGB1, S, VTR_), 495 FMT(B8G8R8_SRGB, RGB8_UNORM, BGR1, S, VTR_), 496 FMT(R8G8B8A8_SRGB, RGBA8_UNORM, RGBA, S, VTR_), 497 FMT(A8B8G8R8_SRGB, RGBA8_UNORM, ABGR, S, VTR_), 498 FMT(X8B8G8R8_SRGB, RGBA8_UNORM, ABG1, S, VTR_), 499 FMT(B8G8R8A8_SRGB, RGBA8_UNORM, BGRA, S, VTR_), 500 FMT(B8G8R8X8_SRGB, RGBA8_UNORM, BGR1, S, VTR_), 501 FMT(A8R8G8B8_SRGB, RGBA8_UNORM, GBAR, S, VTR_), 502 FMT(X8R8G8B8_SRGB, RGBA8_UNORM, GBA1, S, VTR_), 503 FMT(R8_SINT, R8I, R001, L, VTR_), 504 FMT(R16_SINT, R16I, R001, L, VTR_), 505 FMT(R32_SINT, R32I, R001, L, VTR_), 506 FMT(R16_FLOAT, R16F, R001, L, VTR_), 507 FMT(R8G8_SINT, RG8I, RG01, L, VTR_), 508 FMT(R16G16_SINT, RG16I, RG01, L, VTR_), 509 FMT(R32G32_SINT, RG32I, RG01, L, VTR_), 510 FMT(R16G16_FLOAT, RG16F, RG01, L, VTR_), 511 FMT(R8G8B8_SINT, RGB8I, RGB1, L, VTR_), 512 FMT(R32G32B32_SINT, RGB32I, RGB1, L, VTR_), 513 FMT(R8G8B8A8_SINT, RGBA8I, RGBA, L, VTR_), 514 FMT(R16G16B16A16_SINT, RGBA16I, RGBA, L, VTR_), 515 FMT(R32G32B32A32_SINT, RGBA32I, RGBA, L, VTR_), 516 FMT(R16G16B16A16_FLOAT, RGBA16F, RGBA, L, VTR_), 517 FMT(R16G16B16X16_UNORM, RGBA16_UNORM, RGB1, L, VTR_), 518 FMT(R16G16B16X16_SNORM, RGBA16_SNORM, RGB1, L, VT__), 519 FMT(R16G16B16X16_FLOAT, RGBA16F, RGB1, L, VTR_), 520 FMT(R16G16B16X16_UINT, RGBA16UI, RGB1, L, VTR_), 521 FMT(R16G16B16X16_SINT, RGBA16I, RGB1, L, VTR_), 522 FMT(R32G32B32X32_FLOAT, RGBA32F, RGB1, L, VTR_), 523 FMT(R32G32B32X32_UINT, RGBA32UI, RGB1, L, VTR_), 524 FMT(R32G32B32X32_SINT, RGBA32I, RGB1, L, VTR_), 525 526 #if PAN_ARCH <= 6 527 FMT(Z16_UNORM, R16_UNORM, RRRR, L, _T_Z), 528 FMT(Z24_UNORM_S8_UINT, Z24X8_UNORM, RRRR, L, _T_Z), 529 FMT(Z24X8_UNORM, Z24X8_UNORM, RRRR, L, _T_Z), 530 FMT(Z32_FLOAT, R32F, RRRR, L, _T_Z), 531 FMT(Z32_FLOAT_S8X24_UINT, RG32F, RRRR, L, _T_Z), 532 FMT(X32_S8X24_UINT, X32_S8X24, GGGG, L, _T_Z), 533 FMT(X24S8_UINT, RGBA8UI, AAAA, L, _T_Z), 534 FMT(S8_UINT, R8UI, RRRR, L, _T__), 535 536 FMT(A8_UNORM, R8_UNORM, 000R, L, VTR_), 537 FMT(L8A8_UNORM, RG8_UNORM, RRRG, L, VTR_), 538 FMT(L8A8_SRGB, RG8_UNORM, RRRG, S, VTR_), 539 540 /* These formats were removed in v7 */ 541 FMT(A8_SNORM, R8_SNORM, 000R, L, VT__), 542 FMT(A8_SINT, R8I, 000R, L, VTR_), 543 FMT(A8_UINT, R8UI, 000R, L, VTR_), 544 FMT(A16_SINT, R16I, 000R, L, VTR_), 545 FMT(A16_UINT, R16UI, 000R, L, VTR_), 546 FMT(A32_SINT, R32I, 000R, L, VTR_), 547 FMT(A32_UINT, R32UI, 000R, L, VTR_), 548 FMT(A16_UNORM, R16_UNORM, 000R, L, VT__), 549 FMT(A16_SNORM, R16_SNORM, 000R, L, VT__), 550 FMT(A16_FLOAT, R16F, 000R, L, VTR_), 551 552 #else 553 FMT(Z16_UNORM, Z16_UNORM, RGBA, L, _T_Z), 554 FMT(Z24_UNORM_S8_UINT, Z24X8_UNORM, RGBA, L, _T_Z), 555 FMT(Z24X8_UNORM, Z24X8_UNORM, RGBA, L, _T_Z), 556 FMT(Z32_FLOAT, R32F, RGBA, L, _T_Z), 557 558 #if PAN_ARCH >= 9 559 /* Specify interchange formats, the actual format for depth/stencil is 560 * determined by the plane descriptor on Valhall. 561 * 562 * On Valhall, S8 logically acts like "X8S8", so "S8 RGBA" is logically 563 * "0s00" and "S8 GRBA" is logically "s000". For Bifrost compatibility 564 * we want stencil in the red channel, so we use the GRBA swizzles. 565 */ 566 FMT(Z32_FLOAT_S8X24_UINT, R32F, GRBA, L, _T_Z), 567 FMT(X32_S8X24_UINT, S8, GRBA, L, _T__), 568 FMT(X24S8_UINT, S8, GRBA, L, _T_Z), 569 FMT(S8_UINT, S8, GRBA, L, _T__), 570 571 #else 572 /* Specify real formats on Bifrost */ 573 FMT(Z32_FLOAT_S8X24_UINT, Z32_X32, RGBA, L, _T_Z), 574 FMT(X32_S8X24_UINT, X32_S8X24, GRBA, L, _T__), 575 FMT(X24S8_UINT, X24S8, GRBA, L, _T_Z), 576 FMT(S8_UINT, S8, GRBA, L, _T__), 577 578 /* Obsolete formats removed in Valhall */ 579 FMT(A8_UNORM, A8_UNORM, 000A, L, VTR_), 580 FMT(L8A8_UNORM, R8A8_UNORM, RRRA, L, VTR_), 581 FMT(L8A8_SRGB, R8A8_UNORM, RRRA, S, VTR_), 582 #endif 583 584 #endif 585 }; 586