1 /* 2 * Copyright 2010 Christoph Bumiller 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 shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 23 #if NOUVEAU_DRIVER == 0xc0 24 # include "nvc0/nvc0_screen.h" 25 # include "nvc0/nvc0_3d.xml.h" 26 # include "nvc0/gm107_texture.xml.h" 27 #else 28 # include "nv50/nv50_screen.h" 29 # include "nv50/nv50_3d.xml.h" 30 #endif 31 #include "nv50/g80_texture.xml.h" 32 #include "nv50/g80_defs.xml.h" 33 34 #include "pipe/p_defines.h" 35 36 /* Abbreviated usage masks: 37 * T: texturing 38 * R: render target 39 * B: render target, blendable 40 * C: render target (color), blendable only on nvc0 41 * D: scanout/display target, blendable 42 * Z: depth/stencil 43 * I: image / surface, implies T 44 */ 45 #define U_T PIPE_BIND_SAMPLER_VIEW 46 #define U_I PIPE_BIND_SHADER_BUFFER | PIPE_BIND_SHADER_IMAGE | PIPE_BIND_COMPUTE_RESOURCE 47 #define U_TR PIPE_BIND_RENDER_TARGET | U_T 48 #define U_IR U_TR | U_I 49 #define U_TB PIPE_BIND_BLENDABLE | U_TR 50 #define U_IB PIPE_BIND_BLENDABLE | U_IR 51 #define U_TD PIPE_BIND_SCANOUT | PIPE_BIND_DISPLAY_TARGET | U_TB 52 #define U_TZ PIPE_BIND_DEPTH_STENCIL | U_T 53 #define U_ID U_TD | U_I 54 #if NOUVEAU_DRIVER == 0xc0 55 # define U_TC U_TB 56 # define U_IC U_IB 57 # define U_t U_T 58 #else 59 # define U_TC U_TR 60 # define U_IC U_IR 61 # define U_t 0 62 #endif 63 64 #define G80_ZETA_FORMAT_NONE 0 65 #define G80_SURFACE_FORMAT_NONE 0 66 67 #define SF_A(sz) G80_TIC_0_COMPONENTS_SIZES_##sz 68 #define SF_B(sz) G200_TIC_0_COMPONENTS_SIZES_##sz 69 #define SF_C(sz) GF100_TIC_0_COMPONENTS_SIZES_##sz 70 #define SF_D(sz) GM107_TIC2_0_COMPONENTS_SIZES_##sz 71 #define SF(c, pf, sf, r, g, b, a, t0, t1, t2, t3, sz, u) \ 72 [PIPE_FORMAT_##pf] = { \ 73 sf, { \ 74 SF_##c(sz), \ 75 G80_TIC_TYPE_##t0, \ 76 G80_TIC_TYPE_##t1, \ 77 G80_TIC_TYPE_##t2, \ 78 G80_TIC_TYPE_##t3, \ 79 G80_TIC_SOURCE_##r, \ 80 G80_TIC_SOURCE_##g, \ 81 G80_TIC_SOURCE_##b, \ 82 G80_TIC_SOURCE_##a, \ 83 }, U_##u \ 84 } 85 86 #define C4(c, p, n, r, g, b, a, t, s, u) \ 87 SF(c, p, G80_SURFACE_FORMAT_##n, r, g, b, a, t, t, t, t, s, u) 88 89 #define ZX(c, p, n, r, g, b, a, t, s, u) \ 90 SF(c, p, G80_ZETA_FORMAT_##n, \ 91 r, g, b, ONE_FLOAT, t, UINT, UINT, UINT, s, u) 92 #define ZS(c, p, n, r, g, b, a, t, s, u) \ 93 SF(c, p, G80_ZETA_FORMAT_##n, \ 94 r, g, b, ONE_FLOAT, t, UINT, UINT, UINT, s, u) 95 #define SZ(c, p, n, r, g, b, a, t, s, u) \ 96 SF(c, p, G80_ZETA_FORMAT_##n, \ 97 r, g, b, ONE_FLOAT, UINT, t, UINT, UINT, s, u) 98 #define SX(c, p, r, s, u) \ 99 SF(c, p, G80_ZETA_FORMAT_NONE, \ 100 r, r, r, r, UINT, UINT, UINT, UINT, s, u) 101 102 #define F3(c, p, n, r, g, b, a, t, s, u) \ 103 C4(c, p, n, r, g, b, ONE_FLOAT, t, s, u) 104 #define I3(c, p, n, r, g, b, a, t, s, u) \ 105 C4(c, p, n, r, g, b, ONE_INT, t, s, u) 106 107 #define F2(c, p, n, r, g, b, a, t, s, u) \ 108 C4(c, p, n, r, g, ZERO, ONE_FLOAT, t, s, u) 109 #define I2(c, p, n, r, g, b, a, t, s, u) \ 110 C4(c, p, n, r, g, ZERO, ONE_INT, t, s, u) 111 112 #define F1(c, p, n, r, g, b, a, t, s, u) \ 113 C4(c, p, n, r, ZERO, ZERO, ONE_FLOAT, t, s, u) 114 #define I1(c, p, n, r, g, b, a, t, s, u) \ 115 C4(c, p, n, r, ZERO, ZERO, ONE_INT, t, s, u) 116 117 #define A1(c, p, n, r, g, b, a, t, s, u) \ 118 C4(c, p, n, ZERO, ZERO, ZERO, a, t, s, u) 119 120 #if NOUVEAU_DRIVER == 0xc0 121 const struct nvc0_format nvc0_format_table[PIPE_FORMAT_COUNT] = 122 #else 123 const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] = 124 #endif 125 { 126 C4(A, B8G8R8A8_UNORM, BGRA8_UNORM, B, G, R, A, UNORM, A8B8G8R8, ID), 127 F3(A, B8G8R8X8_UNORM, BGRX8_UNORM, B, G, R, xx, UNORM, A8B8G8R8, TD), 128 C4(A, B8G8R8A8_SRGB, BGRA8_SRGB, B, G, R, A, UNORM, A8B8G8R8, TD), 129 F3(A, B8G8R8X8_SRGB, BGRX8_SRGB, B, G, R, xx, UNORM, A8B8G8R8, TD), 130 C4(A, R8G8B8A8_UNORM, RGBA8_UNORM, R, G, B, A, UNORM, A8B8G8R8, IB), 131 F3(A, R8G8B8X8_UNORM, RGBX8_UNORM, R, G, B, xx, UNORM, A8B8G8R8, TB), 132 C4(A, R8G8B8A8_SRGB, RGBA8_SRGB, R, G, B, A, UNORM, A8B8G8R8, TB), 133 F3(A, R8G8B8X8_SRGB, RGBX8_SRGB, R, G, B, xx, UNORM, A8B8G8R8, TB), 134 135 ZX(B, Z16_UNORM, Z16_UNORM, R, R, R, xx, UNORM, Z16, TZ), 136 ZX(A, Z32_FLOAT, Z32_FLOAT, R, R, R, xx, FLOAT, ZF32, TZ), 137 ZX(A, Z24X8_UNORM, Z24_X8_UNORM, R, R, R, xx, UNORM, X8Z24, TZ), 138 SZ(A, X8Z24_UNORM, S8_Z24_UNORM, G, G, G, xx, UNORM, Z24S8, TZ), 139 ZS(A, Z24_UNORM_S8_UINT, Z24_S8_UNORM, R, R, R, xx, UNORM, S8Z24, TZ), 140 SZ(A, S8_UINT_Z24_UNORM, S8_Z24_UNORM, G, G, G, xx, UNORM, Z24S8, TZ), 141 ZS(A, Z32_FLOAT_S8X24_UINT, Z32_S8_X24_FLOAT, R, R, R, xx, FLOAT, ZF32_X24S8, TZ), 142 143 SX(A, S8_UINT, R, R8, T), 144 SX(A, X24S8_UINT, G, G8R24, T), 145 SX(A, S8X24_UINT, R, G24R8, T), 146 SX(A, X32_S8X24_UINT, G, R32_B24G8, T), 147 148 F3(A, B5G6R5_UNORM, B5G6R5_UNORM, B, G, R, xx, UNORM, B5G6R5, TD), 149 C4(A, B5G5R5A1_UNORM, BGR5_A1_UNORM, B, G, R, A, UNORM, A1B5G5R5, TD), 150 F3(A, B5G5R5X1_UNORM, BGR5_X1_UNORM, B, G, R, xx, UNORM, A1B5G5R5, TD), 151 C4(A, B4G4R4A4_UNORM, NONE, B, G, R, A, UNORM, A4B4G4R4, T), 152 F3(A, B4G4R4X4_UNORM, NONE, B, G, R, xx, UNORM, A4B4G4R4, T), 153 F3(A, R9G9B9E5_FLOAT, NONE, R, G, B, xx, FLOAT, E5B9G9R9_SHAREDEXP, T), 154 155 C4(A, R10G10B10A2_UNORM, RGB10_A2_UNORM, R, G, B, A, UNORM, A2B10G10R10, IB), 156 C4(A, B10G10R10A2_UNORM, BGR10_A2_UNORM, B, G, R, A, UNORM, A2B10G10R10, TD), 157 C4(A, R10G10B10A2_SNORM, NONE, R, G, B, A, SNORM, A2B10G10R10, T), 158 C4(A, B10G10R10A2_SNORM, NONE, B, G, R, A, SNORM, A2B10G10R10, T), 159 C4(A, R10G10B10A2_UINT, RGB10_A2_UINT, R, G, B, A, UINT, A2B10G10R10, TR), 160 C4(A, B10G10R10A2_UINT, RGB10_A2_UINT, B, G, R, A, UINT, A2B10G10R10, T), 161 162 F3(A, R11G11B10_FLOAT, R11G11B10_FLOAT, R, G, B, xx, FLOAT, BF10GF11RF11, IB), 163 164 F3(A, L8_UNORM, R8_UNORM, R, R, R, xx, UNORM, R8, TB), 165 F3(A, L8_SRGB, NONE, R, R, R, xx, UNORM, R8, T), 166 F3(A, L8_SNORM, R8_SNORM, R, R, R, xx, SNORM, R8, TC), 167 I3(A, L8_SINT, R8_SINT, R, R, R, xx, SINT, R8, TR), 168 I3(A, L8_UINT, R8_UINT, R, R, R, xx, UINT, R8, TR), 169 F3(A, L16_UNORM, R16_UNORM, R, R, R, xx, UNORM, R16, TC), 170 F3(A, L16_SNORM, R16_SNORM, R, R, R, xx, SNORM, R16, TC), 171 F3(A, L16_FLOAT, R16_FLOAT, R, R, R, xx, FLOAT, R16, TB), 172 I3(A, L16_SINT, R16_SINT, R, R, R, xx, SINT, R16, TR), 173 I3(A, L16_UINT, R16_UINT, R, R, R, xx, UINT, R16, TR), 174 F3(A, L32_FLOAT, R32_FLOAT, R, R, R, xx, FLOAT, R32, TB), 175 I3(A, L32_SINT, R32_SINT, R, R, R, xx, SINT, R32, TR), 176 I3(A, L32_UINT, R32_UINT, R, R, R, xx, UINT, R32, TR), 177 178 C4(A, I8_UNORM, R8_UNORM, R, R, R, R, UNORM, R8, TR), 179 C4(A, I8_SNORM, R8_SNORM, R, R, R, R, SNORM, R8, TR), 180 C4(A, I8_SINT, R8_SINT, R, R, R, R, SINT, R8, TR), 181 C4(A, I8_UINT, R8_UINT, R, R, R, R, UINT, R8, TR), 182 C4(A, I16_UNORM, R16_UNORM, R, R, R, R, UNORM, R16, TR), 183 C4(A, I16_SNORM, R16_SNORM, R, R, R, R, SNORM, R16, TR), 184 C4(A, I16_FLOAT, R16_FLOAT, R, R, R, R, FLOAT, R16, TR), 185 C4(A, I16_SINT, R16_SINT, R, R, R, R, SINT, R16, TR), 186 C4(A, I16_UINT, R16_UINT, R, R, R, R, UINT, R16, TR), 187 C4(A, I32_FLOAT, R32_FLOAT, R, R, R, R, FLOAT, R32, TR), 188 C4(A, I32_SINT, R32_SINT, R, R, R, R, SINT, R32, TR), 189 C4(A, I32_UINT, R32_UINT, R, R, R, R, UINT, R32, TR), 190 191 A1(A, A8_UNORM, A8_UNORM, xx, xx, xx, R, UNORM, R8, TB), 192 A1(A, A8_SNORM, R8_SNORM, xx, xx, xx, R, SNORM, R8, T), 193 A1(A, A8_SINT, R8_SINT, xx, xx, xx, R, SINT, R8, T), 194 A1(A, A8_UINT, R8_UINT, xx, xx, xx, R, UINT, R8, T), 195 A1(A, A16_UNORM, R16_UNORM, xx, xx, xx, R, UNORM, R16, T), 196 A1(A, A16_SNORM, R16_SNORM, xx, xx, xx, R, SNORM, R16, T), 197 A1(A, A16_FLOAT, R16_FLOAT, xx, xx, xx, R, FLOAT, R16, T), 198 A1(A, A16_SINT, R16_SINT, xx, xx, xx, R, SINT, R16, T), 199 A1(A, A16_UINT, R16_UINT, xx, xx, xx, R, UINT, R16, T), 200 A1(A, A32_FLOAT, R32_FLOAT, xx, xx, xx, R, FLOAT, R32, T), 201 A1(A, A32_SINT, R32_SINT, xx, xx, xx, R, SINT, R32, T), 202 A1(A, A32_UINT, R32_UINT, xx, xx, xx, R, UINT, R32, T), 203 204 C4(A, L4A4_UNORM, NONE, R, R, R, G, UNORM, G4R4, T), 205 C4(A, L8A8_UNORM, RG8_UNORM, R, R, R, G, UNORM, G8R8, T), 206 C4(A, L8A8_SNORM, RG8_SNORM, R, R, R, G, SNORM, G8R8, T), 207 C4(A, L8A8_SRGB, NONE, R, R, R, G, UNORM, G8R8, T), 208 C4(A, L8A8_SINT, RG8_SINT, R, R, R, G, SINT, G8R8, T), 209 C4(A, L8A8_UINT, RG8_UINT, R, R, R, G, UINT, G8R8, T), 210 C4(A, L16A16_UNORM, RG16_UNORM, R, R, R, G, UNORM, R16_G16, T), 211 C4(A, L16A16_SNORM, RG16_SNORM, R, R, R, G, SNORM, R16_G16, T), 212 C4(A, L16A16_FLOAT, RG16_FLOAT, R, R, R, G, FLOAT, R16_G16, T), 213 C4(A, L16A16_SINT, RG16_SINT, R, R, R, G, SINT, R16_G16, T), 214 C4(A, L16A16_UINT, RG16_UINT, R, R, R, G, UINT, R16_G16, T), 215 C4(A, L32A32_FLOAT, RG32_FLOAT, R, R, R, G, FLOAT, R32_G32, T), 216 C4(A, L32A32_SINT, RG32_SINT, R, R, R, G, SINT, R32_G32, T), 217 C4(A, L32A32_UINT, RG32_UINT, R, R, R, G, UINT, R32_G32, T), 218 219 F3(A, DXT1_RGB, NONE, R, G, B, xx, UNORM, DXT1, T), 220 F3(A, DXT1_SRGB, NONE, R, G, B, xx, UNORM, DXT1, T), 221 C4(A, DXT1_RGBA, NONE, R, G, B, A, UNORM, DXT1, T), 222 C4(A, DXT1_SRGBA, NONE, R, G, B, A, UNORM, DXT1, T), 223 C4(A, DXT3_RGBA, NONE, R, G, B, A, UNORM, DXT23, T), 224 C4(A, DXT3_SRGBA, NONE, R, G, B, A, UNORM, DXT23, T), 225 C4(A, DXT5_RGBA, NONE, R, G, B, A, UNORM, DXT45, T), 226 C4(A, DXT5_SRGBA, NONE, R, G, B, A, UNORM, DXT45, T), 227 228 F1(A, RGTC1_UNORM, NONE, R, xx, xx, xx, UNORM, DXN1, T), 229 F1(A, RGTC1_SNORM, NONE, R, xx, xx, xx, SNORM, DXN1, T), 230 F2(A, RGTC2_UNORM, NONE, R, G, xx, xx, UNORM, DXN2, T), 231 F2(A, RGTC2_SNORM, NONE, R, G, xx, xx, SNORM, DXN2, T), 232 F3(A, LATC1_UNORM, NONE, R, R, R, xx, UNORM, DXN1, T), 233 F3(A, LATC1_SNORM, NONE, R, R, R, xx, SNORM, DXN1, T), 234 C4(A, LATC2_UNORM, NONE, R, R, R, G, UNORM, DXN2, T), 235 C4(A, LATC2_SNORM, NONE, R, R, R, G, SNORM, DXN2, T), 236 237 C4(C, BPTC_RGBA_UNORM, NONE, R, G, B, A, UNORM, BC7U, t), 238 C4(C, BPTC_SRGBA, NONE, R, G, B, A, UNORM, BC7U, t), 239 F3(C, BPTC_RGB_FLOAT, NONE, R, G, B, xx, FLOAT, BC6H_SF16, t), 240 F3(C, BPTC_RGB_UFLOAT, NONE, R, G, B, xx, FLOAT, BC6H_UF16, t), 241 242 #if NOUVEAU_DRIVER == 0xc0 243 F3(D, ETC1_RGB8, NONE, R, G, B, xx, UNORM, ETC2_RGB, t), 244 F3(D, ETC2_RGB8, NONE, R, G, B, xx, UNORM, ETC2_RGB, t), 245 F3(D, ETC2_SRGB8, NONE, R, G, B, xx, UNORM, ETC2_RGB, t), 246 C4(D, ETC2_RGB8A1, NONE, R, G, B, A, UNORM, ETC2_RGB_PTA, t), 247 C4(D, ETC2_SRGB8A1, NONE, R, G, B, A, UNORM, ETC2_RGB_PTA, t), 248 C4(D, ETC2_RGBA8, NONE, R, G, B, A, UNORM, ETC2_RGBA, t), 249 C4(D, ETC2_SRGBA8, NONE, R, G, B, A, UNORM, ETC2_RGBA, t), 250 F1(D, ETC2_R11_UNORM, NONE, R, xx, xx, xx, UNORM, EAC, t), 251 F1(D, ETC2_R11_SNORM, NONE, R, xx, xx, xx, SNORM, EAC, t), 252 F2(D, ETC2_RG11_UNORM, NONE, R, G, xx, xx, UNORM, EACX2, t), 253 F2(D, ETC2_RG11_SNORM, NONE, R, G, xx, xx, SNORM, EACX2, t), 254 255 C4(D, ASTC_4x4, NONE, R, G, B, A, UNORM, ASTC_2D_4X4, t), 256 C4(D, ASTC_5x4, NONE, R, G, B, A, UNORM, ASTC_2D_5X4, t), 257 C4(D, ASTC_5x5, NONE, R, G, B, A, UNORM, ASTC_2D_5X5, t), 258 C4(D, ASTC_6x5, NONE, R, G, B, A, UNORM, ASTC_2D_6X5, t), 259 C4(D, ASTC_6x6, NONE, R, G, B, A, UNORM, ASTC_2D_6X6, t), 260 C4(D, ASTC_8x5, NONE, R, G, B, A, UNORM, ASTC_2D_8X5, t), 261 C4(D, ASTC_8x6, NONE, R, G, B, A, UNORM, ASTC_2D_8X6, t), 262 C4(D, ASTC_8x8, NONE, R, G, B, A, UNORM, ASTC_2D_8X8, t), 263 C4(D, ASTC_10x5, NONE, R, G, B, A, UNORM, ASTC_2D_10X5, t), 264 C4(D, ASTC_10x6, NONE, R, G, B, A, UNORM, ASTC_2D_10X6, t), 265 C4(D, ASTC_10x8, NONE, R, G, B, A, UNORM, ASTC_2D_10X8, t), 266 C4(D, ASTC_10x10, NONE, R, G, B, A, UNORM, ASTC_2D_10X10, t), 267 C4(D, ASTC_12x10, NONE, R, G, B, A, UNORM, ASTC_2D_12X10, t), 268 C4(D, ASTC_12x12, NONE, R, G, B, A, UNORM, ASTC_2D_12X12, t), 269 270 C4(D, ASTC_4x4_SRGB, NONE, R, G, B, A, UNORM, ASTC_2D_4X4, t), 271 C4(D, ASTC_5x4_SRGB, NONE, R, G, B, A, UNORM, ASTC_2D_5X4, t), 272 C4(D, ASTC_5x5_SRGB, NONE, R, G, B, A, UNORM, ASTC_2D_5X5, t), 273 C4(D, ASTC_6x5_SRGB, NONE, R, G, B, A, UNORM, ASTC_2D_6X5, t), 274 C4(D, ASTC_6x6_SRGB, NONE, R, G, B, A, UNORM, ASTC_2D_6X6, t), 275 C4(D, ASTC_8x5_SRGB, NONE, R, G, B, A, UNORM, ASTC_2D_8X5, t), 276 C4(D, ASTC_8x6_SRGB, NONE, R, G, B, A, UNORM, ASTC_2D_8X6, t), 277 C4(D, ASTC_8x8_SRGB, NONE, R, G, B, A, UNORM, ASTC_2D_8X8, t), 278 C4(D, ASTC_10x5_SRGB, NONE, R, G, B, A, UNORM, ASTC_2D_10X5, t), 279 C4(D, ASTC_10x6_SRGB, NONE, R, G, B, A, UNORM, ASTC_2D_10X6, t), 280 C4(D, ASTC_10x8_SRGB, NONE, R, G, B, A, UNORM, ASTC_2D_10X8, t), 281 C4(D, ASTC_10x10_SRGB, NONE, R, G, B, A, UNORM, ASTC_2D_10X10, t), 282 C4(D, ASTC_12x10_SRGB, NONE, R, G, B, A, UNORM, ASTC_2D_12X10, t), 283 C4(D, ASTC_12x12_SRGB, NONE, R, G, B, A, UNORM, ASTC_2D_12X12, t), 284 #endif 285 286 C4(A, R32G32B32A32_FLOAT, RGBA32_FLOAT, R, G, B, A, FLOAT, R32_G32_B32_A32, IB), 287 C4(A, R32G32B32A32_UNORM, NONE, R, G, B, A, UNORM, R32_G32_B32_A32, T), 288 C4(A, R32G32B32A32_SNORM, NONE, R, G, B, A, SNORM, R32_G32_B32_A32, T), 289 C4(A, R32G32B32A32_SINT, RGBA32_SINT, R, G, B, A, SINT, R32_G32_B32_A32, IR), 290 C4(A, R32G32B32A32_UINT, RGBA32_UINT, R, G, B, A, UINT, R32_G32_B32_A32, IR), 291 F3(A, R32G32B32X32_FLOAT, RGBX32_FLOAT, R, G, B, xx, FLOAT, R32_G32_B32_A32, TB), 292 I3(A, R32G32B32X32_SINT, RGBX32_SINT, R, G, B, xx, SINT, R32_G32_B32_A32, TR), 293 I3(A, R32G32B32X32_UINT, RGBX32_UINT, R, G, B, xx, UINT, R32_G32_B32_A32, TR), 294 295 F3(C, R32G32B32_FLOAT, NONE, R, G, B, xx, FLOAT, R32_G32_B32, t), 296 I3(C, R32G32B32_SINT, NONE, R, G, B, xx, SINT, R32_G32_B32, t), 297 I3(C, R32G32B32_UINT, NONE, R, G, B, xx, UINT, R32_G32_B32, t), 298 299 F2(A, R32G32_FLOAT, RG32_FLOAT, R, G, xx, xx, FLOAT, R32_G32, IB), 300 F2(A, R32G32_UNORM, NONE, R, G, xx, xx, UNORM, R32_G32, T), 301 F2(A, R32G32_SNORM, NONE, R, G, xx, xx, SNORM, R32_G32, T), 302 I2(A, R32G32_SINT, RG32_SINT, R, G, xx, xx, SINT, R32_G32, IR), 303 I2(A, R32G32_UINT, RG32_UINT, R, G, xx, xx, UINT, R32_G32, IR), 304 305 F1(A, R32_FLOAT, R32_FLOAT, R, xx, xx, xx, FLOAT, R32, IB), 306 F1(A, R32_UNORM, NONE, R, xx, xx, xx, UNORM, R32, T), 307 F1(A, R32_SNORM, NONE, R, xx, xx, xx, SNORM, R32, T), 308 I1(A, R32_SINT, R32_SINT, R, xx, xx, xx, SINT, R32, IR), 309 I1(A, R32_UINT, R32_UINT, R, xx, xx, xx, UINT, R32, IR), 310 311 C4(A, R16G16B16A16_FLOAT, RGBA16_FLOAT, R, G, B, A, FLOAT, R16_G16_B16_A16, IB), 312 C4(A, R16G16B16A16_UNORM, RGBA16_UNORM, R, G, B, A, UNORM, R16_G16_B16_A16, IC), 313 C4(A, R16G16B16A16_SNORM, RGBA16_SNORM, R, G, B, A, SNORM, R16_G16_B16_A16, IC), 314 C4(A, R16G16B16A16_SINT, RGBA16_SINT, R, G, B, A, SINT, R16_G16_B16_A16, IR), 315 C4(A, R16G16B16A16_UINT, RGBA16_UINT, R, G, B, A, UINT, R16_G16_B16_A16, IR), 316 F3(A, R16G16B16X16_FLOAT, RGBX16_FLOAT, R, G, B, xx, FLOAT, R16_G16_B16_A16, TB), 317 F3(A, R16G16B16X16_UNORM, RGBA16_UNORM, R, G, B, xx, UNORM, R16_G16_B16_A16, T), 318 F3(A, R16G16B16X16_SNORM, RGBA16_SNORM, R, G, B, xx, SNORM, R16_G16_B16_A16, T), 319 I3(A, R16G16B16X16_SINT, RGBA16_SINT, R, G, B, xx, SINT, R16_G16_B16_A16, T), 320 I3(A, R16G16B16X16_UINT, RGBA16_UINT, R, G, B, xx, UINT, R16_G16_B16_A16, T), 321 322 F2(A, R16G16_FLOAT, RG16_FLOAT, R, G, xx, xx, FLOAT, R16_G16, IB), 323 F2(A, R16G16_UNORM, RG16_UNORM, R, G, xx, xx, UNORM, R16_G16, IC), 324 F2(A, R16G16_SNORM, RG16_SNORM, R, G, xx, xx, SNORM, R16_G16, IC), 325 I2(A, R16G16_SINT, RG16_SINT, R, G, xx, xx, SINT, R16_G16, IR), 326 I2(A, R16G16_UINT, RG16_UINT, R, G, xx, xx, UINT, R16_G16, IR), 327 328 F1(A, R16_FLOAT, R16_FLOAT, R, xx, xx, xx, FLOAT, R16, IB), 329 F1(A, R16_UNORM, R16_UNORM, R, xx, xx, xx, UNORM, R16, IC), 330 F1(A, R16_SNORM, R16_SNORM, R, xx, xx, xx, SNORM, R16, IC), 331 I1(A, R16_SINT, R16_SINT, R, xx, xx, xx, SINT, R16, IR), 332 I1(A, R16_UINT, R16_UINT, R, xx, xx, xx, UINT, R16, IR), 333 334 C4(A, R8G8B8A8_SNORM, RGBA8_SNORM, R, G, B, A, SNORM, A8B8G8R8, IC), 335 C4(A, R8G8B8A8_SINT, RGBA8_SINT, R, G, B, A, SINT, A8B8G8R8, IR), 336 C4(A, R8G8B8A8_UINT, RGBA8_UINT, R, G, B, A, UINT, A8B8G8R8, IR), 337 F3(A, R8G8B8X8_SNORM, RGBA8_SNORM, R, G, B, xx, SNORM, A8B8G8R8, T), 338 I3(A, R8G8B8X8_SINT, RGBA8_SINT, R, G, B, xx, SINT, A8B8G8R8, T), 339 I3(A, R8G8B8X8_UINT, RGBA8_UINT, R, G, B, xx, UINT, A8B8G8R8, T), 340 341 F2(A, R8G8_UNORM, RG8_UNORM, R, G, xx, xx, UNORM, G8R8, IB), 342 F2(A, R8G8_SNORM, RG8_SNORM, R, G, xx, xx, SNORM, G8R8, IC), 343 I2(A, R8G8_SINT, RG8_SINT, R, G, xx, xx, SINT, G8R8, IR), 344 I2(A, R8G8_UINT, RG8_UINT, R, G, xx, xx, UINT, G8R8, IR), 345 346 F1(A, R8_UNORM, R8_UNORM, R, xx, xx, xx, UNORM, R8, IB), 347 F1(A, R8_SNORM, R8_SNORM, R, xx, xx, xx, SNORM, R8, IC), 348 I1(A, R8_SINT, R8_SINT, R, xx, xx, xx, SINT, R8, IR), 349 I1(A, R8_UINT, R8_UINT, R, xx, xx, xx, UINT, R8, IR), 350 351 F3(A, R8G8_B8G8_UNORM, NONE, R, G, B, xx, UNORM, G8B8G8R8, T), 352 F3(A, G8R8_B8R8_UNORM, NONE, G, R, B, xx, UNORM, G8B8G8R8, T), 353 F3(A, G8R8_G8B8_UNORM, NONE, R, G, B, xx, UNORM, B8G8R8G8, T), 354 F3(A, R8G8_R8B8_UNORM, NONE, G, R, B, xx, UNORM, B8G8R8G8, T), 355 356 F1(A, R1_UNORM, BITMAP, R, xx, xx, xx, UNORM, R1, T), 357 358 C4(A, R4A4_UNORM, NONE, R, ZERO, ZERO, G, UNORM, G4R4, T), 359 C4(A, R8A8_UNORM, NONE, R, ZERO, ZERO, G, UNORM, G8R8, T), 360 C4(A, A4R4_UNORM, NONE, G, ZERO, ZERO, R, UNORM, G4R4, T), 361 C4(A, A8R8_UNORM, NONE, G, ZERO, ZERO, R, UNORM, G8R8, T), 362 363 SF(A, R8SG8SB8UX8U_NORM, 0, R, G, B, ONE_FLOAT, SNORM, SNORM, UNORM, UNORM, A8B8G8R8, T), 364 SF(A, R5SG5SB6U_NORM, 0, R, G, B, ONE_FLOAT, SNORM, SNORM, UNORM, UNORM, B6G5R5, T), 365 }; 366 367 #if NOUVEAU_DRIVER == 0xc0 368 # define NVXX_3D_VAF_SIZE(s) NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_##s 369 # define NVXX_3D_VAF_TYPE(t) NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_##t 370 #else 371 # define NVXX_3D_VAF_SIZE(s) NV50_3D_VERTEX_ARRAY_ATTRIB_FORMAT_##s 372 # define NVXX_3D_VAF_TYPE(t) NV50_3D_VERTEX_ARRAY_ATTRIB_TYPE_##t 373 #endif 374 375 #define VF_x(pf, type, size, bgra) 0 376 #define VF_A(pf, type, size, bgra) \ 377 NVXX_3D_VAF_SIZE(size) | NVXX_3D_VAF_TYPE(type) | (bgra << 31) 378 #define VF(c, pf, type, size, bgra) \ 379 [PIPE_FORMAT_##pf] = { \ 380 VF_##c(pf, type, size, bgra), \ 381 PIPE_BIND_VERTEX_BUFFER \ 382 } 383 384 #if NOUVEAU_DRIVER == 0xc0 385 const struct nvc0_vertex_format nvc0_vertex_format[PIPE_FORMAT_COUNT] = 386 #else 387 const struct nv50_vertex_format nv50_vertex_format[PIPE_FORMAT_COUNT] = 388 #endif 389 { 390 VF(A, B8G8R8A8_UNORM, UNORM, 8_8_8_8, 1), 391 VF(A, R8G8B8A8_UNORM, UNORM, 8_8_8_8, 0), 392 393 VF(A, R10G10B10A2_UNORM, UNORM, 10_10_10_2, 0), 394 VF(A, B10G10R10A2_UNORM, UNORM, 10_10_10_2, 1), 395 VF(A, R10G10B10A2_SNORM, SNORM, 10_10_10_2, 0), 396 VF(A, B10G10R10A2_SNORM, SNORM, 10_10_10_2, 1), 397 VF(A, R10G10B10A2_UINT, UINT, 10_10_10_2, 0), 398 VF(A, B10G10R10A2_UINT, UINT, 10_10_10_2, 1), 399 400 VF(A, R11G11B10_FLOAT, FLOAT, 11_11_10, 0), 401 402 VF(A, R32G32B32A32_FLOAT, FLOAT, 32_32_32_32, 0), 403 VF(A, R32G32B32A32_UNORM, UNORM, 32_32_32_32, 0), 404 VF(A, R32G32B32A32_SNORM, SNORM, 32_32_32_32, 0), 405 VF(A, R32G32B32A32_SINT, SINT, 32_32_32_32, 0), 406 VF(A, R32G32B32A32_UINT, UINT, 32_32_32_32, 0), 407 408 VF(A, R32G32_FLOAT, FLOAT, 32_32, 0), 409 VF(A, R32G32_UNORM, UNORM, 32_32, 0), 410 VF(A, R32G32_SNORM, SNORM, 32_32, 0), 411 VF(A, R32G32_SINT, SINT, 32_32, 0), 412 VF(A, R32G32_UINT, UINT, 32_32, 0), 413 414 VF(A, R32_FLOAT, FLOAT, 32, 0), 415 VF(A, R32_UNORM, UNORM, 32, 0), 416 VF(A, R32_SNORM, SNORM, 32, 0), 417 VF(A, R32_SINT, SINT, 32, 0), 418 VF(A, R32_UINT, UINT, 32, 0), 419 420 VF(A, R16G16B16A16_FLOAT, FLOAT, 16_16_16_16, 0), 421 VF(A, R16G16B16A16_UNORM, UNORM, 16_16_16_16, 0), 422 VF(A, R16G16B16A16_SNORM, SNORM, 16_16_16_16, 0), 423 VF(A, R16G16B16A16_SINT, SINT, 16_16_16_16, 0), 424 VF(A, R16G16B16A16_UINT, UINT, 16_16_16_16, 0), 425 426 VF(A, R16G16_FLOAT, FLOAT, 16_16, 0), 427 VF(A, R16G16_UNORM, UNORM, 16_16, 0), 428 VF(A, R16G16_SNORM, SNORM, 16_16, 0), 429 VF(A, R16G16_SINT, SINT, 16_16, 0), 430 VF(A, R16G16_UINT, UINT, 16_16, 0), 431 432 VF(A, R16_FLOAT, FLOAT, 16, 0), 433 VF(A, R16_UNORM, UNORM, 16, 0), 434 VF(A, R16_SNORM, SNORM, 16, 0), 435 VF(A, R16_SINT, SINT, 16, 0), 436 VF(A, R16_UINT, UINT, 16, 0), 437 438 VF(A, R8G8B8A8_SNORM, SNORM, 8_8_8_8, 0), 439 VF(A, R8G8B8A8_SINT, SINT, 8_8_8_8, 0), 440 VF(A, R8G8B8A8_UINT, UINT, 8_8_8_8, 0), 441 442 VF(A, R8G8_UNORM, UNORM, 8_8, 0), 443 VF(A, R8G8_SNORM, SNORM, 8_8, 0), 444 VF(A, R8G8_SINT, SINT, 8_8, 0), 445 VF(A, R8G8_UINT, UINT, 8_8, 0), 446 447 VF(A, R8_UNORM, UNORM, 8, 0), 448 VF(A, R8_SNORM, SNORM, 8, 0), 449 VF(A, R8_SINT, SINT, 8, 0), 450 VF(A, R8_UINT, UINT, 8, 0), 451 452 VF(A, R32G32B32A32_SSCALED, SSCALED, 32_32_32_32, 0), 453 VF(A, R32G32B32A32_USCALED, USCALED, 32_32_32_32, 0), 454 VF(A, R32G32B32_FLOAT, FLOAT, 32_32_32, 0), 455 VF(A, R32G32B32_UNORM, UNORM, 32_32_32, 0), 456 VF(A, R32G32B32_SNORM, SNORM, 32_32_32, 0), 457 VF(A, R32G32B32_SINT, SINT, 32_32_32, 0), 458 VF(A, R32G32B32_UINT, UINT, 32_32_32, 0), 459 VF(A, R32G32B32_SSCALED, SSCALED, 32_32_32, 0), 460 VF(A, R32G32B32_USCALED, USCALED, 32_32_32, 0), 461 VF(A, R32G32_SSCALED, SSCALED, 32_32, 0), 462 VF(A, R32G32_USCALED, USCALED, 32_32, 0), 463 VF(A, R32_SSCALED, SSCALED, 32, 0), 464 VF(A, R32_USCALED, USCALED, 32, 0), 465 466 VF(A, R16G16B16A16_SSCALED, SSCALED, 16_16_16_16, 0), 467 VF(A, R16G16B16A16_USCALED, USCALED, 16_16_16_16, 0), 468 VF(A, R16G16B16_FLOAT, FLOAT, 16_16_16, 0), 469 VF(A, R16G16B16_UNORM, UNORM, 16_16_16, 0), 470 VF(A, R16G16B16_SNORM, SNORM, 16_16_16, 0), 471 VF(A, R16G16B16_SINT, SINT, 16_16_16, 0), 472 VF(A, R16G16B16_UINT, UINT, 16_16_16, 0), 473 VF(A, R16G16B16_SSCALED, SSCALED, 16_16_16, 0), 474 VF(A, R16G16B16_USCALED, USCALED, 16_16_16, 0), 475 VF(A, R16G16_SSCALED, SSCALED, 16_16, 0), 476 VF(A, R16G16_USCALED, USCALED, 16_16, 0), 477 VF(A, R16_SSCALED, SSCALED, 16, 0), 478 VF(A, R16_USCALED, USCALED, 16, 0), 479 480 VF(A, R10G10B10A2_USCALED, USCALED, 10_10_10_2, 0), 481 VF(A, R10G10B10A2_SSCALED, SSCALED, 10_10_10_2, 0), 482 VF(A, B10G10R10A2_USCALED, USCALED, 10_10_10_2, 1), 483 VF(A, B10G10R10A2_SSCALED, SSCALED, 10_10_10_2, 1), 484 485 VF(A, R8G8B8A8_SSCALED, SSCALED, 8_8_8_8, 0), 486 VF(A, R8G8B8A8_USCALED, USCALED, 8_8_8_8, 0), 487 VF(A, R8G8B8_UNORM, UNORM, 8_8_8, 0), 488 VF(A, R8G8B8_SNORM, SNORM, 8_8_8, 0), 489 VF(A, R8G8B8_SINT, SINT, 8_8_8, 0), 490 VF(A, R8G8B8_UINT, UINT, 8_8_8, 0), 491 VF(A, R8G8B8_SSCALED, SSCALED, 8_8_8, 0), 492 VF(A, R8G8B8_USCALED, USCALED, 8_8_8, 0), 493 VF(A, R8G8_SSCALED, SSCALED, 8_8, 0), 494 VF(A, R8G8_USCALED, USCALED, 8_8, 0), 495 VF(A, R8_SSCALED, SSCALED, 8, 0), 496 VF(A, R8_USCALED, USCALED, 8, 0), 497 498 /* FIXED types: not supported natively, converted on VBO push */ 499 500 VF(x, R32G32B32A32_FIXED, xx, xx, xx), 501 VF(x, R32G32B32_FIXED, xx, xx, xx), 502 VF(x, R32G32_FIXED, xx, xx, xx), 503 VF(x, R32_FIXED, xx, xx, xx), 504 505 VF(x, R64G64B64A64_FLOAT, xx, xx, xx), 506 VF(x, R64G64B64_FLOAT, xx, xx, xx), 507 VF(x, R64G64_FLOAT, xx, xx, xx), 508 VF(x, R64_FLOAT, xx, xx, xx), 509 }; 510