VirtualBox

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

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

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