Home | History | Annotate | Download | only in nv50
      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 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
     18  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
     19  * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     20  * SOFTWARE.
     21  */
     22 
     23 #if NOUVEAU_DRIVER == 0xc0
     24 # include "nvc0_screen.h"
     25 # include "nvc0_3d.xml.h"
     26 #else
     27 # include "nv50_screen.h"
     28 # include "nv50_3d.xml.h"
     29 #endif
     30 #include "nv50_texture.xml.h"
     31 #include "nv50_defs.xml.h"
     32 
     33 #include "pipe/p_defines.h"
     34 
     35 /* Abbreviated usage masks:
     36  * T: texturing
     37  * R: render target
     38  * B: render target, blendable
     39  * C: render target (color), blendable only on nvc0
     40  * D: scanout/display target, blendable
     41  * Z: depth/stencil
     42  * V: vertex fetch
     43  */
     44 #define U_V   PIPE_BIND_VERTEX_BUFFER
     45 #define U_T   PIPE_BIND_SAMPLER_VIEW
     46 #define U_TR  PIPE_BIND_RENDER_TARGET | U_T
     47 #define U_TB  PIPE_BIND_BLENDABLE | U_TR
     48 #define U_TD  PIPE_BIND_SCANOUT | PIPE_BIND_DISPLAY_TARGET | U_TB
     49 #define U_TZ  PIPE_BIND_DEPTH_STENCIL | U_T
     50 #define U_TV  U_V | U_T
     51 #define U_TRV U_V | U_TR
     52 #define U_TBV U_V | U_TB
     53 #define U_TDV U_V | U_TD
     54 #if NOUVEAU_DRIVER == 0xc0
     55 # define U_TC  U_TB
     56 # define U_TCV U_TBV
     57 #else
     58 # define U_TC  U_TR
     59 # define U_TCV U_TRV
     60 #endif
     61 
     62 #define NV50_SURFACE_FORMAT_NONE 0
     63 #define NV50_ZETA_FORMAT_NONE 0
     64 
     65 /* for vertex buffers: */
     66 #define NV50_TIC_0_FMT_8_8_8    NV50_TIC_0_FMT_8_8_8_8
     67 #define NV50_TIC_0_FMT_16_16_16 NV50_TIC_0_FMT_16_16_16_16
     68 #define NV50_TIC_0_FMT_32_32_32 NV50_TIC_0_FMT_32_32_32_32
     69 
     70 #if NOUVEAU_DRIVER == 0xc0
     71 # define NVXX_3D_VAF_SIZE(s) NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_##s
     72 # define NVXX_3D_VAF_TYPE(t) NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_##t
     73 #else
     74 # define NVXX_3D_VAF_SIZE(s) NV50_3D_VERTEX_ARRAY_ATTRIB_FORMAT_##s
     75 # define NVXX_3D_VAF_TYPE(t) NV50_3D_VERTEX_ARRAY_ATTRIB_TYPE_##t
     76 #endif
     77 
     78 #define TBLENT_A_(pf, sf, r, g, b, a, t0, t1, t2, t3, sz, u, br)        \
     79    [PIPE_FORMAT_##pf] = {                                               \
     80       sf,                                                               \
     81       (NV50_TIC_MAP_##r << NV50_TIC_0_MAPR__SHIFT) |                    \
     82       (NV50_TIC_MAP_##g << NV50_TIC_0_MAPG__SHIFT) |                    \
     83       (NV50_TIC_MAP_##b << NV50_TIC_0_MAPB__SHIFT) |                    \
     84       (NV50_TIC_MAP_##a << NV50_TIC_0_MAPA__SHIFT) |                    \
     85       (NV50_TIC_TYPE_##t0 << NV50_TIC_0_TYPE0__SHIFT) |                 \
     86       (NV50_TIC_TYPE_##t1 << NV50_TIC_0_TYPE1__SHIFT) |                 \
     87       (NV50_TIC_TYPE_##t2 << NV50_TIC_0_TYPE2__SHIFT) |                 \
     88       (NV50_TIC_TYPE_##t3 << NV50_TIC_0_TYPE3__SHIFT) |                 \
     89       NV50_TIC_0_FMT_##sz,                                              \
     90       NVXX_3D_VAF_SIZE(sz) |                                            \
     91       NVXX_3D_VAF_TYPE(t0) | (br << 31),                                \
     92       U_##u                                                             \
     93    }
     94 
     95 #define TBLENT_B_(pf, sf, r, g, b, a, t0, t1, t2, t3, sz, u)            \
     96    [PIPE_FORMAT_##pf] = {                                               \
     97       sf,                                                               \
     98       (NV50_TIC_MAP_##r << NV50_TIC_0_MAPR__SHIFT) |                    \
     99       (NV50_TIC_MAP_##g << NV50_TIC_0_MAPG__SHIFT) |                    \
    100       (NV50_TIC_MAP_##b << NV50_TIC_0_MAPB__SHIFT) |                    \
    101       (NV50_TIC_MAP_##a << NV50_TIC_0_MAPA__SHIFT) |                    \
    102       (NV50_TIC_TYPE_##t0 << NV50_TIC_0_TYPE0__SHIFT) |                 \
    103       (NV50_TIC_TYPE_##t1 << NV50_TIC_0_TYPE1__SHIFT) |                 \
    104       (NV50_TIC_TYPE_##t2 << NV50_TIC_0_TYPE2__SHIFT) |                 \
    105       (NV50_TIC_TYPE_##t3 << NV50_TIC_0_TYPE3__SHIFT) |                 \
    106       NV50_TIC_0_FMT_##sz, 0, U_##u                                     \
    107    }
    108 
    109 #define C4A(p, n, r, g, b, a, t, s, u, br)                              \
    110    TBLENT_A_(p, NV50_SURFACE_FORMAT_##n, r, g, b, a, t, t, t, t, s, u, br)
    111 #define C4B(p, n, r, g, b, a, t, s, u)                                  \
    112    TBLENT_B_(p, NV50_SURFACE_FORMAT_##n, r, g, b, a, t, t, t, t, s, u)
    113 
    114 #define ZXB(p, n, r, g, b, a, t, s, u)                                  \
    115    TBLENT_B_(p, NV50_ZETA_FORMAT_##n,                                   \
    116              r, g, b, ONE_FLOAT, t, UINT, UINT, UINT, s, u)
    117 #define ZSB(p, n, r, g, b, a, t, s, u)                                  \
    118    TBLENT_B_(p, NV50_ZETA_FORMAT_##n,                                   \
    119              r, g, b, ONE_FLOAT, t, UINT, UINT, UINT, s, u)
    120 #define SZB(p, n, r, g, b, a, t, s, u)                                  \
    121    TBLENT_B_(p, NV50_ZETA_FORMAT_##n,                                   \
    122              r, g, b, ONE_FLOAT, UINT, t, UINT, UINT, s, u)
    123 
    124 #define F3A(p, n, r, g, b, a, t, s, u)          \
    125    C4A(p, n, r, g, b, ONE_FLOAT, t, s, u, 0)
    126 #define I3A(p, n, r, g, b, a, t, s, u)          \
    127    C4A(p, n, r, g, b, ONE_INT, t, s, u, 0)
    128 #define F3B(p, n, r, g, b, a, t, s, u)          \
    129    C4B(p, n, r, g, b, ONE_FLOAT, t, s, u)
    130 #define I3B(p, n, r, g, b, a, t, s, u)          \
    131    C4B(p, n, r, g, b, ONE_INT, t, s, u)
    132 
    133 #define F2A(p, n, r, g, b, a, t, s, u)          \
    134    C4A(p, n, r, g, ZERO, ONE_FLOAT, t, s, u, 0)
    135 #define I2A(p, n, r, g, b, a, t, s, u)          \
    136    C4A(p, n, r, g, ZERO, ONE_INT, t, s, u, 0)
    137 #define F2B(p, n, r, g, b, a, t, s, u)          \
    138    C4B(p, n, r, g, ZERO, ONE_FLOAT, t, s, u)
    139 #define I2B(p, n, r, g, b, a, t, s, u)          \
    140    C4B(p, n, r, g, ZERO, ONE_INT, t, s, u)
    141 
    142 #define F1A(p, n, r, g, b, a, t, s, u)             \
    143    C4A(p, n, r, ZERO, ZERO, ONE_FLOAT, t, s, u, 0)
    144 #define I1A(p, n, r, g, b, a, t, s, u)             \
    145    C4A(p, n, r, ZERO, ZERO, ONE_INT, t, s, u, 0)
    146 #define F1B(p, n, r, g, b, a, t, s, u)          \
    147    C4B(p, n, r, ZERO, ZERO, ONE_FLOAT, t, s, u)
    148 #define I1B(p, n, r, g, b, a, t, s, u)          \
    149    C4B(p, n, r, ZERO, ZERO, ONE_INT, t, s, u)
    150 
    151 #define A1B(p, n, r, g, b, a, t, s, u)          \
    152    C4B(p, n, ZERO, ZERO, ZERO, a, t, s, u)
    153 
    154 #if NOUVEAU_DRIVER == 0xc0
    155 const struct nvc0_format nvc0_format_table[PIPE_FORMAT_COUNT] =
    156 #else
    157 const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] =
    158 #endif
    159 {
    160    C4A(B8G8R8A8_UNORM, BGRA8_UNORM, C2, C1, C0, C3, UNORM, 8_8_8_8, TDV, 1),
    161    F3A(B8G8R8X8_UNORM, BGRX8_UNORM, C2, C1, C0, xx, UNORM, 8_8_8_8, TD),
    162    C4A(B8G8R8A8_SRGB, BGRA8_SRGB, C2, C1, C0, C3, UNORM, 8_8_8_8, TD, 1),
    163    F3A(B8G8R8X8_SRGB, BGRX8_SRGB, C2, C1, C0, xx, UNORM, 8_8_8_8, TD),
    164    C4A(R8G8B8A8_UNORM, RGBA8_UNORM, C0, C1, C2, C3, UNORM, 8_8_8_8, TBV, 0),
    165    F3A(R8G8B8X8_UNORM, RGBX8_UNORM, C0, C1, C2, xx, UNORM, 8_8_8_8, TB),
    166    C4A(R8G8B8A8_SRGB, RGBA8_SRGB, C0, C1, C2, C3, UNORM, 8_8_8_8, TB, 0),
    167 
    168    ZXB(Z16_UNORM, Z16_UNORM, C0, C0, C0, xx, UNORM, Z16, TZ),
    169    ZXB(Z32_FLOAT, Z32_FLOAT, C0, C0, C0, xx, FLOAT, Z32, TZ),
    170    ZXB(Z24X8_UNORM, Z24_X8_UNORM, C0, C0, C0, xx, UNORM, Z24_X8, TZ),
    171    ZSB(Z24_UNORM_S8_UINT, Z24_S8_UNORM, C0, C0, C0, xx, UNORM, Z24_S8, TZ),
    172    ZSB(X24S8_UINT, NONE, C1, C1, C1, xx, UNORM, Z24_S8, T),
    173    SZB(S8_UINT_Z24_UNORM, S8_Z24_UNORM, C1, C1, C1, xx, UNORM, S8_Z24, TZ),
    174    SZB(S8X24_UINT, NONE, C0, C0, C0, xx, UNORM, S8_Z24, T),
    175    ZSB(Z32_FLOAT_S8X24_UINT, Z32_S8_X24_FLOAT, C0, C0, C0, xx, FLOAT,
    176        Z32_S8_X24, TZ),
    177    ZSB(X32_S8X24_UINT, NONE, C1, C1, C1, xx, FLOAT, Z32_S8_X24, T),
    178 
    179    F3B(B5G6R5_UNORM, B5G6R5_UNORM, C2, C1, C0, xx, UNORM, 5_6_5, T),
    180    C4B(B5G5R5A1_UNORM, BGR5_A1_UNORM, C2, C1, C0, C3, UNORM, 5_5_5_1, TB),
    181    F3B(B5G5R5X1_UNORM, BGR5_X1_UNORM, C2, C1, C0, xx, UNORM, 5_5_5_1, TB),
    182    C4B(B4G4R4A4_UNORM, NONE, C2, C1, C0, C3, UNORM, 4_4_4_4, T),
    183    F3B(B4G4R4X4_UNORM, NONE, C2, C1, C0, xx, UNORM, 4_4_4_4, T),
    184    F3B(R9G9B9E5_FLOAT, NONE, C0, C1, C2, xx, FLOAT, 9_9_9_E5, T),
    185 
    186    C4A(R10G10B10A2_UNORM, RGB10_A2_UNORM, C0, C1, C2, C3, UNORM, 10_10_10_2,
    187        TBV, 0),
    188    C4A(B10G10R10A2_UNORM, BGR10_A2_UNORM, C2, C1, C0, C3, UNORM, 10_10_10_2,
    189        TBV, 1),
    190    C4A(R10G10B10A2_SNORM, NONE, C0, C1, C2, C3, SNORM, 10_10_10_2, TV, 0),
    191    C4A(B10G10R10A2_SNORM, NONE, C2, C1, C0, C3, SNORM, 10_10_10_2, TV, 1),
    192 
    193    F3B(R11G11B10_FLOAT, R11G11B10_FLOAT, C0, C1, C2, xx, FLOAT, 11_11_10, TB),
    194 
    195    F3B(L8_UNORM, R8_UNORM, C0, C0, C0, xx, UNORM, 8, TB),
    196    F3B(L8_SRGB, R8_UNORM, C0, C0, C0, xx, UNORM, 8, TB),
    197    F3B(L8_SNORM, R8_SNORM, C0, C0, C0, xx, SNORM, 8, TC),
    198    F3B(L8_SINT, R8_SINT, C0, C0, C0, xx, SINT, 8, TR),
    199    F3B(L8_UINT, R8_UINT, C0, C0, C0, xx, UINT, 8, TR),
    200    F3B(L16_UNORM, R16_UNORM, C0, C0, C0, xx, UNORM, 16, TC),
    201    F3B(L16_SNORM, R16_SNORM, C0, C0, C0, xx, SNORM, 16, TC),
    202    F3B(L16_FLOAT, R16_FLOAT, C0, C0, C0, xx, FLOAT, 16, TB),
    203    F3B(L16_SINT, R16_SINT, C0, C0, C0, xx, SINT, 16, TR),
    204    F3B(L16_UINT, R16_UINT, C0, C0, C0, xx, UINT, 16, TR),
    205    F3B(L32_FLOAT, R32_FLOAT, C0, C0, C0, xx, FLOAT, 32, TB),
    206    F3B(L32_SINT, R32_SINT, C0, C0, C0, xx, SINT, 32, TR),
    207    F3B(L32_UINT, R32_UINT, C0, C0, C0, xx, UINT, 32, TR),
    208 
    209    C4B(I8_UNORM, R8_UNORM, C0, C0, C0, C0, UNORM, 8, TR),
    210    C4B(I8_SNORM, R8_SNORM, C0, C0, C0, C0, SNORM, 8, TR),
    211    C4B(I8_SINT, R8_SINT, C0, C0, C0, C0, SINT, 8, TR),
    212    C4B(I8_UINT, R8_UINT, C0, C0, C0, C0, UINT, 8, TR),
    213    C4B(I16_UNORM, R16_UNORM, C0, C0, C0, C0, UNORM, 16, TR),
    214    C4B(I16_SNORM, R16_SNORM, C0, C0, C0, C0, SNORM, 16, TR),
    215    C4B(I16_FLOAT, R16_FLOAT, C0, C0, C0, C0, FLOAT, 16, TR),
    216    C4B(I16_SINT, R16_SINT, C0, C0, C0, C0, SINT, 16, TR),
    217    C4B(I16_UINT, R16_UINT, C0, C0, C0, C0, UINT, 16, TR),
    218    C4B(I32_FLOAT, R32_FLOAT, C0, C0, C0, C0, FLOAT, 32, TR),
    219    C4B(I32_SINT, R32_SINT, C0, C0, C0, C0, SINT, 32, TR),
    220    C4B(I32_UINT, R32_UINT, C0, C0, C0, C0, UINT, 32, TR),
    221 
    222    A1B(A8_UNORM, A8_UNORM, xx, xx, xx, C0, UNORM, 8, TB),
    223    A1B(A8_SNORM, R8_SNORM, xx, xx, xx, C0, SNORM, 8, T),
    224    A1B(A8_SINT, R8_SINT, xx, xx, xx, C0, SINT, 8, T),
    225    A1B(A8_UINT, R8_UINT, xx, xx, xx, C0, UINT, 8, T),
    226    A1B(A16_UNORM, R16_UNORM, xx, xx, xx, C0, UNORM, 16, T),
    227    A1B(A16_SNORM, R16_SNORM, xx, xx, xx, C0, SNORM, 16, T),
    228    A1B(A16_FLOAT, R16_FLOAT, xx, xx, xx, C0, FLOAT, 16, T),
    229    A1B(A16_SINT, R16_SINT, xx, xx, xx, C0, SINT, 16, T),
    230    A1B(A16_UINT, R16_UINT, xx, xx, xx, C0, UINT, 16, T),
    231    A1B(A32_FLOAT, R32_FLOAT, xx, xx, xx, C0, FLOAT, 32, T),
    232    A1B(A32_SINT, R32_SINT, xx, xx, xx, C0, SINT, 32, T),
    233    A1B(A32_UINT, R32_UINT, xx, xx, xx, C0, UINT, 32, T),
    234 
    235    C4B(L4A4_UNORM, NONE, C0, C0, C0, C1, UNORM, 4_4, T),
    236    C4B(L8A8_UNORM, RG8_UNORM, C0, C0, C0, C1, UNORM, 8_8, T),
    237    C4B(L8A8_SNORM, RG8_SNORM, C0, C0, C0, C1, SNORM, 8_8, T),
    238    C4B(L8A8_SRGB, RG8_UNORM, C0, C0, C0, C1, UNORM, 8_8, T),
    239    C4B(L8A8_SINT, RG8_SINT, C0, C0, C0, C1, SINT, 8_8, T),
    240    C4B(L8A8_UINT, RG8_UINT, C0, C0, C0, C1, UINT, 8_8, T),
    241    C4B(L16A16_UNORM, RG16_UNORM, C0, C0, C0, C1, UNORM, 16_16, T),
    242    C4B(L16A16_SNORM, RG16_SNORM, C0, C0, C0, C1, SNORM, 16_16, T),
    243    C4B(L16A16_FLOAT, RG16_FLOAT, C0, C0, C0, C1, FLOAT, 16_16, T),
    244    C4B(L16A16_SINT, RG16_SINT, C0, C0, C0, C1, SINT, 16_16, T),
    245    C4B(L16A16_UINT, RG16_UINT, C0, C0, C0, C1, UINT, 16_16, T),
    246    C4B(L32A32_FLOAT, RG32_FLOAT, C0, C0, C0, C1, FLOAT, 32_32, T),
    247    C4B(L32A32_SINT, RG32_SINT, C0, C0, C0, C1, SINT, 32_32, T),
    248    C4B(L32A32_UINT, RG32_UINT, C0, C0, C0, C1, UINT, 32_32, T),
    249 
    250    F3B(DXT1_RGB,   NONE, C0, C1, C2, xx, UNORM, DXT1, T),
    251    F3B(DXT1_SRGB,  NONE, C0, C1, C2, xx, UNORM, DXT1, T),
    252    C4B(DXT1_RGBA,  NONE, C0, C1, C2, C3, UNORM, DXT1, T),
    253    C4B(DXT1_SRGBA, NONE, C0, C1, C2, C3, UNORM, DXT1, T),
    254    C4B(DXT3_RGBA,  NONE, C0, C1, C2, C3, UNORM, DXT3, T),
    255    C4B(DXT3_SRGBA, NONE, C0, C1, C2, C3, UNORM, DXT3, T),
    256    C4B(DXT5_RGBA,  NONE, C0, C1, C2, C3, UNORM, DXT5, T),
    257    C4B(DXT5_SRGBA, NONE, C0, C1, C2, C3, UNORM, DXT5, T),
    258 
    259    F1B(RGTC1_UNORM, NONE, C0, xx, xx, xx, UNORM, RGTC1, T),
    260    F1B(RGTC1_SNORM, NONE, C0, xx, xx, xx, SNORM, RGTC1, T),
    261    F2B(RGTC2_UNORM, NONE, C0, C1, xx, xx, UNORM, RGTC2, T),
    262    F2B(RGTC2_SNORM, NONE, C0, C1, xx, xx, SNORM, RGTC2, T),
    263    F3B(LATC1_UNORM, NONE, C0, C0, C0, xx, UNORM, RGTC1, T),
    264    F3B(LATC1_SNORM, NONE, C0, C0, C0, xx, SNORM, RGTC1, T),
    265    C4B(LATC2_UNORM, NONE, C0, C0, C0, C1, UNORM, RGTC2, T),
    266    C4B(LATC2_SNORM, NONE, C0, C0, C0, C1, SNORM, RGTC2, T),
    267 
    268    C4A(R32G32B32A32_FLOAT, RGBA32_FLOAT, C0, C1, C2, C3, FLOAT, 32_32_32_32,
    269        TBV, 0),
    270    C4A(R32G32B32A32_UNORM, NONE, C0, C1, C2, C3, UNORM, 32_32_32_32, TV, 0),
    271    C4A(R32G32B32A32_SNORM, NONE, C0, C1, C2, C3, SNORM, 32_32_32_32, TV, 0),
    272    C4A(R32G32B32A32_SINT, RGBA32_SINT, C0, C1, C2, C3, SINT, 32_32_32_32,
    273        TRV, 0),
    274    C4A(R32G32B32A32_UINT, RGBA32_UINT, C0, C1, C2, C3, UINT, 32_32_32_32,
    275        TRV, 0),
    276 
    277    F2A(R32G32_FLOAT, RG32_FLOAT, C0, C1, xx, xx, FLOAT, 32_32, TBV),
    278    F2A(R32G32_UNORM, NONE, C0, C1, xx, xx, UNORM, 32_32, TV),
    279    F2A(R32G32_SNORM, NONE, C0, C1, xx, xx, SNORM, 32_32, TV),
    280    I2A(R32G32_SINT, RG32_SINT, C0, C1, xx, xx, SINT, 32_32, TRV),
    281    I2A(R32G32_UINT, RG32_UINT, C0, C1, xx, xx, UINT, 32_32, TRV),
    282 
    283    F1A(R32_FLOAT, R32_FLOAT, C0, xx, xx, xx, FLOAT, 32, TBV),
    284    F1A(R32_UNORM, NONE, C0, xx, xx, xx, UNORM, 32, TV),
    285    F1A(R32_SNORM, NONE, C0, xx, xx, xx, SNORM, 32, TV),
    286    I1A(R32_SINT, R32_SINT, C0, xx, xx, xx, SINT, 32, TRV),
    287    I1A(R32_UINT, R32_UINT, C0, xx, xx, xx, UINT, 32, TRV),
    288 
    289    C4A(R16G16B16A16_FLOAT, RGBA16_FLOAT, C0, C1, C2, C3, FLOAT, 16_16_16_16,
    290        TBV, 0),
    291    C4A(R16G16B16A16_UNORM, RGBA16_UNORM, C0, C1, C2, C3, UNORM, 16_16_16_16,
    292        TCV, 0),
    293    C4A(R16G16B16A16_SNORM, RGBA16_SNORM, C0, C1, C2, C3, SNORM, 16_16_16_16,
    294        TCV, 0),
    295    C4A(R16G16B16A16_SINT, RGBA16_SINT, C0, C1, C2, C3, SINT, 16_16_16_16,
    296        TRV, 0),
    297    C4A(R16G16B16A16_UINT, RGBA16_UINT, C0, C1, C2, C3, UINT, 16_16_16_16,
    298        TRV, 0),
    299 
    300    F2A(R16G16_FLOAT, RG16_FLOAT, C0, C1, xx, xx, FLOAT, 16_16, TBV),
    301    F2A(R16G16_UNORM, RG16_UNORM, C0, C1, xx, xx, UNORM, 16_16, TCV),
    302    F2A(R16G16_SNORM, RG16_SNORM, C0, C1, xx, xx, SNORM, 16_16, TCV),
    303    I2A(R16G16_SINT, RG16_SINT, C0, C1, xx, xx, SINT, 16_16, TRV),
    304    I2A(R16G16_UINT, RG16_UINT, C0, C1, xx, xx, UINT, 16_16, TRV),
    305 
    306    F1A(R16_FLOAT, R16_FLOAT, C0, xx, xx, xx, FLOAT, 16, TBV),
    307    F1A(R16_UNORM, R16_UNORM, C0, xx, xx, xx, UNORM, 16, TCV),
    308    F1A(R16_SNORM, R16_SNORM, C0, xx, xx, xx, SNORM, 16, TCV),
    309    I1A(R16_SINT, R16_SINT, C0, xx, xx, xx, SINT, 16, TRV),
    310    I1A(R16_UINT, R16_UINT, C0, xx, xx, xx, UINT, 16, TRV),
    311 
    312    C4A(R8G8B8A8_SNORM, RGBA8_SNORM, C0, C1, C2, C3, SNORM, 8_8_8_8, TCV, 0),
    313    C4A(R8G8B8A8_SINT, RGBA8_SINT, C0, C1, C2, C3, SINT, 8_8_8_8, TRV, 0),
    314    C4A(R8G8B8A8_UINT, RGBA8_UINT, C0, C1, C2, C3, UINT, 8_8_8_8, TRV, 0),
    315 
    316    F2A(R8G8_UNORM, RG8_UNORM, C0, C1, xx, xx, UNORM, 8_8, TBV),
    317    F2A(R8G8_SNORM, RG8_SNORM, C0, C1, xx, xx, SNORM, 8_8, TCV),
    318    I2A(R8G8_SINT, RG8_SINT, C0, C1, xx, xx, SINT, 8_8, TRV),
    319    I2A(R8G8_UINT, RG8_UINT, C0, C1, xx, xx, UINT, 8_8, TRV),
    320 
    321    F1A(R8_UNORM, R8_UNORM, C0, xx, xx, xx, UNORM, 8, TBV),
    322    F1A(R8_SNORM, R8_SNORM, C0, xx, xx, xx, SNORM, 8, TCV),
    323    I1A(R8_SINT, R8_SINT, C0, xx, xx, xx, SINT, 8, TRV),
    324    I1A(R8_UINT, R8_UINT, C0, xx, xx, xx, UINT, 8, TRV),
    325 
    326    F3B(R8G8_B8G8_UNORM, NONE, C0, C1, C2, xx, UNORM, U8_YA8_V8_YB8, T),
    327    F3B(G8R8_B8R8_UNORM, NONE, C1, C0, C2, xx, UNORM, U8_YA8_V8_YB8, T),
    328    F3B(G8R8_G8B8_UNORM, NONE, C0, C1, C2, xx, UNORM, YA8_U8_YB8_V8, T),
    329    F3B(R8G8_R8B8_UNORM, NONE, C1, C0, C2, xx, UNORM, YA8_U8_YB8_V8, T),
    330 
    331    F1B(R1_UNORM, BITMAP, C0, xx, xx, xx, UNORM, BITMAP, T),
    332 
    333    C4B(R4A4_UNORM, NONE, C0, ZERO, ZERO, C1, UNORM, 4_4, T),
    334    C4B(R8A8_UNORM, NONE, C0, ZERO, ZERO, C1, UNORM, 8_8, T),
    335    C4B(A4R4_UNORM, NONE, C1, ZERO, ZERO, C0, UNORM, 4_4, T),
    336    C4B(A8R8_UNORM, NONE, C1, ZERO, ZERO, C0, UNORM, 8_8, T),
    337 
    338    TBLENT_B_(R8SG8SB8UX8U_NORM, 0,
    339              C0, C1, C2, ONE_FLOAT, SNORM, SNORM, UNORM, UNORM, 8_8_8_8, T),
    340    TBLENT_B_(R5SG5SB6U_NORM, 0,
    341              C0, C1, C2, ONE_FLOAT, SNORM, SNORM, UNORM, UNORM, 5_5_6, T),
    342 
    343    /* vertex-only formats: */
    344 
    345    C4A(R32G32B32A32_SSCALED, NONE, C0, C1, C2, C3, SSCALED, 32_32_32_32, V, 0),
    346    C4A(R32G32B32A32_USCALED, NONE, C0, C1, C2, C3, USCALED, 32_32_32_32, V, 0),
    347    F3A(R32G32B32_FLOAT, NONE, C0, C1, C2, xx, FLOAT, 32_32_32, V),
    348    F3A(R32G32B32_UNORM, NONE, C0, C1, C2, xx, UNORM, 32_32_32, V),
    349    F3A(R32G32B32_SNORM, NONE, C0, C1, C2, xx, SNORM, 32_32_32, V),
    350    I3A(R32G32B32_SINT, NONE, C0, C1, C2, xx, SINT, 32_32_32, V),
    351    I3A(R32G32B32_UINT, NONE, C0, C1, C2, xx, UINT, 32_32_32, V),
    352    F3A(R32G32B32_SSCALED, NONE, C0, C1, C2, xx, SSCALED, 32_32_32, V),
    353    F3A(R32G32B32_USCALED, NONE, C0, C1, C2, xx, USCALED, 32_32_32, V),
    354    F2A(R32G32_SSCALED, NONE, C0, C1, xx, xx, SSCALED, 32_32, V),
    355    F2A(R32G32_USCALED, NONE, C0, C1, xx, xx, USCALED, 32_32, V),
    356    F1A(R32_SSCALED, NONE, C0, xx, xx, xx, SSCALED, 32, V),
    357    F1A(R32_USCALED, NONE, C0, xx, xx, xx, USCALED, 32, V),
    358 
    359    C4A(R16G16B16A16_SSCALED, NONE, C0, C1, C2, C3, SSCALED, 16_16_16_16, V, 0),
    360    C4A(R16G16B16A16_USCALED, NONE, C0, C1, C2, C3, USCALED, 16_16_16_16, V, 0),
    361    F3A(R16G16B16_FLOAT, NONE, C0, C1, C2, xx, FLOAT, 16_16_16, V),
    362    F3A(R16G16B16_UNORM, NONE, C0, C1, C2, xx, UNORM, 16_16_16, V),
    363    F3A(R16G16B16_SNORM, NONE, C0, C1, C2, xx, SNORM, 16_16_16, V),
    364    I3A(R16G16B16_SINT, NONE, C0, C1, C2, xx, SINT, 16_16_16, V),
    365    I3A(R16G16B16_UINT, NONE, C0, C1, C2, xx, UINT, 16_16_16, V),
    366    F3A(R16G16B16_SSCALED, NONE, C0, C1, C2, xx, SSCALED, 16_16_16, V),
    367    F3A(R16G16B16_USCALED, NONE, C0, C1, C2, xx, USCALED, 16_16_16, V),
    368    F2A(R16G16_SSCALED, NONE, C0, C1, xx, xx, SSCALED, 16_16, V),
    369    F2A(R16G16_USCALED, NONE, C0, C1, xx, xx, USCALED, 16_16, V),
    370    F1A(R16_SSCALED, NONE, C0, xx, xx, xx, SSCALED, 16, V),
    371    F1A(R16_USCALED, NONE, C0, xx, xx, xx, USCALED, 16, V),
    372 
    373    C4A(R8G8B8A8_SSCALED, NONE, C0, C1, C2, C3, SSCALED, 8_8_8_8, V, 0),
    374    C4A(R8G8B8A8_USCALED, NONE, C0, C1, C2, C3, USCALED, 8_8_8_8, V, 0),
    375    F3A(R8G8B8_UNORM, NONE, C0, C1, C2, xx, UNORM, 8_8_8, V),
    376    F3A(R8G8B8_SNORM, NONE, C0, C1, C2, xx, SNORM, 8_8_8, V),
    377    I2A(R8G8B8_SINT, NONE, C0, C1, C2, xx, SINT, 8_8_8, V),
    378    I2A(R8G8B8_UINT, NONE, C0, C1, C2, xx, UINT, 8_8_8, V),
    379    F3A(R8G8B8_SSCALED, NONE, C0, C1, C2, xx, SSCALED, 8_8_8, V),
    380    F3A(R8G8B8_USCALED, NONE, C0, C1, C2, xx, USCALED, 8_8_8, V),
    381    F2A(R8G8_SSCALED, NONE, C0, C1, xx, xx, SSCALED, 8_8, V),
    382    F2A(R8G8_USCALED, NONE, C0, C1, xx, xx, USCALED, 8_8, V),
    383    F1A(R8_SSCALED, NONE, C0, xx, xx, xx, SSCALED, 8, V),
    384    F1A(R8_USCALED, NONE, C0, xx, xx, xx, USCALED, 8, V),
    385 
    386    /* FIXED types: not supported natively, converted on VBO push */
    387 
    388    C4B(R32G32B32A32_FIXED, NONE, C0, C1, C2, C3, FLOAT, 32_32_32_32, V),
    389    F3B(R32G32B32_FIXED, NONE, C0, C1, C2, xx, FLOAT, 32_32_32, V),
    390    F2B(R32G32_FIXED, NONE, C0, C1, xx, xx, FLOAT, 32_32, V),
    391    F1B(R32_FIXED, NONE, C0, xx, xx, xx, FLOAT, 32, V),
    392 
    393    C4B(R64G64B64A64_FLOAT, NONE, C0, C1, C2, C3, FLOAT, 32_32_32_32, V),
    394    F3B(R64G64B64_FLOAT, NONE, C0, C1, C2, xx, FLOAT, 32_32_32, V),
    395    F2B(R64G64_FLOAT, NONE, C0, C1, xx, xx, FLOAT, 32_32, V),
    396    F1B(R64_FLOAT, NONE, C0, xx, xx, xx, FLOAT, 32, V),
    397 };
    398 
    399 #if 0
    400 const uint8_t nv50_rt_format_map[PIPE_FORMAT_COUNT] =
    401 {
    402    [PIPE_FORMAT_Z16_UNORM]            = NV50_ZETA_FORMAT_Z16_UNORM,
    403    [PIPE_FORMAT_Z24X8_UNORM]          = NV50_ZETA_FORMAT_Z24_X8_UNORM,
    404    [PIPE_FORMAT_Z24_UNORM_S8_UINT]    = NV50_ZETA_FORMAT_Z24_S8_UNORM,
    405    [PIPE_FORMAT_S8_UINT_Z24_UNORM]    = NV50_ZETA_FORMAT_S8_Z24_UNORM,
    406    [PIPE_FORMAT_Z32_FLOAT]            = NV50_ZETA_FORMAT_Z32_FLOAT,
    407    [PIPE_FORMAT_Z32_FLOAT_S8X24_UINT] = NV50_ZETA_FORMAT_Z32_S8_X24_FLOAT,
    408 
    409    [PIPE_FORMAT_R1_UNORM] = NV50_SURFACE_FORMAT_BITMAP,
    410 
    411    [PIPE_FORMAT_R32G32B32A32_FLOAT] = NV50_SURFACE_FORMAT_RGBA32_FLOAT,
    412    [PIPE_FORMAT_R32G32B32X32_FLOAT] = NV50_SURFACE_FORMAT_RGBX32_FLOAT,
    413    [PIPE_FORMAT_R32G32B32A32_SINT]  = NV50_SURFACE_FORMAT_RGBA32_SINT,
    414    [PIPE_FORMAT_R32G32B32X32_SINT]  = NV50_SURFACE_FORMAT_RGBX32_SINT,
    415    [PIPE_FORMAT_R32G32B32A32_UINT]  = NV50_SURFACE_FORMAT_RGBA32_UINT,
    416    [PIPE_FORMAT_R32G32B32X32_UINT]  = NV50_SURFACE_FORMAT_RGBX32_UINT,
    417 
    418    [PIPE_FORMAT_R16G16B16A16_FLOAT] = NV50_SURFACE_FORMAT_RGBA16_FLOAT,
    419    [PIPE_FORMAT_R16G16B16X16_FLOAT] = NV50_SURFACE_FORMAT_RGBX16_FLOAT,
    420    [PIPE_FORMAT_R16G16B16A16_UNORM] = NV50_SURFACE_FORMAT_RGBA16_UNORM,
    421    [PIPE_FORMAT_R16G16B16A16_SNORM] = NV50_SURFACE_FORMAT_RGBA16_SNORM,
    422    [PIPE_FORMAT_R16G16B16A16_SINT]  = NV50_SURFACE_FORMAT_RGBA16_SINT,
    423    [PIPE_FORMAT_R16G16B16A16_UINT]  = NV50_SURFACE_FORMAT_RGBA16_UINT,
    424 
    425    [PIPE_FORMAT_B8G8R8A8_UNORM] = NV50_SURFACE_FORMAT_BGRA8_UNORM,
    426    [PIPE_FORMAT_R8G8B8A8_UNORM] = NV50_SURFACE_FORMAT_RGBA8_UNORM,
    427    [PIPE_FORMAT_B8G8R8X8_UNORM] = NV50_SURFACE_FORMAT_BGRX8_UNORM,
    428    [PIPE_FORMAT_R8G8B8X8_UNORM] = NV50_SURFACE_FORMAT_RGBX8_UNORM,
    429    [PIPE_FORMAT_B8G8R8A8_SRGB]  = NV50_SURFACE_FORMAT_BGRA8_SRGB,
    430    [PIPE_FORMAT_R8G8B8A8_SRGB]  = NV50_SURFACE_FORMAT_RGBA8_SRGB,
    431    [PIPE_FORMAT_B8G8R8X8_SRGB]  = NV50_SURFACE_FORMAT_BGRX8_SRGB,
    432    [PIPE_FORMAT_R8G8B8X8_SRGB]  = NV50_SURFACE_FORMAT_RGBX8_SRGB,
    433    [PIPE_FORMAT_R8G8B8A8_SNORM] = NV50_SURFACE_FORMAT_RGBA8_SNORM,
    434    [PIPE_FORMAT_R8G8B8A8_SINT]  = NV50_SURFACE_FORMAT_RGBA8_SINT,
    435    [PIPE_FORMAT_R8G8B8A8_UINT]  = NV50_SURFACE_FORMAT_RGBA8_UINT,
    436 
    437    [PIPE_FORMAT_R11G11B10_FLOAT] = NV50_SURFACE_FORMAT_R11G11B10_FLOAT,
    438 
    439    [PIPE_FORMAT_B10G10R10A2_UNORM] = NV50_SURFACE_FORMAT_BGR10_A2_UNORM,
    440    [PIPE_FORMAT_R10G10B10A2_UNORM] = NV50_SURFACE_FORMAT_RGB10_A2_UNORM,
    441    [PIPE_FORMAT_R10G10B10A2_UINT]  = NV50_SURFACE_FORMAT_RGB10_A2_UINT,
    442 
    443    [PIPE_FORMAT_B5G6R5_UNORM] = NV50_SURFACE_FORMAT_B5G6R5_UNORM,
    444 
    445    [PIPE_FORMAT_B5G5R5A1_UNORM] = NV50_SURFACE_FORMAT_BGR5_A1_UNORM,
    446    [PIPE_FORMAT_B5G5R5X1_UNORM] = NV50_SURFACE_FORMAT_BGR5_X1_UNORM,
    447 
    448    [PIPE_FORMAT_R32G32_FLOAT] = NV50_SURFACE_FORMAT_RG32_FLOAT,
    449    [PIPE_FORMAT_R32G32_SINT]  = NV50_SURFACE_FORMAT_RG32_SINT,
    450    [PIPE_FORMAT_R32G32_UINT]  = NV50_SURFACE_FORMAT_RG32_UINT,
    451 
    452    [PIPE_FORMAT_R16G16_FLOAT] = NV50_SURFACE_FORMAT_RG16_FLOAT,
    453    [PIPE_FORMAT_R16G16_UNORM] = NV50_SURFACE_FORMAT_RG16_UNORM,
    454    [PIPE_FORMAT_R16G16_SNORM] = NV50_SURFACE_FORMAT_RG16_SNORM,
    455    [PIPE_FORMAT_R16G16_SINT]  = NV50_SURFACE_FORMAT_RG16_SINT,
    456    [PIPE_FORMAT_R16G16_UINT]  = NV50_SURFACE_FORMAT_RG16_UINT,
    457 
    458    [PIPE_FORMAT_R8G8_UNORM] = NV50_SURFACE_FORMAT_RG8_UNORM,
    459    [PIPE_FORMAT_R8G8_SNORM] = NV50_SURFACE_FORMAT_RG8_SNORM,
    460    [PIPE_FORMAT_R8G8_SINT]  = NV50_SURFACE_FORMAT_RG8_SINT,
    461    [PIPE_FORMAT_R8G8_UINT]  = NV50_SURFACE_FORMAT_RG8_UINT,
    462 
    463    [PIPE_FORMAT_R32_FLOAT] = NV50_SURFACE_FORMAT_R32_FLOAT,
    464    [PIPE_FORMAT_R32_SINT]  = NV50_SURFACE_FORMAT_R32_SINT,
    465    [PIPE_FORMAT_R32_UINT]  = NV50_SURFACE_FORMAT_R32_UINT,
    466 
    467    [PIPE_FORMAT_R16_FLOAT] = NV50_SURFACE_FORMAT_R16_FLOAT,
    468    [PIPE_FORMAT_R16_UNORM] = NV50_SURFACE_FORMAT_R16_UNORM,
    469    [PIPE_FORMAT_R16_SNORM] = NV50_SURFACE_FORMAT_R16_SNORM,
    470    [PIPE_FORMAT_R16_SINT]  = NV50_SURFACE_FORMAT_R16_SINT,
    471    [PIPE_FORMAT_R16_UINT]  = NV50_SURFACE_FORMAT_R16_UINT,
    472 
    473    [PIPE_FORMAT_R8_UNORM] = NV50_SURFACE_FORMAT_R8_UNORM,
    474    [PIPE_FORMAT_R8_SNORM] = NV50_SURFACE_FORMAT_R8_SNORM,
    475    [PIPE_FORMAT_R8_SINT]  = NV50_SURFACE_FORMAT_R8_SINT,
    476    [PIPE_FORMAT_R8_UINT]  = NV50_SURFACE_FORMAT_R8_UINT,
    477 
    478    [PIPE_FORMAT_A8_UNORM] = NV50_SURFACE_FORMAT_A8_UNORM
    479 };
    480 #endif
    481