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_format.h" 34#include "svga_types.h" 35#include "svga_shader_dump.h" 36#include "svga3d_reg.h" 37 38#include "util/u_debug.h" 39#include "svga_dump.h" 40 41static const char * 42shader_name(unsigned type) 43{ 44 switch (type) { 45 case SVGA3D_SHADERTYPE_VS: 46 return "SVGA3D_SHADERTYPE_VS"; 47 case SVGA3D_SHADERTYPE_PS: 48 return "SVGA3D_SHADERTYPE_PS"; 49 case SVGA3D_SHADERTYPE_GS: 50 return "SVGA3D_SHADERTYPE_GS"; 51 default: 52 return "unknown shader type!"; 53 } 54} 55 56 57static void 58dump_SVGA3dVertexDecl(const SVGA3dVertexDecl *cmd) 59{ 60 switch((*cmd).identity.type) { 61 case SVGA3D_DECLTYPE_FLOAT1: 62 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT1\n"); 63 break; 64 case SVGA3D_DECLTYPE_FLOAT2: 65 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT2\n"); 66 break; 67 case SVGA3D_DECLTYPE_FLOAT3: 68 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT3\n"); 69 break; 70 case SVGA3D_DECLTYPE_FLOAT4: 71 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT4\n"); 72 break; 73 case SVGA3D_DECLTYPE_D3DCOLOR: 74 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_D3DCOLOR\n"); 75 break; 76 case SVGA3D_DECLTYPE_UBYTE4: 77 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4\n"); 78 break; 79 case SVGA3D_DECLTYPE_SHORT2: 80 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2\n"); 81 break; 82 case SVGA3D_DECLTYPE_SHORT4: 83 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4\n"); 84 break; 85 case SVGA3D_DECLTYPE_UBYTE4N: 86 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4N\n"); 87 break; 88 case SVGA3D_DECLTYPE_SHORT2N: 89 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2N\n"); 90 break; 91 case SVGA3D_DECLTYPE_SHORT4N: 92 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4N\n"); 93 break; 94 case SVGA3D_DECLTYPE_USHORT2N: 95 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT2N\n"); 96 break; 97 case SVGA3D_DECLTYPE_USHORT4N: 98 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT4N\n"); 99 break; 100 case SVGA3D_DECLTYPE_UDEC3: 101 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UDEC3\n"); 102 break; 103 case SVGA3D_DECLTYPE_DEC3N: 104 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_DEC3N\n"); 105 break; 106 case SVGA3D_DECLTYPE_FLOAT16_2: 107 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_2\n"); 108 break; 109 case SVGA3D_DECLTYPE_FLOAT16_4: 110 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_4\n"); 111 break; 112 case SVGA3D_DECLTYPE_MAX: 113 _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_MAX\n"); 114 break; 115 default: 116 _debug_printf("\t\t.identity.type = %i\n", (*cmd).identity.type); 117 break; 118 } 119 switch((*cmd).identity.method) { 120 case SVGA3D_DECLMETHOD_DEFAULT: 121 _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_DEFAULT\n"); 122 break; 123 case SVGA3D_DECLMETHOD_PARTIALU: 124 _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALU\n"); 125 break; 126 case SVGA3D_DECLMETHOD_PARTIALV: 127 _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALV\n"); 128 break; 129 case SVGA3D_DECLMETHOD_CROSSUV: 130 _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_CROSSUV\n"); 131 break; 132 case SVGA3D_DECLMETHOD_UV: 133 _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_UV\n"); 134 break; 135 case SVGA3D_DECLMETHOD_LOOKUP: 136 _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUP\n"); 137 break; 138 case SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED: 139 _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED\n"); 140 break; 141 default: 142 _debug_printf("\t\t.identity.method = %i\n", (*cmd).identity.method); 143 break; 144 } 145 switch((*cmd).identity.usage) { 146 case SVGA3D_DECLUSAGE_POSITION: 147 _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITION\n"); 148 break; 149 case SVGA3D_DECLUSAGE_BLENDWEIGHT: 150 _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDWEIGHT\n"); 151 break; 152 case SVGA3D_DECLUSAGE_BLENDINDICES: 153 _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDINDICES\n"); 154 break; 155 case SVGA3D_DECLUSAGE_NORMAL: 156 _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_NORMAL\n"); 157 break; 158 case SVGA3D_DECLUSAGE_PSIZE: 159 _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_PSIZE\n"); 160 break; 161 case SVGA3D_DECLUSAGE_TEXCOORD: 162 _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TEXCOORD\n"); 163 break; 164 case SVGA3D_DECLUSAGE_TANGENT: 165 _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TANGENT\n"); 166 break; 167 case SVGA3D_DECLUSAGE_BINORMAL: 168 _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BINORMAL\n"); 169 break; 170 case SVGA3D_DECLUSAGE_TESSFACTOR: 171 _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TESSFACTOR\n"); 172 break; 173 case SVGA3D_DECLUSAGE_POSITIONT: 174 _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITIONT\n"); 175 break; 176 case SVGA3D_DECLUSAGE_COLOR: 177 _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_COLOR\n"); 178 break; 179 case SVGA3D_DECLUSAGE_FOG: 180 _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_FOG\n"); 181 break; 182 case SVGA3D_DECLUSAGE_DEPTH: 183 _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_DEPTH\n"); 184 break; 185 case SVGA3D_DECLUSAGE_SAMPLE: 186 _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_SAMPLE\n"); 187 break; 188 case SVGA3D_DECLUSAGE_MAX: 189 _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_MAX\n"); 190 break; 191 default: 192 _debug_printf("\t\t.identity.usage = %i\n", (*cmd).identity.usage); 193 break; 194 } 195 _debug_printf("\t\t.identity.usageIndex = %u\n", (*cmd).identity.usageIndex); 196 _debug_printf("\t\t.array.surfaceId = %u\n", (*cmd).array.surfaceId); 197 _debug_printf("\t\t.array.offset = %u\n", (*cmd).array.offset); 198 _debug_printf("\t\t.array.stride = %u\n", (*cmd).array.stride); 199 _debug_printf("\t\t.rangeHint.first = %u\n", (*cmd).rangeHint.first); 200 _debug_printf("\t\t.rangeHint.last = %u\n", (*cmd).rangeHint.last); 201} 202 203static void 204dump_SVGA3dTextureState(const SVGA3dTextureState *cmd) 205{ 206 _debug_printf("\t\t.stage = %u\n", (*cmd).stage); 207 switch((*cmd).name) { 208 case SVGA3D_TS_INVALID: 209 _debug_printf("\t\t.name = SVGA3D_TS_INVALID\n"); 210 break; 211 case SVGA3D_TS_BIND_TEXTURE: 212 _debug_printf("\t\t.name = SVGA3D_TS_BIND_TEXTURE\n"); 213 break; 214 case SVGA3D_TS_COLOROP: 215 _debug_printf("\t\t.name = SVGA3D_TS_COLOROP\n"); 216 break; 217 case SVGA3D_TS_COLORARG1: 218 _debug_printf("\t\t.name = SVGA3D_TS_COLORARG1\n"); 219 break; 220 case SVGA3D_TS_COLORARG2: 221 _debug_printf("\t\t.name = SVGA3D_TS_COLORARG2\n"); 222 break; 223 case SVGA3D_TS_ALPHAOP: 224 _debug_printf("\t\t.name = SVGA3D_TS_ALPHAOP\n"); 225 break; 226 case SVGA3D_TS_ALPHAARG1: 227 _debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG1\n"); 228 break; 229 case SVGA3D_TS_ALPHAARG2: 230 _debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG2\n"); 231 break; 232 case SVGA3D_TS_ADDRESSU: 233 _debug_printf("\t\t.name = SVGA3D_TS_ADDRESSU\n"); 234 break; 235 case SVGA3D_TS_ADDRESSV: 236 _debug_printf("\t\t.name = SVGA3D_TS_ADDRESSV\n"); 237 break; 238 case SVGA3D_TS_MIPFILTER: 239 _debug_printf("\t\t.name = SVGA3D_TS_MIPFILTER\n"); 240 break; 241 case SVGA3D_TS_MAGFILTER: 242 _debug_printf("\t\t.name = SVGA3D_TS_MAGFILTER\n"); 243 break; 244 case SVGA3D_TS_MINFILTER: 245 _debug_printf("\t\t.name = SVGA3D_TS_MINFILTER\n"); 246 break; 247 case SVGA3D_TS_BORDERCOLOR: 248 _debug_printf("\t\t.name = SVGA3D_TS_BORDERCOLOR\n"); 249 break; 250 case SVGA3D_TS_TEXCOORDINDEX: 251 _debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDINDEX\n"); 252 break; 253 case SVGA3D_TS_TEXTURETRANSFORMFLAGS: 254 _debug_printf("\t\t.name = SVGA3D_TS_TEXTURETRANSFORMFLAGS\n"); 255 break; 256 case SVGA3D_TS_TEXCOORDGEN: 257 _debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDGEN\n"); 258 break; 259 case SVGA3D_TS_BUMPENVMAT00: 260 _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT00\n"); 261 break; 262 case SVGA3D_TS_BUMPENVMAT01: 263 _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT01\n"); 264 break; 265 case SVGA3D_TS_BUMPENVMAT10: 266 _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT10\n"); 267 break; 268 case SVGA3D_TS_BUMPENVMAT11: 269 _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT11\n"); 270 break; 271 case SVGA3D_TS_TEXTURE_MIPMAP_LEVEL: 272 _debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_MIPMAP_LEVEL\n"); 273 break; 274 case SVGA3D_TS_TEXTURE_LOD_BIAS: 275 _debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_LOD_BIAS\n"); 276 break; 277 case SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL: 278 _debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL\n"); 279 break; 280 case SVGA3D_TS_ADDRESSW: 281 _debug_printf("\t\t.name = SVGA3D_TS_ADDRESSW\n"); 282 break; 283 case SVGA3D_TS_GAMMA: 284 _debug_printf("\t\t.name = SVGA3D_TS_GAMMA\n"); 285 break; 286 case SVGA3D_TS_BUMPENVLSCALE: 287 _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLSCALE\n"); 288 break; 289 case SVGA3D_TS_BUMPENVLOFFSET: 290 _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLOFFSET\n"); 291 break; 292 case SVGA3D_TS_COLORARG0: 293 _debug_printf("\t\t.name = SVGA3D_TS_COLORARG0\n"); 294 break; 295 case SVGA3D_TS_ALPHAARG0: 296 _debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG0\n"); 297 break; 298 case SVGA3D_TS_MAX: 299 _debug_printf("\t\t.name = SVGA3D_TS_MAX\n"); 300 break; 301 default: 302 _debug_printf("\t\t.name = %i\n", (*cmd).name); 303 break; 304 } 305 _debug_printf("\t\t.value = %u\n", (*cmd).value); 306 _debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue); 307} 308 309static void 310dump_SVGA3dViewport(const SVGA3dViewport *cmd) 311{ 312 _debug_printf("\t\t.x = %f\n", (*cmd).x); 313 _debug_printf("\t\t.y = %f\n", (*cmd).y); 314 _debug_printf("\t\t.width = %f\n", (*cmd).width); 315 _debug_printf("\t\t.height = %f\n", (*cmd).height); 316 _debug_printf("\t\t.minDepth = %f\n", (*cmd).minDepth); 317 _debug_printf("\t\t.maxDepth = %f\n", (*cmd).maxDepth); 318} 319 320static void 321dump_SVGA3dSamplerId(const SVGA3dSamplerId *cmd) 322{ 323 _debug_printf("\t\t.id = %u\n", *cmd); 324} 325 326static void 327dump_SVGA3dSoTarget(const SVGA3dSoTarget *cmd) 328{ 329 _debug_printf("\t\t.sid = %u\n", (*cmd).sid); 330 _debug_printf("\t\t.offset = %u\n", (*cmd).offset); 331} 332 333static void 334dump_SVGA3dInputElementDesc(const SVGA3dInputElementDesc *cmd) 335{ 336 _debug_printf("\t\t.inputSlot = %u\n", (*cmd).inputSlot); 337 _debug_printf("\t\t.alignedByteOffset = %u\n", (*cmd).alignedByteOffset); 338 _debug_printf("\t\t.format = %s\n", svga_format_name((*cmd).format)); 339 _debug_printf("\t\t.inputSlotClass = %u\n", (*cmd).inputSlotClass); 340 _debug_printf("\t\t.instanceDataStepRate = %u\n", (*cmd).instanceDataStepRate); 341 _debug_printf("\t\t.inputRegister = %u\n", (*cmd).inputRegister); 342} 343 344static void 345dump_SVGA3dVertexBuffer(const SVGA3dVertexBuffer *cmd) 346{ 347 _debug_printf("\t\t.sid = %u\n", (*cmd).sid); 348 _debug_printf("\t\t.stride = %u\n", (*cmd).stride); 349 _debug_printf("\t\t.offset = %u\n", (*cmd).offset); 350} 351 352static void 353dump_SVGA3dCopyBox(const SVGA3dCopyBox *cmd) 354{ 355 _debug_printf("\t\t.x = %u\n", (*cmd).x); 356 _debug_printf("\t\t.y = %u\n", (*cmd).y); 357 _debug_printf("\t\t.z = %u\n", (*cmd).z); 358 _debug_printf("\t\t.w = %u\n", (*cmd).w); 359 _debug_printf("\t\t.h = %u\n", (*cmd).h); 360 _debug_printf("\t\t.d = %u\n", (*cmd).d); 361 _debug_printf("\t\t.srcx = %u\n", (*cmd).srcx); 362 _debug_printf("\t\t.srcy = %u\n", (*cmd).srcy); 363 _debug_printf("\t\t.srcz = %u\n", (*cmd).srcz); 364} 365 366static void 367dump_SVGA3dShaderResourceViewId(const SVGA3dShaderResourceViewId *id) 368{ 369 _debug_printf("\t\t.id = %u\n", *id); 370} 371 372static void 373dump_SVGA3dCmdSetClipPlane(const SVGA3dCmdSetClipPlane *cmd) 374{ 375 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 376 _debug_printf("\t\t.index = %u\n", (*cmd).index); 377 _debug_printf("\t\t.plane[0] = %f\n", (*cmd).plane[0]); 378 _debug_printf("\t\t.plane[1] = %f\n", (*cmd).plane[1]); 379 _debug_printf("\t\t.plane[2] = %f\n", (*cmd).plane[2]); 380 _debug_printf("\t\t.plane[3] = %f\n", (*cmd).plane[3]); 381} 382 383static void 384dump_SVGA3dCmdWaitForQuery(const SVGA3dCmdWaitForQuery *cmd) 385{ 386 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 387 switch((*cmd).type) { 388 case SVGA3D_QUERYTYPE_OCCLUSION: 389 _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n"); 390 break; 391 case SVGA3D_QUERYTYPE_MAX: 392 _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n"); 393 break; 394 default: 395 _debug_printf("\t\t.type = %i\n", (*cmd).type); 396 break; 397 } 398 _debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId); 399 _debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset); 400} 401 402static void 403dump_SVGA3dCmdSetRenderTarget(const SVGA3dCmdSetRenderTarget *cmd) 404{ 405 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 406 switch((*cmd).type) { 407 case SVGA3D_RT_DEPTH: 408 _debug_printf("\t\t.type = SVGA3D_RT_DEPTH\n"); 409 break; 410 case SVGA3D_RT_STENCIL: 411 _debug_printf("\t\t.type = SVGA3D_RT_STENCIL\n"); 412 break; 413 default: 414 _debug_printf("\t\t.type = SVGA3D_RT_COLOR%u\n", (*cmd).type - SVGA3D_RT_COLOR0); 415 break; 416 } 417 _debug_printf("\t\t.target.sid = %u\n", (*cmd).target.sid); 418 _debug_printf("\t\t.target.face = %u\n", (*cmd).target.face); 419 _debug_printf("\t\t.target.mipmap = %u\n", (*cmd).target.mipmap); 420} 421 422static void 423dump_SVGA3dCmdSetTextureState(const SVGA3dCmdSetTextureState *cmd) 424{ 425 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 426} 427 428static void 429dump_SVGA3dCmdSurfaceCopy(const SVGA3dCmdSurfaceCopy *cmd) 430{ 431 _debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid); 432 _debug_printf("\t\t.src.face = %u\n", (*cmd).src.face); 433 _debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap); 434 _debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid); 435 _debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face); 436 _debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap); 437} 438 439static void 440dump_SVGA3dCmdSetMaterial(const SVGA3dCmdSetMaterial *cmd) 441{ 442 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 443 switch((*cmd).face) { 444 case SVGA3D_FACE_INVALID: 445 _debug_printf("\t\t.face = SVGA3D_FACE_INVALID\n"); 446 break; 447 case SVGA3D_FACE_NONE: 448 _debug_printf("\t\t.face = SVGA3D_FACE_NONE\n"); 449 break; 450 case SVGA3D_FACE_FRONT: 451 _debug_printf("\t\t.face = SVGA3D_FACE_FRONT\n"); 452 break; 453 case SVGA3D_FACE_BACK: 454 _debug_printf("\t\t.face = SVGA3D_FACE_BACK\n"); 455 break; 456 case SVGA3D_FACE_FRONT_BACK: 457 _debug_printf("\t\t.face = SVGA3D_FACE_FRONT_BACK\n"); 458 break; 459 case SVGA3D_FACE_MAX: 460 _debug_printf("\t\t.face = SVGA3D_FACE_MAX\n"); 461 break; 462 default: 463 _debug_printf("\t\t.face = %i\n", (*cmd).face); 464 break; 465 } 466 _debug_printf("\t\t.material.diffuse[0] = %f\n", (*cmd).material.diffuse[0]); 467 _debug_printf("\t\t.material.diffuse[1] = %f\n", (*cmd).material.diffuse[1]); 468 _debug_printf("\t\t.material.diffuse[2] = %f\n", (*cmd).material.diffuse[2]); 469 _debug_printf("\t\t.material.diffuse[3] = %f\n", (*cmd).material.diffuse[3]); 470 _debug_printf("\t\t.material.ambient[0] = %f\n", (*cmd).material.ambient[0]); 471 _debug_printf("\t\t.material.ambient[1] = %f\n", (*cmd).material.ambient[1]); 472 _debug_printf("\t\t.material.ambient[2] = %f\n", (*cmd).material.ambient[2]); 473 _debug_printf("\t\t.material.ambient[3] = %f\n", (*cmd).material.ambient[3]); 474 _debug_printf("\t\t.material.specular[0] = %f\n", (*cmd).material.specular[0]); 475 _debug_printf("\t\t.material.specular[1] = %f\n", (*cmd).material.specular[1]); 476 _debug_printf("\t\t.material.specular[2] = %f\n", (*cmd).material.specular[2]); 477 _debug_printf("\t\t.material.specular[3] = %f\n", (*cmd).material.specular[3]); 478 _debug_printf("\t\t.material.emissive[0] = %f\n", (*cmd).material.emissive[0]); 479 _debug_printf("\t\t.material.emissive[1] = %f\n", (*cmd).material.emissive[1]); 480 _debug_printf("\t\t.material.emissive[2] = %f\n", (*cmd).material.emissive[2]); 481 _debug_printf("\t\t.material.emissive[3] = %f\n", (*cmd).material.emissive[3]); 482 _debug_printf("\t\t.material.shininess = %f\n", (*cmd).material.shininess); 483} 484 485static void 486dump_SVGA3dCmdSetLightData(const SVGA3dCmdSetLightData *cmd) 487{ 488 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 489 _debug_printf("\t\t.index = %u\n", (*cmd).index); 490 switch((*cmd).data.type) { 491 case SVGA3D_LIGHTTYPE_INVALID: 492 _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_INVALID\n"); 493 break; 494 case SVGA3D_LIGHTTYPE_POINT: 495 _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_POINT\n"); 496 break; 497 case SVGA3D_LIGHTTYPE_SPOT1: 498 _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT1\n"); 499 break; 500 case SVGA3D_LIGHTTYPE_SPOT2: 501 _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT2\n"); 502 break; 503 case SVGA3D_LIGHTTYPE_DIRECTIONAL: 504 _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_DIRECTIONAL\n"); 505 break; 506 case SVGA3D_LIGHTTYPE_MAX: 507 _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_MAX\n"); 508 break; 509 default: 510 _debug_printf("\t\t.data.type = %i\n", (*cmd).data.type); 511 break; 512 } 513 _debug_printf("\t\t.data.inWorldSpace = %u\n", (*cmd).data.inWorldSpace); 514 _debug_printf("\t\t.data.diffuse[0] = %f\n", (*cmd).data.diffuse[0]); 515 _debug_printf("\t\t.data.diffuse[1] = %f\n", (*cmd).data.diffuse[1]); 516 _debug_printf("\t\t.data.diffuse[2] = %f\n", (*cmd).data.diffuse[2]); 517 _debug_printf("\t\t.data.diffuse[3] = %f\n", (*cmd).data.diffuse[3]); 518 _debug_printf("\t\t.data.specular[0] = %f\n", (*cmd).data.specular[0]); 519 _debug_printf("\t\t.data.specular[1] = %f\n", (*cmd).data.specular[1]); 520 _debug_printf("\t\t.data.specular[2] = %f\n", (*cmd).data.specular[2]); 521 _debug_printf("\t\t.data.specular[3] = %f\n", (*cmd).data.specular[3]); 522 _debug_printf("\t\t.data.ambient[0] = %f\n", (*cmd).data.ambient[0]); 523 _debug_printf("\t\t.data.ambient[1] = %f\n", (*cmd).data.ambient[1]); 524 _debug_printf("\t\t.data.ambient[2] = %f\n", (*cmd).data.ambient[2]); 525 _debug_printf("\t\t.data.ambient[3] = %f\n", (*cmd).data.ambient[3]); 526 _debug_printf("\t\t.data.position[0] = %f\n", (*cmd).data.position[0]); 527 _debug_printf("\t\t.data.position[1] = %f\n", (*cmd).data.position[1]); 528 _debug_printf("\t\t.data.position[2] = %f\n", (*cmd).data.position[2]); 529 _debug_printf("\t\t.data.position[3] = %f\n", (*cmd).data.position[3]); 530 _debug_printf("\t\t.data.direction[0] = %f\n", (*cmd).data.direction[0]); 531 _debug_printf("\t\t.data.direction[1] = %f\n", (*cmd).data.direction[1]); 532 _debug_printf("\t\t.data.direction[2] = %f\n", (*cmd).data.direction[2]); 533 _debug_printf("\t\t.data.direction[3] = %f\n", (*cmd).data.direction[3]); 534 _debug_printf("\t\t.data.range = %f\n", (*cmd).data.range); 535 _debug_printf("\t\t.data.falloff = %f\n", (*cmd).data.falloff); 536 _debug_printf("\t\t.data.attenuation0 = %f\n", (*cmd).data.attenuation0); 537 _debug_printf("\t\t.data.attenuation1 = %f\n", (*cmd).data.attenuation1); 538 _debug_printf("\t\t.data.attenuation2 = %f\n", (*cmd).data.attenuation2); 539 _debug_printf("\t\t.data.theta = %f\n", (*cmd).data.theta); 540 _debug_printf("\t\t.data.phi = %f\n", (*cmd).data.phi); 541} 542 543static void 544dump_SVGA3dCmdSetViewport(const SVGA3dCmdSetViewport *cmd) 545{ 546 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 547 _debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x); 548 _debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y); 549 _debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w); 550 _debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h); 551} 552 553static void 554dump_SVGA3dCmdSetScissorRect(const SVGA3dCmdSetScissorRect *cmd) 555{ 556 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 557 _debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x); 558 _debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y); 559 _debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w); 560 _debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h); 561} 562 563static void 564dump_SVGA3dCopyRect(const SVGA3dCopyRect *cmd) 565{ 566 _debug_printf("\t\t.x = %u\n", (*cmd).x); 567 _debug_printf("\t\t.y = %u\n", (*cmd).y); 568 _debug_printf("\t\t.w = %u\n", (*cmd).w); 569 _debug_printf("\t\t.h = %u\n", (*cmd).h); 570 _debug_printf("\t\t.srcx = %u\n", (*cmd).srcx); 571 _debug_printf("\t\t.srcy = %u\n", (*cmd).srcy); 572} 573 574static void 575dump_SVGA3dCmdSetShader(const SVGA3dCmdSetShader *cmd) 576{ 577 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 578 _debug_printf("\t\t.type = %s\n", shader_name(cmd->type)); 579 _debug_printf("\t\t.shid = %u\n", (*cmd).shid); 580} 581 582static void 583dump_SVGA3dCmdEndQuery(const SVGA3dCmdEndQuery *cmd) 584{ 585 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 586 switch((*cmd).type) { 587 case SVGA3D_QUERYTYPE_OCCLUSION: 588 _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n"); 589 break; 590 case SVGA3D_QUERYTYPE_MAX: 591 _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n"); 592 break; 593 default: 594 _debug_printf("\t\t.type = %i\n", (*cmd).type); 595 break; 596 } 597 _debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId); 598 _debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset); 599} 600 601static void 602dump_SVGA3dSize(const SVGA3dSize *cmd) 603{ 604 _debug_printf("\t\t.width = %u\n", (*cmd).width); 605 _debug_printf("\t\t.height = %u\n", (*cmd).height); 606 _debug_printf("\t\t.depth = %u\n", (*cmd).depth); 607} 608 609static void 610dump_SVGA3dCmdDestroySurface(const SVGA3dCmdDestroySurface *cmd) 611{ 612 _debug_printf("\t\t.sid = %u\n", (*cmd).sid); 613} 614 615static void 616dump_SVGA3dCmdDefineContext(const SVGA3dCmdDefineContext *cmd) 617{ 618 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 619} 620 621static void 622dump_SVGA3dRect(const SVGA3dRect *cmd) 623{ 624 _debug_printf("\t\t.x = %u\n", (*cmd).x); 625 _debug_printf("\t\t.y = %u\n", (*cmd).y); 626 _debug_printf("\t\t.w = %u\n", (*cmd).w); 627 _debug_printf("\t\t.h = %u\n", (*cmd).h); 628} 629 630static void 631dump_SVGA3dCmdBeginQuery(const SVGA3dCmdBeginQuery *cmd) 632{ 633 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 634 switch((*cmd).type) { 635 case SVGA3D_QUERYTYPE_OCCLUSION: 636 _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n"); 637 break; 638 case SVGA3D_QUERYTYPE_MAX: 639 _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n"); 640 break; 641 default: 642 _debug_printf("\t\t.type = %i\n", (*cmd).type); 643 break; 644 } 645} 646 647static void 648dump_SVGA3dRenderState(const SVGA3dRenderState *cmd) 649{ 650 switch((*cmd).state) { 651 case SVGA3D_RS_INVALID: 652 _debug_printf("\t\t.state = SVGA3D_RS_INVALID\n"); 653 break; 654 case SVGA3D_RS_ZENABLE: 655 _debug_printf("\t\t.state = SVGA3D_RS_ZENABLE\n"); 656 break; 657 case SVGA3D_RS_ZWRITEENABLE: 658 _debug_printf("\t\t.state = SVGA3D_RS_ZWRITEENABLE\n"); 659 break; 660 case SVGA3D_RS_ALPHATESTENABLE: 661 _debug_printf("\t\t.state = SVGA3D_RS_ALPHATESTENABLE\n"); 662 break; 663 case SVGA3D_RS_DITHERENABLE: 664 _debug_printf("\t\t.state = SVGA3D_RS_DITHERENABLE\n"); 665 break; 666 case SVGA3D_RS_BLENDENABLE: 667 _debug_printf("\t\t.state = SVGA3D_RS_BLENDENABLE\n"); 668 break; 669 case SVGA3D_RS_FOGENABLE: 670 _debug_printf("\t\t.state = SVGA3D_RS_FOGENABLE\n"); 671 break; 672 case SVGA3D_RS_SPECULARENABLE: 673 _debug_printf("\t\t.state = SVGA3D_RS_SPECULARENABLE\n"); 674 break; 675 case SVGA3D_RS_STENCILENABLE: 676 _debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE\n"); 677 break; 678 case SVGA3D_RS_LIGHTINGENABLE: 679 _debug_printf("\t\t.state = SVGA3D_RS_LIGHTINGENABLE\n"); 680 break; 681 case SVGA3D_RS_NORMALIZENORMALS: 682 _debug_printf("\t\t.state = SVGA3D_RS_NORMALIZENORMALS\n"); 683 break; 684 case SVGA3D_RS_POINTSPRITEENABLE: 685 _debug_printf("\t\t.state = SVGA3D_RS_POINTSPRITEENABLE\n"); 686 break; 687 case SVGA3D_RS_POINTSCALEENABLE: 688 _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALEENABLE\n"); 689 break; 690 case SVGA3D_RS_STENCILREF: 691 _debug_printf("\t\t.state = SVGA3D_RS_STENCILREF\n"); 692 break; 693 case SVGA3D_RS_STENCILMASK: 694 _debug_printf("\t\t.state = SVGA3D_RS_STENCILMASK\n"); 695 break; 696 case SVGA3D_RS_STENCILWRITEMASK: 697 _debug_printf("\t\t.state = SVGA3D_RS_STENCILWRITEMASK\n"); 698 break; 699 case SVGA3D_RS_FOGSTART: 700 _debug_printf("\t\t.state = SVGA3D_RS_FOGSTART\n"); 701 break; 702 case SVGA3D_RS_FOGEND: 703 _debug_printf("\t\t.state = SVGA3D_RS_FOGEND\n"); 704 break; 705 case SVGA3D_RS_FOGDENSITY: 706 _debug_printf("\t\t.state = SVGA3D_RS_FOGDENSITY\n"); 707 break; 708 case SVGA3D_RS_POINTSIZE: 709 _debug_printf("\t\t.state = SVGA3D_RS_POINTSIZE\n"); 710 break; 711 case SVGA3D_RS_POINTSIZEMIN: 712 _debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMIN\n"); 713 break; 714 case SVGA3D_RS_POINTSIZEMAX: 715 _debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMAX\n"); 716 break; 717 case SVGA3D_RS_POINTSCALE_A: 718 _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_A\n"); 719 break; 720 case SVGA3D_RS_POINTSCALE_B: 721 _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_B\n"); 722 break; 723 case SVGA3D_RS_POINTSCALE_C: 724 _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_C\n"); 725 break; 726 case SVGA3D_RS_FOGCOLOR: 727 _debug_printf("\t\t.state = SVGA3D_RS_FOGCOLOR\n"); 728 break; 729 case SVGA3D_RS_AMBIENT: 730 _debug_printf("\t\t.state = SVGA3D_RS_AMBIENT\n"); 731 break; 732 case SVGA3D_RS_CLIPPLANEENABLE: 733 _debug_printf("\t\t.state = SVGA3D_RS_CLIPPLANEENABLE\n"); 734 break; 735 case SVGA3D_RS_FOGMODE: 736 _debug_printf("\t\t.state = SVGA3D_RS_FOGMODE\n"); 737 break; 738 case SVGA3D_RS_FILLMODE: 739 _debug_printf("\t\t.state = SVGA3D_RS_FILLMODE\n"); 740 break; 741 case SVGA3D_RS_SHADEMODE: 742 _debug_printf("\t\t.state = SVGA3D_RS_SHADEMODE\n"); 743 break; 744 case SVGA3D_RS_LINEPATTERN: 745 _debug_printf("\t\t.state = SVGA3D_RS_LINEPATTERN\n"); 746 break; 747 case SVGA3D_RS_SRCBLEND: 748 _debug_printf("\t\t.state = SVGA3D_RS_SRCBLEND\n"); 749 break; 750 case SVGA3D_RS_DSTBLEND: 751 _debug_printf("\t\t.state = SVGA3D_RS_DSTBLEND\n"); 752 break; 753 case SVGA3D_RS_BLENDEQUATION: 754 _debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATION\n"); 755 break; 756 case SVGA3D_RS_CULLMODE: 757 _debug_printf("\t\t.state = SVGA3D_RS_CULLMODE\n"); 758 break; 759 case SVGA3D_RS_ZFUNC: 760 _debug_printf("\t\t.state = SVGA3D_RS_ZFUNC\n"); 761 break; 762 case SVGA3D_RS_ALPHAFUNC: 763 _debug_printf("\t\t.state = SVGA3D_RS_ALPHAFUNC\n"); 764 break; 765 case SVGA3D_RS_STENCILFUNC: 766 _debug_printf("\t\t.state = SVGA3D_RS_STENCILFUNC\n"); 767 break; 768 case SVGA3D_RS_STENCILFAIL: 769 _debug_printf("\t\t.state = SVGA3D_RS_STENCILFAIL\n"); 770 break; 771 case SVGA3D_RS_STENCILZFAIL: 772 _debug_printf("\t\t.state = SVGA3D_RS_STENCILZFAIL\n"); 773 break; 774 case SVGA3D_RS_STENCILPASS: 775 _debug_printf("\t\t.state = SVGA3D_RS_STENCILPASS\n"); 776 break; 777 case SVGA3D_RS_ALPHAREF: 778 _debug_printf("\t\t.state = SVGA3D_RS_ALPHAREF\n"); 779 break; 780 case SVGA3D_RS_FRONTWINDING: 781 _debug_printf("\t\t.state = SVGA3D_RS_FRONTWINDING\n"); 782 break; 783 case SVGA3D_RS_COORDINATETYPE: 784 _debug_printf("\t\t.state = SVGA3D_RS_COORDINATETYPE\n"); 785 break; 786 case SVGA3D_RS_ZBIAS: 787 _debug_printf("\t\t.state = SVGA3D_RS_ZBIAS\n"); 788 break; 789 case SVGA3D_RS_RANGEFOGENABLE: 790 _debug_printf("\t\t.state = SVGA3D_RS_RANGEFOGENABLE\n"); 791 break; 792 case SVGA3D_RS_COLORWRITEENABLE: 793 _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE\n"); 794 break; 795 case SVGA3D_RS_VERTEXMATERIALENABLE: 796 _debug_printf("\t\t.state = SVGA3D_RS_VERTEXMATERIALENABLE\n"); 797 break; 798 case SVGA3D_RS_DIFFUSEMATERIALSOURCE: 799 _debug_printf("\t\t.state = SVGA3D_RS_DIFFUSEMATERIALSOURCE\n"); 800 break; 801 case SVGA3D_RS_SPECULARMATERIALSOURCE: 802 _debug_printf("\t\t.state = SVGA3D_RS_SPECULARMATERIALSOURCE\n"); 803 break; 804 case SVGA3D_RS_AMBIENTMATERIALSOURCE: 805 _debug_printf("\t\t.state = SVGA3D_RS_AMBIENTMATERIALSOURCE\n"); 806 break; 807 case SVGA3D_RS_EMISSIVEMATERIALSOURCE: 808 _debug_printf("\t\t.state = SVGA3D_RS_EMISSIVEMATERIALSOURCE\n"); 809 break; 810 case SVGA3D_RS_TEXTUREFACTOR: 811 _debug_printf("\t\t.state = SVGA3D_RS_TEXTUREFACTOR\n"); 812 break; 813 case SVGA3D_RS_LOCALVIEWER: 814 _debug_printf("\t\t.state = SVGA3D_RS_LOCALVIEWER\n"); 815 break; 816 case SVGA3D_RS_SCISSORTESTENABLE: 817 _debug_printf("\t\t.state = SVGA3D_RS_SCISSORTESTENABLE\n"); 818 break; 819 case SVGA3D_RS_BLENDCOLOR: 820 _debug_printf("\t\t.state = SVGA3D_RS_BLENDCOLOR\n"); 821 break; 822 case SVGA3D_RS_STENCILENABLE2SIDED: 823 _debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE2SIDED\n"); 824 break; 825 case SVGA3D_RS_CCWSTENCILFUNC: 826 _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFUNC\n"); 827 break; 828 case SVGA3D_RS_CCWSTENCILFAIL: 829 _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFAIL\n"); 830 break; 831 case SVGA3D_RS_CCWSTENCILZFAIL: 832 _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILZFAIL\n"); 833 break; 834 case SVGA3D_RS_CCWSTENCILPASS: 835 _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILPASS\n"); 836 break; 837 case SVGA3D_RS_VERTEXBLEND: 838 _debug_printf("\t\t.state = SVGA3D_RS_VERTEXBLEND\n"); 839 break; 840 case SVGA3D_RS_SLOPESCALEDEPTHBIAS: 841 _debug_printf("\t\t.state = SVGA3D_RS_SLOPESCALEDEPTHBIAS\n"); 842 break; 843 case SVGA3D_RS_DEPTHBIAS: 844 _debug_printf("\t\t.state = SVGA3D_RS_DEPTHBIAS\n"); 845 break; 846 case SVGA3D_RS_OUTPUTGAMMA: 847 _debug_printf("\t\t.state = SVGA3D_RS_OUTPUTGAMMA\n"); 848 break; 849 case SVGA3D_RS_ZVISIBLE: 850 _debug_printf("\t\t.state = SVGA3D_RS_ZVISIBLE\n"); 851 break; 852 case SVGA3D_RS_LASTPIXEL: 853 _debug_printf("\t\t.state = SVGA3D_RS_LASTPIXEL\n"); 854 break; 855 case SVGA3D_RS_CLIPPING: 856 _debug_printf("\t\t.state = SVGA3D_RS_CLIPPING\n"); 857 break; 858 case SVGA3D_RS_WRAP0: 859 _debug_printf("\t\t.state = SVGA3D_RS_WRAP0\n"); 860 break; 861 case SVGA3D_RS_WRAP1: 862 _debug_printf("\t\t.state = SVGA3D_RS_WRAP1\n"); 863 break; 864 case SVGA3D_RS_WRAP2: 865 _debug_printf("\t\t.state = SVGA3D_RS_WRAP2\n"); 866 break; 867 case SVGA3D_RS_WRAP3: 868 _debug_printf("\t\t.state = SVGA3D_RS_WRAP3\n"); 869 break; 870 case SVGA3D_RS_WRAP4: 871 _debug_printf("\t\t.state = SVGA3D_RS_WRAP4\n"); 872 break; 873 case SVGA3D_RS_WRAP5: 874 _debug_printf("\t\t.state = SVGA3D_RS_WRAP5\n"); 875 break; 876 case SVGA3D_RS_WRAP6: 877 _debug_printf("\t\t.state = SVGA3D_RS_WRAP6\n"); 878 break; 879 case SVGA3D_RS_WRAP7: 880 _debug_printf("\t\t.state = SVGA3D_RS_WRAP7\n"); 881 break; 882 case SVGA3D_RS_WRAP8: 883 _debug_printf("\t\t.state = SVGA3D_RS_WRAP8\n"); 884 break; 885 case SVGA3D_RS_WRAP9: 886 _debug_printf("\t\t.state = SVGA3D_RS_WRAP9\n"); 887 break; 888 case SVGA3D_RS_WRAP10: 889 _debug_printf("\t\t.state = SVGA3D_RS_WRAP10\n"); 890 break; 891 case SVGA3D_RS_WRAP11: 892 _debug_printf("\t\t.state = SVGA3D_RS_WRAP11\n"); 893 break; 894 case SVGA3D_RS_WRAP12: 895 _debug_printf("\t\t.state = SVGA3D_RS_WRAP12\n"); 896 break; 897 case SVGA3D_RS_WRAP13: 898 _debug_printf("\t\t.state = SVGA3D_RS_WRAP13\n"); 899 break; 900 case SVGA3D_RS_WRAP14: 901 _debug_printf("\t\t.state = SVGA3D_RS_WRAP14\n"); 902 break; 903 case SVGA3D_RS_WRAP15: 904 _debug_printf("\t\t.state = SVGA3D_RS_WRAP15\n"); 905 break; 906 case SVGA3D_RS_MULTISAMPLEANTIALIAS: 907 _debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEANTIALIAS\n"); 908 break; 909 case SVGA3D_RS_MULTISAMPLEMASK: 910 _debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEMASK\n"); 911 break; 912 case SVGA3D_RS_INDEXEDVERTEXBLENDENABLE: 913 _debug_printf("\t\t.state = SVGA3D_RS_INDEXEDVERTEXBLENDENABLE\n"); 914 break; 915 case SVGA3D_RS_TWEENFACTOR: 916 _debug_printf("\t\t.state = SVGA3D_RS_TWEENFACTOR\n"); 917 break; 918 case SVGA3D_RS_ANTIALIASEDLINEENABLE: 919 _debug_printf("\t\t.state = SVGA3D_RS_ANTIALIASEDLINEENABLE\n"); 920 break; 921 case SVGA3D_RS_COLORWRITEENABLE1: 922 _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE1\n"); 923 break; 924 case SVGA3D_RS_COLORWRITEENABLE2: 925 _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE2\n"); 926 break; 927 case SVGA3D_RS_COLORWRITEENABLE3: 928 _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE3\n"); 929 break; 930 case SVGA3D_RS_SEPARATEALPHABLENDENABLE: 931 _debug_printf("\t\t.state = SVGA3D_RS_SEPARATEALPHABLENDENABLE\n"); 932 break; 933 case SVGA3D_RS_SRCBLENDALPHA: 934 _debug_printf("\t\t.state = SVGA3D_RS_SRCBLENDALPHA\n"); 935 break; 936 case SVGA3D_RS_DSTBLENDALPHA: 937 _debug_printf("\t\t.state = SVGA3D_RS_DSTBLENDALPHA\n"); 938 break; 939 case SVGA3D_RS_BLENDEQUATIONALPHA: 940 _debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATIONALPHA\n"); 941 break; 942 case SVGA3D_RS_MAX: 943 _debug_printf("\t\t.state = SVGA3D_RS_MAX\n"); 944 break; 945 default: 946 _debug_printf("\t\t.state = %i\n", (*cmd).state); 947 break; 948 } 949 _debug_printf("\t\t.uintValue = %u\n", (*cmd).uintValue); 950 _debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue); 951} 952 953static void 954dump_SVGA3dVertexDivisor(const SVGA3dVertexDivisor *cmd) 955{ 956 _debug_printf("\t\t.value = %u\n", (*cmd).value); 957 _debug_printf("\t\t.count = %u\n", (*cmd).count); 958 _debug_printf("\t\t.indexedData = %u\n", (*cmd).indexedData); 959 _debug_printf("\t\t.instanceData = %u\n", (*cmd).instanceData); 960} 961 962static void 963dump_SVGA3dCmdDefineShader(const SVGA3dCmdDefineShader *cmd) 964{ 965 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 966 _debug_printf("\t\t.shid = %u\n", (*cmd).shid); 967 switch((*cmd).type) { 968 case SVGA3D_SHADERTYPE_VS: 969 _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n"); 970 break; 971 case SVGA3D_SHADERTYPE_PS: 972 _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n"); 973 break; 974 default: 975 _debug_printf("\t\t.type = %i\n", (*cmd).type); 976 break; 977 } 978} 979 980static void 981dump_constants(SVGA3dShaderConstType type, unsigned start, 982 unsigned numConsts, const void *buf) 983{ 984 unsigned i; 985 const float (*fvalues)[4]; 986 const int32 (*ivalues)[4]; 987 988 switch (type) { 989 case SVGA3D_CONST_TYPE_FLOAT: 990 _debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_FLOAT\n"); 991 fvalues = (const float (*)[4]) buf; 992 for (i = 0; i < numConsts; ++i) { 993 _debug_printf("\t\t.values[%u] = {%f, %f, %f, %f}\n", 994 start + i, 995 fvalues[i][0], 996 fvalues[i][1], 997 fvalues[i][2], 998 fvalues[i][3]); 999 } 1000 break; 1001 case SVGA3D_CONST_TYPE_INT: 1002 _debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_INT\n"); 1003 ivalues = (const int32 (*)[4]) buf; 1004 for (i = 0; i < numConsts; ++i) { 1005 _debug_printf("\t\t.values[%u] = {%i, %i, %i, %i}\n", 1006 start + i, 1007 ivalues[i][0], 1008 ivalues[i][1], 1009 ivalues[i][2], 1010 ivalues[i][3]); 1011 } 1012 break; 1013 case SVGA3D_CONST_TYPE_BOOL: 1014 _debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_BOOL\n"); 1015 ivalues = (const int32 (*)[4]) buf; 1016 for (i = 0; i < numConsts; ++i) { 1017 _debug_printf("\t\t.values[%u] = {%i, %i, %i, %i}\n", 1018 start + i, 1019 ivalues[i][0], 1020 ivalues[i][1], 1021 ivalues[i][2], 1022 ivalues[i][3]); 1023 } 1024 break; 1025 default: 1026 _debug_printf("\t\t.ctype = %i\n", type); 1027 ivalues = (const int32 (*)[4]) buf; 1028 for (i = 0; i < numConsts; ++i) { 1029 _debug_printf("\t\t.values[%u] = {%i, %i, %i, %i}\n", 1030 start + i, 1031 ivalues[i][0], 1032 ivalues[i][1], 1033 ivalues[i][2], 1034 ivalues[i][3]); 1035 } 1036 break; 1037 } 1038} 1039 1040static void 1041dump_SVGA3dCmdSetShaderConst(const SVGA3dCmdSetShaderConst *cmd, uint32 numConsts) 1042{ 1043 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 1044 _debug_printf("\t\t.reg = %u\n", (*cmd).reg); 1045 _debug_printf("\t\t.type = %s\n", shader_name((*cmd).type)); 1046 dump_constants((*cmd).ctype, cmd->reg, numConsts, cmd->values); 1047} 1048 1049static void 1050dump_SVGA3dCmdSetGBShaderConstInline(const SVGA3dCmdSetGBShaderConstInline *cmd, uint32 numConsts) 1051{ 1052 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 1053 _debug_printf("\t\t.reg = %u\n", (*cmd).regStart); 1054 _debug_printf("\t\t.type = %s\n", shader_name((*cmd).shaderType)); 1055 dump_constants((*cmd).constType, cmd->regStart, numConsts, &cmd[1]); 1056} 1057 1058 1059static void 1060dump_SVGA3dCmdSetZRange(const SVGA3dCmdSetZRange *cmd) 1061{ 1062 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 1063 _debug_printf("\t\t.zRange.min = %f\n", (*cmd).zRange.min); 1064 _debug_printf("\t\t.zRange.max = %f\n", (*cmd).zRange.max); 1065} 1066 1067static void 1068dump_SVGA3dCmdDrawPrimitives(const SVGA3dCmdDrawPrimitives *cmd) 1069{ 1070 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 1071 _debug_printf("\t\t.numVertexDecls = %u\n", (*cmd).numVertexDecls); 1072 _debug_printf("\t\t.numRanges = %u\n", (*cmd).numRanges); 1073} 1074 1075static void 1076dump_SVGA3dCmdSetLightEnabled(const SVGA3dCmdSetLightEnabled *cmd) 1077{ 1078 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 1079 _debug_printf("\t\t.index = %u\n", (*cmd).index); 1080 _debug_printf("\t\t.enabled = %u\n", (*cmd).enabled); 1081} 1082 1083static void 1084dump_SVGA3dPrimitiveRange(const SVGA3dPrimitiveRange *cmd) 1085{ 1086 switch((*cmd).primType) { 1087 case SVGA3D_PRIMITIVE_INVALID: 1088 _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_INVALID\n"); 1089 break; 1090 case SVGA3D_PRIMITIVE_TRIANGLELIST: 1091 _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLELIST\n"); 1092 break; 1093 case SVGA3D_PRIMITIVE_POINTLIST: 1094 _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_POINTLIST\n"); 1095 break; 1096 case SVGA3D_PRIMITIVE_LINELIST: 1097 _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINELIST\n"); 1098 break; 1099 case SVGA3D_PRIMITIVE_LINESTRIP: 1100 _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINESTRIP\n"); 1101 break; 1102 case SVGA3D_PRIMITIVE_TRIANGLESTRIP: 1103 _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLESTRIP\n"); 1104 break; 1105 case SVGA3D_PRIMITIVE_TRIANGLEFAN: 1106 _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLEFAN\n"); 1107 break; 1108 case SVGA3D_PRIMITIVE_MAX: 1109 _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_MAX\n"); 1110 break; 1111 default: 1112 _debug_printf("\t\t.primType = %i\n", (*cmd).primType); 1113 break; 1114 } 1115 _debug_printf("\t\t.primitiveCount = %u\n", (*cmd).primitiveCount); 1116 _debug_printf("\t\t.indexArray.surfaceId = %u\n", (*cmd).indexArray.surfaceId); 1117 _debug_printf("\t\t.indexArray.offset = %u\n", (*cmd).indexArray.offset); 1118 _debug_printf("\t\t.indexArray.stride = %u\n", (*cmd).indexArray.stride); 1119 _debug_printf("\t\t.indexWidth = %u\n", (*cmd).indexWidth); 1120 _debug_printf("\t\t.indexBias = %i\n", (*cmd).indexBias); 1121} 1122 1123static void 1124dump_SVGA3dCmdPresent(const SVGA3dCmdPresent *cmd) 1125{ 1126 _debug_printf("\t\t.sid = %u\n", (*cmd).sid); 1127} 1128 1129static void 1130dump_SVGA3dCmdSetRenderState(const SVGA3dCmdSetRenderState *cmd) 1131{ 1132 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 1133} 1134 1135static void 1136dump_SVGA3dCmdSurfaceStretchBlt(const SVGA3dCmdSurfaceStretchBlt *cmd) 1137{ 1138 _debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid); 1139 _debug_printf("\t\t.src.face = %u\n", (*cmd).src.face); 1140 _debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap); 1141 _debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid); 1142 _debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face); 1143 _debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap); 1144 _debug_printf("\t\t.boxSrc.x = %u\n", (*cmd).boxSrc.x); 1145 _debug_printf("\t\t.boxSrc.y = %u\n", (*cmd).boxSrc.y); 1146 _debug_printf("\t\t.boxSrc.z = %u\n", (*cmd).boxSrc.z); 1147 _debug_printf("\t\t.boxSrc.w = %u\n", (*cmd).boxSrc.w); 1148 _debug_printf("\t\t.boxSrc.h = %u\n", (*cmd).boxSrc.h); 1149 _debug_printf("\t\t.boxSrc.d = %u\n", (*cmd).boxSrc.d); 1150 _debug_printf("\t\t.boxDest.x = %u\n", (*cmd).boxDest.x); 1151 _debug_printf("\t\t.boxDest.y = %u\n", (*cmd).boxDest.y); 1152 _debug_printf("\t\t.boxDest.z = %u\n", (*cmd).boxDest.z); 1153 _debug_printf("\t\t.boxDest.w = %u\n", (*cmd).boxDest.w); 1154 _debug_printf("\t\t.boxDest.h = %u\n", (*cmd).boxDest.h); 1155 _debug_printf("\t\t.boxDest.d = %u\n", (*cmd).boxDest.d); 1156 switch((*cmd).mode) { 1157 case SVGA3D_STRETCH_BLT_POINT: 1158 _debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_POINT\n"); 1159 break; 1160 case SVGA3D_STRETCH_BLT_LINEAR: 1161 _debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_LINEAR\n"); 1162 break; 1163 case SVGA3D_STRETCH_BLT_MAX: 1164 _debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_MAX\n"); 1165 break; 1166 default: 1167 _debug_printf("\t\t.mode = %i\n", (*cmd).mode); 1168 break; 1169 } 1170} 1171 1172static void 1173dump_SVGA3dCmdSurfaceDMA(const SVGA3dCmdSurfaceDMA *cmd) 1174{ 1175 _debug_printf("\t\t.guest.ptr.gmrId = %u\n", (*cmd).guest.ptr.gmrId); 1176 _debug_printf("\t\t.guest.ptr.offset = %u\n", (*cmd).guest.ptr.offset); 1177 _debug_printf("\t\t.guest.pitch = %u\n", (*cmd).guest.pitch); 1178 _debug_printf("\t\t.host.sid = %u\n", (*cmd).host.sid); 1179 _debug_printf("\t\t.host.face = %u\n", (*cmd).host.face); 1180 _debug_printf("\t\t.host.mipmap = %u\n", (*cmd).host.mipmap); 1181 switch((*cmd).transfer) { 1182 case SVGA3D_WRITE_HOST_VRAM: 1183 _debug_printf("\t\t.transfer = SVGA3D_WRITE_HOST_VRAM\n"); 1184 break; 1185 case SVGA3D_READ_HOST_VRAM: 1186 _debug_printf("\t\t.transfer = SVGA3D_READ_HOST_VRAM\n"); 1187 break; 1188 default: 1189 _debug_printf("\t\t.transfer = %i\n", (*cmd).transfer); 1190 break; 1191 } 1192} 1193 1194static void 1195dump_SVGA3dCmdSurfaceDMASuffix(const SVGA3dCmdSurfaceDMASuffix *cmd) 1196{ 1197 _debug_printf("\t\t.suffixSize = %u\n", (*cmd).suffixSize); 1198 _debug_printf("\t\t.maximumOffset = %u\n", (*cmd).maximumOffset); 1199 _debug_printf("\t\t.flags.discard = %u\n", (*cmd).flags.discard); 1200 _debug_printf("\t\t.flags.unsynchronized = %u\n", (*cmd).flags.unsynchronized); 1201} 1202 1203static void 1204dump_SVGA3dCmdSetTransform(const SVGA3dCmdSetTransform *cmd) 1205{ 1206 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 1207 switch((*cmd).type) { 1208 case SVGA3D_TRANSFORM_INVALID: 1209 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_INVALID\n"); 1210 break; 1211 case SVGA3D_TRANSFORM_WORLD: 1212 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD\n"); 1213 break; 1214 case SVGA3D_TRANSFORM_VIEW: 1215 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_VIEW\n"); 1216 break; 1217 case SVGA3D_TRANSFORM_PROJECTION: 1218 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_PROJECTION\n"); 1219 break; 1220 case SVGA3D_TRANSFORM_TEXTURE0: 1221 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE0\n"); 1222 break; 1223 case SVGA3D_TRANSFORM_TEXTURE1: 1224 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE1\n"); 1225 break; 1226 case SVGA3D_TRANSFORM_TEXTURE2: 1227 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE2\n"); 1228 break; 1229 case SVGA3D_TRANSFORM_TEXTURE3: 1230 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE3\n"); 1231 break; 1232 case SVGA3D_TRANSFORM_TEXTURE4: 1233 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE4\n"); 1234 break; 1235 case SVGA3D_TRANSFORM_TEXTURE5: 1236 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE5\n"); 1237 break; 1238 case SVGA3D_TRANSFORM_TEXTURE6: 1239 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE6\n"); 1240 break; 1241 case SVGA3D_TRANSFORM_TEXTURE7: 1242 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE7\n"); 1243 break; 1244 case SVGA3D_TRANSFORM_WORLD1: 1245 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD1\n"); 1246 break; 1247 case SVGA3D_TRANSFORM_WORLD2: 1248 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD2\n"); 1249 break; 1250 case SVGA3D_TRANSFORM_WORLD3: 1251 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD3\n"); 1252 break; 1253 case SVGA3D_TRANSFORM_MAX: 1254 _debug_printf("\t\t.type = SVGA3D_TRANSFORM_MAX\n"); 1255 break; 1256 default: 1257 _debug_printf("\t\t.type = %i\n", (*cmd).type); 1258 break; 1259 } 1260 _debug_printf("\t\t.matrix[0] = %f\n", (*cmd).matrix[0]); 1261 _debug_printf("\t\t.matrix[1] = %f\n", (*cmd).matrix[1]); 1262 _debug_printf("\t\t.matrix[2] = %f\n", (*cmd).matrix[2]); 1263 _debug_printf("\t\t.matrix[3] = %f\n", (*cmd).matrix[3]); 1264 _debug_printf("\t\t.matrix[4] = %f\n", (*cmd).matrix[4]); 1265 _debug_printf("\t\t.matrix[5] = %f\n", (*cmd).matrix[5]); 1266 _debug_printf("\t\t.matrix[6] = %f\n", (*cmd).matrix[6]); 1267 _debug_printf("\t\t.matrix[7] = %f\n", (*cmd).matrix[7]); 1268 _debug_printf("\t\t.matrix[8] = %f\n", (*cmd).matrix[8]); 1269 _debug_printf("\t\t.matrix[9] = %f\n", (*cmd).matrix[9]); 1270 _debug_printf("\t\t.matrix[10] = %f\n", (*cmd).matrix[10]); 1271 _debug_printf("\t\t.matrix[11] = %f\n", (*cmd).matrix[11]); 1272 _debug_printf("\t\t.matrix[12] = %f\n", (*cmd).matrix[12]); 1273 _debug_printf("\t\t.matrix[13] = %f\n", (*cmd).matrix[13]); 1274 _debug_printf("\t\t.matrix[14] = %f\n", (*cmd).matrix[14]); 1275 _debug_printf("\t\t.matrix[15] = %f\n", (*cmd).matrix[15]); 1276} 1277 1278static void 1279dump_SVGA3dCmdDestroyShader(const SVGA3dCmdDestroyShader *cmd) 1280{ 1281 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 1282 _debug_printf("\t\t.shid = %u\n", (*cmd).shid); 1283 switch((*cmd).type) { 1284 case SVGA3D_SHADERTYPE_VS: 1285 _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n"); 1286 break; 1287 case SVGA3D_SHADERTYPE_PS: 1288 _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n"); 1289 break; 1290 default: 1291 _debug_printf("\t\t.type = %i\n", (*cmd).type); 1292 break; 1293 } 1294} 1295 1296static void 1297dump_SVGA3dCmdDestroyContext(const SVGA3dCmdDestroyContext *cmd) 1298{ 1299 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 1300} 1301 1302static void 1303dump_SVGA3dCmdClear(const SVGA3dCmdClear *cmd) 1304{ 1305 _debug_printf("\t\t.cid = %u\n", (*cmd).cid); 1306 switch((*cmd).clearFlag) { 1307 case SVGA3D_CLEAR_COLOR: 1308 _debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_COLOR\n"); 1309 break; 1310 case SVGA3D_CLEAR_DEPTH: 1311 _debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_DEPTH\n"); 1312 break; 1313 case SVGA3D_CLEAR_STENCIL: 1314 _debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_STENCIL\n"); 1315 break; 1316 default: 1317 _debug_printf("\t\t.clearFlag = %i\n", (*cmd).clearFlag); 1318 break; 1319 } 1320 _debug_printf("\t\t.color = %u\n", (*cmd).color); 1321 _debug_printf("\t\t.depth = %f\n", (*cmd).depth); 1322 _debug_printf("\t\t.stencil = %u\n", (*cmd).stencil); 1323} 1324 1325static void 1326dump_SVGA3dCmdDefineSurface(const SVGA3dCmdDefineSurface *cmd) 1327{ 1328 _debug_printf("\t\t.sid = %u\n", (*cmd).sid); 1329 switch((*cmd).surfaceFlags) { 1330 case SVGA3D_SURFACE_CUBEMAP: 1331 _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_CUBEMAP\n"); 1332 break; 1333 case SVGA3D_SURFACE_HINT_STATIC: 1334 _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_STATIC\n"); 1335 break; 1336 case SVGA3D_SURFACE_HINT_DYNAMIC: 1337 _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_DYNAMIC\n"); 1338 break; 1339 case SVGA3D_SURFACE_HINT_INDEXBUFFER: 1340 _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_INDEXBUFFER\n"); 1341 break; 1342 case SVGA3D_SURFACE_HINT_VERTEXBUFFER: 1343 _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_VERTEXBUFFER\n"); 1344 break; 1345 default: 1346 _debug_printf("\t\t.surfaceFlags = %i\n", (*cmd).surfaceFlags); 1347 break; 1348 } 1349 _debug_printf("\t\t.format = %s\n", svga_format_name((*cmd).format)); 1350 _debug_printf("\t\t.face[0].numMipLevels = %u\n", (*cmd).face[0].numMipLevels); 1351 _debug_printf("\t\t.face[1].numMipLevels = %u\n", (*cmd).face[1].numMipLevels); 1352 _debug_printf("\t\t.face[2].numMipLevels = %u\n", (*cmd).face[2].numMipLevels); 1353 _debug_printf("\t\t.face[3].numMipLevels = %u\n", (*cmd).face[3].numMipLevels); 1354 _debug_printf("\t\t.face[4].numMipLevels = %u\n", (*cmd).face[4].numMipLevels); 1355 _debug_printf("\t\t.face[5].numMipLevels = %u\n", (*cmd).face[5].numMipLevels); 1356} 1357 1358static void 1359dump_SVGASignedRect(const SVGASignedRect *cmd) 1360{ 1361 _debug_printf("\t\t.left = %i\n", (*cmd).left); 1362 _debug_printf("\t\t.top = %i\n", (*cmd).top); 1363 _debug_printf("\t\t.right = %i\n", (*cmd).right); 1364 _debug_printf("\t\t.bottom = %i\n", (*cmd).bottom); 1365} 1366 1367static void 1368dump_SVGA3dBox(const SVGA3dBox *box) 1369{ 1370 _debug_printf("\t\t.box = %u, %u, %u %u x %u x %u\n", 1371 box->x, box->y, box->z, 1372 box->w, box->h, box->d); 1373} 1374 1375static void 1376dump_SVGA3dCmdBlitSurfaceToScreen(const SVGA3dCmdBlitSurfaceToScreen *cmd) 1377{ 1378 _debug_printf("\t\t.srcImage.sid = %u\n", (*cmd).srcImage.sid); 1379 _debug_printf("\t\t.srcImage.face = %u\n", (*cmd).srcImage.face); 1380 _debug_printf("\t\t.srcImage.mipmap = %u\n", (*cmd).srcImage.mipmap); 1381 _debug_printf("\t\t.srcRect.left = %i\n", (*cmd).srcRect.left); 1382 _debug_printf("\t\t.srcRect.top = %i\n", (*cmd).srcRect.top); 1383 _debug_printf("\t\t.srcRect.right = %i\n", (*cmd).srcRect.right); 1384 _debug_printf("\t\t.srcRect.bottom = %i\n", (*cmd).srcRect.bottom); 1385 _debug_printf("\t\t.destScreenId = %u\n", (*cmd).destScreenId); 1386 _debug_printf("\t\t.destRect.left = %i\n", (*cmd).destRect.left); 1387 _debug_printf("\t\t.destRect.top = %i\n", (*cmd).destRect.top); 1388 _debug_printf("\t\t.destRect.right = %i\n", (*cmd).destRect.right); 1389 _debug_printf("\t\t.destRect.bottom = %i\n", (*cmd).destRect.bottom); 1390} 1391 1392static void 1393dump_SVGA3dCmdDefineGBContext(const SVGA3dCmdDefineGBContext *cmd) 1394{ 1395 _debug_printf("\t\t.cid = %u\n", cmd->cid); 1396} 1397 1398static void 1399dump_SVGA3dCmdBindGBContext(const SVGA3dCmdBindGBContext *cmd) 1400{ 1401 _debug_printf("\t\t.cid = %u\n", cmd->cid); 1402 _debug_printf("\t\t.mobid = %u\n", cmd->mobid); 1403 _debug_printf("\t\t.validContents = %u\n", cmd->validContents); 1404} 1405 1406static void 1407dump_SVGA3dCmdDestroyGBContext(const SVGA3dCmdDestroyGBContext *cmd) 1408{ 1409 _debug_printf("\t\t.cid = %u\n", cmd->cid); 1410} 1411 1412static void 1413dump_SVGA3dCmdDefineGBShader(const SVGA3dCmdDefineGBShader *cmd) 1414{ 1415 _debug_printf("\t\t.shid = %u\n", cmd->shid); 1416 _debug_printf("\t\t.type = %s\n", shader_name(cmd->type)); 1417 _debug_printf("\t\t.sizeInBytes = %u\n", cmd->sizeInBytes); 1418} 1419 1420static void 1421dump_SVGA3dCmdBindGBShader(const SVGA3dCmdBindGBShader *cmd) 1422{ 1423 _debug_printf("\t\t.shid = %u\n", cmd->shid); 1424 _debug_printf("\t\t.mobid = %u\n", cmd->mobid); 1425 _debug_printf("\t\t.offsetInBytes = %u\n", cmd->offsetInBytes); 1426} 1427 1428static void 1429dump_SVGA3dCmdDestroyGBShader(const SVGA3dCmdDestroyGBShader *cmd) 1430{ 1431 _debug_printf("\t\t.shid = %u\n", cmd->shid); 1432} 1433 1434static void 1435dump_SVGA3dCmdBindGBSurface(const SVGA3dCmdBindGBSurface *cmd) 1436{ 1437 _debug_printf("\t\t.sid = %u\n", cmd->sid); 1438 _debug_printf("\t\t.mobid = %u\n", cmd->mobid); 1439} 1440 1441static void 1442dump_SVGA3dCmdUpdateGBSurface(const SVGA3dCmdUpdateGBSurface *cmd) 1443{ 1444 _debug_printf("\t\t.sid = %u\n", cmd->sid); 1445} 1446 1447static void 1448dump_SVGA3dCmdUpdateGBImage(const SVGA3dCmdUpdateGBImage *cmd) 1449{ 1450 _debug_printf("\t\t.image.sid = %u\n", cmd->image.sid); 1451 _debug_printf("\t\t.image.face = %u\n", cmd->image.face); 1452 _debug_printf("\t\t.image.mipmap = %u\n", cmd->image.mipmap); 1453 dump_SVGA3dBox(&cmd->box); 1454} 1455 1456static void 1457dump_SVGA3dCmdReadbackGBImage(const SVGA3dCmdReadbackGBImage *cmd) 1458{ 1459 _debug_printf("\t\t.image.sid = %u\n", cmd->image.sid); 1460 _debug_printf("\t\t.image.face = %u\n", cmd->image.face); 1461 _debug_printf("\t\t.image.mipmap = %u\n", cmd->image.mipmap); 1462} 1463 1464static void 1465dump_SVGA3dCmdInvalidateGBImage(const SVGA3dCmdInvalidateGBImage *cmd) 1466{ 1467 _debug_printf("\t\t.image.sid = %u\n", cmd->image.sid); 1468 _debug_printf("\t\t.image.face = %u\n", cmd->image.face); 1469 _debug_printf("\t\t.image.mipmap = %u\n", cmd->image.mipmap); 1470} 1471 1472static void 1473dump_SVGA3dCmdInvalidateGBImagePartial(const SVGA3dCmdInvalidateGBImagePartial *cmd) 1474{ 1475 _debug_printf("\t\t.image.sid = %u\n", cmd->image.sid); 1476 _debug_printf("\t\t.image.face = %u\n", cmd->image.face); 1477 _debug_printf("\t\t.image.mipmap = %u\n", cmd->image.mipmap); 1478 dump_SVGA3dBox(&cmd->box); 1479 _debug_printf("\t\t.invertBox = %u\n", cmd->invertBox); 1480} 1481 1482/// SVGA_3D_CMD_DX 1483 1484#define __SVGA3D_DUMP_STRINGIFY(a) #a 1485#define SVGA3D_DUMP_STRINGIFY(a) __SVGA3D_DUMP_STRINGIFY(a) 1486 1487#define SVGA3D_DUMP_HEADER(CommandName) \ 1488static void \ 1489dump_SVGA3dCmdDX##CommandName(const SVGA3dCmdDX##CommandName *cmd) 1490 1491#define SVGA3D_DUMP_PARAMETER(ParameterName, ParameterType) \ 1492_debug_printf(SVGA3D_DUMP_STRINGIFY(\t\t.ParameterName = %ParameterType\n), cmd->ParameterName) 1493 1494#define SVGA3D_DUMP_TYPE_CASE(TypeVariableName, CaseName) \ 1495case CaseName: \ 1496 _debug_printf(SVGA3D_DUMP_STRINGIFY(\t\t.TypeVariableName = CaseName) "\n"); \ 1497 break; 1498 1499#define SVGA3D_DUMP_TYPE_DEFAULT(TypeVariableName) \ 1500default: \ 1501 _debug_printf(SVGA3D_DUMP_STRINGIFY(\t\t.TypeVariableName = %i\n), (*cmd).TypeVariableName); \ 1502 break; 1503 1504SVGA3D_DUMP_HEADER(SetShader) 1505{ 1506 SVGA3D_DUMP_PARAMETER(shaderId, u); 1507 debug_printf("\t\t.type = %s\n", shader_name(cmd->type)); 1508} 1509 1510SVGA3D_DUMP_HEADER(SetSamplers) 1511{ 1512 SVGA3D_DUMP_PARAMETER(startSampler, u); 1513 debug_printf("\t\t.type = %s\n", shader_name(cmd->type)); 1514 /* XXX: note we're not printing the sampler IDs at this time */ 1515} 1516 1517SVGA3D_DUMP_HEADER(Draw) 1518{ 1519 SVGA3D_DUMP_PARAMETER(vertexCount, u); 1520 SVGA3D_DUMP_PARAMETER(startVertexLocation, u); 1521} 1522 1523SVGA3D_DUMP_HEADER(DrawIndexed) 1524{ 1525 SVGA3D_DUMP_PARAMETER(indexCount, u); 1526 SVGA3D_DUMP_PARAMETER(startIndexLocation, u); 1527 SVGA3D_DUMP_PARAMETER(baseVertexLocation, i); 1528} 1529 1530SVGA3D_DUMP_HEADER(DrawInstanced) 1531{ 1532 SVGA3D_DUMP_PARAMETER(vertexCountPerInstance, u); 1533 SVGA3D_DUMP_PARAMETER(instanceCount, u); 1534 SVGA3D_DUMP_PARAMETER(startVertexLocation, u); 1535 SVGA3D_DUMP_PARAMETER(startInstanceLocation, u); 1536} 1537 1538SVGA3D_DUMP_HEADER(DrawIndexedInstanced) 1539{ 1540 SVGA3D_DUMP_PARAMETER(indexCountPerInstance, u); 1541 SVGA3D_DUMP_PARAMETER(instanceCount, u); 1542 SVGA3D_DUMP_PARAMETER(startIndexLocation, u); 1543 SVGA3D_DUMP_PARAMETER(baseVertexLocation, i); 1544 SVGA3D_DUMP_PARAMETER(startInstanceLocation, u); 1545} 1546 1547SVGA3D_DUMP_HEADER(DrawAuto) 1548{ 1549} 1550 1551SVGA3D_DUMP_HEADER(SetBlendState) 1552{ 1553 SVGA3D_DUMP_PARAMETER(blendId, u); 1554 _debug_printf("\t\t.blendFactor[4] = %f %f %f %f\n", cmd->blendFactor[0], 1555 cmd->blendFactor[1], 1556 cmd->blendFactor[2], 1557 cmd->blendFactor[3]); 1558 SVGA3D_DUMP_PARAMETER(sampleMask, u); 1559} 1560 1561SVGA3D_DUMP_HEADER(SetDepthStencilState) 1562{ 1563 SVGA3D_DUMP_PARAMETER(depthStencilId, u); 1564 SVGA3D_DUMP_PARAMETER(stencilRef, u); 1565} 1566 1567SVGA3D_DUMP_HEADER(SetRasterizerState) 1568{ 1569 SVGA3D_DUMP_PARAMETER(rasterizerId, u); 1570} 1571 1572SVGA3D_DUMP_HEADER(DefineQuery) 1573{ 1574 SVGA3D_DUMP_PARAMETER(queryId, u); 1575 switch (cmd->type) 1576 { 1577 SVGA3D_DUMP_TYPE_CASE(type, SVGA3D_QUERYTYPE_OCCLUSION); 1578 SVGA3D_DUMP_TYPE_CASE(type, SVGA3D_QUERYTYPE_MAX); 1579 SVGA3D_DUMP_TYPE_DEFAULT(type); 1580 } 1581 switch (cmd->flags) 1582 { 1583 SVGA3D_DUMP_TYPE_CASE(flags, SVGA3D_DXQUERY_FLAG_PREDICATEHINT); 1584 SVGA3D_DUMP_TYPE_DEFAULT(flags); 1585 } 1586} 1587 1588SVGA3D_DUMP_HEADER(DestroyQuery) 1589{ 1590 SVGA3D_DUMP_PARAMETER(queryId, u); 1591} 1592 1593SVGA3D_DUMP_HEADER(BindAllQuery) 1594{ 1595 SVGA3D_DUMP_PARAMETER(cid, u); 1596 SVGA3D_DUMP_PARAMETER(mobid, u); 1597} 1598 1599SVGA3D_DUMP_HEADER(BindQuery) 1600{ 1601 SVGA3D_DUMP_PARAMETER(queryId, u); 1602 SVGA3D_DUMP_PARAMETER(mobid, u); 1603} 1604 1605SVGA3D_DUMP_HEADER(MoveQuery) 1606{ 1607 SVGA3D_DUMP_PARAMETER(queryId, u); 1608 SVGA3D_DUMP_PARAMETER(mobid, u); 1609 SVGA3D_DUMP_PARAMETER(mobOffset, u); 1610} 1611 1612SVGA3D_DUMP_HEADER(ReadbackAllQuery) 1613{ 1614 SVGA3D_DUMP_PARAMETER(cid, u); 1615} 1616 1617SVGA3D_DUMP_HEADER(SetQueryOffset) 1618{ 1619 SVGA3D_DUMP_PARAMETER(queryId, u); 1620 SVGA3D_DUMP_PARAMETER(mobOffset, u); 1621} 1622 1623SVGA3D_DUMP_HEADER(BeginQuery) 1624{ 1625 SVGA3D_DUMP_PARAMETER(queryId, u); 1626} 1627 1628SVGA3D_DUMP_HEADER(EndQuery) 1629{ 1630 SVGA3D_DUMP_PARAMETER(queryId, u); 1631} 1632 1633SVGA3D_DUMP_HEADER(SetPredication) 1634{ 1635 SVGA3D_DUMP_PARAMETER(queryId, u); 1636 SVGA3D_DUMP_PARAMETER(predicateValue, u); 1637} 1638 1639SVGA3D_DUMP_HEADER(SetSOTargets) 1640{ 1641} 1642 1643 1644SVGA3D_DUMP_HEADER(BindContext) 1645{ 1646 SVGA3D_DUMP_PARAMETER(mobid, u); 1647 SVGA3D_DUMP_PARAMETER(validContents, u); 1648} 1649 1650SVGA3D_DUMP_HEADER(SetViewports) 1651{ 1652 1653 /* XXX: note we're not printing the SVGA3dViewport list at this time */ 1654} 1655 1656SVGA3D_DUMP_HEADER(SetScissorRects) 1657{ 1658 1659 /* XXX: note we're not printing the SVGASignedRect list at this time */ 1660} 1661 1662SVGA3D_DUMP_HEADER(ClearRenderTargetView) 1663{ 1664 SVGA3D_DUMP_PARAMETER(renderTargetViewId, u); 1665 SVGA3D_DUMP_PARAMETER(rgba.r, f); 1666 SVGA3D_DUMP_PARAMETER(rgba.g, f); 1667 SVGA3D_DUMP_PARAMETER(rgba.b, f); 1668 SVGA3D_DUMP_PARAMETER(rgba.a, f); 1669} 1670 1671SVGA3D_DUMP_HEADER(ClearDepthStencilView) 1672{ 1673 SVGA3D_DUMP_PARAMETER(flags, u); 1674 SVGA3D_DUMP_PARAMETER(stencil, u); 1675 SVGA3D_DUMP_PARAMETER(depthStencilViewId, u); 1676 SVGA3D_DUMP_PARAMETER(depth, f); 1677} 1678 1679SVGA3D_DUMP_HEADER(DefineShaderResourceView) 1680{ 1681 SVGA3D_DUMP_PARAMETER(shaderResourceViewId, u); 1682 SVGA3D_DUMP_PARAMETER(sid, u); 1683 _debug_printf("\t\t.format = %s\n", svga_format_name(cmd->format)); 1684 switch (cmd->resourceDimension) 1685 { 1686 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_BUFFER); 1687 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_TEXTURE1D); 1688 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_TEXTURE2D); 1689 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_TEXTURE3D); 1690 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_TEXTURECUBE); 1691 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_TYPE_MAX); 1692 SVGA3D_DUMP_TYPE_DEFAULT(resourceDimension); 1693 } 1694 if (cmd->resourceDimension == SVGA3D_RESOURCE_BUFFER) { 1695 SVGA3D_DUMP_PARAMETER(desc.buffer.firstElement, u); 1696 SVGA3D_DUMP_PARAMETER(desc.buffer.numElements, u); 1697 } 1698 else { 1699 SVGA3D_DUMP_PARAMETER(desc.tex.mostDetailedMip, u); 1700 SVGA3D_DUMP_PARAMETER(desc.tex.firstArraySlice, u); 1701 SVGA3D_DUMP_PARAMETER(desc.tex.mipLevels, u); 1702 SVGA3D_DUMP_PARAMETER(desc.tex.arraySize, u); 1703 } 1704} 1705 1706SVGA3D_DUMP_HEADER(SetShaderResources) 1707{ 1708 SVGA3D_DUMP_PARAMETER(startView, u); 1709 debug_printf("\t\t.type = %s\n", shader_name(cmd->type)); 1710} 1711 1712 1713SVGA3D_DUMP_HEADER(DestroyShaderResourceView) 1714{ 1715 SVGA3D_DUMP_PARAMETER(shaderResourceViewId, u); 1716} 1717 1718SVGA3D_DUMP_HEADER(DefineRenderTargetView) 1719{ 1720 SVGA3D_DUMP_PARAMETER(renderTargetViewId, u); 1721 SVGA3D_DUMP_PARAMETER(sid, u); 1722 _debug_printf("\t\t.format = %s\n", svga_format_name(cmd->format)); 1723 switch (cmd->resourceDimension) 1724 { 1725 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_BUFFER); 1726 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_TEXTURE1D); 1727 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_TEXTURE2D); 1728 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_TEXTURE3D); 1729 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_TEXTURECUBE); 1730 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_TYPE_MAX); 1731 SVGA3D_DUMP_TYPE_DEFAULT(resourceDimension); 1732 } 1733 SVGA3D_DUMP_PARAMETER(desc.buffer.firstElement, u); 1734 SVGA3D_DUMP_PARAMETER(desc.buffer.numElements, u); 1735 SVGA3D_DUMP_PARAMETER(desc.tex.mipSlice, u); 1736 SVGA3D_DUMP_PARAMETER(desc.tex.firstArraySlice, u); 1737 SVGA3D_DUMP_PARAMETER(desc.tex.arraySize, u); 1738 SVGA3D_DUMP_PARAMETER(desc.tex3D.mipSlice, u); 1739 SVGA3D_DUMP_PARAMETER(desc.tex3D.firstW, u); 1740 SVGA3D_DUMP_PARAMETER(desc.tex3D.wSize, u); 1741} 1742 1743SVGA3D_DUMP_HEADER(DestroyRenderTargetView) 1744{ 1745 SVGA3D_DUMP_PARAMETER(renderTargetViewId, u); 1746} 1747 1748SVGA3D_DUMP_HEADER(DefineDepthStencilView) 1749{ 1750 SVGA3D_DUMP_PARAMETER(depthStencilViewId, u); 1751 SVGA3D_DUMP_PARAMETER(sid, u); 1752 _debug_printf("\t\t.format = %s\n", svga_format_name(cmd->format)); 1753 switch (cmd->resourceDimension) 1754 { 1755 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_BUFFER); 1756 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_TEXTURE1D); 1757 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_TEXTURE2D); 1758 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_TEXTURE3D); 1759 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_TEXTURECUBE); 1760 SVGA3D_DUMP_TYPE_CASE(resourceDimension, SVGA3D_RESOURCE_TYPE_MAX); 1761 SVGA3D_DUMP_TYPE_DEFAULT(resourceDimension); 1762 } 1763 SVGA3D_DUMP_PARAMETER(mipSlice, u); 1764 SVGA3D_DUMP_PARAMETER(firstArraySlice, u); 1765 SVGA3D_DUMP_PARAMETER(arraySize, u); 1766} 1767 1768SVGA3D_DUMP_HEADER(DestroyDepthStencilView) 1769{ 1770 SVGA3D_DUMP_PARAMETER(depthStencilViewId, u); 1771} 1772 1773SVGA3D_DUMP_HEADER(DefineElementLayout) 1774{ 1775 SVGA3D_DUMP_PARAMETER(elementLayoutId, u); 1776} 1777 1778SVGA3D_DUMP_HEADER(DestroyElementLayout) 1779{ 1780 SVGA3D_DUMP_PARAMETER(elementLayoutId, u); 1781} 1782 1783static void 1784dump_SVGA3dCmdDXDefineBlendState(const SVGA3dCmdDXDefineBlendState *cmd) 1785{ 1786 unsigned i; 1787 1788 SVGA3D_DUMP_PARAMETER(blendId, u); 1789 SVGA3D_DUMP_PARAMETER(alphaToCoverageEnable, u); 1790 SVGA3D_DUMP_PARAMETER(independentBlendEnable, u); 1791 for (i = 0; i < SVGA3D_DX_MAX_RENDER_TARGETS; i++) { 1792 const SVGA3dDXBlendStatePerRT *rt = cmd->perRT + i; 1793 _debug_printf("\t\t.perRT[%u].blendEnable = %u\n", i, rt->blendEnable); 1794 if (rt->blendEnable) { 1795 _debug_printf("\t\t.perRT[%u].srcBlend = %u\n", i, rt->srcBlend); 1796 _debug_printf("\t\t.perRT[%u].destBlend = %u\n", i, rt->destBlend); 1797 _debug_printf("\t\t.perRT[%u].blendOp = %u\n", i, rt->blendOp); 1798 _debug_printf("\t\t.perRT[%u].srcBlendAlpha = %u\n", i, rt->srcBlendAlpha); 1799 _debug_printf("\t\t.perRT[%u].destBlendAlpha = %u\n", i, rt->destBlendAlpha); 1800 _debug_printf("\t\t.perRT[%u].blendOpAlpha = %u\n", i, rt->blendOpAlpha); 1801 } 1802 _debug_printf("\t\t.perRT[%u].renderTargetWriteMask = %u\n", i, rt->renderTargetWriteMask); 1803 _debug_printf("\t\t.perRT[%u].logicOpEnable = %u\n", i, rt->logicOpEnable); 1804 if (rt->logicOpEnable) { 1805 _debug_printf("\t\t.perRT[%u].logicOp = %u\n", i, rt->logicOp); 1806 } 1807 } 1808} 1809 1810SVGA3D_DUMP_HEADER(DestroyBlendState) 1811{ 1812 SVGA3D_DUMP_PARAMETER(blendId, u); 1813} 1814 1815SVGA3D_DUMP_HEADER(DefineDepthStencilState) 1816{ 1817 SVGA3D_DUMP_PARAMETER(depthStencilId, u); 1818 SVGA3D_DUMP_PARAMETER(depthEnable, u); 1819 SVGA3D_DUMP_PARAMETER(depthWriteMask, u); 1820 SVGA3D_DUMP_PARAMETER(depthFunc, u); 1821 SVGA3D_DUMP_PARAMETER(stencilEnable, u); 1822 SVGA3D_DUMP_PARAMETER(frontEnable, u); 1823 SVGA3D_DUMP_PARAMETER(backEnable, u); 1824 SVGA3D_DUMP_PARAMETER(stencilReadMask, u); 1825 SVGA3D_DUMP_PARAMETER(stencilWriteMask, u); 1826 SVGA3D_DUMP_PARAMETER(frontStencilFailOp, u); 1827 SVGA3D_DUMP_PARAMETER(frontStencilDepthFailOp, u); 1828 SVGA3D_DUMP_PARAMETER(frontStencilPassOp, u); 1829 SVGA3D_DUMP_PARAMETER(frontStencilFunc, u); 1830 SVGA3D_DUMP_PARAMETER(backStencilFailOp, u); 1831 SVGA3D_DUMP_PARAMETER(backStencilDepthFailOp, u); 1832 SVGA3D_DUMP_PARAMETER(backStencilPassOp, u); 1833 SVGA3D_DUMP_PARAMETER(backStencilFunc, u); 1834} 1835 1836SVGA3D_DUMP_HEADER(DestroyDepthStencilState) 1837{ 1838 SVGA3D_DUMP_PARAMETER(depthStencilId, u); 1839} 1840 1841SVGA3D_DUMP_HEADER(DefineRasterizerState) 1842{ 1843 SVGA3D_DUMP_PARAMETER(rasterizerId, u); 1844 SVGA3D_DUMP_PARAMETER(fillMode, u); 1845 SVGA3D_DUMP_PARAMETER(cullMode, u); 1846 SVGA3D_DUMP_PARAMETER(frontCounterClockwise, u); 1847 SVGA3D_DUMP_PARAMETER(depthBias, u); 1848 SVGA3D_DUMP_PARAMETER(depthBiasClamp, f); 1849 SVGA3D_DUMP_PARAMETER(slopeScaledDepthBias, f); 1850 SVGA3D_DUMP_PARAMETER(depthClipEnable, u); 1851 SVGA3D_DUMP_PARAMETER(scissorEnable, u); 1852 SVGA3D_DUMP_PARAMETER(multisampleEnable, u); 1853 SVGA3D_DUMP_PARAMETER(antialiasedLineEnable, u); 1854 SVGA3D_DUMP_PARAMETER(lineWidth, f); 1855 SVGA3D_DUMP_PARAMETER(lineStippleEnable, u); 1856 SVGA3D_DUMP_PARAMETER(lineStippleFactor, u); 1857 SVGA3D_DUMP_PARAMETER(lineStipplePattern, u); 1858 SVGA3D_DUMP_PARAMETER(provokingVertexLast, u); 1859} 1860 1861SVGA3D_DUMP_HEADER(DestroyRasterizerState) 1862{ 1863 SVGA3D_DUMP_PARAMETER(rasterizerId, u); 1864} 1865 1866SVGA3D_DUMP_HEADER(DefineSamplerState) 1867{ 1868 SVGA3D_DUMP_PARAMETER(samplerId, u); 1869 SVGA3D_DUMP_PARAMETER(filter, u); 1870 SVGA3D_DUMP_PARAMETER(addressU, u); 1871 SVGA3D_DUMP_PARAMETER(addressV, u); 1872 SVGA3D_DUMP_PARAMETER(addressW, u); 1873 SVGA3D_DUMP_PARAMETER(mipLODBias, f); 1874 SVGA3D_DUMP_PARAMETER(maxAnisotropy, u); 1875 SVGA3D_DUMP_PARAMETER(comparisonFunc, u); 1876 SVGA3D_DUMP_PARAMETER(borderColor.r, f); 1877 SVGA3D_DUMP_PARAMETER(borderColor.g, f); 1878 SVGA3D_DUMP_PARAMETER(borderColor.b, f); 1879 SVGA3D_DUMP_PARAMETER(borderColor.a, f); 1880 SVGA3D_DUMP_PARAMETER(minLOD, f); 1881 SVGA3D_DUMP_PARAMETER(maxLOD, f); 1882} 1883 1884SVGA3D_DUMP_HEADER(DestroySamplerState) 1885{ 1886 SVGA3D_DUMP_PARAMETER(samplerId, u); 1887} 1888 1889SVGA3D_DUMP_HEADER(DefineShader) 1890{ 1891 SVGA3D_DUMP_PARAMETER(shaderId, u); 1892 debug_printf("\t\t.type = %s\n", shader_name(cmd->type)); 1893 SVGA3D_DUMP_PARAMETER(sizeInBytes, u); 1894} 1895 1896SVGA3D_DUMP_HEADER(DestroyShader) 1897{ 1898 SVGA3D_DUMP_PARAMETER(shaderId, u); 1899} 1900 1901SVGA3D_DUMP_HEADER(BindShader) 1902{ 1903 SVGA3D_DUMP_PARAMETER(cid, u); 1904 SVGA3D_DUMP_PARAMETER(shid, u); 1905 SVGA3D_DUMP_PARAMETER(mobid, u); 1906 SVGA3D_DUMP_PARAMETER(offsetInBytes, u); 1907} 1908 1909SVGA3D_DUMP_HEADER(DefineStreamOutput) 1910{ 1911 int i; 1912 SVGA3D_DUMP_PARAMETER(soid, u); 1913 SVGA3D_DUMP_PARAMETER(numOutputStreamEntries, u); 1914 for (i = 0; i < SVGA3D_DX_MAX_SOTARGETS; i++) { 1915 _debug_printf("\t\t.streamOutputStrideInBytes[%d] = %u\n", 1916 i, cmd->streamOutputStrideInBytes[i]); 1917 } 1918 for (i = 0; i < 16; i++) 1919 { 1920 _debug_printf("\t\t.decl[%d].outputSlot = %u\n", i, cmd->decl[i].outputSlot); 1921 _debug_printf("\t\t.decl[%d].registerIndex = %u\n", i, cmd->decl[i].registerIndex); 1922 _debug_printf("\t\t.decl[%d].registerMask = %u\n", i, cmd->decl[i].registerMask); 1923 } 1924} 1925 1926SVGA3D_DUMP_HEADER(DestroyStreamOutput) 1927{ 1928 SVGA3D_DUMP_PARAMETER(soid, u); 1929} 1930 1931SVGA3D_DUMP_HEADER(SetStreamOutput) 1932{ 1933 SVGA3D_DUMP_PARAMETER(soid, u); 1934} 1935 1936SVGA3D_DUMP_HEADER(SetSingleConstantBuffer) 1937{ 1938 SVGA3D_DUMP_PARAMETER(slot, u); 1939 SVGA3D_DUMP_PARAMETER(sid, u); 1940 debug_printf("\t\t.type = %s\n", shader_name(cmd->type)); 1941 SVGA3D_DUMP_PARAMETER(offsetInBytes, u); 1942 SVGA3D_DUMP_PARAMETER(sizeInBytes, u); 1943} 1944 1945SVGA3D_DUMP_HEADER(SetInputLayout) 1946{ 1947 SVGA3D_DUMP_PARAMETER(elementLayoutId, u); 1948} 1949 1950SVGA3D_DUMP_HEADER(SetVertexBuffers) 1951{ 1952 SVGA3D_DUMP_PARAMETER(startBuffer, u); 1953 1954 /* XXX: note we're not printing the SVGA3dVertexBuffer list at this time */ 1955} 1956 1957SVGA3D_DUMP_HEADER(SetTopology) 1958{ 1959 switch (cmd->topology) 1960 { 1961 SVGA3D_DUMP_TYPE_CASE(topology, SVGA3D_PRIMITIVE_INVALID); 1962 SVGA3D_DUMP_TYPE_CASE(topology, SVGA3D_PRIMITIVE_TRIANGLELIST); 1963 SVGA3D_DUMP_TYPE_CASE(topology, SVGA3D_PRIMITIVE_POINTLIST); 1964 SVGA3D_DUMP_TYPE_CASE(topology, SVGA3D_PRIMITIVE_LINELIST); 1965 SVGA3D_DUMP_TYPE_CASE(topology, SVGA3D_PRIMITIVE_LINESTRIP); 1966 SVGA3D_DUMP_TYPE_CASE(topology, SVGA3D_PRIMITIVE_TRIANGLESTRIP); 1967 SVGA3D_DUMP_TYPE_CASE(topology, SVGA3D_PRIMITIVE_TRIANGLEFAN); 1968 SVGA3D_DUMP_TYPE_CASE(topology, SVGA3D_PRIMITIVE_MAX); 1969 SVGA3D_DUMP_TYPE_DEFAULT(topology); 1970 } 1971} 1972 1973SVGA3D_DUMP_HEADER(SetIndexBuffer) 1974{ 1975 SVGA3D_DUMP_PARAMETER(sid, u); 1976 _debug_printf("\t\t.format = %s\n", svga_format_name(cmd->format)); 1977 SVGA3D_DUMP_PARAMETER(offset, u); 1978} 1979 1980SVGA3D_DUMP_HEADER(PredCopyRegion) 1981{ 1982 SVGA3D_DUMP_PARAMETER(dstSid, u); 1983 SVGA3D_DUMP_PARAMETER(dstSubResource, u); 1984 SVGA3D_DUMP_PARAMETER(srcSid, u); 1985 SVGA3D_DUMP_PARAMETER(srcSubResource, u); 1986 dump_SVGA3dCopyBox(&cmd->box); 1987} 1988 1989SVGA3D_DUMP_HEADER(PredCopy) 1990{ 1991 SVGA3D_DUMP_PARAMETER(dstSid, u); 1992 SVGA3D_DUMP_PARAMETER(srcSid, u); 1993} 1994 1995static void 1996dump_SVGA3dCmdDXUpdateSubResource(const SVGA3dCmdDXUpdateSubResource *cmd) 1997{ 1998 SVGA3D_DUMP_PARAMETER(sid, u); 1999 SVGA3D_DUMP_PARAMETER(subResource, u); 2000 dump_SVGA3dBox(&cmd->box); 2001} 2002 2003static void 2004dump_SVGA3dCmdDXReadbackSubResource(const SVGA3dCmdDXReadbackSubResource *cmd) 2005{ 2006 SVGA3D_DUMP_PARAMETER(sid, u); 2007 SVGA3D_DUMP_PARAMETER(subResource, u); 2008} 2009 2010SVGA3D_DUMP_HEADER(BufferCopy) 2011{ 2012 SVGA3D_DUMP_PARAMETER(dest, u); 2013 SVGA3D_DUMP_PARAMETER(src, u); 2014 SVGA3D_DUMP_PARAMETER(destX, u); 2015 SVGA3D_DUMP_PARAMETER(srcX, u); 2016 SVGA3D_DUMP_PARAMETER(width, u); 2017 2018} 2019 2020SVGA3D_DUMP_HEADER(BufferUpdate) 2021{ 2022 SVGA3D_DUMP_PARAMETER(sid, u); 2023 SVGA3D_DUMP_PARAMETER(x, u); 2024 SVGA3D_DUMP_PARAMETER(width, u); 2025 2026} 2027 2028SVGA3D_DUMP_HEADER(GenMips) 2029{ 2030 SVGA3D_DUMP_PARAMETER(shaderResourceViewId, u); 2031} 2032 2033SVGA3D_DUMP_HEADER(TransferFromBuffer) 2034{ 2035 SVGA3D_DUMP_PARAMETER(srcSid, u); 2036 SVGA3D_DUMP_PARAMETER(srcOffset, u); 2037 SVGA3D_DUMP_PARAMETER(srcPitch, u); 2038 SVGA3D_DUMP_PARAMETER(srcSlicePitch, u); 2039 SVGA3D_DUMP_PARAMETER(destSid, u); 2040 SVGA3D_DUMP_PARAMETER(destSubResource, u); 2041 dump_SVGA3dBox(&cmd->destBox); 2042} 2043 2044static void 2045dump_SVGA3dCmdIntraSurfaceCopy(const SVGA3dCmdIntraSurfaceCopy *cmd) 2046{ 2047 SVGA3D_DUMP_PARAMETER(surface.sid, u); 2048 SVGA3D_DUMP_PARAMETER(surface.face, u); 2049 SVGA3D_DUMP_PARAMETER(surface.mipmap, u); 2050 dump_SVGA3dCopyBox(&cmd->box); 2051} 2052 2053static void 2054dump_SVGA3dCmdInvalidateGBSurface(const SVGA3dCmdInvalidateGBSurface *cmd) 2055{ 2056 SVGA3D_DUMP_PARAMETER(sid, u); 2057} 2058 2059#define SVGA3D_DUMP_CASE_BASIC(CommandName, CommandCode) \ 2060case SVGA_3D_CMD_DX_##CommandCode: \ 2061 _debug_printf(SVGA3D_DUMP_STRINGIFY(\tSVGA_3D_CMD_DX_##CommandCode) "\n"); \ 2062 { \ 2063 const SVGA3dCmdDX##CommandName *cmd = (const SVGA3dCmdDX##CommandName *)body; \ 2064 dump_SVGA3dCmdDX##CommandName(cmd); \ 2065 body = (const uint8_t *)&cmd[1]; \ 2066 } \ 2067 break 2068 2069#define SVGA3D_DUMP_CASE_LIST(CommandName, CommandCode, ElementType) \ 2070case SVGA_3D_CMD_DX_##CommandCode: \ 2071 _debug_printf(SVGA3D_DUMP_STRINGIFY(\tSVGA_3D_CMD_DX_##CommandCode) "\n"); \ 2072 { \ 2073 const SVGA3dCmdDX##CommandName *cmd = (const SVGA3dCmdDX##CommandName *)body; \ 2074 dump_SVGA3dCmdDX##CommandName(cmd); \ 2075 body = (const uint8_t *)&cmd[1]; \ 2076 while (body + sizeof(ElementType) <= next) \ 2077 { \ 2078 dump_##ElementType((const ElementType *)body); \ 2079 body += sizeof(ElementType); \ 2080 } \ 2081 } \ 2082 break 2083 2084void 2085svga_dump_command(uint32_t cmd_id, const void *data, uint32_t size) 2086{ 2087 const uint8_t *body = (const uint8_t *)data; 2088 const uint8_t *next = body + size; 2089 2090 switch(cmd_id) { 2091 SVGA3D_DUMP_CASE_BASIC(BindContext, BIND_CONTEXT); 2092 SVGA3D_DUMP_CASE_LIST(SetViewports, SET_VIEWPORTS, SVGA3dViewport); 2093 SVGA3D_DUMP_CASE_BASIC(SetShader, SET_SHADER); 2094 SVGA3D_DUMP_CASE_LIST(SetSamplers, SET_SAMPLERS, SVGA3dSamplerId); 2095 SVGA3D_DUMP_CASE_BASIC(SetBlendState, SET_BLEND_STATE); 2096 SVGA3D_DUMP_CASE_BASIC(SetDepthStencilState, SET_DEPTHSTENCIL_STATE); 2097 SVGA3D_DUMP_CASE_BASIC(SetRasterizerState, SET_RASTERIZER_STATE); 2098 SVGA3D_DUMP_CASE_BASIC(SetPredication, SET_PREDICATION); 2099 SVGA3D_DUMP_CASE_LIST(SetSOTargets, SET_SOTARGETS, SVGA3dSoTarget); 2100 SVGA3D_DUMP_CASE_LIST(SetScissorRects, SET_SCISSORRECTS, SVGASignedRect); 2101 SVGA3D_DUMP_CASE_BASIC(SetStreamOutput, SET_STREAMOUTPUT); 2102 SVGA3D_DUMP_CASE_BASIC(SetSingleConstantBuffer, SET_SINGLE_CONSTANT_BUFFER); 2103 SVGA3D_DUMP_CASE_BASIC(Draw, DRAW); 2104 SVGA3D_DUMP_CASE_BASIC(DrawIndexed, DRAW_INDEXED); 2105 SVGA3D_DUMP_CASE_BASIC(DrawInstanced, DRAW_INSTANCED); 2106 SVGA3D_DUMP_CASE_BASIC(DrawIndexedInstanced, DRAW_INDEXED_INSTANCED); 2107 SVGA3D_DUMP_CASE_BASIC(DrawAuto, DRAW_AUTO); 2108 SVGA3D_DUMP_CASE_BASIC(DefineQuery, DEFINE_QUERY); 2109 SVGA3D_DUMP_CASE_BASIC(DestroyQuery, DESTROY_QUERY); 2110 SVGA3D_DUMP_CASE_BASIC(BindAllQuery, BIND_ALL_QUERY); 2111 SVGA3D_DUMP_CASE_BASIC(BindQuery, BIND_QUERY); 2112 SVGA3D_DUMP_CASE_BASIC(MoveQuery, MOVE_QUERY); 2113 SVGA3D_DUMP_CASE_BASIC(ReadbackAllQuery, READBACK_ALL_QUERY); 2114 SVGA3D_DUMP_CASE_BASIC(SetQueryOffset, SET_QUERY_OFFSET); 2115 SVGA3D_DUMP_CASE_BASIC(BeginQuery, BEGIN_QUERY); 2116 SVGA3D_DUMP_CASE_BASIC(EndQuery, END_QUERY); 2117 SVGA3D_DUMP_CASE_BASIC(ClearRenderTargetView, CLEAR_RENDERTARGET_VIEW); 2118 SVGA3D_DUMP_CASE_BASIC(ClearDepthStencilView, CLEAR_DEPTHSTENCIL_VIEW); 2119 SVGA3D_DUMP_CASE_BASIC(DefineShaderResourceView, DEFINE_SHADERRESOURCE_VIEW); 2120 SVGA3D_DUMP_CASE_LIST(SetShaderResources, SET_SHADER_RESOURCES, SVGA3dShaderResourceViewId); 2121 SVGA3D_DUMP_CASE_BASIC(DestroyShaderResourceView, DESTROY_SHADERRESOURCE_VIEW); 2122 SVGA3D_DUMP_CASE_BASIC(DefineRenderTargetView, DEFINE_RENDERTARGET_VIEW); 2123 SVGA3D_DUMP_CASE_BASIC(DestroyRenderTargetView, DESTROY_RENDERTARGET_VIEW); 2124 SVGA3D_DUMP_CASE_BASIC(DefineDepthStencilView, DEFINE_DEPTHSTENCIL_VIEW); 2125 SVGA3D_DUMP_CASE_BASIC(DestroyDepthStencilView, DESTROY_DEPTHSTENCIL_VIEW); 2126 SVGA3D_DUMP_CASE_LIST(DefineElementLayout, DEFINE_ELEMENTLAYOUT, SVGA3dInputElementDesc); 2127 SVGA3D_DUMP_CASE_BASIC(DestroyElementLayout, DESTROY_ELEMENTLAYOUT); 2128 SVGA3D_DUMP_CASE_BASIC(DefineBlendState, DEFINE_BLEND_STATE); 2129 SVGA3D_DUMP_CASE_BASIC(DestroyBlendState, DESTROY_BLEND_STATE); 2130 SVGA3D_DUMP_CASE_BASIC(DefineDepthStencilState, DEFINE_DEPTHSTENCIL_STATE); 2131 SVGA3D_DUMP_CASE_BASIC(DestroyDepthStencilState, DESTROY_DEPTHSTENCIL_STATE); 2132 SVGA3D_DUMP_CASE_BASIC(DefineRasterizerState, DEFINE_RASTERIZER_STATE); 2133 SVGA3D_DUMP_CASE_BASIC(DestroyRasterizerState, DESTROY_RASTERIZER_STATE); 2134 SVGA3D_DUMP_CASE_BASIC(DefineSamplerState, DEFINE_SAMPLER_STATE); 2135 SVGA3D_DUMP_CASE_BASIC(DestroySamplerState, DESTROY_SAMPLER_STATE); 2136 SVGA3D_DUMP_CASE_BASIC(DefineShader, DEFINE_SHADER); 2137 SVGA3D_DUMP_CASE_BASIC(DestroyShader, DESTROY_SHADER); 2138 SVGA3D_DUMP_CASE_BASIC(BindShader, BIND_SHADER); 2139 SVGA3D_DUMP_CASE_BASIC(DefineStreamOutput, DEFINE_STREAMOUTPUT); 2140 SVGA3D_DUMP_CASE_BASIC(DestroyStreamOutput, DESTROY_STREAMOUTPUT); 2141 SVGA3D_DUMP_CASE_BASIC(SetInputLayout, SET_INPUT_LAYOUT); 2142 SVGA3D_DUMP_CASE_LIST(SetVertexBuffers, SET_VERTEX_BUFFERS, SVGA3dVertexBuffer); 2143 SVGA3D_DUMP_CASE_BASIC(SetTopology, SET_TOPOLOGY); 2144 SVGA3D_DUMP_CASE_BASIC(SetIndexBuffer, SET_INDEX_BUFFER); 2145 2146 SVGA3D_DUMP_CASE_BASIC(PredCopy, PRED_COPY); 2147 SVGA3D_DUMP_CASE_BASIC(UpdateSubResource, UPDATE_SUBRESOURCE); 2148 SVGA3D_DUMP_CASE_BASIC(ReadbackSubResource, READBACK_SUBRESOURCE); 2149 SVGA3D_DUMP_CASE_BASIC(PredCopyRegion, PRED_COPY_REGION); 2150 SVGA3D_DUMP_CASE_BASIC(BufferCopy, BUFFER_COPY); 2151 SVGA3D_DUMP_CASE_BASIC(BufferUpdate, BUFFER_UPDATE); 2152 SVGA3D_DUMP_CASE_BASIC(GenMips, GENMIPS); 2153 SVGA3D_DUMP_CASE_BASIC(TransferFromBuffer, TRANSFER_FROM_BUFFER); 2154 2155 case SVGA_3D_CMD_DX_SET_RENDERTARGETS: 2156 _debug_printf("\tSVGA_3D_CMD_DX_SET_RENDERTARGETS\n"); 2157 { 2158 const SVGA3dCmdDXSetRenderTargets *cmd = 2159 (const SVGA3dCmdDXSetRenderTargets *) body; 2160 _debug_printf("\t\t.depthStencilViewId = %u\n", 2161 cmd->depthStencilViewId); 2162 body = (const uint8_t *) &cmd[1]; 2163 while (body + sizeof(SVGA3dRenderTargetViewId) <= next) { 2164 _debug_printf("\t\t.renderTargetViewId = %u\n", 2165 *((SVGA3dRenderTargetViewId *) body)); 2166 body += sizeof(SVGA3dRenderTargetViewId); 2167 } 2168 } 2169 break; 2170 2171 case SVGA_3D_CMD_SURFACE_DEFINE: 2172 _debug_printf("\tSVGA_3D_CMD_SURFACE_DEFINE\n"); 2173 { 2174 const SVGA3dCmdDefineSurface *cmd = (const SVGA3dCmdDefineSurface *)body; 2175 dump_SVGA3dCmdDefineSurface(cmd); 2176 body = (const uint8_t *)&cmd[1]; 2177 while(body + sizeof(SVGA3dSize) <= next) { 2178 dump_SVGA3dSize((const SVGA3dSize *)body); 2179 body += sizeof(SVGA3dSize); 2180 } 2181 } 2182 break; 2183 case SVGA_3D_CMD_SURFACE_DESTROY: 2184 _debug_printf("\tSVGA_3D_CMD_SURFACE_DESTROY\n"); 2185 { 2186 const SVGA3dCmdDestroySurface *cmd = (const SVGA3dCmdDestroySurface *)body; 2187 dump_SVGA3dCmdDestroySurface(cmd); 2188 body = (const uint8_t *)&cmd[1]; 2189 } 2190 break; 2191 case SVGA_3D_CMD_SURFACE_COPY: 2192 _debug_printf("\tSVGA_3D_CMD_SURFACE_COPY\n"); 2193 { 2194 const SVGA3dCmdSurfaceCopy *cmd = (const SVGA3dCmdSurfaceCopy *)body; 2195 dump_SVGA3dCmdSurfaceCopy(cmd); 2196 body = (const uint8_t *)&cmd[1]; 2197 while(body + sizeof(SVGA3dCopyBox) <= next) { 2198 dump_SVGA3dCopyBox((const SVGA3dCopyBox *)body); 2199 body += sizeof(SVGA3dCopyBox); 2200 } 2201 } 2202 break; 2203 case SVGA_3D_CMD_SURFACE_STRETCHBLT: 2204 _debug_printf("\tSVGA_3D_CMD_SURFACE_STRETCHBLT\n"); 2205 { 2206 const SVGA3dCmdSurfaceStretchBlt *cmd = (const SVGA3dCmdSurfaceStretchBlt *)body; 2207 dump_SVGA3dCmdSurfaceStretchBlt(cmd); 2208 body = (const uint8_t *)&cmd[1]; 2209 } 2210 break; 2211 case SVGA_3D_CMD_SURFACE_DMA: 2212 _debug_printf("\tSVGA_3D_CMD_SURFACE_DMA\n"); 2213 { 2214 const SVGA3dCmdSurfaceDMA *cmd = (const SVGA3dCmdSurfaceDMA *)body; 2215 dump_SVGA3dCmdSurfaceDMA(cmd); 2216 body = (const uint8_t *)&cmd[1]; 2217 while(body + sizeof(SVGA3dCopyBox) <= next) { 2218 dump_SVGA3dCopyBox((const SVGA3dCopyBox *)body); 2219 body += sizeof(SVGA3dCopyBox); 2220 } 2221 while(body + sizeof(SVGA3dCmdSurfaceDMASuffix) <= next) { 2222 dump_SVGA3dCmdSurfaceDMASuffix((const SVGA3dCmdSurfaceDMASuffix *)body); 2223 body += sizeof(SVGA3dCmdSurfaceDMASuffix); 2224 } 2225 } 2226 break; 2227 case SVGA_3D_CMD_CONTEXT_DEFINE: 2228 _debug_printf("\tSVGA_3D_CMD_CONTEXT_DEFINE\n"); 2229 { 2230 const SVGA3dCmdDefineContext *cmd = (const SVGA3dCmdDefineContext *)body; 2231 dump_SVGA3dCmdDefineContext(cmd); 2232 body = (const uint8_t *)&cmd[1]; 2233 } 2234 break; 2235 case SVGA_3D_CMD_CONTEXT_DESTROY: 2236 _debug_printf("\tSVGA_3D_CMD_CONTEXT_DESTROY\n"); 2237 { 2238 const SVGA3dCmdDestroyContext *cmd = (const SVGA3dCmdDestroyContext *)body; 2239 dump_SVGA3dCmdDestroyContext(cmd); 2240 body = (const uint8_t *)&cmd[1]; 2241 } 2242 break; 2243 case SVGA_3D_CMD_SETTRANSFORM: 2244 _debug_printf("\tSVGA_3D_CMD_SETTRANSFORM\n"); 2245 { 2246 const SVGA3dCmdSetTransform *cmd = (const SVGA3dCmdSetTransform *)body; 2247 dump_SVGA3dCmdSetTransform(cmd); 2248 body = (const uint8_t *)&cmd[1]; 2249 } 2250 break; 2251 case SVGA_3D_CMD_SETZRANGE: 2252 _debug_printf("\tSVGA_3D_CMD_SETZRANGE\n"); 2253 { 2254 const SVGA3dCmdSetZRange *cmd = (const SVGA3dCmdSetZRange *)body; 2255 dump_SVGA3dCmdSetZRange(cmd); 2256 body = (const uint8_t *)&cmd[1]; 2257 } 2258 break; 2259 case SVGA_3D_CMD_SETRENDERSTATE: 2260 _debug_printf("\tSVGA_3D_CMD_SETRENDERSTATE\n"); 2261 { 2262 const SVGA3dCmdSetRenderState *cmd = (const SVGA3dCmdSetRenderState *)body; 2263 dump_SVGA3dCmdSetRenderState(cmd); 2264 body = (const uint8_t *)&cmd[1]; 2265 while(body + sizeof(SVGA3dRenderState) <= next) { 2266 dump_SVGA3dRenderState((const SVGA3dRenderState *)body); 2267 body += sizeof(SVGA3dRenderState); 2268 } 2269 } 2270 break; 2271 case SVGA_3D_CMD_SETRENDERTARGET: 2272 _debug_printf("\tSVGA_3D_CMD_SETRENDERTARGET\n"); 2273 { 2274 const SVGA3dCmdSetRenderTarget *cmd = (const SVGA3dCmdSetRenderTarget *)body; 2275 dump_SVGA3dCmdSetRenderTarget(cmd); 2276 body = (const uint8_t *)&cmd[1]; 2277 } 2278 break; 2279 case SVGA_3D_CMD_SETTEXTURESTATE: 2280 _debug_printf("\tSVGA_3D_CMD_SETTEXTURESTATE\n"); 2281 { 2282 const SVGA3dCmdSetTextureState *cmd = (const SVGA3dCmdSetTextureState *)body; 2283 dump_SVGA3dCmdSetTextureState(cmd); 2284 body = (const uint8_t *)&cmd[1]; 2285 while(body + sizeof(SVGA3dTextureState) <= next) { 2286 dump_SVGA3dTextureState((const SVGA3dTextureState *)body); 2287 body += sizeof(SVGA3dTextureState); 2288 } 2289 } 2290 break; 2291 case SVGA_3D_CMD_SETMATERIAL: 2292 _debug_printf("\tSVGA_3D_CMD_SETMATERIAL\n"); 2293 { 2294 const SVGA3dCmdSetMaterial *cmd = (const SVGA3dCmdSetMaterial *)body; 2295 dump_SVGA3dCmdSetMaterial(cmd); 2296 body = (const uint8_t *)&cmd[1]; 2297 } 2298 break; 2299 case SVGA_3D_CMD_SETLIGHTDATA: 2300 _debug_printf("\tSVGA_3D_CMD_SETLIGHTDATA\n"); 2301 { 2302 const SVGA3dCmdSetLightData *cmd = (const SVGA3dCmdSetLightData *)body; 2303 dump_SVGA3dCmdSetLightData(cmd); 2304 body = (const uint8_t *)&cmd[1]; 2305 } 2306 break; 2307 case SVGA_3D_CMD_SETLIGHTENABLED: 2308 _debug_printf("\tSVGA_3D_CMD_SETLIGHTENABLED\n"); 2309 { 2310 const SVGA3dCmdSetLightEnabled *cmd = (const SVGA3dCmdSetLightEnabled *)body; 2311 dump_SVGA3dCmdSetLightEnabled(cmd); 2312 body = (const uint8_t *)&cmd[1]; 2313 } 2314 break; 2315 case SVGA_3D_CMD_SETVIEWPORT: 2316 _debug_printf("\tSVGA_3D_CMD_SETVIEWPORT\n"); 2317 { 2318 const SVGA3dCmdSetViewport *cmd = (const SVGA3dCmdSetViewport *)body; 2319 dump_SVGA3dCmdSetViewport(cmd); 2320 body = (const uint8_t *)&cmd[1]; 2321 } 2322 break; 2323 case SVGA_3D_CMD_SETCLIPPLANE: 2324 _debug_printf("\tSVGA_3D_CMD_SETCLIPPLANE\n"); 2325 { 2326 const SVGA3dCmdSetClipPlane *cmd = (const SVGA3dCmdSetClipPlane *)body; 2327 dump_SVGA3dCmdSetClipPlane(cmd); 2328 body = (const uint8_t *)&cmd[1]; 2329 } 2330 break; 2331 case SVGA_3D_CMD_CLEAR: 2332 _debug_printf("\tSVGA_3D_CMD_CLEAR\n"); 2333 { 2334 const SVGA3dCmdClear *cmd = (const SVGA3dCmdClear *)body; 2335 dump_SVGA3dCmdClear(cmd); 2336 body = (const uint8_t *)&cmd[1]; 2337 while(body + sizeof(SVGA3dRect) <= next) { 2338 dump_SVGA3dRect((const SVGA3dRect *)body); 2339 body += sizeof(SVGA3dRect); 2340 } 2341 } 2342 break; 2343 case SVGA_3D_CMD_PRESENT: 2344 _debug_printf("\tSVGA_3D_CMD_PRESENT\n"); 2345 { 2346 const SVGA3dCmdPresent *cmd = (const SVGA3dCmdPresent *)body; 2347 dump_SVGA3dCmdPresent(cmd); 2348 body = (const uint8_t *)&cmd[1]; 2349 while(body + sizeof(SVGA3dCopyRect) <= next) { 2350 dump_SVGA3dCopyRect((const SVGA3dCopyRect *)body); 2351 body += sizeof(SVGA3dCopyRect); 2352 } 2353 } 2354 break; 2355 case SVGA_3D_CMD_SHADER_DEFINE: 2356 _debug_printf("\tSVGA_3D_CMD_SHADER_DEFINE\n"); 2357 { 2358 const SVGA3dCmdDefineShader *cmd = (const SVGA3dCmdDefineShader *)body; 2359 dump_SVGA3dCmdDefineShader(cmd); 2360 body = (const uint8_t *)&cmd[1]; 2361 svga_shader_dump((const uint32_t *)body, 2362 (unsigned)(next - body)/sizeof(uint32_t), 2363 FALSE ); 2364 body = next; 2365 } 2366 break; 2367 case SVGA_3D_CMD_SHADER_DESTROY: 2368 _debug_printf("\tSVGA_3D_CMD_SHADER_DESTROY\n"); 2369 { 2370 const SVGA3dCmdDestroyShader *cmd = (const SVGA3dCmdDestroyShader *)body; 2371 dump_SVGA3dCmdDestroyShader(cmd); 2372 body = (const uint8_t *)&cmd[1]; 2373 } 2374 break; 2375 case SVGA_3D_CMD_SET_SHADER: 2376 _debug_printf("\tSVGA_3D_CMD_SET_SHADER\n"); 2377 { 2378 const SVGA3dCmdSetShader *cmd = (const SVGA3dCmdSetShader *)body; 2379 dump_SVGA3dCmdSetShader(cmd); 2380 body = (const uint8_t *)&cmd[1]; 2381 } 2382 break; 2383 case SVGA_3D_CMD_SET_SHADER_CONST: 2384 _debug_printf("\tSVGA_3D_CMD_SET_SHADER_CONST\n"); 2385 { 2386 const SVGA3dCmdSetShaderConst *cmd = (const SVGA3dCmdSetShaderConst *)body; 2387 uint32 numConsts = 1 + (size - sizeof *cmd) / (4 * sizeof(uint32)); 2388 dump_SVGA3dCmdSetShaderConst(cmd, numConsts); 2389 body = next; 2390 } 2391 break; 2392 case SVGA_3D_CMD_DRAW_PRIMITIVES: 2393 _debug_printf("\tSVGA_3D_CMD_DRAW_PRIMITIVES\n"); 2394 { 2395 const SVGA3dCmdDrawPrimitives *cmd = (const SVGA3dCmdDrawPrimitives *)body; 2396 unsigned i, j; 2397 dump_SVGA3dCmdDrawPrimitives(cmd); 2398 body = (const uint8_t *)&cmd[1]; 2399 for(i = 0; i < cmd->numVertexDecls; ++i) { 2400 dump_SVGA3dVertexDecl((const SVGA3dVertexDecl *)body); 2401 body += sizeof(SVGA3dVertexDecl); 2402 } 2403 for(j = 0; j < cmd->numRanges; ++j) { 2404 dump_SVGA3dPrimitiveRange((const SVGA3dPrimitiveRange *)body); 2405 body += sizeof(SVGA3dPrimitiveRange); 2406 } 2407 while(body + sizeof(SVGA3dVertexDivisor) <= next) { 2408 dump_SVGA3dVertexDivisor((const SVGA3dVertexDivisor *)body); 2409 body += sizeof(SVGA3dVertexDivisor); 2410 } 2411 } 2412 break; 2413 case SVGA_3D_CMD_SETSCISSORRECT: 2414 _debug_printf("\tSVGA_3D_CMD_SETSCISSORRECT\n"); 2415 { 2416 const SVGA3dCmdSetScissorRect *cmd = (const SVGA3dCmdSetScissorRect *)body; 2417 dump_SVGA3dCmdSetScissorRect(cmd); 2418 body = (const uint8_t *)&cmd[1]; 2419 } 2420 break; 2421 case SVGA_3D_CMD_BEGIN_QUERY: 2422 _debug_printf("\tSVGA_3D_CMD_BEGIN_QUERY\n"); 2423 { 2424 const SVGA3dCmdBeginQuery *cmd = (const SVGA3dCmdBeginQuery *)body; 2425 dump_SVGA3dCmdBeginQuery(cmd); 2426 body = (const uint8_t *)&cmd[1]; 2427 } 2428 break; 2429 case SVGA_3D_CMD_END_QUERY: 2430 _debug_printf("\tSVGA_3D_CMD_END_QUERY\n"); 2431 { 2432 const SVGA3dCmdEndQuery *cmd = (const SVGA3dCmdEndQuery *)body; 2433 dump_SVGA3dCmdEndQuery(cmd); 2434 body = (const uint8_t *)&cmd[1]; 2435 } 2436 break; 2437 case SVGA_3D_CMD_WAIT_FOR_QUERY: 2438 _debug_printf("\tSVGA_3D_CMD_WAIT_FOR_QUERY\n"); 2439 { 2440 const SVGA3dCmdWaitForQuery *cmd = (const SVGA3dCmdWaitForQuery *)body; 2441 dump_SVGA3dCmdWaitForQuery(cmd); 2442 body = (const uint8_t *)&cmd[1]; 2443 } 2444 break; 2445 case SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN: 2446 _debug_printf("\tSVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN\n"); 2447 { 2448 const SVGA3dCmdBlitSurfaceToScreen *cmd = (const SVGA3dCmdBlitSurfaceToScreen *)body; 2449 dump_SVGA3dCmdBlitSurfaceToScreen(cmd); 2450 body = (const uint8_t *)&cmd[1]; 2451 while(body + sizeof(SVGASignedRect) <= next) { 2452 dump_SVGASignedRect((const SVGASignedRect *)body); 2453 body += sizeof(SVGASignedRect); 2454 } 2455 } 2456 break; 2457 case SVGA_3D_CMD_DEFINE_GB_CONTEXT: 2458 _debug_printf("\tSVGA_3D_CMD_DEFINE_GB_CONTEXT\n"); 2459 { 2460 const SVGA3dCmdDefineGBContext *cmd = (const SVGA3dCmdDefineGBContext *) body; 2461 dump_SVGA3dCmdDefineGBContext(cmd); 2462 body = (const uint8_t *)&cmd[1]; 2463 } 2464 break; 2465 case SVGA_3D_CMD_BIND_GB_CONTEXT: 2466 _debug_printf("\tSVGA_3D_CMD_BIND_GB_CONTEXT\n"); 2467 { 2468 const SVGA3dCmdBindGBContext *cmd = (const SVGA3dCmdBindGBContext *) body; 2469 dump_SVGA3dCmdBindGBContext(cmd); 2470 body = (const uint8_t *)&cmd[1]; 2471 } 2472 break; 2473 case SVGA_3D_CMD_DESTROY_GB_CONTEXT: 2474 _debug_printf("\tSVGA_3D_CMD_DESTROY_GB_CONTEXT\n"); 2475 { 2476 const SVGA3dCmdDestroyGBContext *cmd = (const SVGA3dCmdDestroyGBContext *) body; 2477 dump_SVGA3dCmdDestroyGBContext(cmd); 2478 body = (const uint8_t *)&cmd[1]; 2479 } 2480 break; 2481 case SVGA_3D_CMD_DEFINE_GB_SHADER: 2482 _debug_printf("\tSVGA_3D_CMD_DEFINE_GB_SHADER\n"); 2483 { 2484 const SVGA3dCmdDefineGBShader *cmd = (const SVGA3dCmdDefineGBShader *) body; 2485 dump_SVGA3dCmdDefineGBShader(cmd); 2486 body = (const uint8_t *)&cmd[1]; 2487 } 2488 break; 2489 case SVGA_3D_CMD_BIND_GB_SHADER: 2490 _debug_printf("\tSVGA_3D_CMD_BIND_GB_SHADER\n"); 2491 { 2492 const SVGA3dCmdBindGBShader *cmd = (const SVGA3dCmdBindGBShader *) body; 2493 dump_SVGA3dCmdBindGBShader(cmd); 2494 body = (const uint8_t *)&cmd[1]; 2495 } 2496 break; 2497 case SVGA_3D_CMD_DESTROY_GB_SHADER: 2498 _debug_printf("\tSVGA_3D_CMD_DESTROY_GB_SHADER\n"); 2499 { 2500 const SVGA3dCmdDestroyGBShader *cmd = (const SVGA3dCmdDestroyGBShader *) body; 2501 dump_SVGA3dCmdDestroyGBShader(cmd); 2502 body = (const uint8_t *)&cmd[1]; 2503 } 2504 break; 2505 case SVGA_3D_CMD_BIND_GB_SURFACE: 2506 _debug_printf("\tSVGA_3D_CMD_BIND_GB_SURFACE\n"); 2507 { 2508 const SVGA3dCmdBindGBSurface *cmd = (const SVGA3dCmdBindGBSurface *) body; 2509 dump_SVGA3dCmdBindGBSurface(cmd); 2510 body = (const uint8_t *)&cmd[1]; 2511 } 2512 break; 2513 case SVGA_3D_CMD_UPDATE_GB_SURFACE: 2514 _debug_printf("\tSVGA_3D_CMD_UPDATE_GB_SURFACE\n"); 2515 { 2516 const SVGA3dCmdUpdateGBSurface *cmd = (const SVGA3dCmdUpdateGBSurface *) body; 2517 dump_SVGA3dCmdUpdateGBSurface(cmd); 2518 body = (const uint8_t *)&cmd[1]; 2519 } 2520 break; 2521 case SVGA_3D_CMD_READBACK_GB_IMAGE: 2522 _debug_printf("\tSVGA_3D_CMD_READBACK_GB_IMAGE:\n"); 2523 { 2524 const SVGA3dCmdReadbackGBImage *cmd = (SVGA3dCmdReadbackGBImage *) body; 2525 dump_SVGA3dCmdReadbackGBImage(cmd); 2526 body = (const uint8_t *)&cmd[1]; 2527 } 2528 break; 2529 case SVGA_3D_CMD_UPDATE_GB_IMAGE: 2530 _debug_printf("\tSVGA_3D_CMD_UPDATE_GB_IMAGE\n"); 2531 { 2532 const SVGA3dCmdUpdateGBImage *cmd = (const SVGA3dCmdUpdateGBImage *) body; 2533 dump_SVGA3dCmdUpdateGBImage(cmd); 2534 body = (const uint8_t *)&cmd[1]; 2535 } 2536 break; 2537 case SVGA_3D_CMD_INVALIDATE_GB_IMAGE: 2538 _debug_printf("\tSVGA_3D_CMD_INVALIDATE_GB_IMAGE\n"); 2539 { 2540 const SVGA3dCmdInvalidateGBImage *cmd = (const SVGA3dCmdInvalidateGBImage *) body; 2541 dump_SVGA3dCmdInvalidateGBImage(cmd); 2542 body = (const uint8_t *)&cmd[1]; 2543 } 2544 break; 2545 case SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL: 2546 _debug_printf("\tSVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL\n"); 2547 { 2548 const SVGA3dCmdInvalidateGBImagePartial *cmd = (const SVGA3dCmdInvalidateGBImagePartial *) body; 2549 dump_SVGA3dCmdInvalidateGBImagePartial(cmd); 2550 body = (const uint8_t *)&cmd[1]; 2551 } 2552 break; 2553 case SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE: 2554 _debug_printf("\tSVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE\n"); 2555 { 2556 /* XXX Note: re-using the SVGA3dCmdSetShaderConst code here */ 2557 const SVGA3dCmdSetGBShaderConstInline *cmd = (const SVGA3dCmdSetGBShaderConstInline *)body; 2558 uint32 numConsts = (size - sizeof *cmd) / (4 * sizeof(uint32)); 2559 dump_SVGA3dCmdSetGBShaderConstInline(cmd, numConsts); 2560 body = next; 2561 } 2562 break; 2563 case SVGA_3D_CMD_INVALIDATE_GB_SURFACE: 2564 _debug_printf("\tSVGA_3D_CMD_INVALIDATE_GB_SURFACE\n"); 2565 { 2566 const SVGA3dCmdInvalidateGBSurface *cmd = (const SVGA3dCmdInvalidateGBSurface *)body; 2567 dump_SVGA3dCmdInvalidateGBSurface(cmd); 2568 body = (const uint8_t *)&cmd[1]; 2569 } 2570 break; 2571 case SVGA_3D_CMD_INTRA_SURFACE_COPY: 2572 _debug_printf("\tSVGA_3D_CMD_INTRA_SURFACE_COPY\n"); 2573 { 2574 const SVGA3dCmdIntraSurfaceCopy *cmd = (const SVGA3dCmdIntraSurfaceCopy *)body; 2575 dump_SVGA3dCmdIntraSurfaceCopy(cmd); 2576 body = (const uint8_t *)&cmd[1]; 2577 } 2578 break; 2579 default: 2580 _debug_printf("\t0x%08x\n", cmd_id); 2581 break; 2582 } 2583 2584 while(body + sizeof(uint32_t) <= next) { 2585 _debug_printf("\t\t0x%08x\n", *(const uint32_t *)body); 2586 body += sizeof(uint32_t); 2587 } 2588 while(body + sizeof(uint32_t) <= next) 2589 _debug_printf("\t\t0x%02x\n", *body++); 2590} 2591 2592 2593void 2594svga_dump_commands(const void *commands, uint32_t size) 2595{ 2596 const uint8_t *next = commands; 2597 const uint8_t *last = next + size; 2598 2599 assert(size % sizeof(uint32_t) == 0); 2600 2601 while(next < last) { 2602 const uint32_t cmd_id = *(const uint32_t *)next; 2603 2604 if(SVGA_3D_CMD_BASE <= cmd_id && cmd_id < SVGA_3D_CMD_MAX) { 2605 const SVGA3dCmdHeader *header = (const SVGA3dCmdHeader *)next; 2606 const uint8_t *body = (const uint8_t *)&header[1]; 2607 2608 next = body + header->size; 2609 if(next > last) 2610 break; 2611 2612 svga_dump_command(cmd_id, body, header->size); 2613 } 2614 else if(cmd_id == SVGA_CMD_FENCE) { 2615 _debug_printf("\tSVGA_CMD_FENCE\n"); 2616 _debug_printf("\t\t0x%08x\n", ((const uint32_t *)next)[1]); 2617 next += 2*sizeof(uint32_t); 2618 } 2619 else { 2620 _debug_printf("\t0x%08x\n", cmd_id); 2621 next += sizeof(uint32_t); 2622 } 2623 } 2624} 2625 2626