VirtualBox

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

最後變更 在這個檔案從99679是 95023,由 vboxsync 提交於 3 年 前

Devices/Graphics: shaders; render targets; removed a wrong ClearState call: bugref:9830

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

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