Home | History | Annotate | Download | only in include
      1 /**********************************************************
      2  * Copyright 2007-2015 VMware, Inc.  All rights reserved.
      3  *
      4  * Permission is hereby granted, free of charge, to any person
      5  * obtaining a copy of this software and associated documentation
      6  * files (the "Software"), to deal in the Software without
      7  * restriction, including without limitation the rights to use, copy,
      8  * modify, merge, publish, distribute, sublicense, and/or sell copies
      9  * of the Software, and to permit persons to whom the Software is
     10  * furnished to do so, subject to the following conditions:
     11  *
     12  * The above copyright notice and this permission notice shall be
     13  * included in all copies or substantial portions of the Software.
     14  *
     15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     18  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
     19  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
     20  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
     21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     22  * SOFTWARE.
     23  *
     24  **********************************************************/
     25 
     26 /*
     27  * svga3d_types.h --
     28  *
     29  *       SVGA 3d hardware definitions for basic types
     30  */
     31 
     32 #ifndef _SVGA3D_TYPES_H_
     33 #define _SVGA3D_TYPES_H_
     34 
     35 #define INCLUDE_ALLOW_MODULE
     36 #define INCLUDE_ALLOW_USERLEVEL
     37 #define INCLUDE_ALLOW_VMCORE
     38 
     39 #include "includeCheck.h"
     40 
     41 /*
     42  * Generic Types
     43  */
     44 
     45 #define SVGA3D_INVALID_ID         ((uint32)-1)
     46 
     47 typedef uint32 SVGA3dBool; /* 32-bit Bool definition */
     48 typedef uint32 SVGA3dColor; /* a, r, g, b */
     49 
     50 typedef
     51 #include "vmware_pack_begin.h"
     52 struct SVGA3dCopyRect {
     53    uint32               x;
     54    uint32               y;
     55    uint32               w;
     56    uint32               h;
     57    uint32               srcx;
     58    uint32               srcy;
     59 }
     60 #include "vmware_pack_end.h"
     61 SVGA3dCopyRect;
     62 
     63 typedef
     64 #include "vmware_pack_begin.h"
     65 struct SVGA3dCopyBox {
     66    uint32               x;
     67    uint32               y;
     68    uint32               z;
     69    uint32               w;
     70    uint32               h;
     71    uint32               d;
     72    uint32               srcx;
     73    uint32               srcy;
     74    uint32               srcz;
     75 }
     76 #include "vmware_pack_end.h"
     77 SVGA3dCopyBox;
     78 
     79 typedef
     80 #include "vmware_pack_begin.h"
     81 struct SVGA3dRect {
     82    uint32               x;
     83    uint32               y;
     84    uint32               w;
     85    uint32               h;
     86 }
     87 #include "vmware_pack_end.h"
     88 SVGA3dRect;
     89 
     90 typedef
     91 #include "vmware_pack_begin.h"
     92 struct {
     93    uint32               x;
     94    uint32               y;
     95    uint32               z;
     96    uint32               w;
     97    uint32               h;
     98    uint32               d;
     99 }
    100 #include "vmware_pack_end.h"
    101 SVGA3dBox;
    102 
    103 typedef
    104 #include "vmware_pack_begin.h"
    105 struct {
    106    uint32               x;
    107    uint32               y;
    108    uint32               z;
    109 }
    110 #include "vmware_pack_end.h"
    111 SVGA3dPoint;
    112 
    113 /*
    114  * Surface formats.
    115  */
    116 typedef enum SVGA3dSurfaceFormat {
    117    SVGA3D_FORMAT_INVALID               = 0,
    118 
    119    SVGA3D_X8R8G8B8                     = 1,
    120    SVGA3D_FORMAT_MIN                   = 1,
    121 
    122    SVGA3D_A8R8G8B8                     = 2,
    123 
    124    SVGA3D_R5G6B5                       = 3,
    125    SVGA3D_X1R5G5B5                     = 4,
    126    SVGA3D_A1R5G5B5                     = 5,
    127    SVGA3D_A4R4G4B4                     = 6,
    128 
    129    SVGA3D_Z_D32                        = 7,
    130    SVGA3D_Z_D16                        = 8,
    131    SVGA3D_Z_D24S8                      = 9,
    132    SVGA3D_Z_D15S1                      = 10,
    133 
    134    SVGA3D_LUMINANCE8                   = 11,
    135    SVGA3D_LUMINANCE4_ALPHA4            = 12,
    136    SVGA3D_LUMINANCE16                  = 13,
    137    SVGA3D_LUMINANCE8_ALPHA8            = 14,
    138 
    139    SVGA3D_DXT1                         = 15,
    140    SVGA3D_DXT2                         = 16,
    141    SVGA3D_DXT3                         = 17,
    142    SVGA3D_DXT4                         = 18,
    143    SVGA3D_DXT5                         = 19,
    144 
    145    SVGA3D_BUMPU8V8                     = 20,
    146    SVGA3D_BUMPL6V5U5                   = 21,
    147    SVGA3D_BUMPX8L8V8U8                 = 22,
    148    SVGA3D_FORMAT_DEAD1                 = 23,
    149 
    150    SVGA3D_ARGB_S10E5                   = 24,   /* 16-bit floating-point ARGB */
    151    SVGA3D_ARGB_S23E8                   = 25,   /* 32-bit floating-point ARGB */
    152 
    153    SVGA3D_A2R10G10B10                  = 26,
    154 
    155    /* signed formats */
    156    SVGA3D_V8U8                         = 27,
    157    SVGA3D_Q8W8V8U8                     = 28,
    158    SVGA3D_CxV8U8                       = 29,
    159 
    160    /* mixed formats */
    161    SVGA3D_X8L8V8U8                     = 30,
    162    SVGA3D_A2W10V10U10                  = 31,
    163 
    164    SVGA3D_ALPHA8                       = 32,
    165 
    166    /* Single- and dual-component floating point formats */
    167    SVGA3D_R_S10E5                      = 33,
    168    SVGA3D_R_S23E8                      = 34,
    169    SVGA3D_RG_S10E5                     = 35,
    170    SVGA3D_RG_S23E8                     = 36,
    171 
    172    SVGA3D_BUFFER                       = 37,
    173 
    174    SVGA3D_Z_D24X8                      = 38,
    175 
    176    SVGA3D_V16U16                       = 39,
    177 
    178    SVGA3D_G16R16                       = 40,
    179    SVGA3D_A16B16G16R16                 = 41,
    180 
    181    /* Packed Video formats */
    182    SVGA3D_UYVY                         = 42,
    183    SVGA3D_YUY2                         = 43,
    184 
    185    /* Planar video formats */
    186    SVGA3D_NV12                         = 44,
    187 
    188    /* Video format with alpha */
    189    SVGA3D_AYUV                         = 45,
    190 
    191    SVGA3D_R32G32B32A32_TYPELESS        = 46,
    192    SVGA3D_R32G32B32A32_UINT            = 47,
    193    SVGA3D_R32G32B32A32_SINT            = 48,
    194    SVGA3D_R32G32B32_TYPELESS           = 49,
    195    SVGA3D_R32G32B32_FLOAT              = 50,
    196    SVGA3D_R32G32B32_UINT               = 51,
    197    SVGA3D_R32G32B32_SINT               = 52,
    198    SVGA3D_R16G16B16A16_TYPELESS        = 53,
    199    SVGA3D_R16G16B16A16_UINT            = 54,
    200    SVGA3D_R16G16B16A16_SNORM           = 55,
    201    SVGA3D_R16G16B16A16_SINT            = 56,
    202    SVGA3D_R32G32_TYPELESS              = 57,
    203    SVGA3D_R32G32_UINT                  = 58,
    204    SVGA3D_R32G32_SINT                  = 59,
    205    SVGA3D_R32G8X24_TYPELESS            = 60,
    206    SVGA3D_D32_FLOAT_S8X24_UINT         = 61,
    207    SVGA3D_R32_FLOAT_X8X24              = 62,
    208    SVGA3D_X32_G8X24_UINT               = 63,
    209    SVGA3D_R10G10B10A2_TYPELESS         = 64,
    210    SVGA3D_R10G10B10A2_UINT             = 65,
    211    SVGA3D_R11G11B10_FLOAT              = 66,
    212    SVGA3D_R8G8B8A8_TYPELESS            = 67,
    213    SVGA3D_R8G8B8A8_UNORM               = 68,
    214    SVGA3D_R8G8B8A8_UNORM_SRGB          = 69,
    215    SVGA3D_R8G8B8A8_UINT                = 70,
    216    SVGA3D_R8G8B8A8_SINT                = 71,
    217    SVGA3D_R16G16_TYPELESS              = 72,
    218    SVGA3D_R16G16_UINT                  = 73,
    219    SVGA3D_R16G16_SINT                  = 74,
    220    SVGA3D_R32_TYPELESS                 = 75,
    221    SVGA3D_D32_FLOAT                    = 76,
    222    SVGA3D_R32_UINT                     = 77,
    223    SVGA3D_R32_SINT                     = 78,
    224    SVGA3D_R24G8_TYPELESS               = 79,
    225    SVGA3D_D24_UNORM_S8_UINT            = 80,
    226    SVGA3D_R24_UNORM_X8                 = 81,
    227    SVGA3D_X24_G8_UINT                  = 82,
    228    SVGA3D_R8G8_TYPELESS                = 83,
    229    SVGA3D_R8G8_UNORM                   = 84,
    230    SVGA3D_R8G8_UINT                    = 85,
    231    SVGA3D_R8G8_SINT                    = 86,
    232    SVGA3D_R16_TYPELESS                 = 87,
    233    SVGA3D_R16_UNORM                    = 88,
    234    SVGA3D_R16_UINT                     = 89,
    235    SVGA3D_R16_SNORM                    = 90,
    236    SVGA3D_R16_SINT                     = 91,
    237    SVGA3D_R8_TYPELESS                  = 92,
    238    SVGA3D_R8_UNORM                     = 93,
    239    SVGA3D_R8_UINT                      = 94,
    240    SVGA3D_R8_SNORM                     = 95,
    241    SVGA3D_R8_SINT                      = 96,
    242    SVGA3D_P8                           = 97,
    243    SVGA3D_R9G9B9E5_SHAREDEXP           = 98,
    244    SVGA3D_R8G8_B8G8_UNORM              = 99,
    245    SVGA3D_G8R8_G8B8_UNORM              = 100,
    246    SVGA3D_BC1_TYPELESS                 = 101,
    247    SVGA3D_BC1_UNORM_SRGB               = 102,
    248    SVGA3D_BC2_TYPELESS                 = 103,
    249    SVGA3D_BC2_UNORM_SRGB               = 104,
    250    SVGA3D_BC3_TYPELESS                 = 105,
    251    SVGA3D_BC3_UNORM_SRGB               = 106,
    252    SVGA3D_BC4_TYPELESS                 = 107,
    253    SVGA3D_ATI1                         = 108,   /* DX9-specific BC4_UNORM */
    254    SVGA3D_BC4_SNORM                    = 109,
    255    SVGA3D_BC5_TYPELESS                 = 110,
    256    SVGA3D_ATI2                         = 111,   /* DX9-specific BC5_UNORM */
    257    SVGA3D_BC5_SNORM                    = 112,
    258    SVGA3D_R10G10B10_XR_BIAS_A2_UNORM   = 113,
    259    SVGA3D_B8G8R8A8_TYPELESS            = 114,
    260    SVGA3D_B8G8R8A8_UNORM_SRGB          = 115,
    261    SVGA3D_B8G8R8X8_TYPELESS            = 116,
    262    SVGA3D_B8G8R8X8_UNORM_SRGB          = 117,
    263 
    264    /* Advanced depth formats. */
    265    SVGA3D_Z_DF16                       = 118,
    266    SVGA3D_Z_DF24                       = 119,
    267    SVGA3D_Z_D24S8_INT                  = 120,
    268 
    269    /* Planar video formats. */
    270    SVGA3D_YV12                         = 121,
    271 
    272    SVGA3D_R32G32B32A32_FLOAT           = 122,
    273    SVGA3D_R16G16B16A16_FLOAT           = 123,
    274    SVGA3D_R16G16B16A16_UNORM           = 124,
    275    SVGA3D_R32G32_FLOAT                 = 125,
    276    SVGA3D_R10G10B10A2_UNORM            = 126,
    277    SVGA3D_R8G8B8A8_SNORM               = 127,
    278    SVGA3D_R16G16_FLOAT                 = 128,
    279    SVGA3D_R16G16_UNORM                 = 129,
    280    SVGA3D_R16G16_SNORM                 = 130,
    281    SVGA3D_R32_FLOAT                    = 131,
    282    SVGA3D_R8G8_SNORM                   = 132,
    283    SVGA3D_R16_FLOAT                    = 133,
    284    SVGA3D_D16_UNORM                    = 134,
    285    SVGA3D_A8_UNORM                     = 135,
    286    SVGA3D_BC1_UNORM                    = 136,
    287    SVGA3D_BC2_UNORM                    = 137,
    288    SVGA3D_BC3_UNORM                    = 138,
    289    SVGA3D_B5G6R5_UNORM                 = 139,
    290    SVGA3D_B5G5R5A1_UNORM               = 140,
    291    SVGA3D_B8G8R8A8_UNORM               = 141,
    292    SVGA3D_B8G8R8X8_UNORM               = 142,
    293    SVGA3D_BC4_UNORM                    = 143,
    294    SVGA3D_BC5_UNORM                    = 144,
    295 
    296    SVGA3D_FORMAT_MAX
    297 } SVGA3dSurfaceFormat;
    298 
    299 typedef uint32 SVGA3dSurfaceFlags;
    300 #define SVGA3D_SURFACE_CUBEMAP                (1 << 0)
    301 
    302 /*
    303  * HINT flags are not enforced by the device but are useful for
    304  * performance.
    305  */
    306 #define SVGA3D_SURFACE_HINT_STATIC            (1 << 1)
    307 #define SVGA3D_SURFACE_HINT_DYNAMIC           (1 << 2)
    308 #define SVGA3D_SURFACE_HINT_INDEXBUFFER       (1 << 3)
    309 #define SVGA3D_SURFACE_HINT_VERTEXBUFFER      (1 << 4)
    310 #define SVGA3D_SURFACE_HINT_TEXTURE           (1 << 5)
    311 #define SVGA3D_SURFACE_HINT_RENDERTARGET      (1 << 6)
    312 #define SVGA3D_SURFACE_HINT_DEPTHSTENCIL      (1 << 7)
    313 #define SVGA3D_SURFACE_HINT_WRITEONLY         (1 << 8)
    314 #define SVGA3D_SURFACE_MASKABLE_ANTIALIAS     (1 << 9)
    315 #define SVGA3D_SURFACE_AUTOGENMIPMAPS         (1 << 10)
    316 #define SVGA3D_SURFACE_DECODE_RENDERTARGET    (1 << 11)
    317 
    318 /*
    319  * Is this surface using a base-level pitch for it's mob backing?
    320  *
    321  * This flag is not intended to be set by guest-drivers, but is instead
    322  * set by the device when the surface is bound to a mob with a specified
    323  * pitch.
    324  */
    325 #define SVGA3D_SURFACE_MOB_PITCH              (1 << 12)
    326 
    327 #define SVGA3D_SURFACE_INACTIVE               (1 << 13)
    328 #define SVGA3D_SURFACE_HINT_RT_LOCKABLE       (1 << 14)
    329 #define SVGA3D_SURFACE_VOLUME                 (1 << 15)
    330 
    331 /*
    332  * Required to be set on a surface to bind it to a screen target.
    333  */
    334 #define SVGA3D_SURFACE_SCREENTARGET           (1 << 16)
    335 
    336 /*
    337  * Align images in the guest-backing mob to 16-bytes.
    338  */
    339 #define SVGA3D_SURFACE_ALIGN16                (1 << 17)
    340 
    341 #define SVGA3D_SURFACE_1D                     (1 << 18)
    342 #define SVGA3D_SURFACE_ARRAY                  (1 << 19)
    343 
    344 /*
    345  * Bind flags.
    346  * These are enforced for any surface defined with DefineGBSurface_v2.
    347  */
    348 #define SVGA3D_SURFACE_BIND_VERTEX_BUFFER     (1 << 20)
    349 #define SVGA3D_SURFACE_BIND_INDEX_BUFFER      (1 << 21)
    350 #define SVGA3D_SURFACE_BIND_CONSTANT_BUFFER   (1 << 22)
    351 #define SVGA3D_SURFACE_BIND_SHADER_RESOURCE   (1 << 23)
    352 #define SVGA3D_SURFACE_BIND_RENDER_TARGET     (1 << 24)
    353 #define SVGA3D_SURFACE_BIND_DEPTH_STENCIL     (1 << 25)
    354 #define SVGA3D_SURFACE_BIND_STREAM_OUTPUT     (1 << 26)
    355 
    356 /*
    357  * The STAGING flags notes that the surface will not be used directly by the
    358  * drawing pipeline, i.e. that it will not be bound to any bind point.
    359  * Staging surfaces may be used by copy operations to move data in and out
    360  * of other surfaces.  No bind flags may be set on surfaces with this flag.
    361  *
    362  * The HINT_INDIRECT_UPDATE flag suggests that the surface will receive
    363  * updates indirectly, i.e. the surface will not be updated directly, but
    364  * will receive copies from staging surfaces.
    365  */
    366 #define SVGA3D_SURFACE_STAGING_UPLOAD         (1 << 27)
    367 #define SVGA3D_SURFACE_STAGING_DOWNLOAD       (1 << 28)
    368 #define SVGA3D_SURFACE_HINT_INDIRECT_UPDATE   (1 << 29)
    369 
    370 /*
    371  * Setting this flag allow this surface to be used with the
    372  * SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER command.  It is only valid for
    373  * buffer surfaces, and no bind flags are allowed to be set on surfaces
    374  * with this flag.
    375  */
    376 #define SVGA3D_SURFACE_TRANSFER_FROM_BUFFER   (1 << 30)
    377 
    378 /*
    379  * Marker for the last defined bit in SVGA3dSurfaceFlags.
    380  */
    381 #define SVGA3D_SURFACE_FLAG_MAX               (1 << 31)
    382 
    383 #define SVGA3D_SURFACE_HB_DISALLOWED_MASK        \
    384         (  SVGA3D_SURFACE_MOB_PITCH    |         \
    385            SVGA3D_SURFACE_SCREENTARGET |         \
    386            SVGA3D_SURFACE_ALIGN16 |              \
    387            SVGA3D_SURFACE_BIND_CONSTANT_BUFFER | \
    388            SVGA3D_SURFACE_BIND_STREAM_OUTPUT |   \
    389            SVGA3D_SURFACE_STAGING_UPLOAD |       \
    390            SVGA3D_SURFACE_STAGING_DOWNLOAD |     \
    391            SVGA3D_SURFACE_HINT_INDIRECT_UPDATE | \
    392            SVGA3D_SURFACE_TRANSFER_FROM_BUFFER   \
    393         )
    394 
    395 #define SVGA3D_SURFACE_2D_DISALLOWED_MASK           \
    396         (  SVGA3D_SURFACE_CUBEMAP |                 \
    397            SVGA3D_SURFACE_MASKABLE_ANTIALIAS |      \
    398            SVGA3D_SURFACE_AUTOGENMIPMAPS |          \
    399            SVGA3D_SURFACE_DECODE_RENDERTARGET |     \
    400            SVGA3D_SURFACE_VOLUME |                  \
    401            SVGA3D_SURFACE_1D |                      \
    402            SVGA3D_SURFACE_BIND_VERTEX_BUFFER |      \
    403            SVGA3D_SURFACE_BIND_INDEX_BUFFER |       \
    404            SVGA3D_SURFACE_BIND_CONSTANT_BUFFER |    \
    405            SVGA3D_SURFACE_BIND_DEPTH_STENCIL |      \
    406            SVGA3D_SURFACE_BIND_STREAM_OUTPUT |      \
    407            SVGA3D_SURFACE_TRANSFER_FROM_BUFFER      \
    408         )
    409 
    410 #define SVGA3D_SURFACE_SCREENTARGET_DISALLOWED_MASK \
    411         (  SVGA3D_SURFACE_CUBEMAP |                 \
    412            SVGA3D_SURFACE_AUTOGENMIPMAPS |          \
    413            SVGA3D_SURFACE_DECODE_RENDERTARGET |     \
    414            SVGA3D_SURFACE_VOLUME |                  \
    415            SVGA3D_SURFACE_1D |                      \
    416            SVGA3D_SURFACE_BIND_VERTEX_BUFFER |      \
    417            SVGA3D_SURFACE_BIND_INDEX_BUFFER |       \
    418            SVGA3D_SURFACE_BIND_CONSTANT_BUFFER |    \
    419            SVGA3D_SURFACE_BIND_DEPTH_STENCIL |      \
    420            SVGA3D_SURFACE_BIND_STREAM_OUTPUT |      \
    421            SVGA3D_SURFACE_INACTIVE |                \
    422            SVGA3D_SURFACE_STAGING_UPLOAD |          \
    423            SVGA3D_SURFACE_STAGING_DOWNLOAD |        \
    424            SVGA3D_SURFACE_HINT_INDIRECT_UPDATE |    \
    425            SVGA3D_SURFACE_TRANSFER_FROM_BUFFER      \
    426         )
    427 
    428 #define SVGA3D_SURFACE_DX_ONLY_MASK             \
    429         (  SVGA3D_SURFACE_BIND_STREAM_OUTPUT |  \
    430            SVGA3D_SURFACE_STAGING_UPLOAD |      \
    431            SVGA3D_SURFACE_STAGING_DOWNLOAD |    \
    432            SVGA3D_SURFACE_TRANSFER_FROM_BUFFER  \
    433         )
    434 
    435 #define SVGA3D_SURFACE_STAGING_MASK             \
    436         (  SVGA3D_SURFACE_STAGING_UPLOAD |      \
    437            SVGA3D_SURFACE_STAGING_DOWNLOAD      \
    438         )
    439 
    440 #define SVGA3D_SURFACE_BIND_MASK                  \
    441         (  SVGA3D_SURFACE_BIND_VERTEX_BUFFER   |  \
    442            SVGA3D_SURFACE_BIND_INDEX_BUFFER    |  \
    443            SVGA3D_SURFACE_BIND_CONSTANT_BUFFER |  \
    444            SVGA3D_SURFACE_BIND_SHADER_RESOURCE |  \
    445            SVGA3D_SURFACE_BIND_RENDER_TARGET   |  \
    446            SVGA3D_SURFACE_BIND_DEPTH_STENCIL   |  \
    447            SVGA3D_SURFACE_BIND_STREAM_OUTPUT      \
    448         )
    449 
    450 typedef enum {
    451    SVGA3DFORMAT_OP_TEXTURE                               = 0x00000001,
    452    SVGA3DFORMAT_OP_VOLUMETEXTURE                         = 0x00000002,
    453    SVGA3DFORMAT_OP_CUBETEXTURE                           = 0x00000004,
    454    SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET                = 0x00000008,
    455    SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET              = 0x00000010,
    456    SVGA3DFORMAT_OP_ZSTENCIL                              = 0x00000040,
    457    SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH   = 0x00000080,
    458 
    459 /*
    460  * This format can be used as a render target if the current display mode
    461  * is the same depth if the alpha channel is ignored. e.g. if the device
    462  * can render to A8R8G8B8 when the display mode is X8R8G8B8, then the
    463  * format op list entry for A8R8G8B8 should have this cap.
    464  */
    465    SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET  = 0x00000100,
    466 
    467 /*
    468  * This format contains DirectDraw support (including Flip).  This flag
    469  * should not to be set on alpha formats.
    470  */
    471    SVGA3DFORMAT_OP_DISPLAYMODE                           = 0x00000400,
    472 
    473 /*
    474  * The rasterizer can support some level of Direct3D support in this format
    475  * and implies that the driver can create a Context in this mode (for some
    476  * render target format).  When this flag is set, the SVGA3DFORMAT_OP_DISPLAYMODE
    477  * flag must also be set.
    478  */
    479    SVGA3DFORMAT_OP_3DACCELERATION                        = 0x00000800,
    480 
    481 /*
    482  * This is set for a private format when the driver has put the bpp in
    483  * the structure.
    484  */
    485    SVGA3DFORMAT_OP_PIXELSIZE                             = 0x00001000,
    486 
    487 /*
    488  * Indicates that this format can be converted to any RGB format for which
    489  * SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB is specified
    490  */
    491    SVGA3DFORMAT_OP_CONVERT_TO_ARGB                       = 0x00002000,
    492 
    493 /*
    494  * Indicates that this format can be used to create offscreen plain surfaces.
    495  */
    496    SVGA3DFORMAT_OP_OFFSCREENPLAIN                        = 0x00004000,
    497 
    498 /*
    499  * Indicated that this format can be read as an SRGB texture (meaning that the
    500  * sampler will linearize the looked up data)
    501  */
    502    SVGA3DFORMAT_OP_SRGBREAD                              = 0x00008000,
    503 
    504 /*
    505  * Indicates that this format can be used in the bumpmap instructions
    506  */
    507    SVGA3DFORMAT_OP_BUMPMAP                               = 0x00010000,
    508 
    509 /*
    510  * Indicates that this format can be sampled by the displacement map sampler
    511  */
    512    SVGA3DFORMAT_OP_DMAP                                  = 0x00020000,
    513 
    514 /*
    515  * Indicates that this format cannot be used with texture filtering
    516  */
    517    SVGA3DFORMAT_OP_NOFILTER                              = 0x00040000,
    518 
    519 /*
    520  * Indicates that format conversions are supported to this RGB format if
    521  * SVGA3DFORMAT_OP_CONVERT_TO_ARGB is specified in the source format.
    522  */
    523    SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB                    = 0x00080000,
    524 
    525 /*
    526  * Indicated that this format can be written as an SRGB target
    527  * (meaning that the pixel pipe will DE-linearize data on output to format)
    528  */
    529    SVGA3DFORMAT_OP_SRGBWRITE                             = 0x00100000,
    530 
    531 /*
    532  * Indicates that this format cannot be used with alpha blending
    533  */
    534    SVGA3DFORMAT_OP_NOALPHABLEND                          = 0x00200000,
    535 
    536 /*
    537  * Indicates that the device can auto-generated sublevels for resources
    538  * of this format
    539  */
    540    SVGA3DFORMAT_OP_AUTOGENMIPMAP                         = 0x00400000,
    541 
    542 /*
    543  * Indicates that this format can be used by vertex texture sampler
    544  */
    545    SVGA3DFORMAT_OP_VERTEXTEXTURE                         = 0x00800000,
    546 
    547 /*
    548  * Indicates that this format supports neither texture coordinate
    549  * wrap modes, nor mipmapping.
    550  */
    551    SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP                  = 0x01000000
    552 } SVGA3dFormatOp;
    553 
    554 #define SVGA3D_FORMAT_POSITIVE                             \
    555    (SVGA3DFORMAT_OP_TEXTURE                              | \
    556     SVGA3DFORMAT_OP_VOLUMETEXTURE                        | \
    557     SVGA3DFORMAT_OP_CUBETEXTURE                          | \
    558     SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET               | \
    559     SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET             | \
    560     SVGA3DFORMAT_OP_ZSTENCIL                             | \
    561     SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH  | \
    562     SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET | \
    563     SVGA3DFORMAT_OP_DISPLAYMODE                          | \
    564     SVGA3DFORMAT_OP_3DACCELERATION                       | \
    565     SVGA3DFORMAT_OP_PIXELSIZE                            | \
    566     SVGA3DFORMAT_OP_CONVERT_TO_ARGB                      | \
    567     SVGA3DFORMAT_OP_OFFSCREENPLAIN                       | \
    568     SVGA3DFORMAT_OP_SRGBREAD                             | \
    569     SVGA3DFORMAT_OP_BUMPMAP                              | \
    570     SVGA3DFORMAT_OP_DMAP                                 | \
    571     SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB                   | \
    572     SVGA3DFORMAT_OP_SRGBWRITE                            | \
    573     SVGA3DFORMAT_OP_AUTOGENMIPMAP                        | \
    574     SVGA3DFORMAT_OP_VERTEXTEXTURE)
    575 
    576 #define SVGA3D_FORMAT_NEGATIVE               \
    577    (SVGA3DFORMAT_OP_NOFILTER               | \
    578     SVGA3DFORMAT_OP_NOALPHABLEND           | \
    579     SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP)
    580 
    581 /*
    582  * This structure is a conversion of SVGA3DFORMAT_OP_*
    583  * Entries must be located at the same position.
    584  */
    585 typedef union {
    586    uint32 value;
    587    struct {
    588       uint32 texture : 1;
    589       uint32 volumeTexture : 1;
    590       uint32 cubeTexture : 1;
    591       uint32 offscreenRenderTarget : 1;
    592       uint32 sameFormatRenderTarget : 1;
    593       uint32 unknown1 : 1;
    594       uint32 zStencil : 1;
    595       uint32 zStencilArbitraryDepth : 1;
    596       uint32 sameFormatUpToAlpha : 1;
    597       uint32 unknown2 : 1;
    598       uint32 displayMode : 1;
    599       uint32 acceleration3d : 1;
    600       uint32 pixelSize : 1;
    601       uint32 convertToARGB : 1;
    602       uint32 offscreenPlain : 1;
    603       uint32 sRGBRead : 1;
    604       uint32 bumpMap : 1;
    605       uint32 dmap : 1;
    606       uint32 noFilter : 1;
    607       uint32 memberOfGroupARGB : 1;
    608       uint32 sRGBWrite : 1;
    609       uint32 noAlphaBlend : 1;
    610       uint32 autoGenMipMap : 1;
    611       uint32 vertexTexture : 1;
    612       uint32 noTexCoordWrapNorMip : 1;
    613    };
    614 } SVGA3dSurfaceFormatCaps;
    615 
    616 /*
    617  * SVGA_3D_CMD_SETRENDERSTATE Types.  All value types
    618  * must fit in a uint32.
    619  */
    620 
    621 typedef enum {
    622    SVGA3D_RS_INVALID                   = 0,
    623    SVGA3D_RS_MIN                       = 1,
    624    SVGA3D_RS_ZENABLE                   = 1,     /* SVGA3dBool */
    625    SVGA3D_RS_ZWRITEENABLE              = 2,     /* SVGA3dBool */
    626    SVGA3D_RS_ALPHATESTENABLE           = 3,     /* SVGA3dBool */
    627    SVGA3D_RS_DITHERENABLE              = 4,     /* SVGA3dBool */
    628    SVGA3D_RS_BLENDENABLE               = 5,     /* SVGA3dBool */
    629    SVGA3D_RS_FOGENABLE                 = 6,     /* SVGA3dBool */
    630    SVGA3D_RS_SPECULARENABLE            = 7,     /* SVGA3dBool */
    631    SVGA3D_RS_STENCILENABLE             = 8,     /* SVGA3dBool */
    632    SVGA3D_RS_LIGHTINGENABLE            = 9,     /* SVGA3dBool */
    633    SVGA3D_RS_NORMALIZENORMALS          = 10,    /* SVGA3dBool */
    634    SVGA3D_RS_POINTSPRITEENABLE         = 11,    /* SVGA3dBool */
    635    SVGA3D_RS_POINTSCALEENABLE          = 12,    /* SVGA3dBool */
    636    SVGA3D_RS_STENCILREF                = 13,    /* uint32 */
    637    SVGA3D_RS_STENCILMASK               = 14,    /* uint32 */
    638    SVGA3D_RS_STENCILWRITEMASK          = 15,    /* uint32 */
    639    SVGA3D_RS_FOGSTART                  = 16,    /* float */
    640    SVGA3D_RS_FOGEND                    = 17,    /* float */
    641    SVGA3D_RS_FOGDENSITY                = 18,    /* float */
    642    SVGA3D_RS_POINTSIZE                 = 19,    /* float */
    643    SVGA3D_RS_POINTSIZEMIN              = 20,    /* float */
    644    SVGA3D_RS_POINTSIZEMAX              = 21,    /* float */
    645    SVGA3D_RS_POINTSCALE_A              = 22,    /* float */
    646    SVGA3D_RS_POINTSCALE_B              = 23,    /* float */
    647    SVGA3D_RS_POINTSCALE_C              = 24,    /* float */
    648    SVGA3D_RS_FOGCOLOR                  = 25,    /* SVGA3dColor */
    649    SVGA3D_RS_AMBIENT                   = 26,    /* SVGA3dColor */
    650    SVGA3D_RS_CLIPPLANEENABLE           = 27,    /* SVGA3dClipPlanes */
    651    SVGA3D_RS_FOGMODE                   = 28,    /* SVGA3dFogMode */
    652    SVGA3D_RS_FILLMODE                  = 29,    /* SVGA3dFillMode */
    653    SVGA3D_RS_SHADEMODE                 = 30,    /* SVGA3dShadeMode */
    654    SVGA3D_RS_LINEPATTERN               = 31,    /* SVGA3dLinePattern */
    655    SVGA3D_RS_SRCBLEND                  = 32,    /* SVGA3dBlendOp */
    656    SVGA3D_RS_DSTBLEND                  = 33,    /* SVGA3dBlendOp */
    657    SVGA3D_RS_BLENDEQUATION             = 34,    /* SVGA3dBlendEquation */
    658    SVGA3D_RS_CULLMODE                  = 35,    /* SVGA3dFace */
    659    SVGA3D_RS_ZFUNC                     = 36,    /* SVGA3dCmpFunc */
    660    SVGA3D_RS_ALPHAFUNC                 = 37,    /* SVGA3dCmpFunc */
    661    SVGA3D_RS_STENCILFUNC               = 38,    /* SVGA3dCmpFunc */
    662    SVGA3D_RS_STENCILFAIL               = 39,    /* SVGA3dStencilOp */
    663    SVGA3D_RS_STENCILZFAIL              = 40,    /* SVGA3dStencilOp */
    664    SVGA3D_RS_STENCILPASS               = 41,    /* SVGA3dStencilOp */
    665    SVGA3D_RS_ALPHAREF                  = 42,    /* float (0.0 .. 1.0) */
    666    SVGA3D_RS_FRONTWINDING              = 43,    /* SVGA3dFrontWinding */
    667    SVGA3D_RS_COORDINATETYPE            = 44,    /* SVGA3dCoordinateType */
    668    SVGA3D_RS_ZBIAS                     = 45,    /* float */
    669    SVGA3D_RS_RANGEFOGENABLE            = 46,    /* SVGA3dBool */
    670    SVGA3D_RS_COLORWRITEENABLE          = 47,    /* SVGA3dColorMask */
    671    SVGA3D_RS_VERTEXMATERIALENABLE      = 48,    /* SVGA3dBool */
    672    SVGA3D_RS_DIFFUSEMATERIALSOURCE     = 49,    /* SVGA3dVertexMaterial */
    673    SVGA3D_RS_SPECULARMATERIALSOURCE    = 50,    /* SVGA3dVertexMaterial */
    674    SVGA3D_RS_AMBIENTMATERIALSOURCE     = 51,    /* SVGA3dVertexMaterial */
    675    SVGA3D_RS_EMISSIVEMATERIALSOURCE    = 52,    /* SVGA3dVertexMaterial */
    676    SVGA3D_RS_TEXTUREFACTOR             = 53,    /* SVGA3dColor */
    677    SVGA3D_RS_LOCALVIEWER               = 54,    /* SVGA3dBool */
    678    SVGA3D_RS_SCISSORTESTENABLE         = 55,    /* SVGA3dBool */
    679    SVGA3D_RS_BLENDCOLOR                = 56,    /* SVGA3dColor */
    680    SVGA3D_RS_STENCILENABLE2SIDED       = 57,    /* SVGA3dBool */
    681    SVGA3D_RS_CCWSTENCILFUNC            = 58,    /* SVGA3dCmpFunc */
    682    SVGA3D_RS_CCWSTENCILFAIL            = 59,    /* SVGA3dStencilOp */
    683    SVGA3D_RS_CCWSTENCILZFAIL           = 60,    /* SVGA3dStencilOp */
    684    SVGA3D_RS_CCWSTENCILPASS            = 61,    /* SVGA3dStencilOp */
    685    SVGA3D_RS_VERTEXBLEND               = 62,    /* SVGA3dVertexBlendFlags */
    686    SVGA3D_RS_SLOPESCALEDEPTHBIAS       = 63,    /* float */
    687    SVGA3D_RS_DEPTHBIAS                 = 64,    /* float */
    688 
    689 
    690    /*
    691     * Output Gamma Level
    692     *
    693     * Output gamma effects the gamma curve of colors that are output from the
    694     * rendering pipeline.  A value of 1.0 specifies a linear color space. If the
    695     * value is <= 0.0, gamma correction is ignored and linear color space is
    696     * used.
    697     */
    698 
    699    SVGA3D_RS_OUTPUTGAMMA               = 65,    /* float */
    700    SVGA3D_RS_ZVISIBLE                  = 66,    /* SVGA3dBool */
    701    SVGA3D_RS_LASTPIXEL                 = 67,    /* SVGA3dBool */
    702    SVGA3D_RS_CLIPPING                  = 68,    /* SVGA3dBool */
    703    SVGA3D_RS_WRAP0                     = 69,    /* SVGA3dWrapFlags */
    704    SVGA3D_RS_WRAP1                     = 70,    /* SVGA3dWrapFlags */
    705    SVGA3D_RS_WRAP2                     = 71,    /* SVGA3dWrapFlags */
    706    SVGA3D_RS_WRAP3                     = 72,    /* SVGA3dWrapFlags */
    707    SVGA3D_RS_WRAP4                     = 73,    /* SVGA3dWrapFlags */
    708    SVGA3D_RS_WRAP5                     = 74,    /* SVGA3dWrapFlags */
    709    SVGA3D_RS_WRAP6                     = 75,    /* SVGA3dWrapFlags */
    710    SVGA3D_RS_WRAP7                     = 76,    /* SVGA3dWrapFlags */
    711    SVGA3D_RS_WRAP8                     = 77,    /* SVGA3dWrapFlags */
    712    SVGA3D_RS_WRAP9                     = 78,    /* SVGA3dWrapFlags */
    713    SVGA3D_RS_WRAP10                    = 79,    /* SVGA3dWrapFlags */
    714    SVGA3D_RS_WRAP11                    = 80,    /* SVGA3dWrapFlags */
    715    SVGA3D_RS_WRAP12                    = 81,    /* SVGA3dWrapFlags */
    716    SVGA3D_RS_WRAP13                    = 82,    /* SVGA3dWrapFlags */
    717    SVGA3D_RS_WRAP14                    = 83,    /* SVGA3dWrapFlags */
    718    SVGA3D_RS_WRAP15                    = 84,    /* SVGA3dWrapFlags */
    719    SVGA3D_RS_MULTISAMPLEANTIALIAS      = 85,    /* SVGA3dBool */
    720    SVGA3D_RS_MULTISAMPLEMASK           = 86,    /* uint32 */
    721    SVGA3D_RS_INDEXEDVERTEXBLENDENABLE  = 87,    /* SVGA3dBool */
    722    SVGA3D_RS_TWEENFACTOR               = 88,    /* float */
    723    SVGA3D_RS_ANTIALIASEDLINEENABLE     = 89,    /* SVGA3dBool */
    724    SVGA3D_RS_COLORWRITEENABLE1         = 90,    /* SVGA3dColorMask */
    725    SVGA3D_RS_COLORWRITEENABLE2         = 91,    /* SVGA3dColorMask */
    726    SVGA3D_RS_COLORWRITEENABLE3         = 92,    /* SVGA3dColorMask */
    727    SVGA3D_RS_SEPARATEALPHABLENDENABLE  = 93,    /* SVGA3dBool */
    728    SVGA3D_RS_SRCBLENDALPHA             = 94,    /* SVGA3dBlendOp */
    729    SVGA3D_RS_DSTBLENDALPHA             = 95,    /* SVGA3dBlendOp */
    730    SVGA3D_RS_BLENDEQUATIONALPHA        = 96,    /* SVGA3dBlendEquation */
    731    SVGA3D_RS_TRANSPARENCYANTIALIAS     = 97,    /* SVGA3dTransparencyAntialiasType */
    732    SVGA3D_RS_LINEWIDTH                 = 98,    /* float */
    733    SVGA3D_RS_MAX
    734 } SVGA3dRenderStateName;
    735 
    736 typedef enum {
    737    SVGA3D_TRANSPARENCYANTIALIAS_NORMAL            = 0,
    738    SVGA3D_TRANSPARENCYANTIALIAS_ALPHATOCOVERAGE   = 1,
    739    SVGA3D_TRANSPARENCYANTIALIAS_SUPERSAMPLE       = 2,
    740    SVGA3D_TRANSPARENCYANTIALIAS_MAX
    741 } SVGA3dTransparencyAntialiasType;
    742 
    743 typedef enum {
    744    SVGA3D_VERTEXMATERIAL_NONE     = 0,    /* Use the value in the current material */
    745    SVGA3D_VERTEXMATERIAL_DIFFUSE  = 1,    /* Use the value in the diffuse component */
    746    SVGA3D_VERTEXMATERIAL_SPECULAR = 2,    /* Use the value in the specular component */
    747    SVGA3D_VERTEXMATERIAL_MAX      = 3,
    748 } SVGA3dVertexMaterial;
    749 
    750 typedef enum {
    751    SVGA3D_FILLMODE_INVALID = 0,
    752    SVGA3D_FILLMODE_MIN     = 1,
    753    SVGA3D_FILLMODE_POINT   = 1,
    754    SVGA3D_FILLMODE_LINE    = 2,
    755    SVGA3D_FILLMODE_FILL    = 3,
    756    SVGA3D_FILLMODE_MAX
    757 } SVGA3dFillModeType;
    758 
    759 
    760 typedef
    761 #include "vmware_pack_begin.h"
    762 union {
    763    struct {
    764       uint16   mode;       /* SVGA3dFillModeType */
    765       uint16   face;       /* SVGA3dFace */
    766    };
    767    uint32 uintValue;
    768 }
    769 #include "vmware_pack_end.h"
    770 SVGA3dFillMode;
    771 
    772 typedef enum {
    773    SVGA3D_SHADEMODE_INVALID = 0,
    774    SVGA3D_SHADEMODE_FLAT    = 1,
    775    SVGA3D_SHADEMODE_SMOOTH  = 2,
    776    SVGA3D_SHADEMODE_PHONG   = 3,     /* Not supported */
    777    SVGA3D_SHADEMODE_MAX
    778 } SVGA3dShadeMode;
    779 
    780 typedef
    781 #include "vmware_pack_begin.h"
    782 union {
    783    struct {
    784       uint16 repeat;
    785       uint16 pattern;
    786    };
    787    uint32 uintValue;
    788 }
    789 #include "vmware_pack_end.h"
    790 SVGA3dLinePattern;
    791 
    792 typedef enum {
    793    SVGA3D_BLENDOP_INVALID             = 0,
    794    SVGA3D_BLENDOP_MIN                 = 1,
    795    SVGA3D_BLENDOP_ZERO                = 1,
    796    SVGA3D_BLENDOP_ONE                 = 2,
    797    SVGA3D_BLENDOP_SRCCOLOR            = 3,
    798    SVGA3D_BLENDOP_INVSRCCOLOR         = 4,
    799    SVGA3D_BLENDOP_SRCALPHA            = 5,
    800    SVGA3D_BLENDOP_INVSRCALPHA         = 6,
    801    SVGA3D_BLENDOP_DESTALPHA           = 7,
    802    SVGA3D_BLENDOP_INVDESTALPHA        = 8,
    803    SVGA3D_BLENDOP_DESTCOLOR           = 9,
    804    SVGA3D_BLENDOP_INVDESTCOLOR        = 10,
    805    SVGA3D_BLENDOP_SRCALPHASAT         = 11,
    806    SVGA3D_BLENDOP_BLENDFACTOR         = 12,
    807    SVGA3D_BLENDOP_INVBLENDFACTOR      = 13,
    808    SVGA3D_BLENDOP_SRC1COLOR           = 14,
    809    SVGA3D_BLENDOP_INVSRC1COLOR        = 15,
    810    SVGA3D_BLENDOP_SRC1ALPHA           = 16,
    811    SVGA3D_BLENDOP_INVSRC1ALPHA        = 17,
    812    SVGA3D_BLENDOP_BLENDFACTORALPHA    = 18,
    813    SVGA3D_BLENDOP_INVBLENDFACTORALPHA = 19,
    814    SVGA3D_BLENDOP_MAX
    815 } SVGA3dBlendOp;
    816 
    817 typedef enum {
    818    SVGA3D_BLENDEQ_INVALID            = 0,
    819    SVGA3D_BLENDEQ_MIN                = 1,
    820    SVGA3D_BLENDEQ_ADD                = 1,
    821    SVGA3D_BLENDEQ_SUBTRACT           = 2,
    822    SVGA3D_BLENDEQ_REVSUBTRACT        = 3,
    823    SVGA3D_BLENDEQ_MINIMUM            = 4,
    824    SVGA3D_BLENDEQ_MAXIMUM            = 5,
    825    SVGA3D_BLENDEQ_MAX
    826 } SVGA3dBlendEquation;
    827 
    828 typedef enum {
    829    SVGA3D_DX11_LOGICOP_MIN           = 0,
    830    SVGA3D_DX11_LOGICOP_CLEAR         = 0,
    831    SVGA3D_DX11_LOGICOP_SET           = 1,
    832    SVGA3D_DX11_LOGICOP_COPY          = 2,
    833    SVGA3D_DX11_LOGICOP_COPY_INVERTED = 3,
    834    SVGA3D_DX11_LOGICOP_NOOP          = 4,
    835    SVGA3D_DX11_LOGICOP_INVERT        = 5,
    836    SVGA3D_DX11_LOGICOP_AND           = 6,
    837    SVGA3D_DX11_LOGICOP_NAND          = 7,
    838    SVGA3D_DX11_LOGICOP_OR            = 8,
    839    SVGA3D_DX11_LOGICOP_NOR           = 9,
    840    SVGA3D_DX11_LOGICOP_XOR           = 10,
    841    SVGA3D_DX11_LOGICOP_EQUIV         = 11,
    842    SVGA3D_DX11_LOGICOP_AND_REVERSE   = 12,
    843    SVGA3D_DX11_LOGICOP_AND_INVERTED  = 13,
    844    SVGA3D_DX11_LOGICOP_OR_REVERSE    = 14,
    845    SVGA3D_DX11_LOGICOP_OR_INVERTED   = 15,
    846    SVGA3D_DX11_LOGICOP_MAX
    847 } SVGA3dDX11LogicOp;
    848 
    849 typedef enum {
    850    SVGA3D_FRONTWINDING_INVALID = 0,
    851    SVGA3D_FRONTWINDING_CW      = 1,
    852    SVGA3D_FRONTWINDING_CCW     = 2,
    853    SVGA3D_FRONTWINDING_MAX
    854 } SVGA3dFrontWinding;
    855 
    856 typedef enum {
    857    SVGA3D_FACE_INVALID  = 0,
    858    SVGA3D_FACE_NONE     = 1,
    859    SVGA3D_FACE_MIN      = 1,
    860    SVGA3D_FACE_FRONT    = 2,
    861    SVGA3D_FACE_BACK     = 3,
    862    SVGA3D_FACE_FRONT_BACK = 4,
    863    SVGA3D_FACE_MAX
    864 } SVGA3dFace;
    865 
    866 /*
    867  * The order and the values should not be changed
    868  */
    869 
    870 typedef enum {
    871    SVGA3D_CMP_INVALID              = 0,
    872    SVGA3D_CMP_NEVER                = 1,
    873    SVGA3D_CMP_LESS                 = 2,
    874    SVGA3D_CMP_EQUAL                = 3,
    875    SVGA3D_CMP_LESSEQUAL            = 4,
    876    SVGA3D_CMP_GREATER              = 5,
    877    SVGA3D_CMP_NOTEQUAL             = 6,
    878    SVGA3D_CMP_GREATEREQUAL         = 7,
    879    SVGA3D_CMP_ALWAYS               = 8,
    880    SVGA3D_CMP_MAX
    881 } SVGA3dCmpFunc;
    882 
    883 /*
    884  * SVGA3D_FOGFUNC_* specifies the fog equation, or PER_VERTEX which allows
    885  * the fog factor to be specified in the alpha component of the specular
    886  * (a.k.a. secondary) vertex color.
    887  */
    888 typedef enum {
    889    SVGA3D_FOGFUNC_INVALID          = 0,
    890    SVGA3D_FOGFUNC_EXP              = 1,
    891    SVGA3D_FOGFUNC_EXP2             = 2,
    892    SVGA3D_FOGFUNC_LINEAR           = 3,
    893    SVGA3D_FOGFUNC_PER_VERTEX       = 4
    894 } SVGA3dFogFunction;
    895 
    896 /*
    897  * SVGA3D_FOGTYPE_* specifies if fog factors are computed on a per-vertex
    898  * or per-pixel basis.
    899  */
    900 typedef enum {
    901    SVGA3D_FOGTYPE_INVALID          = 0,
    902    SVGA3D_FOGTYPE_VERTEX           = 1,
    903    SVGA3D_FOGTYPE_PIXEL            = 2,
    904    SVGA3D_FOGTYPE_MAX              = 3
    905 } SVGA3dFogType;
    906 
    907 /*
    908  * SVGA3D_FOGBASE_* selects depth or range-based fog. Depth-based fog is
    909  * computed using the eye Z value of each pixel (or vertex), whereas range-
    910  * based fog is computed using the actual distance (range) to the eye.
    911  */
    912 typedef enum {
    913    SVGA3D_FOGBASE_INVALID          = 0,
    914    SVGA3D_FOGBASE_DEPTHBASED       = 1,
    915    SVGA3D_FOGBASE_RANGEBASED       = 2,
    916    SVGA3D_FOGBASE_MAX              = 3
    917 } SVGA3dFogBase;
    918 
    919 typedef enum {
    920    SVGA3D_STENCILOP_INVALID        = 0,
    921    SVGA3D_STENCILOP_MIN            = 1,
    922    SVGA3D_STENCILOP_KEEP           = 1,
    923    SVGA3D_STENCILOP_ZERO           = 2,
    924    SVGA3D_STENCILOP_REPLACE        = 3,
    925    SVGA3D_STENCILOP_INCRSAT        = 4,
    926    SVGA3D_STENCILOP_DECRSAT        = 5,
    927    SVGA3D_STENCILOP_INVERT         = 6,
    928    SVGA3D_STENCILOP_INCR           = 7,
    929    SVGA3D_STENCILOP_DECR           = 8,
    930    SVGA3D_STENCILOP_MAX
    931 } SVGA3dStencilOp;
    932 
    933 typedef enum {
    934    SVGA3D_CLIPPLANE_0              = (1 << 0),
    935    SVGA3D_CLIPPLANE_1              = (1 << 1),
    936    SVGA3D_CLIPPLANE_2              = (1 << 2),
    937    SVGA3D_CLIPPLANE_3              = (1 << 3),
    938    SVGA3D_CLIPPLANE_4              = (1 << 4),
    939    SVGA3D_CLIPPLANE_5              = (1 << 5),
    940 } SVGA3dClipPlanes;
    941 
    942 typedef enum {
    943    SVGA3D_CLEAR_COLOR              = 0x1,
    944    SVGA3D_CLEAR_DEPTH              = 0x2,
    945    SVGA3D_CLEAR_STENCIL            = 0x4,
    946 
    947    /*
    948     * Hint only, must be used together with SVGA3D_CLEAR_COLOR. If
    949     * SVGA3D_CLEAR_DEPTH or SVGA3D_CLEAR_STENCIL bit is set, this
    950     * bit will be ignored.
    951     */
    952    SVGA3D_CLEAR_COLORFILL          = 0x8
    953 } SVGA3dClearFlag;
    954 
    955 typedef enum {
    956    SVGA3D_RT_DEPTH                 = 0,
    957    SVGA3D_RT_MIN                   = 0,
    958    SVGA3D_RT_STENCIL               = 1,
    959    SVGA3D_RT_COLOR0                = 2,
    960    SVGA3D_RT_COLOR1                = 3,
    961    SVGA3D_RT_COLOR2                = 4,
    962    SVGA3D_RT_COLOR3                = 5,
    963    SVGA3D_RT_COLOR4                = 6,
    964    SVGA3D_RT_COLOR5                = 7,
    965    SVGA3D_RT_COLOR6                = 8,
    966    SVGA3D_RT_COLOR7                = 9,
    967    SVGA3D_RT_MAX,
    968    SVGA3D_RT_INVALID               = ((uint32)-1),
    969 } SVGA3dRenderTargetType;
    970 
    971 #define SVGA3D_MAX_RT_COLOR (SVGA3D_RT_COLOR7 - SVGA3D_RT_COLOR0 + 1)
    972 
    973 typedef
    974 #include "vmware_pack_begin.h"
    975 union {
    976    struct {
    977       uint32  red   : 1;
    978       uint32  green : 1;
    979       uint32  blue  : 1;
    980       uint32  alpha : 1;
    981    };
    982    uint32 uintValue;
    983 }
    984 #include "vmware_pack_end.h"
    985 SVGA3dColorMask;
    986 
    987 typedef enum {
    988    SVGA3D_VBLEND_DISABLE            = 0,
    989    SVGA3D_VBLEND_1WEIGHT            = 1,
    990    SVGA3D_VBLEND_2WEIGHT            = 2,
    991    SVGA3D_VBLEND_3WEIGHT            = 3,
    992    SVGA3D_VBLEND_MAX                = 4,
    993 } SVGA3dVertexBlendFlags;
    994 
    995 typedef enum {
    996    SVGA3D_WRAPCOORD_0   = 1 << 0,
    997    SVGA3D_WRAPCOORD_1   = 1 << 1,
    998    SVGA3D_WRAPCOORD_2   = 1 << 2,
    999    SVGA3D_WRAPCOORD_3   = 1 << 3,
   1000    SVGA3D_WRAPCOORD_ALL = 0xF,
   1001 } SVGA3dWrapFlags;
   1002 
   1003 /*
   1004  * SVGA_3D_CMD_TEXTURESTATE Types.  All value types
   1005  * must fit in a uint32.
   1006  */
   1007 
   1008 typedef enum {
   1009    SVGA3D_TS_INVALID                    = 0,
   1010    SVGA3D_TS_MIN                        = 1,
   1011    SVGA3D_TS_BIND_TEXTURE               = 1,    /* SVGA3dSurfaceId */
   1012    SVGA3D_TS_COLOROP                    = 2,    /* SVGA3dTextureCombiner */
   1013    SVGA3D_TS_COLORARG1                  = 3,    /* SVGA3dTextureArgData */
   1014    SVGA3D_TS_COLORARG2                  = 4,    /* SVGA3dTextureArgData */
   1015    SVGA3D_TS_ALPHAOP                    = 5,    /* SVGA3dTextureCombiner */
   1016    SVGA3D_TS_ALPHAARG1                  = 6,    /* SVGA3dTextureArgData */
   1017    SVGA3D_TS_ALPHAARG2                  = 7,    /* SVGA3dTextureArgData */
   1018    SVGA3D_TS_ADDRESSU                   = 8,    /* SVGA3dTextureAddress */
   1019    SVGA3D_TS_ADDRESSV                   = 9,    /* SVGA3dTextureAddress */
   1020    SVGA3D_TS_MIPFILTER                  = 10,   /* SVGA3dTextureFilter */
   1021    SVGA3D_TS_MAGFILTER                  = 11,   /* SVGA3dTextureFilter */
   1022    SVGA3D_TS_MINFILTER                  = 12,   /* SVGA3dTextureFilter */
   1023    SVGA3D_TS_BORDERCOLOR                = 13,   /* SVGA3dColor */
   1024    SVGA3D_TS_TEXCOORDINDEX              = 14,   /* uint32 */
   1025    SVGA3D_TS_TEXTURETRANSFORMFLAGS      = 15,   /* SVGA3dTexTransformFlags */
   1026    SVGA3D_TS_TEXCOORDGEN                = 16,   /* SVGA3dTextureCoordGen */
   1027    SVGA3D_TS_BUMPENVMAT00               = 17,   /* float */
   1028    SVGA3D_TS_BUMPENVMAT01               = 18,   /* float */
   1029    SVGA3D_TS_BUMPENVMAT10               = 19,   /* float */
   1030    SVGA3D_TS_BUMPENVMAT11               = 20,   /* float */
   1031    SVGA3D_TS_TEXTURE_MIPMAP_LEVEL       = 21,   /* uint32 */
   1032    SVGA3D_TS_TEXTURE_LOD_BIAS           = 22,   /* float */
   1033    SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL  = 23,   /* uint32 */
   1034    SVGA3D_TS_ADDRESSW                   = 24,   /* SVGA3dTextureAddress */
   1035 
   1036 
   1037    /*
   1038     * Sampler Gamma Level
   1039     *
   1040     * Sampler gamma effects the color of samples taken from the sampler.  A
   1041     * value of 1.0 will produce linear samples.  If the value is <= 0.0 the
   1042     * gamma value is ignored and a linear space is used.
   1043     */
   1044 
   1045    SVGA3D_TS_GAMMA                      = 25,   /* float */
   1046    SVGA3D_TS_BUMPENVLSCALE              = 26,   /* float */
   1047    SVGA3D_TS_BUMPENVLOFFSET             = 27,   /* float */
   1048    SVGA3D_TS_COLORARG0                  = 28,   /* SVGA3dTextureArgData */
   1049    SVGA3D_TS_ALPHAARG0                  = 29,   /* SVGA3dTextureArgData */
   1050    SVGA3D_TS_PREGB_MAX                  = 30,   /* Max value before GBObjects */
   1051    SVGA3D_TS_CONSTANT                   = 30,   /* SVGA3dColor */
   1052    SVGA3D_TS_COLOR_KEY_ENABLE           = 31,   /* SVGA3dBool */
   1053    SVGA3D_TS_COLOR_KEY                  = 32,   /* SVGA3dColor */
   1054    SVGA3D_TS_MAX
   1055 } SVGA3dTextureStateName;
   1056 
   1057 typedef enum {
   1058    SVGA3D_TC_INVALID                   = 0,
   1059    SVGA3D_TC_DISABLE                   = 1,
   1060    SVGA3D_TC_SELECTARG1                = 2,
   1061    SVGA3D_TC_SELECTARG2                = 3,
   1062    SVGA3D_TC_MODULATE                  = 4,
   1063    SVGA3D_TC_ADD                       = 5,
   1064    SVGA3D_TC_ADDSIGNED                 = 6,
   1065    SVGA3D_TC_SUBTRACT                  = 7,
   1066    SVGA3D_TC_BLENDTEXTUREALPHA         = 8,
   1067    SVGA3D_TC_BLENDDIFFUSEALPHA         = 9,
   1068    SVGA3D_TC_BLENDCURRENTALPHA         = 10,
   1069    SVGA3D_TC_BLENDFACTORALPHA          = 11,
   1070    SVGA3D_TC_MODULATE2X                = 12,
   1071    SVGA3D_TC_MODULATE4X                = 13,
   1072    SVGA3D_TC_DSDT                      = 14,
   1073    SVGA3D_TC_DOTPRODUCT3               = 15,
   1074    SVGA3D_TC_BLENDTEXTUREALPHAPM       = 16,
   1075    SVGA3D_TC_ADDSIGNED2X               = 17,
   1076    SVGA3D_TC_ADDSMOOTH                 = 18,
   1077    SVGA3D_TC_PREMODULATE               = 19,
   1078    SVGA3D_TC_MODULATEALPHA_ADDCOLOR    = 20,
   1079    SVGA3D_TC_MODULATECOLOR_ADDALPHA    = 21,
   1080    SVGA3D_TC_MODULATEINVALPHA_ADDCOLOR = 22,
   1081    SVGA3D_TC_MODULATEINVCOLOR_ADDALPHA = 23,
   1082    SVGA3D_TC_BUMPENVMAPLUMINANCE       = 24,
   1083    SVGA3D_TC_MULTIPLYADD               = 25,
   1084    SVGA3D_TC_LERP                      = 26,
   1085    SVGA3D_TC_MAX
   1086 } SVGA3dTextureCombiner;
   1087 
   1088 #define SVGA3D_TC_CAP_BIT(svga3d_tc_op) (svga3d_tc_op ? (1 << (svga3d_tc_op - 1)) : 0)
   1089 
   1090 typedef enum {
   1091    SVGA3D_TEX_ADDRESS_INVALID    = 0,
   1092    SVGA3D_TEX_ADDRESS_MIN        = 1,
   1093    SVGA3D_TEX_ADDRESS_WRAP       = 1,
   1094    SVGA3D_TEX_ADDRESS_MIRROR     = 2,
   1095    SVGA3D_TEX_ADDRESS_CLAMP      = 3,
   1096    SVGA3D_TEX_ADDRESS_BORDER     = 4,
   1097    SVGA3D_TEX_ADDRESS_MIRRORONCE = 5,
   1098    SVGA3D_TEX_ADDRESS_EDGE       = 6,
   1099    SVGA3D_TEX_ADDRESS_MAX
   1100 } SVGA3dTextureAddress;
   1101 
   1102 /*
   1103  * SVGA3D_TEX_FILTER_NONE as the minification filter means mipmapping is
   1104  * disabled, and the rasterizer should use the magnification filter instead.
   1105  */
   1106 typedef enum {
   1107    SVGA3D_TEX_FILTER_NONE           = 0,
   1108    SVGA3D_TEX_FILTER_MIN            = 0,
   1109    SVGA3D_TEX_FILTER_NEAREST        = 1,
   1110    SVGA3D_TEX_FILTER_LINEAR         = 2,
   1111    SVGA3D_TEX_FILTER_ANISOTROPIC    = 3,
   1112    SVGA3D_TEX_FILTER_FLATCUBIC      = 4, /* Deprecated, not implemented */
   1113    SVGA3D_TEX_FILTER_GAUSSIANCUBIC  = 5, /* Deprecated, not implemented */
   1114    SVGA3D_TEX_FILTER_PYRAMIDALQUAD  = 6, /* Not currently implemented */
   1115    SVGA3D_TEX_FILTER_GAUSSIANQUAD   = 7, /* Not currently implemented */
   1116    SVGA3D_TEX_FILTER_MAX
   1117 } SVGA3dTextureFilter;
   1118 
   1119 typedef enum {
   1120    SVGA3D_TEX_TRANSFORM_OFF    = 0,
   1121    SVGA3D_TEX_TRANSFORM_S      = (1 << 0),
   1122    SVGA3D_TEX_TRANSFORM_T      = (1 << 1),
   1123    SVGA3D_TEX_TRANSFORM_R      = (1 << 2),
   1124    SVGA3D_TEX_TRANSFORM_Q      = (1 << 3),
   1125    SVGA3D_TEX_PROJECTED        = (1 << 15),
   1126 } SVGA3dTexTransformFlags;
   1127 
   1128 typedef enum {
   1129    SVGA3D_TEXCOORD_GEN_OFF              = 0,
   1130    SVGA3D_TEXCOORD_GEN_EYE_POSITION     = 1,
   1131    SVGA3D_TEXCOORD_GEN_EYE_NORMAL       = 2,
   1132    SVGA3D_TEXCOORD_GEN_REFLECTIONVECTOR = 3,
   1133    SVGA3D_TEXCOORD_GEN_SPHERE           = 4,
   1134    SVGA3D_TEXCOORD_GEN_MAX
   1135 } SVGA3dTextureCoordGen;
   1136 
   1137 /*
   1138  * Texture argument constants for texture combiner
   1139  */
   1140 typedef enum {
   1141    SVGA3D_TA_INVALID    = 0,
   1142    SVGA3D_TA_TFACTOR    = 1,
   1143    SVGA3D_TA_PREVIOUS   = 2,
   1144    SVGA3D_TA_DIFFUSE    = 3,
   1145    SVGA3D_TA_TEXTURE    = 4,
   1146    SVGA3D_TA_SPECULAR   = 5,
   1147    SVGA3D_TA_CONSTANT   = 6,
   1148    SVGA3D_TA_MAX
   1149 } SVGA3dTextureArgData;
   1150 
   1151 #define SVGA3D_TM_MASK_LEN 4
   1152 
   1153 /* Modifiers for texture argument constants defined above. */
   1154 typedef enum {
   1155    SVGA3D_TM_NONE       = 0,
   1156    SVGA3D_TM_ALPHA      = (1 << SVGA3D_TM_MASK_LEN),
   1157    SVGA3D_TM_ONE_MINUS  = (2 << SVGA3D_TM_MASK_LEN),
   1158 } SVGA3dTextureArgModifier;
   1159 
   1160 /*
   1161  * Vertex declarations
   1162  *
   1163  * Notes:
   1164  *
   1165  * SVGA3D_DECLUSAGE_POSITIONT is for pre-transformed vertices. If you
   1166  * draw with any POSITIONT vertex arrays, the programmable vertex
   1167  * pipeline will be implicitly disabled. Drawing will take place as if
   1168  * no vertex shader was bound.
   1169  */
   1170 
   1171 typedef enum {
   1172    SVGA3D_DECLUSAGE_POSITION     = 0,
   1173    SVGA3D_DECLUSAGE_BLENDWEIGHT,
   1174    SVGA3D_DECLUSAGE_BLENDINDICES,
   1175    SVGA3D_DECLUSAGE_NORMAL,
   1176    SVGA3D_DECLUSAGE_PSIZE,
   1177    SVGA3D_DECLUSAGE_TEXCOORD,
   1178    SVGA3D_DECLUSAGE_TANGENT,
   1179    SVGA3D_DECLUSAGE_BINORMAL,
   1180    SVGA3D_DECLUSAGE_TESSFACTOR,
   1181    SVGA3D_DECLUSAGE_POSITIONT,
   1182    SVGA3D_DECLUSAGE_COLOR,
   1183    SVGA3D_DECLUSAGE_FOG,
   1184    SVGA3D_DECLUSAGE_DEPTH,
   1185    SVGA3D_DECLUSAGE_SAMPLE,
   1186    SVGA3D_DECLUSAGE_MAX
   1187 } SVGA3dDeclUsage;
   1188 
   1189 typedef enum {
   1190    SVGA3D_DECLMETHOD_DEFAULT     = 0,
   1191    SVGA3D_DECLMETHOD_PARTIALU,
   1192    SVGA3D_DECLMETHOD_PARTIALV,
   1193    SVGA3D_DECLMETHOD_CROSSUV,          /* Normal */
   1194    SVGA3D_DECLMETHOD_UV,
   1195    SVGA3D_DECLMETHOD_LOOKUP,           /* Lookup a displacement map */
   1196    SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED, /* Lookup a pre-sampled displacement */
   1197                                        /* map */
   1198 } SVGA3dDeclMethod;
   1199 
   1200 typedef enum {
   1201    SVGA3D_DECLTYPE_FLOAT1        =  0,
   1202    SVGA3D_DECLTYPE_FLOAT2        =  1,
   1203    SVGA3D_DECLTYPE_FLOAT3        =  2,
   1204    SVGA3D_DECLTYPE_FLOAT4        =  3,
   1205    SVGA3D_DECLTYPE_D3DCOLOR      =  4,
   1206    SVGA3D_DECLTYPE_UBYTE4        =  5,
   1207    SVGA3D_DECLTYPE_SHORT2        =  6,
   1208    SVGA3D_DECLTYPE_SHORT4        =  7,
   1209    SVGA3D_DECLTYPE_UBYTE4N       =  8,
   1210    SVGA3D_DECLTYPE_SHORT2N       =  9,
   1211    SVGA3D_DECLTYPE_SHORT4N       = 10,
   1212    SVGA3D_DECLTYPE_USHORT2N      = 11,
   1213    SVGA3D_DECLTYPE_USHORT4N      = 12,
   1214    SVGA3D_DECLTYPE_UDEC3         = 13,
   1215    SVGA3D_DECLTYPE_DEC3N         = 14,
   1216    SVGA3D_DECLTYPE_FLOAT16_2     = 15,
   1217    SVGA3D_DECLTYPE_FLOAT16_4     = 16,
   1218    SVGA3D_DECLTYPE_MAX,
   1219 } SVGA3dDeclType;
   1220 
   1221 /*
   1222  * This structure is used for the divisor for geometry instancing;
   1223  * it's a direct translation of the Direct3D equivalent.
   1224  */
   1225 typedef union {
   1226    struct {
   1227       /*
   1228        * For index data, this number represents the number of instances to draw.
   1229        * For instance data, this number represents the number of
   1230        * instances/vertex in this stream
   1231        */
   1232       uint32 count : 30;
   1233 
   1234       /*
   1235        * This is 1 if this is supposed to be the data that is repeated for
   1236        * every instance.
   1237        */
   1238       uint32 indexedData : 1;
   1239 
   1240       /*
   1241        * This is 1 if this is supposed to be the per-instance data.
   1242        */
   1243       uint32 instanceData : 1;
   1244    };
   1245 
   1246    uint32 value;
   1247 } SVGA3dVertexDivisor;
   1248 
   1249 typedef enum {
   1250    /*
   1251     * SVGA3D_PRIMITIVE_INVALID is a valid primitive type.
   1252     *
   1253     * List MIN second so debuggers will think INVALID is
   1254     * the correct name.
   1255     */
   1256    SVGA3D_PRIMITIVE_INVALID                     = 0,
   1257    SVGA3D_PRIMITIVE_MIN                         = 0,
   1258    SVGA3D_PRIMITIVE_TRIANGLELIST                = 1,
   1259    SVGA3D_PRIMITIVE_POINTLIST                   = 2,
   1260    SVGA3D_PRIMITIVE_LINELIST                    = 3,
   1261    SVGA3D_PRIMITIVE_LINESTRIP                   = 4,
   1262    SVGA3D_PRIMITIVE_TRIANGLESTRIP               = 5,
   1263    SVGA3D_PRIMITIVE_TRIANGLEFAN                 = 6,
   1264    SVGA3D_PRIMITIVE_LINELIST_ADJ                = 7,
   1265    SVGA3D_PRIMITIVE_PREDX_MAX                   = 7,
   1266    SVGA3D_PRIMITIVE_LINESTRIP_ADJ               = 8,
   1267    SVGA3D_PRIMITIVE_TRIANGLELIST_ADJ            = 9,
   1268    SVGA3D_PRIMITIVE_TRIANGLESTRIP_ADJ           = 10,
   1269    SVGA3D_PRIMITIVE_MAX
   1270 } SVGA3dPrimitiveType;
   1271 
   1272 typedef enum {
   1273    SVGA3D_COORDINATE_INVALID                   = 0,
   1274    SVGA3D_COORDINATE_LEFTHANDED                = 1,
   1275    SVGA3D_COORDINATE_RIGHTHANDED               = 2,
   1276    SVGA3D_COORDINATE_MAX
   1277 } SVGA3dCoordinateType;
   1278 
   1279 typedef enum {
   1280    SVGA3D_TRANSFORM_INVALID                     = 0,
   1281    SVGA3D_TRANSFORM_WORLD                       = 1,
   1282    SVGA3D_TRANSFORM_MIN                         = 1,
   1283    SVGA3D_TRANSFORM_VIEW                        = 2,
   1284    SVGA3D_TRANSFORM_PROJECTION                  = 3,
   1285    SVGA3D_TRANSFORM_TEXTURE0                    = 4,
   1286    SVGA3D_TRANSFORM_TEXTURE1                    = 5,
   1287    SVGA3D_TRANSFORM_TEXTURE2                    = 6,
   1288    SVGA3D_TRANSFORM_TEXTURE3                    = 7,
   1289    SVGA3D_TRANSFORM_TEXTURE4                    = 8,
   1290    SVGA3D_TRANSFORM_TEXTURE5                    = 9,
   1291    SVGA3D_TRANSFORM_TEXTURE6                    = 10,
   1292    SVGA3D_TRANSFORM_TEXTURE7                    = 11,
   1293    SVGA3D_TRANSFORM_WORLD1                      = 12,
   1294    SVGA3D_TRANSFORM_WORLD2                      = 13,
   1295    SVGA3D_TRANSFORM_WORLD3                      = 14,
   1296    SVGA3D_TRANSFORM_MAX
   1297 } SVGA3dTransformType;
   1298 
   1299 typedef enum {
   1300    SVGA3D_LIGHTTYPE_INVALID                     = 0,
   1301    SVGA3D_LIGHTTYPE_MIN                         = 1,
   1302    SVGA3D_LIGHTTYPE_POINT                       = 1,
   1303    SVGA3D_LIGHTTYPE_SPOT1                       = 2, /* 1-cone, in degrees */
   1304    SVGA3D_LIGHTTYPE_SPOT2                       = 3, /* 2-cone, in radians */
   1305    SVGA3D_LIGHTTYPE_DIRECTIONAL                 = 4,
   1306    SVGA3D_LIGHTTYPE_MAX
   1307 } SVGA3dLightType;
   1308 
   1309 typedef enum {
   1310    SVGA3D_CUBEFACE_POSX                         = 0,
   1311    SVGA3D_CUBEFACE_NEGX                         = 1,
   1312    SVGA3D_CUBEFACE_POSY                         = 2,
   1313    SVGA3D_CUBEFACE_NEGY                         = 3,
   1314    SVGA3D_CUBEFACE_POSZ                         = 4,
   1315    SVGA3D_CUBEFACE_NEGZ                         = 5,
   1316 } SVGA3dCubeFace;
   1317 
   1318 typedef enum {
   1319    SVGA3D_SHADERTYPE_INVALID                    = 0,
   1320    SVGA3D_SHADERTYPE_MIN                        = 1,
   1321    SVGA3D_SHADERTYPE_VS                         = 1,
   1322    SVGA3D_SHADERTYPE_PS                         = 2,
   1323    SVGA3D_SHADERTYPE_PREDX_MAX                  = 3,
   1324    SVGA3D_SHADERTYPE_GS                         = 3,
   1325    SVGA3D_SHADERTYPE_DX10_MAX                   = 4,
   1326    SVGA3D_SHADERTYPE_HS                         = 4,
   1327    SVGA3D_SHADERTYPE_DS                         = 5,
   1328    SVGA3D_SHADERTYPE_CS                         = 6,
   1329    SVGA3D_SHADERTYPE_MAX                        = 7
   1330 } SVGA3dShaderType;
   1331 
   1332 #define SVGA3D_NUM_SHADERTYPE_PREDX \
   1333    (SVGA3D_SHADERTYPE_PREDX_MAX - SVGA3D_SHADERTYPE_MIN)
   1334 
   1335 #define SVGA3D_NUM_SHADERTYPE_DX10 \
   1336    (SVGA3D_SHADERTYPE_DX10_MAX - SVGA3D_SHADERTYPE_MIN)
   1337 
   1338 #define SVGA3D_NUM_SHADERTYPE \
   1339    (SVGA3D_SHADERTYPE_MAX - SVGA3D_SHADERTYPE_MIN)
   1340 
   1341 typedef enum {
   1342    SVGA3D_CONST_TYPE_MIN                        = 0,
   1343    SVGA3D_CONST_TYPE_FLOAT                      = 0,
   1344    SVGA3D_CONST_TYPE_INT                        = 1,
   1345    SVGA3D_CONST_TYPE_BOOL                       = 2,
   1346    SVGA3D_CONST_TYPE_MAX                        = 3,
   1347 } SVGA3dShaderConstType;
   1348 
   1349 /*
   1350  * Register limits for shader consts.
   1351  */
   1352 #define SVGA3D_CONSTREG_MAX            256
   1353 #define SVGA3D_CONSTINTREG_MAX         16
   1354 #define SVGA3D_CONSTBOOLREG_MAX        16
   1355 
   1356 typedef enum {
   1357    SVGA3D_STRETCH_BLT_POINT                     = 0,
   1358    SVGA3D_STRETCH_BLT_LINEAR                    = 1,
   1359    SVGA3D_STRETCH_BLT_MAX
   1360 } SVGA3dStretchBltMode;
   1361 
   1362 typedef enum {
   1363    SVGA3D_QUERYTYPE_INVALID                     = ((uint8)-1),
   1364    SVGA3D_QUERYTYPE_MIN                         = 0,
   1365    SVGA3D_QUERYTYPE_OCCLUSION                   = 0,
   1366    SVGA3D_QUERYTYPE_TIMESTAMP                   = 1,
   1367    SVGA3D_QUERYTYPE_TIMESTAMPDISJOINT           = 2,
   1368    SVGA3D_QUERYTYPE_PIPELINESTATS               = 3,
   1369    SVGA3D_QUERYTYPE_OCCLUSIONPREDICATE          = 4,
   1370    SVGA3D_QUERYTYPE_STREAMOUTPUTSTATS           = 5,
   1371    SVGA3D_QUERYTYPE_STREAMOVERFLOWPREDICATE     = 6,
   1372    SVGA3D_QUERYTYPE_OCCLUSION64                 = 7,
   1373    SVGA3D_QUERYTYPE_DX10_MAX                    = 8,
   1374    SVGA3D_QUERYTYPE_SOSTATS_STREAM0             = 8,
   1375    SVGA3D_QUERYTYPE_SOSTATS_STREAM1             = 9,
   1376    SVGA3D_QUERYTYPE_SOSTATS_STREAM2             = 10,
   1377    SVGA3D_QUERYTYPE_SOSTATS_STREAM3             = 11,
   1378    SVGA3D_QUERYTYPE_SOP_STREAM0                 = 12,
   1379    SVGA3D_QUERYTYPE_SOP_STREAM1                 = 13,
   1380    SVGA3D_QUERYTYPE_SOP_STREAM2                 = 14,
   1381    SVGA3D_QUERYTYPE_SOP_STREAM3                 = 15,
   1382    SVGA3D_QUERYTYPE_MAX
   1383 } SVGA3dQueryType;
   1384 
   1385 typedef uint8 SVGA3dQueryTypeUint8;
   1386 
   1387 #define SVGA3D_NUM_QUERYTYPE  (SVGA3D_QUERYTYPE_MAX - SVGA3D_QUERYTYPE_MIN)
   1388 
   1389 /*
   1390  * This is the maximum number of queries per context that can be active
   1391  * simultaneously between a beginQuery and endQuery.
   1392  */
   1393 #define SVGA3D_MAX_QUERY 64
   1394 
   1395 /*
   1396  * Query result buffer formats
   1397  */
   1398 typedef
   1399 #include "vmware_pack_begin.h"
   1400 struct {
   1401    uint32 samplesRendered;
   1402 }
   1403 #include "vmware_pack_end.h"
   1404 SVGADXOcclusionQueryResult;
   1405 
   1406 typedef
   1407 #include "vmware_pack_begin.h"
   1408 struct {
   1409    uint32 passed;
   1410 }
   1411 #include "vmware_pack_end.h"
   1412 SVGADXEventQueryResult;
   1413 
   1414 typedef
   1415 #include "vmware_pack_begin.h"
   1416 struct {
   1417    uint64 timestamp;
   1418 }
   1419 #include "vmware_pack_end.h"
   1420 SVGADXTimestampQueryResult;
   1421 
   1422 typedef
   1423 #include "vmware_pack_begin.h"
   1424 struct {
   1425    uint64 realFrequency;
   1426    uint32 disjoint;
   1427 }
   1428 #include "vmware_pack_end.h"
   1429 SVGADXTimestampDisjointQueryResult;
   1430 
   1431 typedef
   1432 #include "vmware_pack_begin.h"
   1433 struct {
   1434    uint64 inputAssemblyVertices;
   1435    uint64 inputAssemblyPrimitives;
   1436    uint64 vertexShaderInvocations;
   1437    uint64 geometryShaderInvocations;
   1438    uint64 geometryShaderPrimitives;
   1439    uint64 clipperInvocations;
   1440    uint64 clipperPrimitives;
   1441    uint64 pixelShaderInvocations;
   1442    uint64 hullShaderInvocations;
   1443    uint64 domainShaderInvocations;
   1444    uint64 computeShaderInvocations;
   1445 }
   1446 #include "vmware_pack_end.h"
   1447 SVGADXPipelineStatisticsQueryResult;
   1448 
   1449 typedef
   1450 #include "vmware_pack_begin.h"
   1451 struct {
   1452    uint32 anySamplesRendered;
   1453 }
   1454 #include "vmware_pack_end.h"
   1455 SVGADXOcclusionPredicateQueryResult;
   1456 
   1457 typedef
   1458 #include "vmware_pack_begin.h"
   1459 struct {
   1460    uint64 numPrimitivesWritten;
   1461    uint64 numPrimitivesRequired;
   1462 }
   1463 #include "vmware_pack_end.h"
   1464 SVGADXStreamOutStatisticsQueryResult;
   1465 
   1466 typedef
   1467 #include "vmware_pack_begin.h"
   1468 struct {
   1469    uint32 overflowed;
   1470 }
   1471 #include "vmware_pack_end.h"
   1472 SVGADXStreamOutPredicateQueryResult;
   1473 
   1474 typedef
   1475 #include "vmware_pack_begin.h"
   1476 struct {
   1477    uint64 samplesRendered;
   1478 }
   1479 #include "vmware_pack_end.h"
   1480 SVGADXOcclusion64QueryResult;
   1481 
   1482 /*
   1483  * SVGADXQueryResultUnion is not intended for use in the protocol, but is
   1484  * very helpful when working with queries generically.
   1485  */
   1486 typedef
   1487 #include "vmware_pack_begin.h"
   1488 union SVGADXQueryResultUnion {
   1489    SVGADXOcclusionQueryResult occ;
   1490    SVGADXEventQueryResult event;
   1491    SVGADXTimestampQueryResult ts;
   1492    SVGADXTimestampDisjointQueryResult tsDisjoint;
   1493    SVGADXPipelineStatisticsQueryResult pipelineStats;
   1494    SVGADXOcclusionPredicateQueryResult occPred;
   1495    SVGADXStreamOutStatisticsQueryResult soStats;
   1496    SVGADXStreamOutPredicateQueryResult soPred;
   1497    SVGADXOcclusion64QueryResult occ64;
   1498 }
   1499 #include "vmware_pack_end.h"
   1500 SVGADXQueryResultUnion;
   1501 
   1502 
   1503 typedef enum {
   1504    SVGA3D_QUERYSTATE_PENDING     = 0,      /* Query is not finished yet */
   1505    SVGA3D_QUERYSTATE_SUCCEEDED   = 1,      /* Completed successfully */
   1506    SVGA3D_QUERYSTATE_FAILED      = 2,      /* Completed unsuccessfully */
   1507    SVGA3D_QUERYSTATE_NEW         = 3,      /* Never submitted (guest only) */
   1508 } SVGA3dQueryState;
   1509 
   1510 typedef enum {
   1511    SVGA3D_WRITE_HOST_VRAM        = 1,
   1512    SVGA3D_READ_HOST_VRAM         = 2,
   1513 } SVGA3dTransferType;
   1514 
   1515 typedef enum {
   1516    SVGA3D_LOGICOP_INVALID   = 0,
   1517    SVGA3D_LOGICOP_MIN       = 1,
   1518    SVGA3D_LOGICOP_COPY      = 1,
   1519    SVGA3D_LOGICOP_NOT       = 2,
   1520    SVGA3D_LOGICOP_AND       = 3,
   1521    SVGA3D_LOGICOP_OR        = 4,
   1522    SVGA3D_LOGICOP_XOR       = 5,
   1523    SVGA3D_LOGICOP_NXOR      = 6,
   1524    SVGA3D_LOGICOP_ROP3MIN   = 30,   /* 7-29 are reserved for future logic ops. */
   1525    SVGA3D_LOGICOP_ROP3MAX   = (SVGA3D_LOGICOP_ROP3MIN + 255),
   1526    SVGA3D_LOGICOP_MAX       = (SVGA3D_LOGICOP_ROP3MAX + 1),
   1527 } SVGA3dLogicOp;
   1528 
   1529 typedef
   1530 #include "vmware_pack_begin.h"
   1531 struct {
   1532    union {
   1533       struct {
   1534 	 uint16  function;       /* SVGA3dFogFunction */
   1535 	 uint8   type;           /* SVGA3dFogType */
   1536 	 uint8   base;           /* SVGA3dFogBase */
   1537       };
   1538       uint32     uintValue;
   1539    };
   1540 }
   1541 #include "vmware_pack_end.h"
   1542 SVGA3dFogMode;
   1543 
   1544 /*
   1545  * Uniquely identify one image (a 1D/2D/3D array) from a surface. This
   1546  * is a surface ID as well as face/mipmap indices.
   1547  */
   1548 
   1549 typedef
   1550 #include "vmware_pack_begin.h"
   1551 struct SVGA3dSurfaceImageId {
   1552    uint32               sid;
   1553    uint32               face;
   1554    uint32               mipmap;
   1555 }
   1556 #include "vmware_pack_end.h"
   1557 SVGA3dSurfaceImageId;
   1558 
   1559 typedef
   1560 #include "vmware_pack_begin.h"
   1561 struct {
   1562    uint32               width;
   1563    uint32               height;
   1564    uint32               depth;
   1565 }
   1566 #include "vmware_pack_end.h"
   1567 SVGA3dSize;
   1568 
   1569 /*
   1570  * Guest-backed objects definitions.
   1571  */
   1572 typedef enum {
   1573    SVGA_OTABLE_MOB             = 0,
   1574    SVGA_OTABLE_MIN             = 0,
   1575    SVGA_OTABLE_SURFACE         = 1,
   1576    SVGA_OTABLE_CONTEXT         = 2,
   1577    SVGA_OTABLE_SHADER          = 3,
   1578    SVGA_OTABLE_SCREENTARGET    = 4,
   1579 
   1580    SVGA_OTABLE_DX9_MAX         = 5,
   1581 
   1582    SVGA_OTABLE_DXCONTEXT       = 5,
   1583    SVGA_OTABLE_MAX             = 6
   1584 } SVGAOTableType;
   1585 
   1586 /*
   1587  * Deprecated.
   1588  */
   1589 #define SVGA_OTABLE_COUNT 4
   1590 
   1591 typedef enum {
   1592    SVGA_COTABLE_MIN             = 0,
   1593    SVGA_COTABLE_RTVIEW          = 0,
   1594    SVGA_COTABLE_DSVIEW          = 1,
   1595    SVGA_COTABLE_SRVIEW          = 2,
   1596    SVGA_COTABLE_ELEMENTLAYOUT   = 3,
   1597    SVGA_COTABLE_BLENDSTATE      = 4,
   1598    SVGA_COTABLE_DEPTHSTENCIL    = 5,
   1599    SVGA_COTABLE_RASTERIZERSTATE = 6,
   1600    SVGA_COTABLE_SAMPLER         = 7,
   1601    SVGA_COTABLE_STREAMOUTPUT    = 8,
   1602    SVGA_COTABLE_DXQUERY         = 9,
   1603    SVGA_COTABLE_DXSHADER        = 10,
   1604    SVGA_COTABLE_DX10_MAX        = 11,
   1605    SVGA_COTABLE_UAVIEW          = 11,
   1606    SVGA_COTABLE_MAX
   1607 } SVGACOTableType;
   1608 
   1609 /*
   1610  * The largest size (number of entries) allowed in a COTable.
   1611  */
   1612 #define SVGA_COTABLE_MAX_IDS (MAX_UINT16 - 2)
   1613 
   1614 typedef enum SVGAMobFormat {
   1615    SVGA3D_MOBFMT_INVALID     = SVGA3D_INVALID_ID,
   1616    SVGA3D_MOBFMT_PTDEPTH_0   = 0,
   1617    SVGA3D_MOBFMT_MIN         = 0,
   1618    SVGA3D_MOBFMT_PTDEPTH_1   = 1,
   1619    SVGA3D_MOBFMT_PTDEPTH_2   = 2,
   1620    SVGA3D_MOBFMT_RANGE       = 3,
   1621    SVGA3D_MOBFMT_PTDEPTH64_0 = 4,
   1622    SVGA3D_MOBFMT_PTDEPTH64_1 = 5,
   1623    SVGA3D_MOBFMT_PTDEPTH64_2 = 6,
   1624    SVGA3D_MOBFMT_PREDX_MAX   = 7,
   1625    SVGA3D_MOBFMT_EMPTY       = 7,
   1626    SVGA3D_MOBFMT_MAX,
   1627 } SVGAMobFormat;
   1628 
   1629 #define SVGA3D_MOB_EMPTY_BASE 1
   1630 
   1631 #endif /* _SVGA3D_TYPES_H_ */
   1632