VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/svgadump/svga_dump.c@ 88830

Last change on this file since 88830 was 88830, checked in by vboxsync, 4 years ago

Devices/Graphics: VirtualBox modifications for svga command logging. bugref:9830

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette