Home | History | Annotate | Download | only in svgadump
      1 /**********************************************************
      2  * Copyright 2009 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  * @file
     28  * Dump SVGA commands.
     29  *
     30  * Generated automatically from svga3d_reg.h by svga_dump.py.
     31  */
     32 
     33 #include "svga_types.h"
     34 #include "svga_shader_dump.h"
     35 #include "svga3d_reg.h"
     36 
     37 #include "util/u_debug.h"
     38 #include "svga_dump.h"
     39 
     40 static void
     41 dump_SVGA3dVertexDecl(const SVGA3dVertexDecl *cmd)
     42 {
     43    switch((*cmd).identity.type) {
     44    case SVGA3D_DECLTYPE_FLOAT1:
     45       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT1\n");
     46       break;
     47    case SVGA3D_DECLTYPE_FLOAT2:
     48       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT2\n");
     49       break;
     50    case SVGA3D_DECLTYPE_FLOAT3:
     51       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT3\n");
     52       break;
     53    case SVGA3D_DECLTYPE_FLOAT4:
     54       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT4\n");
     55       break;
     56    case SVGA3D_DECLTYPE_D3DCOLOR:
     57       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_D3DCOLOR\n");
     58       break;
     59    case SVGA3D_DECLTYPE_UBYTE4:
     60       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4\n");
     61       break;
     62    case SVGA3D_DECLTYPE_SHORT2:
     63       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2\n");
     64       break;
     65    case SVGA3D_DECLTYPE_SHORT4:
     66       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4\n");
     67       break;
     68    case SVGA3D_DECLTYPE_UBYTE4N:
     69       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4N\n");
     70       break;
     71    case SVGA3D_DECLTYPE_SHORT2N:
     72       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2N\n");
     73       break;
     74    case SVGA3D_DECLTYPE_SHORT4N:
     75       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4N\n");
     76       break;
     77    case SVGA3D_DECLTYPE_USHORT2N:
     78       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT2N\n");
     79       break;
     80    case SVGA3D_DECLTYPE_USHORT4N:
     81       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT4N\n");
     82       break;
     83    case SVGA3D_DECLTYPE_UDEC3:
     84       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UDEC3\n");
     85       break;
     86    case SVGA3D_DECLTYPE_DEC3N:
     87       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_DEC3N\n");
     88       break;
     89    case SVGA3D_DECLTYPE_FLOAT16_2:
     90       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_2\n");
     91       break;
     92    case SVGA3D_DECLTYPE_FLOAT16_4:
     93       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_4\n");
     94       break;
     95    case SVGA3D_DECLTYPE_MAX:
     96       _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_MAX\n");
     97       break;
     98    default:
     99       _debug_printf("\t\t.identity.type = %i\n", (*cmd).identity.type);
    100       break;
    101    }
    102    switch((*cmd).identity.method) {
    103    case SVGA3D_DECLMETHOD_DEFAULT:
    104       _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_DEFAULT\n");
    105       break;
    106    case SVGA3D_DECLMETHOD_PARTIALU:
    107       _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALU\n");
    108       break;
    109    case SVGA3D_DECLMETHOD_PARTIALV:
    110       _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALV\n");
    111       break;
    112    case SVGA3D_DECLMETHOD_CROSSUV:
    113       _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_CROSSUV\n");
    114       break;
    115    case SVGA3D_DECLMETHOD_UV:
    116       _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_UV\n");
    117       break;
    118    case SVGA3D_DECLMETHOD_LOOKUP:
    119       _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUP\n");
    120       break;
    121    case SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED:
    122       _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED\n");
    123       break;
    124    default:
    125       _debug_printf("\t\t.identity.method = %i\n", (*cmd).identity.method);
    126       break;
    127    }
    128    switch((*cmd).identity.usage) {
    129    case SVGA3D_DECLUSAGE_POSITION:
    130       _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITION\n");
    131       break;
    132    case SVGA3D_DECLUSAGE_BLENDWEIGHT:
    133       _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDWEIGHT\n");
    134       break;
    135    case SVGA3D_DECLUSAGE_BLENDINDICES:
    136       _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDINDICES\n");
    137       break;
    138    case SVGA3D_DECLUSAGE_NORMAL:
    139       _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_NORMAL\n");
    140       break;
    141    case SVGA3D_DECLUSAGE_PSIZE:
    142       _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_PSIZE\n");
    143       break;
    144    case SVGA3D_DECLUSAGE_TEXCOORD:
    145       _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TEXCOORD\n");
    146       break;
    147    case SVGA3D_DECLUSAGE_TANGENT:
    148       _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TANGENT\n");
    149       break;
    150    case SVGA3D_DECLUSAGE_BINORMAL:
    151       _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BINORMAL\n");
    152       break;
    153    case SVGA3D_DECLUSAGE_TESSFACTOR:
    154       _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TESSFACTOR\n");
    155       break;
    156    case SVGA3D_DECLUSAGE_POSITIONT:
    157       _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITIONT\n");
    158       break;
    159    case SVGA3D_DECLUSAGE_COLOR:
    160       _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_COLOR\n");
    161       break;
    162    case SVGA3D_DECLUSAGE_FOG:
    163       _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_FOG\n");
    164       break;
    165    case SVGA3D_DECLUSAGE_DEPTH:
    166       _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_DEPTH\n");
    167       break;
    168    case SVGA3D_DECLUSAGE_SAMPLE:
    169       _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_SAMPLE\n");
    170       break;
    171    case SVGA3D_DECLUSAGE_MAX:
    172       _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_MAX\n");
    173       break;
    174    default:
    175       _debug_printf("\t\t.identity.usage = %i\n", (*cmd).identity.usage);
    176       break;
    177    }
    178    _debug_printf("\t\t.identity.usageIndex = %u\n", (*cmd).identity.usageIndex);
    179    _debug_printf("\t\t.array.surfaceId = %u\n", (*cmd).array.surfaceId);
    180    _debug_printf("\t\t.array.offset = %u\n", (*cmd).array.offset);
    181    _debug_printf("\t\t.array.stride = %u\n", (*cmd).array.stride);
    182    _debug_printf("\t\t.rangeHint.first = %u\n", (*cmd).rangeHint.first);
    183    _debug_printf("\t\t.rangeHint.last = %u\n", (*cmd).rangeHint.last);
    184 }
    185 
    186 static void
    187 dump_SVGA3dTextureState(const SVGA3dTextureState *cmd)
    188 {
    189    _debug_printf("\t\t.stage = %u\n", (*cmd).stage);
    190    switch((*cmd).name) {
    191    case SVGA3D_TS_INVALID:
    192       _debug_printf("\t\t.name = SVGA3D_TS_INVALID\n");
    193       break;
    194    case SVGA3D_TS_BIND_TEXTURE:
    195       _debug_printf("\t\t.name = SVGA3D_TS_BIND_TEXTURE\n");
    196       break;
    197    case SVGA3D_TS_COLOROP:
    198       _debug_printf("\t\t.name = SVGA3D_TS_COLOROP\n");
    199       break;
    200    case SVGA3D_TS_COLORARG1:
    201       _debug_printf("\t\t.name = SVGA3D_TS_COLORARG1\n");
    202       break;
    203    case SVGA3D_TS_COLORARG2:
    204       _debug_printf("\t\t.name = SVGA3D_TS_COLORARG2\n");
    205       break;
    206    case SVGA3D_TS_ALPHAOP:
    207       _debug_printf("\t\t.name = SVGA3D_TS_ALPHAOP\n");
    208       break;
    209    case SVGA3D_TS_ALPHAARG1:
    210       _debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG1\n");
    211       break;
    212    case SVGA3D_TS_ALPHAARG2:
    213       _debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG2\n");
    214       break;
    215    case SVGA3D_TS_ADDRESSU:
    216       _debug_printf("\t\t.name = SVGA3D_TS_ADDRESSU\n");
    217       break;
    218    case SVGA3D_TS_ADDRESSV:
    219       _debug_printf("\t\t.name = SVGA3D_TS_ADDRESSV\n");
    220       break;
    221    case SVGA3D_TS_MIPFILTER:
    222       _debug_printf("\t\t.name = SVGA3D_TS_MIPFILTER\n");
    223       break;
    224    case SVGA3D_TS_MAGFILTER:
    225       _debug_printf("\t\t.name = SVGA3D_TS_MAGFILTER\n");
    226       break;
    227    case SVGA3D_TS_MINFILTER:
    228       _debug_printf("\t\t.name = SVGA3D_TS_MINFILTER\n");
    229       break;
    230    case SVGA3D_TS_BORDERCOLOR:
    231       _debug_printf("\t\t.name = SVGA3D_TS_BORDERCOLOR\n");
    232       break;
    233    case SVGA3D_TS_TEXCOORDINDEX:
    234       _debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDINDEX\n");
    235       break;
    236    case SVGA3D_TS_TEXTURETRANSFORMFLAGS:
    237       _debug_printf("\t\t.name = SVGA3D_TS_TEXTURETRANSFORMFLAGS\n");
    238       break;
    239    case SVGA3D_TS_TEXCOORDGEN:
    240       _debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDGEN\n");
    241       break;
    242    case SVGA3D_TS_BUMPENVMAT00:
    243       _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT00\n");
    244       break;
    245    case SVGA3D_TS_BUMPENVMAT01:
    246       _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT01\n");
    247       break;
    248    case SVGA3D_TS_BUMPENVMAT10:
    249       _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT10\n");
    250       break;
    251    case SVGA3D_TS_BUMPENVMAT11:
    252       _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT11\n");
    253       break;
    254    case SVGA3D_TS_TEXTURE_MIPMAP_LEVEL:
    255       _debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_MIPMAP_LEVEL\n");
    256       break;
    257    case SVGA3D_TS_TEXTURE_LOD_BIAS:
    258       _debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_LOD_BIAS\n");
    259       break;
    260    case SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL:
    261       _debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL\n");
    262       break;
    263    case SVGA3D_TS_ADDRESSW:
    264       _debug_printf("\t\t.name = SVGA3D_TS_ADDRESSW\n");
    265       break;
    266    case SVGA3D_TS_GAMMA:
    267       _debug_printf("\t\t.name = SVGA3D_TS_GAMMA\n");
    268       break;
    269    case SVGA3D_TS_BUMPENVLSCALE:
    270       _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLSCALE\n");
    271       break;
    272    case SVGA3D_TS_BUMPENVLOFFSET:
    273       _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLOFFSET\n");
    274       break;
    275    case SVGA3D_TS_COLORARG0:
    276       _debug_printf("\t\t.name = SVGA3D_TS_COLORARG0\n");
    277       break;
    278    case SVGA3D_TS_ALPHAARG0:
    279       _debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG0\n");
    280       break;
    281    case SVGA3D_TS_MAX:
    282       _debug_printf("\t\t.name = SVGA3D_TS_MAX\n");
    283       break;
    284    default:
    285       _debug_printf("\t\t.name = %i\n", (*cmd).name);
    286       break;
    287    }
    288    _debug_printf("\t\t.value = %u\n", (*cmd).value);
    289    _debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue);
    290 }
    291 
    292 static void
    293 dump_SVGA3dCopyBox(const SVGA3dCopyBox *cmd)
    294 {
    295    _debug_printf("\t\t.x = %u\n", (*cmd).x);
    296    _debug_printf("\t\t.y = %u\n", (*cmd).y);
    297    _debug_printf("\t\t.z = %u\n", (*cmd).z);
    298    _debug_printf("\t\t.w = %u\n", (*cmd).w);
    299    _debug_printf("\t\t.h = %u\n", (*cmd).h);
    300    _debug_printf("\t\t.d = %u\n", (*cmd).d);
    301    _debug_printf("\t\t.srcx = %u\n", (*cmd).srcx);
    302    _debug_printf("\t\t.srcy = %u\n", (*cmd).srcy);
    303    _debug_printf("\t\t.srcz = %u\n", (*cmd).srcz);
    304 }
    305 
    306 static void
    307 dump_SVGA3dCmdSetClipPlane(const SVGA3dCmdSetClipPlane *cmd)
    308 {
    309    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
    310    _debug_printf("\t\t.index = %u\n", (*cmd).index);
    311    _debug_printf("\t\t.plane[0] = %f\n", (*cmd).plane[0]);
    312    _debug_printf("\t\t.plane[1] = %f\n", (*cmd).plane[1]);
    313    _debug_printf("\t\t.plane[2] = %f\n", (*cmd).plane[2]);
    314    _debug_printf("\t\t.plane[3] = %f\n", (*cmd).plane[3]);
    315 }
    316 
    317 static void
    318 dump_SVGA3dCmdWaitForQuery(const SVGA3dCmdWaitForQuery *cmd)
    319 {
    320    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
    321    switch((*cmd).type) {
    322    case SVGA3D_QUERYTYPE_OCCLUSION:
    323       _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n");
    324       break;
    325    case SVGA3D_QUERYTYPE_MAX:
    326       _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n");
    327       break;
    328    default:
    329       _debug_printf("\t\t.type = %i\n", (*cmd).type);
    330       break;
    331    }
    332    _debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId);
    333    _debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset);
    334 }
    335 
    336 static void
    337 dump_SVGA3dCmdSetRenderTarget(const SVGA3dCmdSetRenderTarget *cmd)
    338 {
    339    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
    340    switch((*cmd).type) {
    341    case SVGA3D_RT_DEPTH:
    342       _debug_printf("\t\t.type = SVGA3D_RT_DEPTH\n");
    343       break;
    344    case SVGA3D_RT_STENCIL:
    345       _debug_printf("\t\t.type = SVGA3D_RT_STENCIL\n");
    346       break;
    347    default:
    348       _debug_printf("\t\t.type = SVGA3D_RT_COLOR%u\n", (*cmd).type - SVGA3D_RT_COLOR0);
    349       break;
    350    }
    351    _debug_printf("\t\t.target.sid = %u\n", (*cmd).target.sid);
    352    _debug_printf("\t\t.target.face = %u\n", (*cmd).target.face);
    353    _debug_printf("\t\t.target.mipmap = %u\n", (*cmd).target.mipmap);
    354 }
    355 
    356 static void
    357 dump_SVGA3dCmdSetTextureState(const SVGA3dCmdSetTextureState *cmd)
    358 {
    359    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
    360 }
    361 
    362 static void
    363 dump_SVGA3dCmdSurfaceCopy(const SVGA3dCmdSurfaceCopy *cmd)
    364 {
    365    _debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid);
    366    _debug_printf("\t\t.src.face = %u\n", (*cmd).src.face);
    367    _debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap);
    368    _debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid);
    369    _debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face);
    370    _debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap);
    371 }
    372 
    373 static void
    374 dump_SVGA3dCmdSetMaterial(const SVGA3dCmdSetMaterial *cmd)
    375 {
    376    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
    377    switch((*cmd).face) {
    378    case SVGA3D_FACE_INVALID:
    379       _debug_printf("\t\t.face = SVGA3D_FACE_INVALID\n");
    380       break;
    381    case SVGA3D_FACE_NONE:
    382       _debug_printf("\t\t.face = SVGA3D_FACE_NONE\n");
    383       break;
    384    case SVGA3D_FACE_FRONT:
    385       _debug_printf("\t\t.face = SVGA3D_FACE_FRONT\n");
    386       break;
    387    case SVGA3D_FACE_BACK:
    388       _debug_printf("\t\t.face = SVGA3D_FACE_BACK\n");
    389       break;
    390    case SVGA3D_FACE_FRONT_BACK:
    391       _debug_printf("\t\t.face = SVGA3D_FACE_FRONT_BACK\n");
    392       break;
    393    case SVGA3D_FACE_MAX:
    394       _debug_printf("\t\t.face = SVGA3D_FACE_MAX\n");
    395       break;
    396    default:
    397       _debug_printf("\t\t.face = %i\n", (*cmd).face);
    398       break;
    399    }
    400    _debug_printf("\t\t.material.diffuse[0] = %f\n", (*cmd).material.diffuse[0]);
    401    _debug_printf("\t\t.material.diffuse[1] = %f\n", (*cmd).material.diffuse[1]);
    402    _debug_printf("\t\t.material.diffuse[2] = %f\n", (*cmd).material.diffuse[2]);
    403    _debug_printf("\t\t.material.diffuse[3] = %f\n", (*cmd).material.diffuse[3]);
    404    _debug_printf("\t\t.material.ambient[0] = %f\n", (*cmd).material.ambient[0]);
    405    _debug_printf("\t\t.material.ambient[1] = %f\n", (*cmd).material.ambient[1]);
    406    _debug_printf("\t\t.material.ambient[2] = %f\n", (*cmd).material.ambient[2]);
    407    _debug_printf("\t\t.material.ambient[3] = %f\n", (*cmd).material.ambient[3]);
    408    _debug_printf("\t\t.material.specular[0] = %f\n", (*cmd).material.specular[0]);
    409    _debug_printf("\t\t.material.specular[1] = %f\n", (*cmd).material.specular[1]);
    410    _debug_printf("\t\t.material.specular[2] = %f\n", (*cmd).material.specular[2]);
    411    _debug_printf("\t\t.material.specular[3] = %f\n", (*cmd).material.specular[3]);
    412    _debug_printf("\t\t.material.emissive[0] = %f\n", (*cmd).material.emissive[0]);
    413    _debug_printf("\t\t.material.emissive[1] = %f\n", (*cmd).material.emissive[1]);
    414    _debug_printf("\t\t.material.emissive[2] = %f\n", (*cmd).material.emissive[2]);
    415    _debug_printf("\t\t.material.emissive[3] = %f\n", (*cmd).material.emissive[3]);
    416    _debug_printf("\t\t.material.shininess = %f\n", (*cmd).material.shininess);
    417 }
    418 
    419 static void
    420 dump_SVGA3dCmdSetLightData(const SVGA3dCmdSetLightData *cmd)
    421 {
    422    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
    423    _debug_printf("\t\t.index = %u\n", (*cmd).index);
    424    switch((*cmd).data.type) {
    425    case SVGA3D_LIGHTTYPE_INVALID:
    426       _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_INVALID\n");
    427       break;
    428    case SVGA3D_LIGHTTYPE_POINT:
    429       _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_POINT\n");
    430       break;
    431    case SVGA3D_LIGHTTYPE_SPOT1:
    432       _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT1\n");
    433       break;
    434    case SVGA3D_LIGHTTYPE_SPOT2:
    435       _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT2\n");
    436       break;
    437    case SVGA3D_LIGHTTYPE_DIRECTIONAL:
    438       _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_DIRECTIONAL\n");
    439       break;
    440    case SVGA3D_LIGHTTYPE_MAX:
    441       _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_MAX\n");
    442       break;
    443    default:
    444       _debug_printf("\t\t.data.type = %i\n", (*cmd).data.type);
    445       break;
    446    }
    447    _debug_printf("\t\t.data.inWorldSpace = %u\n", (*cmd).data.inWorldSpace);
    448    _debug_printf("\t\t.data.diffuse[0] = %f\n", (*cmd).data.diffuse[0]);
    449    _debug_printf("\t\t.data.diffuse[1] = %f\n", (*cmd).data.diffuse[1]);
    450    _debug_printf("\t\t.data.diffuse[2] = %f\n", (*cmd).data.diffuse[2]);
    451    _debug_printf("\t\t.data.diffuse[3] = %f\n", (*cmd).data.diffuse[3]);
    452    _debug_printf("\t\t.data.specular[0] = %f\n", (*cmd).data.specular[0]);
    453    _debug_printf("\t\t.data.specular[1] = %f\n", (*cmd).data.specular[1]);
    454    _debug_printf("\t\t.data.specular[2] = %f\n", (*cmd).data.specular[2]);
    455    _debug_printf("\t\t.data.specular[3] = %f\n", (*cmd).data.specular[3]);
    456    _debug_printf("\t\t.data.ambient[0] = %f\n", (*cmd).data.ambient[0]);
    457    _debug_printf("\t\t.data.ambient[1] = %f\n", (*cmd).data.ambient[1]);
    458    _debug_printf("\t\t.data.ambient[2] = %f\n", (*cmd).data.ambient[2]);
    459    _debug_printf("\t\t.data.ambient[3] = %f\n", (*cmd).data.ambient[3]);
    460    _debug_printf("\t\t.data.position[0] = %f\n", (*cmd).data.position[0]);
    461    _debug_printf("\t\t.data.position[1] = %f\n", (*cmd).data.position[1]);
    462    _debug_printf("\t\t.data.position[2] = %f\n", (*cmd).data.position[2]);
    463    _debug_printf("\t\t.data.position[3] = %f\n", (*cmd).data.position[3]);
    464    _debug_printf("\t\t.data.direction[0] = %f\n", (*cmd).data.direction[0]);
    465    _debug_printf("\t\t.data.direction[1] = %f\n", (*cmd).data.direction[1]);
    466    _debug_printf("\t\t.data.direction[2] = %f\n", (*cmd).data.direction[2]);
    467    _debug_printf("\t\t.data.direction[3] = %f\n", (*cmd).data.direction[3]);
    468    _debug_printf("\t\t.data.range = %f\n", (*cmd).data.range);
    469    _debug_printf("\t\t.data.falloff = %f\n", (*cmd).data.falloff);
    470    _debug_printf("\t\t.data.attenuation0 = %f\n", (*cmd).data.attenuation0);
    471    _debug_printf("\t\t.data.attenuation1 = %f\n", (*cmd).data.attenuation1);
    472    _debug_printf("\t\t.data.attenuation2 = %f\n", (*cmd).data.attenuation2);
    473    _debug_printf("\t\t.data.theta = %f\n", (*cmd).data.theta);
    474    _debug_printf("\t\t.data.phi = %f\n", (*cmd).data.phi);
    475 }
    476 
    477 static void
    478 dump_SVGA3dCmdSetViewport(const SVGA3dCmdSetViewport *cmd)
    479 {
    480    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
    481    _debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x);
    482    _debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y);
    483    _debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w);
    484    _debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h);
    485 }
    486 
    487 static void
    488 dump_SVGA3dCmdSetScissorRect(const SVGA3dCmdSetScissorRect *cmd)
    489 {
    490    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
    491    _debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x);
    492    _debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y);
    493    _debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w);
    494    _debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h);
    495 }
    496 
    497 static void
    498 dump_SVGA3dCopyRect(const SVGA3dCopyRect *cmd)
    499 {
    500    _debug_printf("\t\t.x = %u\n", (*cmd).x);
    501    _debug_printf("\t\t.y = %u\n", (*cmd).y);
    502    _debug_printf("\t\t.w = %u\n", (*cmd).w);
    503    _debug_printf("\t\t.h = %u\n", (*cmd).h);
    504    _debug_printf("\t\t.srcx = %u\n", (*cmd).srcx);
    505    _debug_printf("\t\t.srcy = %u\n", (*cmd).srcy);
    506 }
    507 
    508 static void
    509 dump_SVGA3dCmdSetShader(const SVGA3dCmdSetShader *cmd)
    510 {
    511    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
    512    switch((*cmd).type) {
    513    case SVGA3D_SHADERTYPE_VS:
    514       _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
    515       break;
    516    case SVGA3D_SHADERTYPE_PS:
    517       _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
    518       break;
    519    case SVGA3D_SHADERTYPE_MAX:
    520       _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
    521       break;
    522    default:
    523       _debug_printf("\t\t.type = %i\n", (*cmd).type);
    524       break;
    525    }
    526    _debug_printf("\t\t.shid = %u\n", (*cmd).shid);
    527 }
    528 
    529 static void
    530 dump_SVGA3dCmdEndQuery(const SVGA3dCmdEndQuery *cmd)
    531 {
    532    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
    533    switch((*cmd).type) {
    534    case SVGA3D_QUERYTYPE_OCCLUSION:
    535       _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n");
    536       break;
    537    case SVGA3D_QUERYTYPE_MAX:
    538       _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n");
    539       break;
    540    default:
    541       _debug_printf("\t\t.type = %i\n", (*cmd).type);
    542       break;
    543    }
    544    _debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId);
    545    _debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset);
    546 }
    547 
    548 static void
    549 dump_SVGA3dSize(const SVGA3dSize *cmd)
    550 {
    551    _debug_printf("\t\t.width = %u\n", (*cmd).width);
    552    _debug_printf("\t\t.height = %u\n", (*cmd).height);
    553    _debug_printf("\t\t.depth = %u\n", (*cmd).depth);
    554 }
    555 
    556 static void
    557 dump_SVGA3dCmdDestroySurface(const SVGA3dCmdDestroySurface *cmd)
    558 {
    559    _debug_printf("\t\t.sid = %u\n", (*cmd).sid);
    560 }
    561 
    562 static void
    563 dump_SVGA3dCmdDefineContext(const SVGA3dCmdDefineContext *cmd)
    564 {
    565    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
    566 }
    567 
    568 static void
    569 dump_SVGA3dRect(const SVGA3dRect *cmd)
    570 {
    571    _debug_printf("\t\t.x = %u\n", (*cmd).x);
    572    _debug_printf("\t\t.y = %u\n", (*cmd).y);
    573    _debug_printf("\t\t.w = %u\n", (*cmd).w);
    574    _debug_printf("\t\t.h = %u\n", (*cmd).h);
    575 }
    576 
    577 static void
    578 dump_SVGA3dCmdBeginQuery(const SVGA3dCmdBeginQuery *cmd)
    579 {
    580    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
    581    switch((*cmd).type) {
    582    case SVGA3D_QUERYTYPE_OCCLUSION:
    583       _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n");
    584       break;
    585    case SVGA3D_QUERYTYPE_MAX:
    586       _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n");
    587       break;
    588    default:
    589       _debug_printf("\t\t.type = %i\n", (*cmd).type);
    590       break;
    591    }
    592 }
    593 
    594 static void
    595 dump_SVGA3dRenderState(const SVGA3dRenderState *cmd)
    596 {
    597    switch((*cmd).state) {
    598    case SVGA3D_RS_INVALID:
    599       _debug_printf("\t\t.state = SVGA3D_RS_INVALID\n");
    600       break;
    601    case SVGA3D_RS_ZENABLE:
    602       _debug_printf("\t\t.state = SVGA3D_RS_ZENABLE\n");
    603       break;
    604    case SVGA3D_RS_ZWRITEENABLE:
    605       _debug_printf("\t\t.state = SVGA3D_RS_ZWRITEENABLE\n");
    606       break;
    607    case SVGA3D_RS_ALPHATESTENABLE:
    608       _debug_printf("\t\t.state = SVGA3D_RS_ALPHATESTENABLE\n");
    609       break;
    610    case SVGA3D_RS_DITHERENABLE:
    611       _debug_printf("\t\t.state = SVGA3D_RS_DITHERENABLE\n");
    612       break;
    613    case SVGA3D_RS_BLENDENABLE:
    614       _debug_printf("\t\t.state = SVGA3D_RS_BLENDENABLE\n");
    615       break;
    616    case SVGA3D_RS_FOGENABLE:
    617       _debug_printf("\t\t.state = SVGA3D_RS_FOGENABLE\n");
    618       break;
    619    case SVGA3D_RS_SPECULARENABLE:
    620       _debug_printf("\t\t.state = SVGA3D_RS_SPECULARENABLE\n");
    621       break;
    622    case SVGA3D_RS_STENCILENABLE:
    623       _debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE\n");
    624       break;
    625    case SVGA3D_RS_LIGHTINGENABLE:
    626       _debug_printf("\t\t.state = SVGA3D_RS_LIGHTINGENABLE\n");
    627       break;
    628    case SVGA3D_RS_NORMALIZENORMALS:
    629       _debug_printf("\t\t.state = SVGA3D_RS_NORMALIZENORMALS\n");
    630       break;
    631    case SVGA3D_RS_POINTSPRITEENABLE:
    632       _debug_printf("\t\t.state = SVGA3D_RS_POINTSPRITEENABLE\n");
    633       break;
    634    case SVGA3D_RS_POINTSCALEENABLE:
    635       _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALEENABLE\n");
    636       break;
    637    case SVGA3D_RS_STENCILREF:
    638       _debug_printf("\t\t.state = SVGA3D_RS_STENCILREF\n");
    639       break;
    640    case SVGA3D_RS_STENCILMASK:
    641       _debug_printf("\t\t.state = SVGA3D_RS_STENCILMASK\n");
    642       break;
    643    case SVGA3D_RS_STENCILWRITEMASK:
    644       _debug_printf("\t\t.state = SVGA3D_RS_STENCILWRITEMASK\n");
    645       break;
    646    case SVGA3D_RS_FOGSTART:
    647       _debug_printf("\t\t.state = SVGA3D_RS_FOGSTART\n");
    648       break;
    649    case SVGA3D_RS_FOGEND:
    650       _debug_printf("\t\t.state = SVGA3D_RS_FOGEND\n");
    651       break;
    652    case SVGA3D_RS_FOGDENSITY:
    653       _debug_printf("\t\t.state = SVGA3D_RS_FOGDENSITY\n");
    654       break;
    655    case SVGA3D_RS_POINTSIZE:
    656       _debug_printf("\t\t.state = SVGA3D_RS_POINTSIZE\n");
    657       break;
    658    case SVGA3D_RS_POINTSIZEMIN:
    659       _debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMIN\n");
    660       break;
    661    case SVGA3D_RS_POINTSIZEMAX:
    662       _debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMAX\n");
    663       break;
    664    case SVGA3D_RS_POINTSCALE_A:
    665       _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_A\n");
    666       break;
    667    case SVGA3D_RS_POINTSCALE_B:
    668       _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_B\n");
    669       break;
    670    case SVGA3D_RS_POINTSCALE_C:
    671       _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_C\n");
    672       break;
    673    case SVGA3D_RS_FOGCOLOR:
    674       _debug_printf("\t\t.state = SVGA3D_RS_FOGCOLOR\n");
    675       break;
    676    case SVGA3D_RS_AMBIENT:
    677       _debug_printf("\t\t.state = SVGA3D_RS_AMBIENT\n");
    678       break;
    679    case SVGA3D_RS_CLIPPLANEENABLE:
    680       _debug_printf("\t\t.state = SVGA3D_RS_CLIPPLANEENABLE\n");
    681       break;
    682    case SVGA3D_RS_FOGMODE:
    683       _debug_printf("\t\t.state = SVGA3D_RS_FOGMODE\n");
    684       break;
    685    case SVGA3D_RS_FILLMODE:
    686       _debug_printf("\t\t.state = SVGA3D_RS_FILLMODE\n");
    687       break;
    688    case SVGA3D_RS_SHADEMODE:
    689       _debug_printf("\t\t.state = SVGA3D_RS_SHADEMODE\n");
    690       break;
    691    case SVGA3D_RS_LINEPATTERN:
    692       _debug_printf("\t\t.state = SVGA3D_RS_LINEPATTERN\n");
    693       break;
    694    case SVGA3D_RS_SRCBLEND:
    695       _debug_printf("\t\t.state = SVGA3D_RS_SRCBLEND\n");
    696       break;
    697    case SVGA3D_RS_DSTBLEND:
    698       _debug_printf("\t\t.state = SVGA3D_RS_DSTBLEND\n");
    699       break;
    700    case SVGA3D_RS_BLENDEQUATION:
    701       _debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATION\n");
    702       break;
    703    case SVGA3D_RS_CULLMODE:
    704       _debug_printf("\t\t.state = SVGA3D_RS_CULLMODE\n");
    705       break;
    706    case SVGA3D_RS_ZFUNC:
    707       _debug_printf("\t\t.state = SVGA3D_RS_ZFUNC\n");
    708       break;
    709    case SVGA3D_RS_ALPHAFUNC:
    710       _debug_printf("\t\t.state = SVGA3D_RS_ALPHAFUNC\n");
    711       break;
    712    case SVGA3D_RS_STENCILFUNC:
    713       _debug_printf("\t\t.state = SVGA3D_RS_STENCILFUNC\n");
    714       break;
    715    case SVGA3D_RS_STENCILFAIL:
    716       _debug_printf("\t\t.state = SVGA3D_RS_STENCILFAIL\n");
    717       break;
    718    case SVGA3D_RS_STENCILZFAIL:
    719       _debug_printf("\t\t.state = SVGA3D_RS_STENCILZFAIL\n");
    720       break;
    721    case SVGA3D_RS_STENCILPASS:
    722       _debug_printf("\t\t.state = SVGA3D_RS_STENCILPASS\n");
    723       break;
    724    case SVGA3D_RS_ALPHAREF:
    725       _debug_printf("\t\t.state = SVGA3D_RS_ALPHAREF\n");
    726       break;
    727    case SVGA3D_RS_FRONTWINDING:
    728       _debug_printf("\t\t.state = SVGA3D_RS_FRONTWINDING\n");
    729       break;
    730    case SVGA3D_RS_COORDINATETYPE:
    731       _debug_printf("\t\t.state = SVGA3D_RS_COORDINATETYPE\n");
    732       break;
    733    case SVGA3D_RS_ZBIAS:
    734       _debug_printf("\t\t.state = SVGA3D_RS_ZBIAS\n");
    735       break;
    736    case SVGA3D_RS_RANGEFOGENABLE:
    737       _debug_printf("\t\t.state = SVGA3D_RS_RANGEFOGENABLE\n");
    738       break;
    739    case SVGA3D_RS_COLORWRITEENABLE:
    740       _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE\n");
    741       break;
    742    case SVGA3D_RS_VERTEXMATERIALENABLE:
    743       _debug_printf("\t\t.state = SVGA3D_RS_VERTEXMATERIALENABLE\n");
    744       break;
    745    case SVGA3D_RS_DIFFUSEMATERIALSOURCE:
    746       _debug_printf("\t\t.state = SVGA3D_RS_DIFFUSEMATERIALSOURCE\n");
    747       break;
    748    case SVGA3D_RS_SPECULARMATERIALSOURCE:
    749       _debug_printf("\t\t.state = SVGA3D_RS_SPECULARMATERIALSOURCE\n");
    750       break;
    751    case SVGA3D_RS_AMBIENTMATERIALSOURCE:
    752       _debug_printf("\t\t.state = SVGA3D_RS_AMBIENTMATERIALSOURCE\n");
    753       break;
    754    case SVGA3D_RS_EMISSIVEMATERIALSOURCE:
    755       _debug_printf("\t\t.state = SVGA3D_RS_EMISSIVEMATERIALSOURCE\n");
    756       break;
    757    case SVGA3D_RS_TEXTUREFACTOR:
    758       _debug_printf("\t\t.state = SVGA3D_RS_TEXTUREFACTOR\n");
    759       break;
    760    case SVGA3D_RS_LOCALVIEWER:
    761       _debug_printf("\t\t.state = SVGA3D_RS_LOCALVIEWER\n");
    762       break;
    763    case SVGA3D_RS_SCISSORTESTENABLE:
    764       _debug_printf("\t\t.state = SVGA3D_RS_SCISSORTESTENABLE\n");
    765       break;
    766    case SVGA3D_RS_BLENDCOLOR:
    767       _debug_printf("\t\t.state = SVGA3D_RS_BLENDCOLOR\n");
    768       break;
    769    case SVGA3D_RS_STENCILENABLE2SIDED:
    770       _debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE2SIDED\n");
    771       break;
    772    case SVGA3D_RS_CCWSTENCILFUNC:
    773       _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFUNC\n");
    774       break;
    775    case SVGA3D_RS_CCWSTENCILFAIL:
    776       _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFAIL\n");
    777       break;
    778    case SVGA3D_RS_CCWSTENCILZFAIL:
    779       _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILZFAIL\n");
    780       break;
    781    case SVGA3D_RS_CCWSTENCILPASS:
    782       _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILPASS\n");
    783       break;
    784    case SVGA3D_RS_VERTEXBLEND:
    785       _debug_printf("\t\t.state = SVGA3D_RS_VERTEXBLEND\n");
    786       break;
    787    case SVGA3D_RS_SLOPESCALEDEPTHBIAS:
    788       _debug_printf("\t\t.state = SVGA3D_RS_SLOPESCALEDEPTHBIAS\n");
    789       break;
    790    case SVGA3D_RS_DEPTHBIAS:
    791       _debug_printf("\t\t.state = SVGA3D_RS_DEPTHBIAS\n");
    792       break;
    793    case SVGA3D_RS_OUTPUTGAMMA:
    794       _debug_printf("\t\t.state = SVGA3D_RS_OUTPUTGAMMA\n");
    795       break;
    796    case SVGA3D_RS_ZVISIBLE:
    797       _debug_printf("\t\t.state = SVGA3D_RS_ZVISIBLE\n");
    798       break;
    799    case SVGA3D_RS_LASTPIXEL:
    800       _debug_printf("\t\t.state = SVGA3D_RS_LASTPIXEL\n");
    801       break;
    802    case SVGA3D_RS_CLIPPING:
    803       _debug_printf("\t\t.state = SVGA3D_RS_CLIPPING\n");
    804       break;
    805    case SVGA3D_RS_WRAP0:
    806       _debug_printf("\t\t.state = SVGA3D_RS_WRAP0\n");
    807       break;
    808    case SVGA3D_RS_WRAP1:
    809       _debug_printf("\t\t.state = SVGA3D_RS_WRAP1\n");
    810       break;
    811    case SVGA3D_RS_WRAP2:
    812       _debug_printf("\t\t.state = SVGA3D_RS_WRAP2\n");
    813       break;
    814    case SVGA3D_RS_WRAP3:
    815       _debug_printf("\t\t.state = SVGA3D_RS_WRAP3\n");
    816       break;
    817    case SVGA3D_RS_WRAP4:
    818       _debug_printf("\t\t.state = SVGA3D_RS_WRAP4\n");
    819       break;
    820    case SVGA3D_RS_WRAP5:
    821       _debug_printf("\t\t.state = SVGA3D_RS_WRAP5\n");
    822       break;
    823    case SVGA3D_RS_WRAP6:
    824       _debug_printf("\t\t.state = SVGA3D_RS_WRAP6\n");
    825       break;
    826    case SVGA3D_RS_WRAP7:
    827       _debug_printf("\t\t.state = SVGA3D_RS_WRAP7\n");
    828       break;
    829    case SVGA3D_RS_WRAP8:
    830       _debug_printf("\t\t.state = SVGA3D_RS_WRAP8\n");
    831       break;
    832    case SVGA3D_RS_WRAP9:
    833       _debug_printf("\t\t.state = SVGA3D_RS_WRAP9\n");
    834       break;
    835    case SVGA3D_RS_WRAP10:
    836       _debug_printf("\t\t.state = SVGA3D_RS_WRAP10\n");
    837       break;
    838    case SVGA3D_RS_WRAP11:
    839       _debug_printf("\t\t.state = SVGA3D_RS_WRAP11\n");
    840       break;
    841    case SVGA3D_RS_WRAP12:
    842       _debug_printf("\t\t.state = SVGA3D_RS_WRAP12\n");
    843       break;
    844    case SVGA3D_RS_WRAP13:
    845       _debug_printf("\t\t.state = SVGA3D_RS_WRAP13\n");
    846       break;
    847    case SVGA3D_RS_WRAP14:
    848       _debug_printf("\t\t.state = SVGA3D_RS_WRAP14\n");
    849       break;
    850    case SVGA3D_RS_WRAP15:
    851       _debug_printf("\t\t.state = SVGA3D_RS_WRAP15\n");
    852       break;
    853    case SVGA3D_RS_MULTISAMPLEANTIALIAS:
    854       _debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEANTIALIAS\n");
    855       break;
    856    case SVGA3D_RS_MULTISAMPLEMASK:
    857       _debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEMASK\n");
    858       break;
    859    case SVGA3D_RS_INDEXEDVERTEXBLENDENABLE:
    860       _debug_printf("\t\t.state = SVGA3D_RS_INDEXEDVERTEXBLENDENABLE\n");
    861       break;
    862    case SVGA3D_RS_TWEENFACTOR:
    863       _debug_printf("\t\t.state = SVGA3D_RS_TWEENFACTOR\n");
    864       break;
    865    case SVGA3D_RS_ANTIALIASEDLINEENABLE:
    866       _debug_printf("\t\t.state = SVGA3D_RS_ANTIALIASEDLINEENABLE\n");
    867       break;
    868    case SVGA3D_RS_COLORWRITEENABLE1:
    869       _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE1\n");
    870       break;
    871    case SVGA3D_RS_COLORWRITEENABLE2:
    872       _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE2\n");
    873       break;
    874    case SVGA3D_RS_COLORWRITEENABLE3:
    875       _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE3\n");
    876       break;
    877    case SVGA3D_RS_SEPARATEALPHABLENDENABLE:
    878       _debug_printf("\t\t.state = SVGA3D_RS_SEPARATEALPHABLENDENABLE\n");
    879       break;
    880    case SVGA3D_RS_SRCBLENDALPHA:
    881       _debug_printf("\t\t.state = SVGA3D_RS_SRCBLENDALPHA\n");
    882       break;
    883    case SVGA3D_RS_DSTBLENDALPHA:
    884       _debug_printf("\t\t.state = SVGA3D_RS_DSTBLENDALPHA\n");
    885       break;
    886    case SVGA3D_RS_BLENDEQUATIONALPHA:
    887       _debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATIONALPHA\n");
    888       break;
    889    case SVGA3D_RS_MAX:
    890       _debug_printf("\t\t.state = SVGA3D_RS_MAX\n");
    891       break;
    892    default:
    893       _debug_printf("\t\t.state = %i\n", (*cmd).state);
    894       break;
    895    }
    896    _debug_printf("\t\t.uintValue = %u\n", (*cmd).uintValue);
    897    _debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue);
    898 }
    899 
    900 static void
    901 dump_SVGA3dVertexDivisor(const SVGA3dVertexDivisor *cmd)
    902 {
    903    _debug_printf("\t\t.value = %u\n", (*cmd).value);
    904    _debug_printf("\t\t.count = %u\n", (*cmd).count);
    905    _debug_printf("\t\t.indexedData = %u\n", (*cmd).indexedData);
    906    _debug_printf("\t\t.instanceData = %u\n", (*cmd).instanceData);
    907 }
    908 
    909 static void
    910 dump_SVGA3dCmdDefineShader(const SVGA3dCmdDefineShader *cmd)
    911 {
    912    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
    913    _debug_printf("\t\t.shid = %u\n", (*cmd).shid);
    914    switch((*cmd).type) {
    915    case SVGA3D_SHADERTYPE_VS:
    916       _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
    917       break;
    918    case SVGA3D_SHADERTYPE_PS:
    919       _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
    920       break;
    921    case SVGA3D_SHADERTYPE_MAX:
    922       _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
    923       break;
    924    default:
    925       _debug_printf("\t\t.type = %i\n", (*cmd).type);
    926       break;
    927    }
    928 }
    929 
    930 static void
    931 dump_SVGA3dCmdSetShaderConst(const SVGA3dCmdSetShaderConst *cmd, uint32 numConsts)
    932 {
    933    uint32 i;
    934    const float (*fvalues)[4];
    935    const int32 (*ivalues)[4];
    936    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
    937    _debug_printf("\t\t.reg = %u\n", (*cmd).reg);
    938    switch((*cmd).type) {
    939    case SVGA3D_SHADERTYPE_VS:
    940       _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
    941       break;
    942    case SVGA3D_SHADERTYPE_PS:
    943       _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
    944       break;
    945    case SVGA3D_SHADERTYPE_MAX:
    946       _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
    947       break;
    948    default:
    949       _debug_printf("\t\t.type = %i\n", (*cmd).type);
    950       break;
    951    }
    952    switch((*cmd).ctype) {
    953    case SVGA3D_CONST_TYPE_FLOAT:
    954       _debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_FLOAT\n");
    955       fvalues = (const float (*)[4])cmd->values;
    956       for (i = 0; i < numConsts; ++i) {
    957          _debug_printf("\t\t.values[%u] = {%f, %f, %f, %f}\n",
    958                        cmd->reg + i,
    959                        fvalues[i][0],
    960                        fvalues[i][1],
    961                        fvalues[i][2],
    962                        fvalues[i][3]);
    963       }
    964       break;
    965    case SVGA3D_CONST_TYPE_INT:
    966       _debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_INT\n");
    967       ivalues = (const int32 (*)[4])cmd->values;
    968       for (i = 0; i < numConsts; ++i) {
    969          _debug_printf("\t\t.values[%u] = {%i, %i, %i, %i}\n",
    970                        cmd->reg + i,
    971                        ivalues[i][0],
    972                        ivalues[i][1],
    973                        ivalues[i][2],
    974                        ivalues[i][3]);
    975       }
    976       break;
    977    case SVGA3D_CONST_TYPE_BOOL:
    978       _debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_BOOL\n");
    979       ivalues = (const int32 (*)[4])cmd->values;
    980       for (i = 0; i < numConsts; ++i) {
    981          _debug_printf("\t\t.values[%u] = {%i, %i, %i, %i}\n",
    982                        cmd->reg + i,
    983                        ivalues[i][0],
    984                        ivalues[i][1],
    985                        ivalues[i][2],
    986                        ivalues[i][3]);
    987       }
    988       break;
    989    default:
    990       _debug_printf("\t\t.ctype = %i\n", (*cmd).ctype);
    991       ivalues = (const int32 (*)[4])cmd->values;
    992       for (i = 0; i < numConsts; ++i) {
    993          _debug_printf("\t\t.values[%u] = {%i, %i, %i, %i}\n",
    994                        cmd->reg + i,
    995                        ivalues[i][0],
    996                        ivalues[i][1],
    997                        ivalues[i][2],
    998                        ivalues[i][3]);
    999       }
   1000       break;
   1001    }
   1002 }
   1003 
   1004 static void
   1005 dump_SVGA3dCmdSetZRange(const SVGA3dCmdSetZRange *cmd)
   1006 {
   1007    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
   1008    _debug_printf("\t\t.zRange.min = %f\n", (*cmd).zRange.min);
   1009    _debug_printf("\t\t.zRange.max = %f\n", (*cmd).zRange.max);
   1010 }
   1011 
   1012 static void
   1013 dump_SVGA3dCmdDrawPrimitives(const SVGA3dCmdDrawPrimitives *cmd)
   1014 {
   1015    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
   1016    _debug_printf("\t\t.numVertexDecls = %u\n", (*cmd).numVertexDecls);
   1017    _debug_printf("\t\t.numRanges = %u\n", (*cmd).numRanges);
   1018 }
   1019 
   1020 static void
   1021 dump_SVGA3dCmdSetLightEnabled(const SVGA3dCmdSetLightEnabled *cmd)
   1022 {
   1023    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
   1024    _debug_printf("\t\t.index = %u\n", (*cmd).index);
   1025    _debug_printf("\t\t.enabled = %u\n", (*cmd).enabled);
   1026 }
   1027 
   1028 static void
   1029 dump_SVGA3dPrimitiveRange(const SVGA3dPrimitiveRange *cmd)
   1030 {
   1031    switch((*cmd).primType) {
   1032    case SVGA3D_PRIMITIVE_INVALID:
   1033       _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_INVALID\n");
   1034       break;
   1035    case SVGA3D_PRIMITIVE_TRIANGLELIST:
   1036       _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLELIST\n");
   1037       break;
   1038    case SVGA3D_PRIMITIVE_POINTLIST:
   1039       _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_POINTLIST\n");
   1040       break;
   1041    case SVGA3D_PRIMITIVE_LINELIST:
   1042       _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINELIST\n");
   1043       break;
   1044    case SVGA3D_PRIMITIVE_LINESTRIP:
   1045       _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINESTRIP\n");
   1046       break;
   1047    case SVGA3D_PRIMITIVE_TRIANGLESTRIP:
   1048       _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLESTRIP\n");
   1049       break;
   1050    case SVGA3D_PRIMITIVE_TRIANGLEFAN:
   1051       _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLEFAN\n");
   1052       break;
   1053    case SVGA3D_PRIMITIVE_MAX:
   1054       _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_MAX\n");
   1055       break;
   1056    default:
   1057       _debug_printf("\t\t.primType = %i\n", (*cmd).primType);
   1058       break;
   1059    }
   1060    _debug_printf("\t\t.primitiveCount = %u\n", (*cmd).primitiveCount);
   1061    _debug_printf("\t\t.indexArray.surfaceId = %u\n", (*cmd).indexArray.surfaceId);
   1062    _debug_printf("\t\t.indexArray.offset = %u\n", (*cmd).indexArray.offset);
   1063    _debug_printf("\t\t.indexArray.stride = %u\n", (*cmd).indexArray.stride);
   1064    _debug_printf("\t\t.indexWidth = %u\n", (*cmd).indexWidth);
   1065    _debug_printf("\t\t.indexBias = %i\n", (*cmd).indexBias);
   1066 }
   1067 
   1068 static void
   1069 dump_SVGA3dCmdPresent(const SVGA3dCmdPresent *cmd)
   1070 {
   1071    _debug_printf("\t\t.sid = %u\n", (*cmd).sid);
   1072 }
   1073 
   1074 static void
   1075 dump_SVGA3dCmdSetRenderState(const SVGA3dCmdSetRenderState *cmd)
   1076 {
   1077    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
   1078 }
   1079 
   1080 static void
   1081 dump_SVGA3dCmdSurfaceStretchBlt(const SVGA3dCmdSurfaceStretchBlt *cmd)
   1082 {
   1083    _debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid);
   1084    _debug_printf("\t\t.src.face = %u\n", (*cmd).src.face);
   1085    _debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap);
   1086    _debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid);
   1087    _debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face);
   1088    _debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap);
   1089    _debug_printf("\t\t.boxSrc.x = %u\n", (*cmd).boxSrc.x);
   1090    _debug_printf("\t\t.boxSrc.y = %u\n", (*cmd).boxSrc.y);
   1091    _debug_printf("\t\t.boxSrc.z = %u\n", (*cmd).boxSrc.z);
   1092    _debug_printf("\t\t.boxSrc.w = %u\n", (*cmd).boxSrc.w);
   1093    _debug_printf("\t\t.boxSrc.h = %u\n", (*cmd).boxSrc.h);
   1094    _debug_printf("\t\t.boxSrc.d = %u\n", (*cmd).boxSrc.d);
   1095    _debug_printf("\t\t.boxDest.x = %u\n", (*cmd).boxDest.x);
   1096    _debug_printf("\t\t.boxDest.y = %u\n", (*cmd).boxDest.y);
   1097    _debug_printf("\t\t.boxDest.z = %u\n", (*cmd).boxDest.z);
   1098    _debug_printf("\t\t.boxDest.w = %u\n", (*cmd).boxDest.w);
   1099    _debug_printf("\t\t.boxDest.h = %u\n", (*cmd).boxDest.h);
   1100    _debug_printf("\t\t.boxDest.d = %u\n", (*cmd).boxDest.d);
   1101    switch((*cmd).mode) {
   1102    case SVGA3D_STRETCH_BLT_POINT:
   1103       _debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_POINT\n");
   1104       break;
   1105    case SVGA3D_STRETCH_BLT_LINEAR:
   1106       _debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_LINEAR\n");
   1107       break;
   1108    case SVGA3D_STRETCH_BLT_MAX:
   1109       _debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_MAX\n");
   1110       break;
   1111    default:
   1112       _debug_printf("\t\t.mode = %i\n", (*cmd).mode);
   1113       break;
   1114    }
   1115 }
   1116 
   1117 static void
   1118 dump_SVGA3dCmdSurfaceDMA(const SVGA3dCmdSurfaceDMA *cmd)
   1119 {
   1120    _debug_printf("\t\t.guest.ptr.gmrId = %u\n", (*cmd).guest.ptr.gmrId);
   1121    _debug_printf("\t\t.guest.ptr.offset = %u\n", (*cmd).guest.ptr.offset);
   1122    _debug_printf("\t\t.guest.pitch = %u\n", (*cmd).guest.pitch);
   1123    _debug_printf("\t\t.host.sid = %u\n", (*cmd).host.sid);
   1124    _debug_printf("\t\t.host.face = %u\n", (*cmd).host.face);
   1125    _debug_printf("\t\t.host.mipmap = %u\n", (*cmd).host.mipmap);
   1126    switch((*cmd).transfer) {
   1127    case SVGA3D_WRITE_HOST_VRAM:
   1128       _debug_printf("\t\t.transfer = SVGA3D_WRITE_HOST_VRAM\n");
   1129       break;
   1130    case SVGA3D_READ_HOST_VRAM:
   1131       _debug_printf("\t\t.transfer = SVGA3D_READ_HOST_VRAM\n");
   1132       break;
   1133    default:
   1134       _debug_printf("\t\t.transfer = %i\n", (*cmd).transfer);
   1135       break;
   1136    }
   1137 }
   1138 
   1139 static void
   1140 dump_SVGA3dCmdSurfaceDMASuffix(const SVGA3dCmdSurfaceDMASuffix *cmd)
   1141 {
   1142    _debug_printf("\t\t.suffixSize = %u\n", (*cmd).suffixSize);
   1143    _debug_printf("\t\t.maximumOffset = %u\n", (*cmd).maximumOffset);
   1144    _debug_printf("\t\t.flags.discard = %u\n", (*cmd).flags.discard);
   1145    _debug_printf("\t\t.flags.unsynchronized = %u\n", (*cmd).flags.unsynchronized);
   1146 }
   1147 
   1148 static void
   1149 dump_SVGA3dCmdSetTransform(const SVGA3dCmdSetTransform *cmd)
   1150 {
   1151    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
   1152    switch((*cmd).type) {
   1153    case SVGA3D_TRANSFORM_INVALID:
   1154       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_INVALID\n");
   1155       break;
   1156    case SVGA3D_TRANSFORM_WORLD:
   1157       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD\n");
   1158       break;
   1159    case SVGA3D_TRANSFORM_VIEW:
   1160       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_VIEW\n");
   1161       break;
   1162    case SVGA3D_TRANSFORM_PROJECTION:
   1163       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_PROJECTION\n");
   1164       break;
   1165    case SVGA3D_TRANSFORM_TEXTURE0:
   1166       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE0\n");
   1167       break;
   1168    case SVGA3D_TRANSFORM_TEXTURE1:
   1169       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE1\n");
   1170       break;
   1171    case SVGA3D_TRANSFORM_TEXTURE2:
   1172       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE2\n");
   1173       break;
   1174    case SVGA3D_TRANSFORM_TEXTURE3:
   1175       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE3\n");
   1176       break;
   1177    case SVGA3D_TRANSFORM_TEXTURE4:
   1178       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE4\n");
   1179       break;
   1180    case SVGA3D_TRANSFORM_TEXTURE5:
   1181       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE5\n");
   1182       break;
   1183    case SVGA3D_TRANSFORM_TEXTURE6:
   1184       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE6\n");
   1185       break;
   1186    case SVGA3D_TRANSFORM_TEXTURE7:
   1187       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE7\n");
   1188       break;
   1189    case SVGA3D_TRANSFORM_WORLD1:
   1190       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD1\n");
   1191       break;
   1192    case SVGA3D_TRANSFORM_WORLD2:
   1193       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD2\n");
   1194       break;
   1195    case SVGA3D_TRANSFORM_WORLD3:
   1196       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD3\n");
   1197       break;
   1198    case SVGA3D_TRANSFORM_MAX:
   1199       _debug_printf("\t\t.type = SVGA3D_TRANSFORM_MAX\n");
   1200       break;
   1201    default:
   1202       _debug_printf("\t\t.type = %i\n", (*cmd).type);
   1203       break;
   1204    }
   1205    _debug_printf("\t\t.matrix[0] = %f\n", (*cmd).matrix[0]);
   1206    _debug_printf("\t\t.matrix[1] = %f\n", (*cmd).matrix[1]);
   1207    _debug_printf("\t\t.matrix[2] = %f\n", (*cmd).matrix[2]);
   1208    _debug_printf("\t\t.matrix[3] = %f\n", (*cmd).matrix[3]);
   1209    _debug_printf("\t\t.matrix[4] = %f\n", (*cmd).matrix[4]);
   1210    _debug_printf("\t\t.matrix[5] = %f\n", (*cmd).matrix[5]);
   1211    _debug_printf("\t\t.matrix[6] = %f\n", (*cmd).matrix[6]);
   1212    _debug_printf("\t\t.matrix[7] = %f\n", (*cmd).matrix[7]);
   1213    _debug_printf("\t\t.matrix[8] = %f\n", (*cmd).matrix[8]);
   1214    _debug_printf("\t\t.matrix[9] = %f\n", (*cmd).matrix[9]);
   1215    _debug_printf("\t\t.matrix[10] = %f\n", (*cmd).matrix[10]);
   1216    _debug_printf("\t\t.matrix[11] = %f\n", (*cmd).matrix[11]);
   1217    _debug_printf("\t\t.matrix[12] = %f\n", (*cmd).matrix[12]);
   1218    _debug_printf("\t\t.matrix[13] = %f\n", (*cmd).matrix[13]);
   1219    _debug_printf("\t\t.matrix[14] = %f\n", (*cmd).matrix[14]);
   1220    _debug_printf("\t\t.matrix[15] = %f\n", (*cmd).matrix[15]);
   1221 }
   1222 
   1223 static void
   1224 dump_SVGA3dCmdDestroyShader(const SVGA3dCmdDestroyShader *cmd)
   1225 {
   1226    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
   1227    _debug_printf("\t\t.shid = %u\n", (*cmd).shid);
   1228    switch((*cmd).type) {
   1229    case SVGA3D_SHADERTYPE_VS:
   1230       _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
   1231       break;
   1232    case SVGA3D_SHADERTYPE_PS:
   1233       _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
   1234       break;
   1235    case SVGA3D_SHADERTYPE_MAX:
   1236       _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
   1237       break;
   1238    default:
   1239       _debug_printf("\t\t.type = %i\n", (*cmd).type);
   1240       break;
   1241    }
   1242 }
   1243 
   1244 static void
   1245 dump_SVGA3dCmdDestroyContext(const SVGA3dCmdDestroyContext *cmd)
   1246 {
   1247    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
   1248 }
   1249 
   1250 static void
   1251 dump_SVGA3dCmdClear(const SVGA3dCmdClear *cmd)
   1252 {
   1253    _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
   1254    switch((*cmd).clearFlag) {
   1255    case SVGA3D_CLEAR_COLOR:
   1256       _debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_COLOR\n");
   1257       break;
   1258    case SVGA3D_CLEAR_DEPTH:
   1259       _debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_DEPTH\n");
   1260       break;
   1261    case SVGA3D_CLEAR_STENCIL:
   1262       _debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_STENCIL\n");
   1263       break;
   1264    default:
   1265       _debug_printf("\t\t.clearFlag = %i\n", (*cmd).clearFlag);
   1266       break;
   1267    }
   1268    _debug_printf("\t\t.color = %u\n", (*cmd).color);
   1269    _debug_printf("\t\t.depth = %f\n", (*cmd).depth);
   1270    _debug_printf("\t\t.stencil = %u\n", (*cmd).stencil);
   1271 }
   1272 
   1273 static void
   1274 dump_SVGA3dCmdDefineSurface(const SVGA3dCmdDefineSurface *cmd)
   1275 {
   1276    _debug_printf("\t\t.sid = %u\n", (*cmd).sid);
   1277    switch((*cmd).surfaceFlags) {
   1278    case SVGA3D_SURFACE_CUBEMAP:
   1279       _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_CUBEMAP\n");
   1280       break;
   1281    case SVGA3D_SURFACE_HINT_STATIC:
   1282       _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_STATIC\n");
   1283       break;
   1284    case SVGA3D_SURFACE_HINT_DYNAMIC:
   1285       _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_DYNAMIC\n");
   1286       break;
   1287    case SVGA3D_SURFACE_HINT_INDEXBUFFER:
   1288       _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_INDEXBUFFER\n");
   1289       break;
   1290    case SVGA3D_SURFACE_HINT_VERTEXBUFFER:
   1291       _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_VERTEXBUFFER\n");
   1292       break;
   1293    default:
   1294       _debug_printf("\t\t.surfaceFlags = %i\n", (*cmd).surfaceFlags);
   1295       break;
   1296    }
   1297    switch((*cmd).format) {
   1298    case SVGA3D_FORMAT_INVALID:
   1299       _debug_printf("\t\t.format = SVGA3D_FORMAT_INVALID\n");
   1300       break;
   1301    case SVGA3D_X8R8G8B8:
   1302       _debug_printf("\t\t.format = SVGA3D_X8R8G8B8\n");
   1303       break;
   1304    case SVGA3D_A8R8G8B8:
   1305       _debug_printf("\t\t.format = SVGA3D_A8R8G8B8\n");
   1306       break;
   1307    case SVGA3D_R5G6B5:
   1308       _debug_printf("\t\t.format = SVGA3D_R5G6B5\n");
   1309       break;
   1310    case SVGA3D_X1R5G5B5:
   1311       _debug_printf("\t\t.format = SVGA3D_X1R5G5B5\n");
   1312       break;
   1313    case SVGA3D_A1R5G5B5:
   1314       _debug_printf("\t\t.format = SVGA3D_A1R5G5B5\n");
   1315       break;
   1316    case SVGA3D_A4R4G4B4:
   1317       _debug_printf("\t\t.format = SVGA3D_A4R4G4B4\n");
   1318       break;
   1319    case SVGA3D_Z_D32:
   1320       _debug_printf("\t\t.format = SVGA3D_Z_D32\n");
   1321       break;
   1322    case SVGA3D_Z_D16:
   1323       _debug_printf("\t\t.format = SVGA3D_Z_D16\n");
   1324       break;
   1325    case SVGA3D_Z_D24S8:
   1326       _debug_printf("\t\t.format = SVGA3D_Z_D24S8\n");
   1327       break;
   1328    case SVGA3D_Z_D15S1:
   1329       _debug_printf("\t\t.format = SVGA3D_Z_D15S1\n");
   1330       break;
   1331    case SVGA3D_LUMINANCE8:
   1332       _debug_printf("\t\t.format = SVGA3D_LUMINANCE8\n");
   1333       break;
   1334    case SVGA3D_LUMINANCE4_ALPHA4:
   1335       _debug_printf("\t\t.format = SVGA3D_LUMINANCE4_ALPHA4\n");
   1336       break;
   1337    case SVGA3D_LUMINANCE16:
   1338       _debug_printf("\t\t.format = SVGA3D_LUMINANCE16\n");
   1339       break;
   1340    case SVGA3D_LUMINANCE8_ALPHA8:
   1341       _debug_printf("\t\t.format = SVGA3D_LUMINANCE8_ALPHA8\n");
   1342       break;
   1343    case SVGA3D_DXT1:
   1344       _debug_printf("\t\t.format = SVGA3D_DXT1\n");
   1345       break;
   1346    case SVGA3D_DXT2:
   1347       _debug_printf("\t\t.format = SVGA3D_DXT2\n");
   1348       break;
   1349    case SVGA3D_DXT3:
   1350       _debug_printf("\t\t.format = SVGA3D_DXT3\n");
   1351       break;
   1352    case SVGA3D_DXT4:
   1353       _debug_printf("\t\t.format = SVGA3D_DXT4\n");
   1354       break;
   1355    case SVGA3D_DXT5:
   1356       _debug_printf("\t\t.format = SVGA3D_DXT5\n");
   1357       break;
   1358    case SVGA3D_BUMPU8V8:
   1359       _debug_printf("\t\t.format = SVGA3D_BUMPU8V8\n");
   1360       break;
   1361    case SVGA3D_BUMPL6V5U5:
   1362       _debug_printf("\t\t.format = SVGA3D_BUMPL6V5U5\n");
   1363       break;
   1364    case SVGA3D_BUMPX8L8V8U8:
   1365       _debug_printf("\t\t.format = SVGA3D_BUMPX8L8V8U8\n");
   1366       break;
   1367    case SVGA3D_BUMPL8V8U8:
   1368       _debug_printf("\t\t.format = SVGA3D_BUMPL8V8U8\n");
   1369       break;
   1370    case SVGA3D_ARGB_S10E5:
   1371       _debug_printf("\t\t.format = SVGA3D_ARGB_S10E5\n");
   1372       break;
   1373    case SVGA3D_ARGB_S23E8:
   1374       _debug_printf("\t\t.format = SVGA3D_ARGB_S23E8\n");
   1375       break;
   1376    case SVGA3D_A2R10G10B10:
   1377       _debug_printf("\t\t.format = SVGA3D_A2R10G10B10\n");
   1378       break;
   1379    case SVGA3D_V8U8:
   1380       _debug_printf("\t\t.format = SVGA3D_V8U8\n");
   1381       break;
   1382    case SVGA3D_Q8W8V8U8:
   1383       _debug_printf("\t\t.format = SVGA3D_Q8W8V8U8\n");
   1384       break;
   1385    case SVGA3D_CxV8U8:
   1386       _debug_printf("\t\t.format = SVGA3D_CxV8U8\n");
   1387       break;
   1388    case SVGA3D_X8L8V8U8:
   1389       _debug_printf("\t\t.format = SVGA3D_X8L8V8U8\n");
   1390       break;
   1391    case SVGA3D_A2W10V10U10:
   1392       _debug_printf("\t\t.format = SVGA3D_A2W10V10U10\n");
   1393       break;
   1394    case SVGA3D_ALPHA8:
   1395       _debug_printf("\t\t.format = SVGA3D_ALPHA8\n");
   1396       break;
   1397    case SVGA3D_R_S10E5:
   1398       _debug_printf("\t\t.format = SVGA3D_R_S10E5\n");
   1399       break;
   1400    case SVGA3D_R_S23E8:
   1401       _debug_printf("\t\t.format = SVGA3D_R_S23E8\n");
   1402       break;
   1403    case SVGA3D_RG_S10E5:
   1404       _debug_printf("\t\t.format = SVGA3D_RG_S10E5\n");
   1405       break;
   1406    case SVGA3D_RG_S23E8:
   1407       _debug_printf("\t\t.format = SVGA3D_RG_S23E8\n");
   1408       break;
   1409    case SVGA3D_BUFFER:
   1410       _debug_printf("\t\t.format = SVGA3D_BUFFER\n");
   1411       break;
   1412    case SVGA3D_Z_D24X8:
   1413       _debug_printf("\t\t.format = SVGA3D_Z_D24X8\n");
   1414       break;
   1415    case SVGA3D_G16R16:
   1416       _debug_printf("\t\t.format = SVGA3D_G16R16\n");
   1417       break;
   1418    case SVGA3D_A16B16G16R16:
   1419       _debug_printf("\t\t.format = SVGA3D_A16B16G16R16\n");
   1420       break;
   1421    case SVGA3D_UYVY:
   1422       _debug_printf("\t\t.format = SVGA3D_UYVY\n");
   1423       break;
   1424    case SVGA3D_YUY2:
   1425       _debug_printf("\t\t.format = SVGA3D_YUY2\n");
   1426       break;
   1427    case SVGA3D_NV12:
   1428       _debug_printf("\t\t.format = SVGA3D_NV12\n");
   1429       break;
   1430    case SVGA3D_AYUV:
   1431       _debug_printf("\t\t.format = SVGA3D_AYUV\n");
   1432       break;
   1433    case SVGA3D_Z_DF16:
   1434       _debug_printf("\t\t.format = SVGA3D_Z_D16\n");
   1435       break;
   1436    case SVGA3D_Z_DF24:
   1437       _debug_printf("\t\t.format = SVGA3D_Z_DF24\n");
   1438       break;
   1439    case SVGA3D_Z_D24S8_INT:
   1440       _debug_printf("\t\t.format = SVGA3D_Z_D24S8_INT\n");
   1441       break;
   1442    default:
   1443       _debug_printf("\t\t.format = %i\n", (*cmd).format);
   1444       break;
   1445    }
   1446    _debug_printf("\t\t.face[0].numMipLevels = %u\n", (*cmd).face[0].numMipLevels);
   1447    _debug_printf("\t\t.face[1].numMipLevels = %u\n", (*cmd).face[1].numMipLevels);
   1448    _debug_printf("\t\t.face[2].numMipLevels = %u\n", (*cmd).face[2].numMipLevels);
   1449    _debug_printf("\t\t.face[3].numMipLevels = %u\n", (*cmd).face[3].numMipLevels);
   1450    _debug_printf("\t\t.face[4].numMipLevels = %u\n", (*cmd).face[4].numMipLevels);
   1451    _debug_printf("\t\t.face[5].numMipLevels = %u\n", (*cmd).face[5].numMipLevels);
   1452 }
   1453 
   1454 static void
   1455 dump_SVGASignedRect(const SVGASignedRect *cmd)
   1456 {
   1457    _debug_printf("\t\t.left = %i\n", (*cmd).left);
   1458    _debug_printf("\t\t.top = %i\n", (*cmd).top);
   1459    _debug_printf("\t\t.right = %i\n", (*cmd).right);
   1460    _debug_printf("\t\t.bottom = %i\n", (*cmd).bottom);
   1461 }
   1462 
   1463 static void
   1464 dump_SVGA3dCmdBlitSurfaceToScreen(const SVGA3dCmdBlitSurfaceToScreen *cmd)
   1465 {
   1466    _debug_printf("\t\t.srcImage.sid = %u\n", (*cmd).srcImage.sid);
   1467    _debug_printf("\t\t.srcImage.face = %u\n", (*cmd).srcImage.face);
   1468    _debug_printf("\t\t.srcImage.mipmap = %u\n", (*cmd).srcImage.mipmap);
   1469    _debug_printf("\t\t.srcRect.left = %i\n", (*cmd).srcRect.left);
   1470    _debug_printf("\t\t.srcRect.top = %i\n", (*cmd).srcRect.top);
   1471    _debug_printf("\t\t.srcRect.right = %i\n", (*cmd).srcRect.right);
   1472    _debug_printf("\t\t.srcRect.bottom = %i\n", (*cmd).srcRect.bottom);
   1473    _debug_printf("\t\t.destScreenId = %u\n", (*cmd).destScreenId);
   1474    _debug_printf("\t\t.destRect.left = %i\n", (*cmd).destRect.left);
   1475    _debug_printf("\t\t.destRect.top = %i\n", (*cmd).destRect.top);
   1476    _debug_printf("\t\t.destRect.right = %i\n", (*cmd).destRect.right);
   1477    _debug_printf("\t\t.destRect.bottom = %i\n", (*cmd).destRect.bottom);
   1478 }
   1479 
   1480 
   1481 void
   1482 svga_dump_command(uint32_t cmd_id, const void *data, uint32_t size)
   1483 {
   1484    const uint8_t *body = (const uint8_t *)data;
   1485    const uint8_t *next = body + size;
   1486 
   1487    switch(cmd_id) {
   1488    case SVGA_3D_CMD_SURFACE_DEFINE:
   1489       _debug_printf("\tSVGA_3D_CMD_SURFACE_DEFINE\n");
   1490       {
   1491          const SVGA3dCmdDefineSurface *cmd = (const SVGA3dCmdDefineSurface *)body;
   1492          dump_SVGA3dCmdDefineSurface(cmd);
   1493          body = (const uint8_t *)&cmd[1];
   1494          while(body + sizeof(SVGA3dSize) <= next) {
   1495             dump_SVGA3dSize((const SVGA3dSize *)body);
   1496             body += sizeof(SVGA3dSize);
   1497          }
   1498       }
   1499       break;
   1500    case SVGA_3D_CMD_SURFACE_DESTROY:
   1501       _debug_printf("\tSVGA_3D_CMD_SURFACE_DESTROY\n");
   1502       {
   1503          const SVGA3dCmdDestroySurface *cmd = (const SVGA3dCmdDestroySurface *)body;
   1504          dump_SVGA3dCmdDestroySurface(cmd);
   1505          body = (const uint8_t *)&cmd[1];
   1506       }
   1507       break;
   1508    case SVGA_3D_CMD_SURFACE_COPY:
   1509       _debug_printf("\tSVGA_3D_CMD_SURFACE_COPY\n");
   1510       {
   1511          const SVGA3dCmdSurfaceCopy *cmd = (const SVGA3dCmdSurfaceCopy *)body;
   1512          dump_SVGA3dCmdSurfaceCopy(cmd);
   1513          body = (const uint8_t *)&cmd[1];
   1514          while(body + sizeof(SVGA3dCopyBox) <= next) {
   1515             dump_SVGA3dCopyBox((const SVGA3dCopyBox *)body);
   1516             body += sizeof(SVGA3dCopyBox);
   1517          }
   1518       }
   1519       break;
   1520    case SVGA_3D_CMD_SURFACE_STRETCHBLT:
   1521       _debug_printf("\tSVGA_3D_CMD_SURFACE_STRETCHBLT\n");
   1522       {
   1523          const SVGA3dCmdSurfaceStretchBlt *cmd = (const SVGA3dCmdSurfaceStretchBlt *)body;
   1524          dump_SVGA3dCmdSurfaceStretchBlt(cmd);
   1525          body = (const uint8_t *)&cmd[1];
   1526       }
   1527       break;
   1528    case SVGA_3D_CMD_SURFACE_DMA:
   1529       _debug_printf("\tSVGA_3D_CMD_SURFACE_DMA\n");
   1530       {
   1531          const SVGA3dCmdSurfaceDMA *cmd = (const SVGA3dCmdSurfaceDMA *)body;
   1532          dump_SVGA3dCmdSurfaceDMA(cmd);
   1533          body = (const uint8_t *)&cmd[1];
   1534          while(body + sizeof(SVGA3dCopyBox) <= next) {
   1535             dump_SVGA3dCopyBox((const SVGA3dCopyBox *)body);
   1536             body += sizeof(SVGA3dCopyBox);
   1537          }
   1538          while(body + sizeof(SVGA3dCmdSurfaceDMASuffix) <= next) {
   1539             dump_SVGA3dCmdSurfaceDMASuffix((const SVGA3dCmdSurfaceDMASuffix *)body);
   1540             body += sizeof(SVGA3dCmdSurfaceDMASuffix);
   1541          }
   1542       }
   1543       break;
   1544    case SVGA_3D_CMD_CONTEXT_DEFINE:
   1545       _debug_printf("\tSVGA_3D_CMD_CONTEXT_DEFINE\n");
   1546       {
   1547          const SVGA3dCmdDefineContext *cmd = (const SVGA3dCmdDefineContext *)body;
   1548          dump_SVGA3dCmdDefineContext(cmd);
   1549          body = (const uint8_t *)&cmd[1];
   1550       }
   1551       break;
   1552    case SVGA_3D_CMD_CONTEXT_DESTROY:
   1553       _debug_printf("\tSVGA_3D_CMD_CONTEXT_DESTROY\n");
   1554       {
   1555          const SVGA3dCmdDestroyContext *cmd = (const SVGA3dCmdDestroyContext *)body;
   1556          dump_SVGA3dCmdDestroyContext(cmd);
   1557          body = (const uint8_t *)&cmd[1];
   1558       }
   1559       break;
   1560    case SVGA_3D_CMD_SETTRANSFORM:
   1561       _debug_printf("\tSVGA_3D_CMD_SETTRANSFORM\n");
   1562       {
   1563          const SVGA3dCmdSetTransform *cmd = (const SVGA3dCmdSetTransform *)body;
   1564          dump_SVGA3dCmdSetTransform(cmd);
   1565          body = (const uint8_t *)&cmd[1];
   1566       }
   1567       break;
   1568    case SVGA_3D_CMD_SETZRANGE:
   1569       _debug_printf("\tSVGA_3D_CMD_SETZRANGE\n");
   1570       {
   1571          const SVGA3dCmdSetZRange *cmd = (const SVGA3dCmdSetZRange *)body;
   1572          dump_SVGA3dCmdSetZRange(cmd);
   1573          body = (const uint8_t *)&cmd[1];
   1574       }
   1575       break;
   1576    case SVGA_3D_CMD_SETRENDERSTATE:
   1577       _debug_printf("\tSVGA_3D_CMD_SETRENDERSTATE\n");
   1578       {
   1579          const SVGA3dCmdSetRenderState *cmd = (const SVGA3dCmdSetRenderState *)body;
   1580          dump_SVGA3dCmdSetRenderState(cmd);
   1581          body = (const uint8_t *)&cmd[1];
   1582          while(body + sizeof(SVGA3dRenderState) <= next) {
   1583             dump_SVGA3dRenderState((const SVGA3dRenderState *)body);
   1584             body += sizeof(SVGA3dRenderState);
   1585          }
   1586       }
   1587       break;
   1588    case SVGA_3D_CMD_SETRENDERTARGET:
   1589       _debug_printf("\tSVGA_3D_CMD_SETRENDERTARGET\n");
   1590       {
   1591          const SVGA3dCmdSetRenderTarget *cmd = (const SVGA3dCmdSetRenderTarget *)body;
   1592          dump_SVGA3dCmdSetRenderTarget(cmd);
   1593          body = (const uint8_t *)&cmd[1];
   1594       }
   1595       break;
   1596    case SVGA_3D_CMD_SETTEXTURESTATE:
   1597       _debug_printf("\tSVGA_3D_CMD_SETTEXTURESTATE\n");
   1598       {
   1599          const SVGA3dCmdSetTextureState *cmd = (const SVGA3dCmdSetTextureState *)body;
   1600          dump_SVGA3dCmdSetTextureState(cmd);
   1601          body = (const uint8_t *)&cmd[1];
   1602          while(body + sizeof(SVGA3dTextureState) <= next) {
   1603             dump_SVGA3dTextureState((const SVGA3dTextureState *)body);
   1604             body += sizeof(SVGA3dTextureState);
   1605          }
   1606       }
   1607       break;
   1608    case SVGA_3D_CMD_SETMATERIAL:
   1609       _debug_printf("\tSVGA_3D_CMD_SETMATERIAL\n");
   1610       {
   1611          const SVGA3dCmdSetMaterial *cmd = (const SVGA3dCmdSetMaterial *)body;
   1612          dump_SVGA3dCmdSetMaterial(cmd);
   1613          body = (const uint8_t *)&cmd[1];
   1614       }
   1615       break;
   1616    case SVGA_3D_CMD_SETLIGHTDATA:
   1617       _debug_printf("\tSVGA_3D_CMD_SETLIGHTDATA\n");
   1618       {
   1619          const SVGA3dCmdSetLightData *cmd = (const SVGA3dCmdSetLightData *)body;
   1620          dump_SVGA3dCmdSetLightData(cmd);
   1621          body = (const uint8_t *)&cmd[1];
   1622       }
   1623       break;
   1624    case SVGA_3D_CMD_SETLIGHTENABLED:
   1625       _debug_printf("\tSVGA_3D_CMD_SETLIGHTENABLED\n");
   1626       {
   1627          const SVGA3dCmdSetLightEnabled *cmd = (const SVGA3dCmdSetLightEnabled *)body;
   1628          dump_SVGA3dCmdSetLightEnabled(cmd);
   1629          body = (const uint8_t *)&cmd[1];
   1630       }
   1631       break;
   1632    case SVGA_3D_CMD_SETVIEWPORT:
   1633       _debug_printf("\tSVGA_3D_CMD_SETVIEWPORT\n");
   1634       {
   1635          const SVGA3dCmdSetViewport *cmd = (const SVGA3dCmdSetViewport *)body;
   1636          dump_SVGA3dCmdSetViewport(cmd);
   1637          body = (const uint8_t *)&cmd[1];
   1638       }
   1639       break;
   1640    case SVGA_3D_CMD_SETCLIPPLANE:
   1641       _debug_printf("\tSVGA_3D_CMD_SETCLIPPLANE\n");
   1642       {
   1643          const SVGA3dCmdSetClipPlane *cmd = (const SVGA3dCmdSetClipPlane *)body;
   1644          dump_SVGA3dCmdSetClipPlane(cmd);
   1645          body = (const uint8_t *)&cmd[1];
   1646       }
   1647       break;
   1648    case SVGA_3D_CMD_CLEAR:
   1649       _debug_printf("\tSVGA_3D_CMD_CLEAR\n");
   1650       {
   1651          const SVGA3dCmdClear *cmd = (const SVGA3dCmdClear *)body;
   1652          dump_SVGA3dCmdClear(cmd);
   1653          body = (const uint8_t *)&cmd[1];
   1654          while(body + sizeof(SVGA3dRect) <= next) {
   1655             dump_SVGA3dRect((const SVGA3dRect *)body);
   1656             body += sizeof(SVGA3dRect);
   1657          }
   1658       }
   1659       break;
   1660    case SVGA_3D_CMD_PRESENT:
   1661       _debug_printf("\tSVGA_3D_CMD_PRESENT\n");
   1662       {
   1663          const SVGA3dCmdPresent *cmd = (const SVGA3dCmdPresent *)body;
   1664          dump_SVGA3dCmdPresent(cmd);
   1665          body = (const uint8_t *)&cmd[1];
   1666          while(body + sizeof(SVGA3dCopyRect) <= next) {
   1667             dump_SVGA3dCopyRect((const SVGA3dCopyRect *)body);
   1668             body += sizeof(SVGA3dCopyRect);
   1669          }
   1670       }
   1671       break;
   1672    case SVGA_3D_CMD_SHADER_DEFINE:
   1673       _debug_printf("\tSVGA_3D_CMD_SHADER_DEFINE\n");
   1674       {
   1675          const SVGA3dCmdDefineShader *cmd = (const SVGA3dCmdDefineShader *)body;
   1676          dump_SVGA3dCmdDefineShader(cmd);
   1677          body = (const uint8_t *)&cmd[1];
   1678          svga_shader_dump((const uint32_t *)body,
   1679                       (unsigned)(next - body)/sizeof(uint32_t),
   1680                       FALSE );
   1681          body = next;
   1682       }
   1683       break;
   1684    case SVGA_3D_CMD_SHADER_DESTROY:
   1685       _debug_printf("\tSVGA_3D_CMD_SHADER_DESTROY\n");
   1686       {
   1687          const SVGA3dCmdDestroyShader *cmd = (const SVGA3dCmdDestroyShader *)body;
   1688          dump_SVGA3dCmdDestroyShader(cmd);
   1689          body = (const uint8_t *)&cmd[1];
   1690       }
   1691       break;
   1692    case SVGA_3D_CMD_SET_SHADER:
   1693       _debug_printf("\tSVGA_3D_CMD_SET_SHADER\n");
   1694       {
   1695          const SVGA3dCmdSetShader *cmd = (const SVGA3dCmdSetShader *)body;
   1696          dump_SVGA3dCmdSetShader(cmd);
   1697          body = (const uint8_t *)&cmd[1];
   1698       }
   1699       break;
   1700    case SVGA_3D_CMD_SET_SHADER_CONST:
   1701       _debug_printf("\tSVGA_3D_CMD_SET_SHADER_CONST\n");
   1702       {
   1703          const SVGA3dCmdSetShaderConst *cmd = (const SVGA3dCmdSetShaderConst *)body;
   1704          uint32 numConsts = 1 + (size - sizeof *cmd) / (4 * sizeof(uint32));
   1705          dump_SVGA3dCmdSetShaderConst(cmd, numConsts);
   1706          body = next;
   1707       }
   1708       break;
   1709    case SVGA_3D_CMD_DRAW_PRIMITIVES:
   1710       _debug_printf("\tSVGA_3D_CMD_DRAW_PRIMITIVES\n");
   1711       {
   1712          const SVGA3dCmdDrawPrimitives *cmd = (const SVGA3dCmdDrawPrimitives *)body;
   1713          unsigned i, j;
   1714          dump_SVGA3dCmdDrawPrimitives(cmd);
   1715          body = (const uint8_t *)&cmd[1];
   1716          for(i = 0; i < cmd->numVertexDecls; ++i) {
   1717             dump_SVGA3dVertexDecl((const SVGA3dVertexDecl *)body);
   1718             body += sizeof(SVGA3dVertexDecl);
   1719          }
   1720          for(j = 0; j < cmd->numRanges; ++j) {
   1721             dump_SVGA3dPrimitiveRange((const SVGA3dPrimitiveRange *)body);
   1722             body += sizeof(SVGA3dPrimitiveRange);
   1723          }
   1724          while(body + sizeof(SVGA3dVertexDivisor) <= next) {
   1725             dump_SVGA3dVertexDivisor((const SVGA3dVertexDivisor *)body);
   1726             body += sizeof(SVGA3dVertexDivisor);
   1727          }
   1728       }
   1729       break;
   1730    case SVGA_3D_CMD_SETSCISSORRECT:
   1731       _debug_printf("\tSVGA_3D_CMD_SETSCISSORRECT\n");
   1732       {
   1733          const SVGA3dCmdSetScissorRect *cmd = (const SVGA3dCmdSetScissorRect *)body;
   1734          dump_SVGA3dCmdSetScissorRect(cmd);
   1735          body = (const uint8_t *)&cmd[1];
   1736       }
   1737       break;
   1738    case SVGA_3D_CMD_BEGIN_QUERY:
   1739       _debug_printf("\tSVGA_3D_CMD_BEGIN_QUERY\n");
   1740       {
   1741          const SVGA3dCmdBeginQuery *cmd = (const SVGA3dCmdBeginQuery *)body;
   1742          dump_SVGA3dCmdBeginQuery(cmd);
   1743          body = (const uint8_t *)&cmd[1];
   1744       }
   1745       break;
   1746    case SVGA_3D_CMD_END_QUERY:
   1747       _debug_printf("\tSVGA_3D_CMD_END_QUERY\n");
   1748       {
   1749          const SVGA3dCmdEndQuery *cmd = (const SVGA3dCmdEndQuery *)body;
   1750          dump_SVGA3dCmdEndQuery(cmd);
   1751          body = (const uint8_t *)&cmd[1];
   1752       }
   1753       break;
   1754    case SVGA_3D_CMD_WAIT_FOR_QUERY:
   1755       _debug_printf("\tSVGA_3D_CMD_WAIT_FOR_QUERY\n");
   1756       {
   1757          const SVGA3dCmdWaitForQuery *cmd = (const SVGA3dCmdWaitForQuery *)body;
   1758          dump_SVGA3dCmdWaitForQuery(cmd);
   1759          body = (const uint8_t *)&cmd[1];
   1760       }
   1761       break;
   1762    case SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN:
   1763       _debug_printf("\tSVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN\n");
   1764       {
   1765          const SVGA3dCmdBlitSurfaceToScreen *cmd = (const SVGA3dCmdBlitSurfaceToScreen *)body;
   1766          dump_SVGA3dCmdBlitSurfaceToScreen(cmd);
   1767          body = (const uint8_t *)&cmd[1];
   1768          while(body + sizeof(SVGASignedRect) <= next) {
   1769             dump_SVGASignedRect((const SVGASignedRect *)body);
   1770             body += sizeof(SVGASignedRect);
   1771          }
   1772       }
   1773       break;
   1774    default:
   1775       _debug_printf("\t0x%08x\n", cmd_id);
   1776       break;
   1777    }
   1778 
   1779    while(body + sizeof(uint32_t) <= next) {
   1780       _debug_printf("\t\t0x%08x\n", *(const uint32_t *)body);
   1781       body += sizeof(uint32_t);
   1782    }
   1783    while(body + sizeof(uint32_t) <= next)
   1784       _debug_printf("\t\t0x%02x\n", *body++);
   1785 }
   1786 
   1787 
   1788 void
   1789 svga_dump_commands(const void *commands, uint32_t size)
   1790 {
   1791    const uint8_t *next = commands;
   1792    const uint8_t *last = next + size;
   1793 
   1794    assert(size % sizeof(uint32_t) == 0);
   1795 
   1796    while(next < last) {
   1797       const uint32_t cmd_id = *(const uint32_t *)next;
   1798 
   1799       if(SVGA_3D_CMD_BASE <= cmd_id && cmd_id < SVGA_3D_CMD_MAX) {
   1800          const SVGA3dCmdHeader *header = (const SVGA3dCmdHeader *)next;
   1801          const uint8_t *body = (const uint8_t *)&header[1];
   1802 
   1803          next = body + header->size;
   1804          if(next > last)
   1805             break;
   1806 
   1807          svga_dump_command(cmd_id, body, header->size);
   1808       }
   1809       else if(cmd_id == SVGA_CMD_FENCE) {
   1810          _debug_printf("\tSVGA_CMD_FENCE\n");
   1811          _debug_printf("\t\t0x%08x\n", ((const uint32_t *)next)[1]);
   1812          next += 2*sizeof(uint32_t);
   1813       }
   1814       else {
   1815          _debug_printf("\t0x%08x\n", cmd_id);
   1816          next += sizeof(uint32_t);
   1817       }
   1818    }
   1819 }
   1820 
   1821