1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
2 /**********************************************************
3  * Copyright 2012-2019 VMware, Inc.
4  *
5  * Permission is hereby granted, free of charge, to any person
6  * obtaining a copy of this software and associated documentation
7  * files (the "Software"), to deal in the Software without
8  * restriction, including without limitation the rights to use, copy,
9  * modify, merge, publish, distribute, sublicense, and/or sell copies
10  * of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24  *
25  **********************************************************/
26 
27 /*
28  * svga3d_dx.h --
29  *
30  *       SVGA 3d hardware definitions for DX10 support.
31  */
32 
33 #ifndef _SVGA3D_DX_H_
34 #define _SVGA3D_DX_H_
35 
36 #define INCLUDE_ALLOW_MODULE
37 #define INCLUDE_ALLOW_USERLEVEL
38 #define INCLUDE_ALLOW_VMCORE
39 #include "includeCheck.h"
40 
41 #include "svga3d_limits.h"
42 
43 #define SVGA3D_INPUT_MIN               0
44 #define SVGA3D_INPUT_PER_VERTEX_DATA   0
45 #define SVGA3D_INPUT_PER_INSTANCE_DATA 1
46 #define SVGA3D_INPUT_MAX               2
47 typedef uint32 SVGA3dInputClassification;
48 
49 #define SVGA3D_RESOURCE_TYPE_MIN      1
50 #define SVGA3D_RESOURCE_BUFFER        1
51 #define SVGA3D_RESOURCE_TEXTURE1D     2
52 #define SVGA3D_RESOURCE_TEXTURE2D     3
53 #define SVGA3D_RESOURCE_TEXTURE3D     4
54 #define SVGA3D_RESOURCE_TEXTURECUBE   5
55 #define SVGA3D_RESOURCE_TYPE_DX10_MAX 6
56 #define SVGA3D_RESOURCE_BUFFEREX      6
57 #define SVGA3D_RESOURCE_TYPE_MAX      7
58 typedef uint32 SVGA3dResourceType;
59 
60 #define SVGA3D_COLOR_WRITE_ENABLE_RED     (1 << 0)
61 #define SVGA3D_COLOR_WRITE_ENABLE_GREEN   (1 << 1)
62 #define SVGA3D_COLOR_WRITE_ENABLE_BLUE    (1 << 2)
63 #define SVGA3D_COLOR_WRITE_ENABLE_ALPHA   (1 << 3)
64 #define SVGA3D_COLOR_WRITE_ENABLE_ALL     (SVGA3D_COLOR_WRITE_ENABLE_RED |   \
65                                            SVGA3D_COLOR_WRITE_ENABLE_GREEN | \
66                                            SVGA3D_COLOR_WRITE_ENABLE_BLUE |  \
67                                            SVGA3D_COLOR_WRITE_ENABLE_ALPHA)
68 typedef uint8 SVGA3dColorWriteEnable;
69 
70 #define SVGA3D_DEPTH_WRITE_MASK_ZERO   0
71 #define SVGA3D_DEPTH_WRITE_MASK_ALL    1
72 typedef uint8 SVGA3dDepthWriteMask;
73 
74 #define SVGA3D_FILTER_MIP_LINEAR  (1 << 0)
75 #define SVGA3D_FILTER_MAG_LINEAR  (1 << 2)
76 #define SVGA3D_FILTER_MIN_LINEAR  (1 << 4)
77 #define SVGA3D_FILTER_ANISOTROPIC (1 << 6)
78 #define SVGA3D_FILTER_COMPARE     (1 << 7)
79 typedef uint32 SVGA3dFilter;
80 
81 #define SVGA3D_CULL_INVALID 0
82 #define SVGA3D_CULL_MIN     1
83 #define SVGA3D_CULL_NONE    1
84 #define SVGA3D_CULL_FRONT   2
85 #define SVGA3D_CULL_BACK    3
86 #define SVGA3D_CULL_MAX     4
87 typedef uint8 SVGA3dCullMode;
88 
89 #define SVGA3D_COMPARISON_INVALID         0
90 #define SVGA3D_COMPARISON_MIN             1
91 #define SVGA3D_COMPARISON_NEVER           1
92 #define SVGA3D_COMPARISON_LESS            2
93 #define SVGA3D_COMPARISON_EQUAL           3
94 #define SVGA3D_COMPARISON_LESS_EQUAL      4
95 #define SVGA3D_COMPARISON_GREATER         5
96 #define SVGA3D_COMPARISON_NOT_EQUAL       6
97 #define SVGA3D_COMPARISON_GREATER_EQUAL   7
98 #define SVGA3D_COMPARISON_ALWAYS          8
99 #define SVGA3D_COMPARISON_MAX             9
100 typedef uint8 SVGA3dComparisonFunc;
101 
102 /*
103  * SVGA3D_MULTISAMPLE_RAST_DISABLE disables MSAA for all primitives.
104  * SVGA3D_MULTISAMPLE_RAST_DISABLE_LINE, which is supported in SM41,
105  * disables MSAA for lines only.
106  */
107 #define SVGA3D_MULTISAMPLE_RAST_DISABLE        0
108 #define SVGA3D_MULTISAMPLE_RAST_ENABLE         1
109 #define SVGA3D_MULTISAMPLE_RAST_DX_MAX         1
110 #define SVGA3D_MULTISAMPLE_RAST_DISABLE_LINE   2
111 #define SVGA3D_MULTISAMPLE_RAST_MAX            2
112 typedef uint8 SVGA3dMultisampleRastEnable;
113 
114 #define SVGA3D_DX_MAX_VERTEXBUFFERS 32
115 #define SVGA3D_DX_MAX_VERTEXINPUTREGISTERS 16
116 #define SVGA3D_DX_SM41_MAX_VERTEXINPUTREGISTERS 32
117 #define SVGA3D_DX_MAX_SOTARGETS 4
118 #define SVGA3D_DX_MAX_SRVIEWS 128
119 #define SVGA3D_DX_MAX_CONSTBUFFERS 16
120 #define SVGA3D_DX_MAX_SAMPLERS 16
121 #define SVGA3D_DX_MAX_CLASS_INSTANCES 253
122 
123 #define SVGA3D_DX_MAX_CONSTBUF_BINDING_SIZE (4096 * 4 * (uint32)sizeof(uint32))
124 
125 typedef uint32 SVGA3dShaderResourceViewId;
126 typedef uint32 SVGA3dRenderTargetViewId;
127 typedef uint32 SVGA3dDepthStencilViewId;
128 typedef uint32 SVGA3dUAViewId;
129 
130 typedef uint32 SVGA3dShaderId;
131 typedef uint32 SVGA3dElementLayoutId;
132 typedef uint32 SVGA3dSamplerId;
133 typedef uint32 SVGA3dBlendStateId;
134 typedef uint32 SVGA3dDepthStencilStateId;
135 typedef uint32 SVGA3dRasterizerStateId;
136 typedef uint32 SVGA3dQueryId;
137 typedef uint32 SVGA3dStreamOutputId;
138 
139 typedef union {
140    struct {
141       float r;
142       float g;
143       float b;
144       float a;
145    };
146 
147    float value[4];
148 } SVGA3dRGBAFloat;
149 
150 typedef union {
151    struct {
152       uint32 r;
153       uint32 g;
154       uint32 b;
155       uint32 a;
156    };
157 
158    uint32 value[4];
159 } SVGA3dRGBAUint32;
160 
161 typedef
162 #include "vmware_pack_begin.h"
163 struct {
164    uint32 cid;
165    SVGAMobId mobid;
166 }
167 #include "vmware_pack_end.h"
168 SVGAOTableDXContextEntry;
169 
170 typedef
171 #include "vmware_pack_begin.h"
172 struct SVGA3dCmdDXDefineContext {
173    uint32 cid;
174 }
175 #include "vmware_pack_end.h"
176 SVGA3dCmdDXDefineContext;   /* SVGA_3D_CMD_DX_DEFINE_CONTEXT */
177 
178 typedef
179 #include "vmware_pack_begin.h"
180 struct SVGA3dCmdDXDestroyContext {
181    uint32 cid;
182 }
183 #include "vmware_pack_end.h"
184 SVGA3dCmdDXDestroyContext;   /* SVGA_3D_CMD_DX_DESTROY_CONTEXT */
185 
186 /*
187  * Bind a DX context.
188  *
189  * validContents should be set to 0 for new contexts,
190  * and 1 if this is an old context which is getting paged
191  * back on to the device.
192  *
193  * For new contexts, it is recommended that the driver
194  * issue commands to initialize all interesting state
195  * prior to rendering.
196  */
197 typedef
198 #include "vmware_pack_begin.h"
199 struct SVGA3dCmdDXBindContext {
200    uint32 cid;
201    SVGAMobId mobid;
202    uint32 validContents;
203 }
204 #include "vmware_pack_end.h"
205 SVGA3dCmdDXBindContext;   /* SVGA_3D_CMD_DX_BIND_CONTEXT */
206 
207 /*
208  * Readback a DX context.
209  * (Request that the device flush the contents back into guest memory.)
210  */
211 typedef
212 #include "vmware_pack_begin.h"
213 struct SVGA3dCmdDXReadbackContext {
214    uint32 cid;
215 }
216 #include "vmware_pack_end.h"
217 SVGA3dCmdDXReadbackContext;   /* SVGA_3D_CMD_DX_READBACK_CONTEXT */
218 
219 /*
220  * Invalidate a guest-backed context.
221  */
222 typedef
223 #include "vmware_pack_begin.h"
224 struct SVGA3dCmdDXInvalidateContext {
225    uint32 cid;
226 }
227 #include "vmware_pack_end.h"
228 SVGA3dCmdDXInvalidateContext;   /* SVGA_3D_CMD_DX_INVALIDATE_CONTEXT */
229 
230 typedef
231 #include "vmware_pack_begin.h"
232 struct SVGA3dCmdDXSetSingleConstantBuffer {
233    uint32 slot;
234    SVGA3dShaderType type;
235    SVGA3dSurfaceId sid;
236    uint32 offsetInBytes;
237    uint32 sizeInBytes;
238 }
239 #include "vmware_pack_end.h"
240 SVGA3dCmdDXSetSingleConstantBuffer;
241 /* SVGA_3D_CMD_DX_SET_SINGLE_CONSTANT_BUFFER */
242 
243 typedef
244 #include "vmware_pack_begin.h"
245 struct SVGA3dCmdDXSetShaderResources {
246    uint32 startView;
247    SVGA3dShaderType type;
248 
249    /*
250     * Followed by a variable number of SVGA3dShaderResourceViewId's.
251     */
252 }
253 #include "vmware_pack_end.h"
254 SVGA3dCmdDXSetShaderResources; /* SVGA_3D_CMD_DX_SET_SHADER_RESOURCES */
255 
256 typedef
257 #include "vmware_pack_begin.h"
258 struct SVGA3dCmdDXSetShader {
259    SVGA3dShaderId shaderId;
260    SVGA3dShaderType type;
261 }
262 #include "vmware_pack_end.h"
263 SVGA3dCmdDXSetShader; /* SVGA_3D_CMD_DX_SET_SHADER */
264 
265 typedef union {
266    struct {
267       uint32 cbOffset : 12;
268       uint32 cbId     : 4;
269       uint32 baseSamp : 4;
270       uint32 baseTex  : 7;
271       uint32 reserved : 5;
272    };
273    uint32 value;
274 } SVGA3dIfaceData;
275 
276 typedef
277 #include "vmware_pack_begin.h"
278 struct SVGA3dCmdDXSetShaderIface {
279    SVGA3dShaderType type;
280    uint32 numClassInstances;
281    uint32 index;
282    uint32 iface;
283    SVGA3dIfaceData data;
284 }
285 #include "vmware_pack_end.h"
286 SVGA3dCmdDXSetShaderIface; /* SVGA_3D_CMD_DX_SET_SHADER_IFACE */
287 
288 typedef
289 #include "vmware_pack_begin.h"
290 struct SVGA3dCmdDXBindShaderIface {
291    uint32 cid;
292    SVGAMobId mobid;
293    uint32 offsetInBytes;
294 }
295 #include "vmware_pack_end.h"
296 SVGA3dCmdDXBindShaderIface; /* SVGA_3D_CMD_DX_BIND_SHADER_IFACE */
297 
298 typedef
299 #include "vmware_pack_begin.h"
300 struct SVGA3dCmdDXSetSamplers {
301    uint32 startSampler;
302    SVGA3dShaderType type;
303 
304    /*
305     * Followed by a variable number of SVGA3dSamplerId's.
306     */
307 }
308 #include "vmware_pack_end.h"
309 SVGA3dCmdDXSetSamplers; /* SVGA_3D_CMD_DX_SET_SAMPLERS */
310 
311 typedef
312 #include "vmware_pack_begin.h"
313 struct SVGA3dCmdDXDraw {
314    uint32 vertexCount;
315    uint32 startVertexLocation;
316 }
317 #include "vmware_pack_end.h"
318 SVGA3dCmdDXDraw; /* SVGA_3D_CMD_DX_DRAW */
319 
320 typedef
321 #include "vmware_pack_begin.h"
322 struct SVGA3dCmdDXDrawIndexed {
323    uint32 indexCount;
324    uint32 startIndexLocation;
325    int32  baseVertexLocation;
326 }
327 #include "vmware_pack_end.h"
328 SVGA3dCmdDXDrawIndexed; /* SVGA_3D_CMD_DX_DRAW_INDEXED */
329 
330 typedef
331 #include "vmware_pack_begin.h"
332 struct SVGA3dCmdDXDrawInstanced {
333    uint32 vertexCountPerInstance;
334    uint32 instanceCount;
335    uint32 startVertexLocation;
336    uint32 startInstanceLocation;
337 }
338 #include "vmware_pack_end.h"
339 SVGA3dCmdDXDrawInstanced; /* SVGA_3D_CMD_DX_DRAW_INSTANCED */
340 
341 typedef
342 #include "vmware_pack_begin.h"
343 struct SVGA3dCmdDXDrawIndexedInstanced {
344    uint32 indexCountPerInstance;
345    uint32 instanceCount;
346    uint32 startIndexLocation;
347    int32  baseVertexLocation;
348    uint32 startInstanceLocation;
349 }
350 #include "vmware_pack_end.h"
351 SVGA3dCmdDXDrawIndexedInstanced; /* SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED */
352 
353 typedef
354 #include "vmware_pack_begin.h"
355 struct SVGA3dCmdDXDrawIndexedInstancedIndirect {
356    SVGA3dSurfaceId argsBufferSid;
357    uint32 byteOffsetForArgs;
358 }
359 #include "vmware_pack_end.h"
360 SVGA3dCmdDXDrawIndexedInstancedIndirect;
361 /* SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED_INDIRECT */
362 
363 typedef
364 #include "vmware_pack_begin.h"
365 struct SVGA3dCmdDXDrawInstancedIndirect {
366    SVGA3dSurfaceId argsBufferSid;
367    uint32 byteOffsetForArgs;
368 }
369 #include "vmware_pack_end.h"
370 SVGA3dCmdDXDrawInstancedIndirect;
371 /* SVGA_3D_CMD_DX_DRAW_INSTANCED_INDIRECT */
372 
373 typedef
374 #include "vmware_pack_begin.h"
375 struct SVGA3dCmdDXDrawAuto {
376    uint32 pad0;
377 }
378 #include "vmware_pack_end.h"
379 SVGA3dCmdDXDrawAuto; /* SVGA_3D_CMD_DX_DRAW_AUTO */
380 
381 typedef
382 #include "vmware_pack_begin.h"
383 struct SVGA3dCmdDXDispatch {
384    uint32 threadGroupCountX;
385    uint32 threadGroupCountY;
386    uint32 threadGroupCountZ;
387 }
388 #include "vmware_pack_end.h"
389 SVGA3dCmdDXDispatch;
390 /* SVGA_3D_CMD_DX_DISPATCH */
391 
392 typedef
393 #include "vmware_pack_begin.h"
394 struct SVGA3dCmdDXDispatchIndirect {
395    SVGA3dSurfaceId argsBufferSid;
396    uint32 byteOffsetForArgs;
397 }
398 #include "vmware_pack_end.h"
399 SVGA3dCmdDXDispatchIndirect;
400 /* SVGA_3D_CMD_DX_DISPATCH_INDIRECT */
401 
402 typedef
403 #include "vmware_pack_begin.h"
404 struct SVGA3dCmdDXSetInputLayout {
405    SVGA3dElementLayoutId elementLayoutId;
406 }
407 #include "vmware_pack_end.h"
408 SVGA3dCmdDXSetInputLayout; /* SVGA_3D_CMD_DX_SET_INPUT_LAYOUT */
409 
410 typedef
411 #include "vmware_pack_begin.h"
412 struct SVGA3dVertexBuffer {
413    SVGA3dSurfaceId sid;
414    uint32 stride;
415    uint32 offset;
416 }
417 #include "vmware_pack_end.h"
418 SVGA3dVertexBuffer;
419 
420 typedef
421 #include "vmware_pack_begin.h"
422 struct SVGA3dCmdDXSetVertexBuffers {
423    uint32 startBuffer;
424    /* Followed by a variable number of SVGA3dVertexBuffer's. */
425 }
426 #include "vmware_pack_end.h"
427 SVGA3dCmdDXSetVertexBuffers; /* SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS */
428 
429 typedef
430 #include "vmware_pack_begin.h"
431 struct SVGA3dCmdDXSetIndexBuffer {
432    SVGA3dSurfaceId sid;
433    SVGA3dSurfaceFormat format;
434    uint32 offset;
435 }
436 #include "vmware_pack_end.h"
437 SVGA3dCmdDXSetIndexBuffer; /* SVGA_3D_CMD_DX_SET_INDEX_BUFFER */
438 
439 typedef
440 #include "vmware_pack_begin.h"
441 struct SVGA3dCmdDXSetTopology {
442    SVGA3dPrimitiveType topology;
443 }
444 #include "vmware_pack_end.h"
445 SVGA3dCmdDXSetTopology; /* SVGA_3D_CMD_DX_SET_TOPOLOGY */
446 
447 typedef
448 #include "vmware_pack_begin.h"
449 struct SVGA3dCmdDXSetRenderTargets {
450    SVGA3dDepthStencilViewId depthStencilViewId;
451    /* Followed by a variable number of SVGA3dRenderTargetViewId's. */
452 }
453 #include "vmware_pack_end.h"
454 SVGA3dCmdDXSetRenderTargets; /* SVGA_3D_CMD_DX_SET_RENDERTARGETS */
455 
456 typedef
457 #include "vmware_pack_begin.h"
458 struct SVGA3dCmdDXSetBlendState {
459    SVGA3dBlendStateId blendId;
460    float blendFactor[4];
461    uint32 sampleMask;
462 }
463 #include "vmware_pack_end.h"
464 SVGA3dCmdDXSetBlendState; /* SVGA_3D_CMD_DX_SET_BLEND_STATE */
465 
466 typedef
467 #include "vmware_pack_begin.h"
468 struct SVGA3dCmdDXSetDepthStencilState {
469    SVGA3dDepthStencilStateId depthStencilId;
470    uint32 stencilRef;
471 }
472 #include "vmware_pack_end.h"
473 SVGA3dCmdDXSetDepthStencilState; /* SVGA_3D_CMD_DX_SET_DEPTHSTENCIL_STATE */
474 
475 typedef
476 #include "vmware_pack_begin.h"
477 struct SVGA3dCmdDXSetRasterizerState {
478    SVGA3dRasterizerStateId rasterizerId;
479 }
480 #include "vmware_pack_end.h"
481 SVGA3dCmdDXSetRasterizerState; /* SVGA_3D_CMD_DX_SET_RASTERIZER_STATE */
482 
483 #define SVGA3D_DXQUERY_FLAG_PREDICATEHINT (1 << 0)
484 typedef uint32 SVGA3dDXQueryFlags;
485 
486 /*
487  * The SVGADXQueryDeviceState and SVGADXQueryDeviceBits are used by the device
488  * to track query state transitions, but are not intended to be used by the
489  * driver.
490  */
491 #define SVGADX_QDSTATE_INVALID   ((uint8)-1) /* Query has no state */
492 #define SVGADX_QDSTATE_MIN       0
493 #define SVGADX_QDSTATE_IDLE      0   /* Query hasn't started yet */
494 #define SVGADX_QDSTATE_ACTIVE    1   /* Query is actively gathering data */
495 #define SVGADX_QDSTATE_PENDING   2   /* Query is waiting for results */
496 #define SVGADX_QDSTATE_FINISHED  3   /* Query has completed */
497 #define SVGADX_QDSTATE_MAX       4
498 typedef uint8 SVGADXQueryDeviceState;
499 
500 typedef
501 #include "vmware_pack_begin.h"
502 struct {
503    SVGA3dQueryTypeUint8 type;
504    uint16 pad0;
505    SVGADXQueryDeviceState state;
506    SVGA3dDXQueryFlags flags;
507    SVGAMobId mobid;
508    uint32 offset;
509 }
510 #include "vmware_pack_end.h"
511 SVGACOTableDXQueryEntry;
512 
513 typedef
514 #include "vmware_pack_begin.h"
515 struct SVGA3dCmdDXDefineQuery {
516    SVGA3dQueryId queryId;
517    SVGA3dQueryType type;
518    SVGA3dDXQueryFlags flags;
519 }
520 #include "vmware_pack_end.h"
521 SVGA3dCmdDXDefineQuery; /* SVGA_3D_CMD_DX_DEFINE_QUERY */
522 
523 typedef
524 #include "vmware_pack_begin.h"
525 struct SVGA3dCmdDXDestroyQuery {
526    SVGA3dQueryId queryId;
527 }
528 #include "vmware_pack_end.h"
529 SVGA3dCmdDXDestroyQuery; /* SVGA_3D_CMD_DX_DESTROY_QUERY */
530 
531 typedef
532 #include "vmware_pack_begin.h"
533 struct SVGA3dCmdDXBindQuery {
534    SVGA3dQueryId queryId;
535    SVGAMobId mobid;
536 }
537 #include "vmware_pack_end.h"
538 SVGA3dCmdDXBindQuery; /* SVGA_3D_CMD_DX_BIND_QUERY */
539 
540 typedef
541 #include "vmware_pack_begin.h"
542 struct SVGA3dCmdDXSetQueryOffset {
543    SVGA3dQueryId queryId;
544    uint32 mobOffset;
545 }
546 #include "vmware_pack_end.h"
547 SVGA3dCmdDXSetQueryOffset; /* SVGA_3D_CMD_DX_SET_QUERY_OFFSET */
548 
549 typedef
550 #include "vmware_pack_begin.h"
551 struct SVGA3dCmdDXBeginQuery {
552    SVGA3dQueryId queryId;
553 }
554 #include "vmware_pack_end.h"
555 SVGA3dCmdDXBeginQuery; /* SVGA_3D_CMD_DX_QUERY_BEGIN */
556 
557 typedef
558 #include "vmware_pack_begin.h"
559 struct SVGA3dCmdDXEndQuery {
560    SVGA3dQueryId queryId;
561 }
562 #include "vmware_pack_end.h"
563 SVGA3dCmdDXEndQuery; /* SVGA_3D_CMD_DX_QUERY_END */
564 
565 typedef
566 #include "vmware_pack_begin.h"
567 struct SVGA3dCmdDXReadbackQuery {
568    SVGA3dQueryId queryId;
569 }
570 #include "vmware_pack_end.h"
571 SVGA3dCmdDXReadbackQuery; /* SVGA_3D_CMD_DX_READBACK_QUERY */
572 
573 typedef
574 #include "vmware_pack_begin.h"
575 struct SVGA3dCmdDXMoveQuery {
576    SVGA3dQueryId queryId;
577    SVGAMobId mobid;
578    uint32 mobOffset;
579 }
580 #include "vmware_pack_end.h"
581 SVGA3dCmdDXMoveQuery; /* SVGA_3D_CMD_DX_MOVE_QUERY */
582 
583 typedef
584 #include "vmware_pack_begin.h"
585 struct SVGA3dCmdDXBindAllQuery {
586    uint32 cid;
587    SVGAMobId mobid;
588 }
589 #include "vmware_pack_end.h"
590 SVGA3dCmdDXBindAllQuery; /* SVGA_3D_CMD_DX_BIND_ALL_QUERY */
591 
592 typedef
593 #include "vmware_pack_begin.h"
594 struct SVGA3dCmdDXReadbackAllQuery {
595    uint32 cid;
596 }
597 #include "vmware_pack_end.h"
598 SVGA3dCmdDXReadbackAllQuery; /* SVGA_3D_CMD_DX_READBACK_ALL_QUERY */
599 
600 typedef
601 #include "vmware_pack_begin.h"
602 struct SVGA3dCmdDXSetPredication {
603    SVGA3dQueryId queryId;
604    uint32 predicateValue;
605 }
606 #include "vmware_pack_end.h"
607 SVGA3dCmdDXSetPredication; /* SVGA_3D_CMD_DX_SET_PREDICATION */
608 
609 typedef
610 #include "vmware_pack_begin.h"
611 struct MKS3dDXSOState {
612    uint32 offset;       /* Starting offset */
613    uint32 intOffset;    /* Internal offset */
614    uint32 vertexCount;  /* vertices written */
615    uint32 dead;
616 }
617 #include "vmware_pack_end.h"
618 SVGA3dDXSOState;
619 
620 /* Set the offset field to this value to append SO values to the buffer */
621 #define SVGA3D_DX_SO_OFFSET_APPEND ((uint32) ~0u)
622 
623 typedef
624 #include "vmware_pack_begin.h"
625 struct SVGA3dSoTarget {
626    SVGA3dSurfaceId sid;
627    uint32 offset;
628    uint32 sizeInBytes;
629 }
630 #include "vmware_pack_end.h"
631 SVGA3dSoTarget;
632 
633 typedef
634 #include "vmware_pack_begin.h"
635 struct SVGA3dCmdDXSetSOTargets {
636    uint32 pad0;
637    /* Followed by a variable number of SVGA3dSOTarget's. */
638 }
639 #include "vmware_pack_end.h"
640 SVGA3dCmdDXSetSOTargets; /* SVGA_3D_CMD_DX_SET_SOTARGETS */
641 
642 typedef
643 #include "vmware_pack_begin.h"
644 struct SVGA3dViewport
645 {
646    float x;
647    float y;
648    float width;
649    float height;
650    float minDepth;
651    float maxDepth;
652 }
653 #include "vmware_pack_end.h"
654 SVGA3dViewport;
655 
656 typedef
657 #include "vmware_pack_begin.h"
658 struct SVGA3dCmdDXSetViewports {
659    uint32 pad0;
660    /* Followed by a variable number of SVGA3dViewport's. */
661 }
662 #include "vmware_pack_end.h"
663 SVGA3dCmdDXSetViewports; /* SVGA_3D_CMD_DX_SET_VIEWPORTS */
664 
665 #define SVGA3D_DX_MAX_VIEWPORTS  16
666 
667 typedef
668 #include "vmware_pack_begin.h"
669 struct SVGA3dCmdDXSetScissorRects {
670    uint32 pad0;
671    /* Followed by a variable number of SVGASignedRect's. */
672 }
673 #include "vmware_pack_end.h"
674 SVGA3dCmdDXSetScissorRects; /* SVGA_3D_CMD_DX_SET_SCISSORRECTS */
675 
676 #define SVGA3D_DX_MAX_SCISSORRECTS  16
677 
678 typedef
679 #include "vmware_pack_begin.h"
680 struct SVGA3dCmdDXClearRenderTargetView {
681    SVGA3dRenderTargetViewId renderTargetViewId;
682    SVGA3dRGBAFloat rgba;
683 }
684 #include "vmware_pack_end.h"
685 SVGA3dCmdDXClearRenderTargetView; /* SVGA_3D_CMD_DX_CLEAR_RENDERTARGET_VIEW */
686 
687 typedef
688 #include "vmware_pack_begin.h"
689 struct SVGA3dCmdDXClearDepthStencilView {
690    uint16 flags;
691    uint16 stencil;
692    SVGA3dDepthStencilViewId depthStencilViewId;
693    float depth;
694 }
695 #include "vmware_pack_end.h"
696 SVGA3dCmdDXClearDepthStencilView; /* SVGA_3D_CMD_DX_CLEAR_DEPTHSTENCIL_VIEW */
697 
698 typedef
699 #include "vmware_pack_begin.h"
700 struct SVGA3dCmdDXPredCopyRegion {
701    SVGA3dSurfaceId dstSid;
702    uint32 dstSubResource;
703    SVGA3dSurfaceId srcSid;
704    uint32 srcSubResource;
705    SVGA3dCopyBox box;
706 }
707 #include "vmware_pack_end.h"
708 SVGA3dCmdDXPredCopyRegion;
709 /* SVGA_3D_CMD_DX_PRED_COPY_REGION */
710 
711 typedef
712 #include "vmware_pack_begin.h"
713 struct SVGA3dCmdDXPredCopy {
714    SVGA3dSurfaceId dstSid;
715    SVGA3dSurfaceId srcSid;
716 }
717 #include "vmware_pack_end.h"
718 SVGA3dCmdDXPredCopy; /* SVGA_3D_CMD_DX_PRED_COPY */
719 
720 typedef
721 #include "vmware_pack_begin.h"
722 struct SVGA3dCmdDXPredConvertRegion {
723    SVGA3dSurfaceId dstSid;
724    uint32 dstSubResource;
725    SVGA3dBox destBox;
726    SVGA3dSurfaceId srcSid;
727    uint32 srcSubResource;
728    SVGA3dBox srcBox;
729 }
730 #include "vmware_pack_end.h"
731 SVGA3dCmdDXPredConvertRegion; /* SVGA_3D_CMD_DX_PRED_CONVERT_REGION */
732 
733 typedef
734 #include "vmware_pack_begin.h"
735 struct SVGA3dCmdDXPredConvert {
736    SVGA3dSurfaceId dstSid;
737    SVGA3dSurfaceId srcSid;
738 }
739 #include "vmware_pack_end.h"
740 SVGA3dCmdDXPredConvert; /* SVGA_3D_CMD_DX_PRED_CONVERT */
741 
742 typedef
743 #include "vmware_pack_begin.h"
744 struct SVGA3dCmdDXBufferCopy {
745    SVGA3dSurfaceId dest;
746    SVGA3dSurfaceId src;
747    uint32 destX;
748    uint32 srcX;
749    uint32 width;
750 }
751 #include "vmware_pack_end.h"
752 SVGA3dCmdDXBufferCopy;
753 /* SVGA_3D_CMD_DX_BUFFER_COPY */
754 
755 /*
756  * Perform a surface copy between a multisample, and a non-multisampled
757  * surface.
758  */
759 typedef
760 #include "vmware_pack_begin.h"
761 struct {
762    SVGA3dSurfaceId dstSid;
763    uint32 dstSubResource;
764    SVGA3dSurfaceId srcSid;
765    uint32 srcSubResource;
766    SVGA3dSurfaceFormat copyFormat;
767 }
768 #include "vmware_pack_end.h"
769 SVGA3dCmdDXResolveCopy;               /* SVGA_3D_CMD_DX_RESOLVE_COPY */
770 
771 /*
772  * Perform a predicated surface copy between a multisample, and a
773  * non-multisampled surface.
774  */
775 typedef
776 #include "vmware_pack_begin.h"
777 struct {
778    SVGA3dSurfaceId dstSid;
779    uint32 dstSubResource;
780    SVGA3dSurfaceId srcSid;
781    uint32 srcSubResource;
782    SVGA3dSurfaceFormat copyFormat;
783 }
784 #include "vmware_pack_end.h"
785 SVGA3dCmdDXPredResolveCopy;           /* SVGA_3D_CMD_DX_PRED_RESOLVE_COPY */
786 
787 typedef uint32 SVGA3dDXPresentBltMode;
788 #define SVGADX_PRESENTBLT_LINEAR           (1 << 0)
789 #define SVGADX_PRESENTBLT_FORCE_SRC_SRGB   (1 << 1)
790 #define SVGADX_PRESENTBLT_FORCE_SRC_XRBIAS (1 << 2)
791 #define SVGADX_PRESENTBLT_MODE_MAX         (1 << 3)
792 
793 typedef
794 #include "vmware_pack_begin.h"
795 struct SVGA3dCmdDXPresentBlt {
796    SVGA3dSurfaceId srcSid;
797    uint32 srcSubResource;
798    SVGA3dSurfaceId dstSid;
799    uint32 destSubResource;
800    SVGA3dBox boxSrc;
801    SVGA3dBox boxDest;
802    SVGA3dDXPresentBltMode mode;
803 }
804 #include "vmware_pack_end.h"
805 SVGA3dCmdDXPresentBlt; /* SVGA_3D_CMD_DX_PRESENTBLT*/
806 
807 typedef
808 #include "vmware_pack_begin.h"
809 struct SVGA3dCmdDXGenMips {
810    SVGA3dShaderResourceViewId shaderResourceViewId;
811 }
812 #include "vmware_pack_end.h"
813 SVGA3dCmdDXGenMips; /* SVGA_3D_CMD_DX_GENMIPS */
814 
815 /*
816  * Update a sub-resource in a guest-backed resource.
817  * (Inform the device that the guest-contents have been updated.)
818  */
819 typedef
820 #include "vmware_pack_begin.h"
821 struct SVGA3dCmdDXUpdateSubResource {
822    SVGA3dSurfaceId sid;
823    uint32 subResource;
824    SVGA3dBox box;
825 }
826 #include "vmware_pack_end.h"
827 SVGA3dCmdDXUpdateSubResource;   /* SVGA_3D_CMD_DX_UPDATE_SUBRESOURCE */
828 
829 /*
830  * Readback a subresource in a guest-backed resource.
831  * (Request the device to flush the dirty contents into the guest.)
832  */
833 typedef
834 #include "vmware_pack_begin.h"
835 struct SVGA3dCmdDXReadbackSubResource {
836    SVGA3dSurfaceId sid;
837    uint32 subResource;
838 }
839 #include "vmware_pack_end.h"
840 SVGA3dCmdDXReadbackSubResource;   /* SVGA_3D_CMD_DX_READBACK_SUBRESOURCE */
841 
842 /*
843  * Invalidate an image in a guest-backed surface.
844  * (Notify the device that the contents can be lost.)
845  */
846 typedef
847 #include "vmware_pack_begin.h"
848 struct SVGA3dCmdDXInvalidateSubResource {
849    SVGA3dSurfaceId sid;
850    uint32 subResource;
851 }
852 #include "vmware_pack_end.h"
853 SVGA3dCmdDXInvalidateSubResource;   /* SVGA_3D_CMD_DX_INVALIDATE_SUBRESOURCE */
854 
855 
856 /*
857  * Raw byte wise transfer from a buffer surface into another surface
858  * of the requested box.  Supported if 3d is enabled and SVGA_CAP_DX
859  * is set.  This command does not take a context.
860  */
861 typedef
862 #include "vmware_pack_begin.h"
863 struct SVGA3dCmdDXTransferFromBuffer {
864    SVGA3dSurfaceId srcSid;
865    uint32 srcOffset;
866    uint32 srcPitch;
867    uint32 srcSlicePitch;
868    SVGA3dSurfaceId destSid;
869    uint32 destSubResource;
870    SVGA3dBox destBox;
871 }
872 #include "vmware_pack_end.h"
873 SVGA3dCmdDXTransferFromBuffer;   /* SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER */
874 
875 
876 #define SVGA3D_TRANSFER_TO_BUFFER_READBACK   (1 << 0)
877 #define SVGA3D_TRANSFER_TO_BUFFER_FLAGS_MASK (1 << 0)
878 typedef uint32 SVGA3dTransferToBufferFlags;
879 
880 /*
881  * Raw byte wise transfer to a buffer surface from another surface
882  * of the requested box.  Supported if SVGA_CAP_DX2 is set.  This
883  * command does not take a context.
884  */
885 typedef
886 #include "vmware_pack_begin.h"
887 struct SVGA3dCmdDXTransferToBuffer {
888    SVGA3dSurfaceId srcSid;
889    uint32 srcSubResource;
890    SVGA3dBox srcBox;
891    SVGA3dSurfaceId destSid;
892    uint32 destOffset;
893    uint32 destPitch;
894    uint32 destSlicePitch;
895    SVGA3dTransferToBufferFlags flags;
896 }
897 #include "vmware_pack_end.h"
898 SVGA3dCmdDXTransferToBuffer;   /* SVGA_3D_CMD_DX_TRANSFER_TO_BUFFER */
899 
900 
901 /*
902  * Raw byte wise transfer from a buffer surface into another surface
903  * of the requested box.  Supported if SVGA3D_DEVCAP_DXCONTEXT is set.
904  * The context is implied from the command buffer header.
905  */
906 typedef
907 #include "vmware_pack_begin.h"
908 struct SVGA3dCmdDXPredTransferFromBuffer {
909    SVGA3dSurfaceId srcSid;
910    uint32 srcOffset;
911    uint32 srcPitch;
912    uint32 srcSlicePitch;
913    SVGA3dSurfaceId destSid;
914    uint32 destSubResource;
915    SVGA3dBox destBox;
916 }
917 #include "vmware_pack_end.h"
918 SVGA3dCmdDXPredTransferFromBuffer;
919 /* SVGA_3D_CMD_DX_PRED_TRANSFER_FROM_BUFFER */
920 
921 
922 typedef
923 #include "vmware_pack_begin.h"
924 struct SVGA3dCmdDXSurfaceCopyAndReadback {
925    SVGA3dSurfaceId srcSid;
926    SVGA3dSurfaceId destSid;
927    SVGA3dCopyBox box;
928 }
929 #include "vmware_pack_end.h"
930 SVGA3dCmdDXSurfaceCopyAndReadback;
931 /* SVGA_3D_CMD_DX_SURFACE_COPY_AND_READBACK */
932 
933 /*
934  * SVGA_DX_HINT_NONE: Does nothing.
935  *
936  * SVGA_DX_HINT_PREFETCH_OBJECT:
937  * SVGA_DX_HINT_PREEVICT_OBJECT:
938  *      Consumes a SVGAObjectRef, and hints that the host should consider
939  *      fetching/evicting the specified object.
940  *
941  *      An id of SVGA3D_INVALID_ID can be used if the guest isn't sure
942  *      what object was affected.  (For instance, if the guest knows that
943  *      it is about to evict a DXShader, but doesn't know precisely which one,
944  *      the device can still use this to help limit it's search, or track
945  *      how many page-outs have happened.)
946  *
947  * SVGA_DX_HINT_PREFETCH_COBJECT:
948  * SVGA_DX_HINT_PREEVICT_COBJECT:
949  *      Same as the above, except they consume an SVGACObjectRef.
950  */
951 typedef uint32 SVGADXHintId;
952 #define SVGA_DX_HINT_NONE              0
953 #define SVGA_DX_HINT_PREFETCH_OBJECT   1
954 #define SVGA_DX_HINT_PREEVICT_OBJECT   2
955 #define SVGA_DX_HINT_PREFETCH_COBJECT  3
956 #define SVGA_DX_HINT_PREEVICT_COBJECT  4
957 #define SVGA_DX_HINT_MAX               5
958 
959 typedef
960 #include "vmware_pack_begin.h"
961 struct SVGAObjectRef {
962    SVGAOTableType type;
963    uint32 id;
964 }
965 #include "vmware_pack_end.h"
966 SVGAObjectRef;
967 
968 typedef
969 #include "vmware_pack_begin.h"
970 struct SVGACObjectRef {
971    SVGACOTableType type;
972    uint32 cid;
973    uint32 id;
974 }
975 #include "vmware_pack_end.h"
976 SVGACObjectRef;
977 
978 typedef
979 #include "vmware_pack_begin.h"
980 struct SVGA3dCmdDXHint {
981    SVGADXHintId hintId;
982 
983    /*
984     * Followed by variable sized data depending on the hintId.
985     */
986 }
987 #include "vmware_pack_end.h"
988 SVGA3dCmdDXHint;
989 /* SVGA_3D_CMD_DX_HINT */
990 
991 typedef
992 #include "vmware_pack_begin.h"
993 struct SVGA3dCmdDXBufferUpdate {
994    SVGA3dSurfaceId sid;
995    uint32 x;
996    uint32 width;
997 }
998 #include "vmware_pack_end.h"
999 SVGA3dCmdDXBufferUpdate;
1000 /* SVGA_3D_CMD_DX_BUFFER_UPDATE */
1001 
1002 typedef
1003 #include "vmware_pack_begin.h"
1004 struct SVGA3dCmdDXSetConstantBufferOffset {
1005    uint32 slot;
1006    uint32 offsetInBytes;
1007 }
1008 #include "vmware_pack_end.h"
1009 SVGA3dCmdDXSetConstantBufferOffset;
1010 
1011 typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetVSConstantBufferOffset;
1012 /* SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET */
1013 
1014 typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetPSConstantBufferOffset;
1015 /* SVGA_3D_CMD_DX_SET_PS_CONSTANT_BUFFER_OFFSET */
1016 
1017 typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetGSConstantBufferOffset;
1018 /* SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET */
1019 
1020 typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetHSConstantBufferOffset;
1021 /* SVGA_3D_CMD_DX_SET_HS_CONSTANT_BUFFER_OFFSET */
1022 
1023 typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetDSConstantBufferOffset;
1024 /* SVGA_3D_CMD_DX_SET_DS_CONSTANT_BUFFER_OFFSET */
1025 
1026 typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetCSConstantBufferOffset;
1027 /* SVGA_3D_CMD_DX_SET_CS_CONSTANT_BUFFER_OFFSET */
1028 
1029 
1030 #define SVGA3D_BUFFEREX_SRV_RAW        (1 << 0)
1031 #define SVGA3D_BUFFEREX_SRV_FLAGS_MAX  (1 << 1)
1032 #define SVGA3D_BUFFEREX_SRV_FLAGS_MASK (SVGA3D_BUFFEREX_SRV_FLAGS_MAX - 1)
1033 typedef uint32 SVGA3dBufferExFlags;
1034 
1035 typedef
1036 #include "vmware_pack_begin.h"
1037 struct {
1038    union {
1039       struct {
1040          uint32 firstElement;
1041          uint32 numElements;
1042          uint32 pad0;
1043          uint32 pad1;
1044       } buffer;
1045       struct {
1046          uint32 mostDetailedMip;
1047          uint32 firstArraySlice;
1048          uint32 mipLevels;
1049          uint32 arraySize;
1050       } tex; /* 1d, 2d, 3d, cube */
1051       struct {
1052          uint32 firstElement;
1053          uint32 numElements;
1054          SVGA3dBufferExFlags flags;
1055          uint32 pad0;
1056       } bufferex;
1057    };
1058 }
1059 #include "vmware_pack_end.h"
1060 SVGA3dShaderResourceViewDesc;
1061 
1062 typedef
1063 #include "vmware_pack_begin.h"
1064 struct {
1065    SVGA3dSurfaceId sid;
1066    SVGA3dSurfaceFormat format;
1067    SVGA3dResourceType resourceDimension;
1068    SVGA3dShaderResourceViewDesc desc;
1069    uint32 pad;
1070 }
1071 #include "vmware_pack_end.h"
1072 SVGACOTableDXSRViewEntry;
1073 
1074 typedef
1075 #include "vmware_pack_begin.h"
1076 struct SVGA3dCmdDXDefineShaderResourceView {
1077    SVGA3dShaderResourceViewId shaderResourceViewId;
1078 
1079    SVGA3dSurfaceId sid;
1080    SVGA3dSurfaceFormat format;
1081    SVGA3dResourceType resourceDimension;
1082 
1083    SVGA3dShaderResourceViewDesc desc;
1084 }
1085 #include "vmware_pack_end.h"
1086 SVGA3dCmdDXDefineShaderResourceView;
1087 /* SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW */
1088 
1089 typedef
1090 #include "vmware_pack_begin.h"
1091 struct SVGA3dCmdDXDestroyShaderResourceView {
1092    SVGA3dShaderResourceViewId shaderResourceViewId;
1093 }
1094 #include "vmware_pack_end.h"
1095 SVGA3dCmdDXDestroyShaderResourceView;
1096 /* SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW */
1097 
1098 typedef
1099 #include "vmware_pack_begin.h"
1100 struct SVGA3dRenderTargetViewDesc {
1101    union {
1102       struct {
1103          uint32 firstElement;
1104          uint32 numElements;
1105          uint32 padding0;
1106       } buffer;
1107       struct {
1108          uint32 mipSlice;
1109          uint32 firstArraySlice;
1110          uint32 arraySize;
1111       } tex;                    /* 1d, 2d, cube */
1112       struct {
1113          uint32 mipSlice;
1114          uint32 firstW;
1115          uint32 wSize;
1116       } tex3D;
1117    };
1118 }
1119 #include "vmware_pack_end.h"
1120 SVGA3dRenderTargetViewDesc;
1121 
1122 typedef
1123 #include "vmware_pack_begin.h"
1124 struct {
1125    SVGA3dSurfaceId sid;
1126    SVGA3dSurfaceFormat format;
1127    SVGA3dResourceType resourceDimension;
1128    SVGA3dRenderTargetViewDesc desc;
1129    uint32 pad[2];
1130 }
1131 #include "vmware_pack_end.h"
1132 SVGACOTableDXRTViewEntry;
1133 
1134 typedef
1135 #include "vmware_pack_begin.h"
1136 struct SVGA3dCmdDXDefineRenderTargetView {
1137    SVGA3dRenderTargetViewId renderTargetViewId;
1138 
1139    SVGA3dSurfaceId sid;
1140    SVGA3dSurfaceFormat format;
1141    SVGA3dResourceType resourceDimension;
1142 
1143    SVGA3dRenderTargetViewDesc desc;
1144 }
1145 #include "vmware_pack_end.h"
1146 SVGA3dCmdDXDefineRenderTargetView;
1147 /* SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW */
1148 
1149 typedef
1150 #include "vmware_pack_begin.h"
1151 struct SVGA3dCmdDXDestroyRenderTargetView {
1152    SVGA3dRenderTargetViewId renderTargetViewId;
1153 }
1154 #include "vmware_pack_end.h"
1155 SVGA3dCmdDXDestroyRenderTargetView;
1156 /* SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW */
1157 
1158 /*
1159  */
1160 #define SVGA3D_DXDSVIEW_CREATE_READ_ONLY_DEPTH   0x01
1161 #define SVGA3D_DXDSVIEW_CREATE_READ_ONLY_STENCIL 0x02
1162 #define SVGA3D_DXDSVIEW_CREATE_FLAG_MASK         0x03
1163 typedef uint8 SVGA3DCreateDSViewFlags;
1164 
1165 typedef
1166 #include "vmware_pack_begin.h"
1167 struct {
1168    SVGA3dSurfaceId sid;
1169    SVGA3dSurfaceFormat format;
1170    SVGA3dResourceType resourceDimension;
1171    uint32 mipSlice;
1172    uint32 firstArraySlice;
1173    uint32 arraySize;
1174    SVGA3DCreateDSViewFlags flags;
1175    uint8 pad0;
1176    uint16 pad1;
1177    uint32 pad2;
1178 }
1179 #include "vmware_pack_end.h"
1180 SVGACOTableDXDSViewEntry;
1181 
1182 typedef
1183 #include "vmware_pack_begin.h"
1184 struct SVGA3dCmdDXDefineDepthStencilView {
1185    SVGA3dDepthStencilViewId depthStencilViewId;
1186 
1187    SVGA3dSurfaceId sid;
1188    SVGA3dSurfaceFormat format;
1189    SVGA3dResourceType resourceDimension;
1190    uint32 mipSlice;
1191    uint32 firstArraySlice;
1192    uint32 arraySize;
1193    SVGA3DCreateDSViewFlags flags;
1194    uint8 pad0;
1195    uint16 pad1;
1196 }
1197 #include "vmware_pack_end.h"
1198 SVGA3dCmdDXDefineDepthStencilView;
1199 /* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW */
1200 
1201 /*
1202  * Version 2 needed in order to start validating and using the flags
1203  * field.  Unfortunately the device wasn't validating or using the
1204  * flags field and the driver wasn't initializing it in shipped code,
1205  * so a new version of the command is needed to allow that code to
1206  * continue to work.
1207  */
1208 typedef
1209 #include "vmware_pack_begin.h"
1210 struct SVGA3dCmdDXDefineDepthStencilView_v2 {
1211    SVGA3dDepthStencilViewId depthStencilViewId;
1212 
1213    SVGA3dSurfaceId sid;
1214    SVGA3dSurfaceFormat format;
1215    SVGA3dResourceType resourceDimension;
1216    uint32 mipSlice;
1217    uint32 firstArraySlice;
1218    uint32 arraySize;
1219    SVGA3DCreateDSViewFlags flags;
1220    uint8 pad0;
1221    uint16 pad1;
1222 }
1223 #include "vmware_pack_end.h"
1224 SVGA3dCmdDXDefineDepthStencilView_v2;
1225 /* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW_V2 */
1226 
1227 typedef
1228 #include "vmware_pack_begin.h"
1229 struct SVGA3dCmdDXDestroyDepthStencilView {
1230    SVGA3dDepthStencilViewId depthStencilViewId;
1231 }
1232 #include "vmware_pack_end.h"
1233 SVGA3dCmdDXDestroyDepthStencilView;
1234 /* SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW */
1235 
1236 
1237 #define SVGA3D_UABUFFER_RAW     (1 << 0)
1238 #define SVGA3D_UABUFFER_APPEND  (1 << 1)
1239 #define SVGA3D_UABUFFER_COUNTER (1 << 2)
1240 typedef uint32 SVGA3dUABufferFlags;
1241 
1242 typedef
1243 #include "vmware_pack_begin.h"
1244 struct {
1245    union {
1246       struct {
1247          uint32 firstElement;
1248          uint32 numElements;
1249          SVGA3dUABufferFlags flags;
1250          uint32 padding0;
1251          uint32 padding1;
1252       } buffer;
1253       struct {
1254          uint32 mipSlice;
1255          uint32 firstArraySlice;
1256          uint32 arraySize;
1257          uint32 padding0;
1258          uint32 padding1;
1259       } tex;  /* 1d, 2d */
1260       struct {
1261          uint32 mipSlice;
1262          uint32 firstW;
1263          uint32 wSize;
1264          uint32 padding0;
1265          uint32 padding1;
1266       } tex3D;
1267    };
1268 }
1269 #include "vmware_pack_end.h"
1270 SVGA3dUAViewDesc;
1271 
1272 typedef
1273 #include "vmware_pack_begin.h"
1274 struct {
1275    SVGA3dSurfaceId sid;
1276    SVGA3dSurfaceFormat format;
1277    SVGA3dResourceType resourceDimension;
1278    SVGA3dUAViewDesc desc;
1279    uint32 structureCount;
1280    uint32 pad[7];
1281 }
1282 #include "vmware_pack_end.h"
1283 SVGACOTableDXUAViewEntry;
1284 
1285 typedef
1286 #include "vmware_pack_begin.h"
1287 struct SVGA3dCmdDXDefineUAView {
1288    SVGA3dUAViewId uaViewId;
1289 
1290    SVGA3dSurfaceId sid;
1291    SVGA3dSurfaceFormat format;
1292    SVGA3dResourceType resourceDimension;
1293 
1294    SVGA3dUAViewDesc desc;
1295 }
1296 #include "vmware_pack_end.h"
1297 SVGA3dCmdDXDefineUAView;
1298 /* SVGA_3D_CMD_DX_DEFINE_UA_VIEW */
1299 
1300 typedef
1301 #include "vmware_pack_begin.h"
1302 struct SVGA3dCmdDXDestroyUAView {
1303    SVGA3dUAViewId uaViewId;
1304 }
1305 #include "vmware_pack_end.h"
1306 SVGA3dCmdDXDestroyUAView;
1307 /* SVGA_3D_CMD_DX_DESTROY_UA_VIEW */
1308 
1309 typedef
1310 #include "vmware_pack_begin.h"
1311 struct SVGA3dCmdDXClearUAViewUint {
1312    SVGA3dUAViewId uaViewId;
1313    SVGA3dRGBAUint32 value;
1314 }
1315 #include "vmware_pack_end.h"
1316 SVGA3dCmdDXClearUAViewUint;
1317 /* SVGA_3D_CMD_DX_CLEAR_UA_VIEW_UINT */
1318 
1319 typedef
1320 #include "vmware_pack_begin.h"
1321 struct SVGA3dCmdDXClearUAViewFloat {
1322    SVGA3dUAViewId uaViewId;
1323    SVGA3dRGBAFloat value;
1324 }
1325 #include "vmware_pack_end.h"
1326 SVGA3dCmdDXClearUAViewFloat;
1327 /* SVGA_3D_CMD_DX_CLEAR_UA_VIEW_FLOAT */
1328 
1329 typedef
1330 #include "vmware_pack_begin.h"
1331 struct SVGA3dCmdDXCopyStructureCount {
1332    SVGA3dUAViewId srcUAViewId;
1333    SVGA3dSurfaceId destSid;
1334    uint32 destByteOffset;
1335 }
1336 #include "vmware_pack_end.h"
1337 SVGA3dCmdDXCopyStructureCount;
1338 /* SVGA_3D_CMD_DX_COPY_STRUCTURE_COUNT */
1339 
1340 typedef
1341 #include "vmware_pack_begin.h"
1342 struct SVGA3dCmdDXSetStructureCount {
1343    SVGA3dUAViewId uaViewId;
1344    uint32 structureCount;
1345 }
1346 #include "vmware_pack_end.h"
1347 SVGA3dCmdDXSetStructureCount;
1348 /* SVGA_3D_CMD_DX_SET_STRUCTURE_COUNT */
1349 
1350 typedef
1351 #include "vmware_pack_begin.h"
1352 struct SVGA3dCmdDXSetUAViews {
1353    uint32 uavSpliceIndex;
1354    /* Followed by a variable number of SVGA3dUAViewId's. */
1355 }
1356 #include "vmware_pack_end.h"
1357 SVGA3dCmdDXSetUAViews; /* SVGA_3D_CMD_DX_SET_UA_VIEWS */
1358 
1359 typedef
1360 #include "vmware_pack_begin.h"
1361 struct SVGA3dCmdDXSetCSUAViews {
1362    uint32 startIndex;
1363    /* Followed by a variable number of SVGA3dUAViewId's. */
1364 }
1365 #include "vmware_pack_end.h"
1366 SVGA3dCmdDXSetCSUAViews; /* SVGA_3D_CMD_DX_SET_CS_UA_VIEWS */
1367 
1368 typedef
1369 #include "vmware_pack_begin.h"
1370 struct SVGA3dInputElementDesc {
1371    uint32 inputSlot;
1372    uint32 alignedByteOffset;
1373    SVGA3dSurfaceFormat format;
1374    SVGA3dInputClassification inputSlotClass;
1375    uint32 instanceDataStepRate;
1376    uint32 inputRegister;
1377 }
1378 #include "vmware_pack_end.h"
1379 SVGA3dInputElementDesc;
1380 
1381 typedef
1382 #include "vmware_pack_begin.h"
1383 struct {
1384    uint32 elid;
1385    uint32 numDescs;
1386    SVGA3dInputElementDesc descs[32];
1387    uint32 pad[62];
1388 }
1389 #include "vmware_pack_end.h"
1390 SVGACOTableDXElementLayoutEntry;
1391 
1392 typedef
1393 #include "vmware_pack_begin.h"
1394 struct SVGA3dCmdDXDefineElementLayout {
1395    SVGA3dElementLayoutId elementLayoutId;
1396    /* Followed by a variable number of SVGA3dInputElementDesc's. */
1397 }
1398 #include "vmware_pack_end.h"
1399 SVGA3dCmdDXDefineElementLayout;
1400 /* SVGA_3D_CMD_DX_DEFINE_ELEMENTLAYOUT */
1401 
1402 typedef
1403 #include "vmware_pack_begin.h"
1404 struct SVGA3dCmdDXDestroyElementLayout {
1405    SVGA3dElementLayoutId elementLayoutId;
1406 }
1407 #include "vmware_pack_end.h"
1408 SVGA3dCmdDXDestroyElementLayout;
1409 /* SVGA_3D_CMD_DX_DESTROY_ELEMENTLAYOUT */
1410 
1411 
1412 #define SVGA3D_DX_MAX_RENDER_TARGETS 8
1413 
1414 typedef
1415 #include "vmware_pack_begin.h"
1416 struct SVGA3dDXBlendStatePerRT {
1417       uint8 blendEnable;
1418       uint8 srcBlend;
1419       uint8 destBlend;
1420       uint8 blendOp;
1421       uint8 srcBlendAlpha;
1422       uint8 destBlendAlpha;
1423       uint8 blendOpAlpha;
1424       SVGA3dColorWriteEnable renderTargetWriteMask;
1425       uint8 logicOpEnable;
1426       uint8 logicOp;
1427       uint16 pad0;
1428 }
1429 #include "vmware_pack_end.h"
1430 SVGA3dDXBlendStatePerRT;
1431 
1432 typedef
1433 #include "vmware_pack_begin.h"
1434 struct {
1435    uint8 alphaToCoverageEnable;
1436    uint8 independentBlendEnable;
1437    uint16 pad0;
1438    SVGA3dDXBlendStatePerRT perRT[SVGA3D_MAX_RENDER_TARGETS];
1439    uint32 pad1[7];
1440 }
1441 #include "vmware_pack_end.h"
1442 SVGACOTableDXBlendStateEntry;
1443 
1444 /*
1445  */
1446 typedef
1447 #include "vmware_pack_begin.h"
1448 struct SVGA3dCmdDXDefineBlendState {
1449    SVGA3dBlendStateId blendId;
1450    uint8 alphaToCoverageEnable;
1451    uint8 independentBlendEnable;
1452    uint16 pad0;
1453    SVGA3dDXBlendStatePerRT perRT[SVGA3D_MAX_RENDER_TARGETS];
1454 }
1455 #include "vmware_pack_end.h"
1456 SVGA3dCmdDXDefineBlendState; /* SVGA_3D_CMD_DX_DEFINE_BLEND_STATE */
1457 
1458 typedef
1459 #include "vmware_pack_begin.h"
1460 struct SVGA3dCmdDXDestroyBlendState {
1461    SVGA3dBlendStateId blendId;
1462 }
1463 #include "vmware_pack_end.h"
1464 SVGA3dCmdDXDestroyBlendState; /* SVGA_3D_CMD_DX_DESTROY_BLEND_STATE */
1465 
1466 typedef
1467 #include "vmware_pack_begin.h"
1468 struct {
1469    uint8 depthEnable;
1470    SVGA3dDepthWriteMask depthWriteMask;
1471    SVGA3dComparisonFunc depthFunc;
1472    uint8 stencilEnable;
1473    uint8 frontEnable;
1474    uint8 backEnable;
1475    uint8 stencilReadMask;
1476    uint8 stencilWriteMask;
1477 
1478    uint8 frontStencilFailOp;
1479    uint8 frontStencilDepthFailOp;
1480    uint8 frontStencilPassOp;
1481    SVGA3dComparisonFunc frontStencilFunc;
1482 
1483    uint8 backStencilFailOp;
1484    uint8 backStencilDepthFailOp;
1485    uint8 backStencilPassOp;
1486    SVGA3dComparisonFunc backStencilFunc;
1487 }
1488 #include "vmware_pack_end.h"
1489 SVGACOTableDXDepthStencilEntry;
1490 
1491 /*
1492  */
1493 typedef
1494 #include "vmware_pack_begin.h"
1495 struct SVGA3dCmdDXDefineDepthStencilState {
1496    SVGA3dDepthStencilStateId depthStencilId;
1497 
1498    uint8 depthEnable;
1499    SVGA3dDepthWriteMask depthWriteMask;
1500    SVGA3dComparisonFunc depthFunc;
1501    uint8 stencilEnable;
1502    uint8 frontEnable;
1503    uint8 backEnable;
1504    uint8 stencilReadMask;
1505    uint8 stencilWriteMask;
1506 
1507    uint8 frontStencilFailOp;
1508    uint8 frontStencilDepthFailOp;
1509    uint8 frontStencilPassOp;
1510    SVGA3dComparisonFunc frontStencilFunc;
1511 
1512    uint8 backStencilFailOp;
1513    uint8 backStencilDepthFailOp;
1514    uint8 backStencilPassOp;
1515    SVGA3dComparisonFunc backStencilFunc;
1516 }
1517 #include "vmware_pack_end.h"
1518 SVGA3dCmdDXDefineDepthStencilState;
1519 /* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_STATE */
1520 
1521 typedef
1522 #include "vmware_pack_begin.h"
1523 struct SVGA3dCmdDXDestroyDepthStencilState {
1524    SVGA3dDepthStencilStateId depthStencilId;
1525 }
1526 #include "vmware_pack_end.h"
1527 SVGA3dCmdDXDestroyDepthStencilState;
1528 /* SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_STATE */
1529 
1530 typedef
1531 #include "vmware_pack_begin.h"
1532 struct {
1533    uint8 fillMode;
1534    SVGA3dCullMode cullMode;
1535    uint8 frontCounterClockwise;
1536    uint8 provokingVertexLast;
1537    int32 depthBias;
1538    float depthBiasClamp;
1539    float slopeScaledDepthBias;
1540    uint8 depthClipEnable;
1541    uint8 scissorEnable;
1542    SVGA3dMultisampleRastEnable multisampleEnable;
1543    uint8 antialiasedLineEnable;
1544    float lineWidth;
1545    uint8 lineStippleEnable;
1546    uint8 lineStippleFactor;
1547    uint16 lineStipplePattern;
1548    uint8 forcedSampleCount;
1549    uint8 mustBeZero[3];
1550 }
1551 #include "vmware_pack_end.h"
1552 SVGACOTableDXRasterizerStateEntry;
1553 
1554 /*
1555  */
1556 typedef
1557 #include "vmware_pack_begin.h"
1558 struct SVGA3dCmdDXDefineRasterizerState {
1559    SVGA3dRasterizerStateId rasterizerId;
1560 
1561    uint8 fillMode;
1562    SVGA3dCullMode cullMode;
1563    uint8 frontCounterClockwise;
1564    uint8 provokingVertexLast;
1565    int32 depthBias;
1566    float depthBiasClamp;
1567    float slopeScaledDepthBias;
1568    uint8 depthClipEnable;
1569    uint8 scissorEnable;
1570    SVGA3dMultisampleRastEnable multisampleEnable;
1571    uint8 antialiasedLineEnable;
1572    float lineWidth;
1573    uint8 lineStippleEnable;
1574    uint8 lineStippleFactor;
1575    uint16 lineStipplePattern;
1576 }
1577 #include "vmware_pack_end.h"
1578 SVGA3dCmdDXDefineRasterizerState;
1579 /* SVGA_3D_CMD_DX_DEFINE_RASTERIZER_STATE */
1580 
1581 typedef
1582 #include "vmware_pack_begin.h"
1583 struct SVGA3dCmdDXDestroyRasterizerState {
1584    SVGA3dRasterizerStateId rasterizerId;
1585 }
1586 #include "vmware_pack_end.h"
1587 SVGA3dCmdDXDestroyRasterizerState;
1588 /* SVGA_3D_CMD_DX_DESTROY_RASTERIZER_STATE */
1589 
1590 typedef
1591 #include "vmware_pack_begin.h"
1592 struct {
1593    SVGA3dFilter filter;
1594    uint8 addressU;
1595    uint8 addressV;
1596    uint8 addressW;
1597    uint8 pad0;
1598    float mipLODBias;
1599    uint8 maxAnisotropy;
1600    SVGA3dComparisonFunc comparisonFunc;
1601    uint16 pad1;
1602    SVGA3dRGBAFloat borderColor;
1603    float minLOD;
1604    float maxLOD;
1605    uint32 pad2[6];
1606 }
1607 #include "vmware_pack_end.h"
1608 SVGACOTableDXSamplerEntry;
1609 
1610 /*
1611  */
1612 typedef
1613 #include "vmware_pack_begin.h"
1614 struct SVGA3dCmdDXDefineSamplerState {
1615    SVGA3dSamplerId samplerId;
1616    SVGA3dFilter filter;
1617    uint8 addressU;
1618    uint8 addressV;
1619    uint8 addressW;
1620    uint8 pad0;
1621    float mipLODBias;
1622    uint8 maxAnisotropy;
1623    SVGA3dComparisonFunc comparisonFunc;
1624    uint16 pad1;
1625    SVGA3dRGBAFloat borderColor;
1626    float minLOD;
1627    float maxLOD;
1628 }
1629 #include "vmware_pack_end.h"
1630 SVGA3dCmdDXDefineSamplerState; /* SVGA_3D_CMD_DX_DEFINE_SAMPLER_STATE */
1631 
1632 typedef
1633 #include "vmware_pack_begin.h"
1634 struct SVGA3dCmdDXDestroySamplerState {
1635    SVGA3dSamplerId samplerId;
1636 }
1637 #include "vmware_pack_end.h"
1638 SVGA3dCmdDXDestroySamplerState; /* SVGA_3D_CMD_DX_DESTROY_SAMPLER_STATE */
1639 
1640 
1641 #define SVGADX_SIGNATURE_SEMANTIC_NAME_UNDEFINED                          0
1642 #define SVGADX_SIGNATURE_SEMANTIC_NAME_POSITION                           1
1643 #define SVGADX_SIGNATURE_SEMANTIC_NAME_CLIP_DISTANCE                      2
1644 #define SVGADX_SIGNATURE_SEMANTIC_NAME_CULL_DISTANCE                      3
1645 #define SVGADX_SIGNATURE_SEMANTIC_NAME_RENDER_TARGET_ARRAY_INDEX          4
1646 #define SVGADX_SIGNATURE_SEMANTIC_NAME_VIEWPORT_ARRAY_INDEX               5
1647 #define SVGADX_SIGNATURE_SEMANTIC_NAME_VERTEX_ID                          6
1648 #define SVGADX_SIGNATURE_SEMANTIC_NAME_PRIMITIVE_ID                       7
1649 #define SVGADX_SIGNATURE_SEMANTIC_NAME_INSTANCE_ID                        8
1650 #define SVGADX_SIGNATURE_SEMANTIC_NAME_IS_FRONT_FACE                      9
1651 #define SVGADX_SIGNATURE_SEMANTIC_NAME_SAMPLE_INDEX                       10
1652 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_EQ_0_EDGE_TESSFACTOR  11
1653 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_EQ_0_EDGE_TESSFACTOR  12
1654 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_EQ_1_EDGE_TESSFACTOR  13
1655 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_EQ_1_EDGE_TESSFACTOR  14
1656 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_INSIDE_TESSFACTOR     15
1657 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_INSIDE_TESSFACTOR     16
1658 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_U_EQ_0_EDGE_TESSFACTOR   17
1659 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_V_EQ_0_EDGE_TESSFACTOR   18
1660 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_W_EQ_0_EDGE_TESSFACTOR   19
1661 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_INSIDE_TESSFACTOR        20
1662 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_LINE_DETAIL_TESSFACTOR       21
1663 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_LINE_DENSITY_TESSFACTOR      22
1664 #define SVGADX_SIGNATURE_SEMANTIC_NAME_MAX                                23
1665 typedef uint32 SVGA3dDXSignatureSemanticName;
1666 
1667 #define SVGADX_SIGNATURE_REGISTER_COMPONENT_UNKNOWN 0
1668 typedef uint32 SVGA3dDXSignatureRegisterComponentType;
1669 
1670 #define SVGADX_SIGNATURE_MIN_PRECISION_DEFAULT 0
1671 typedef uint32 SVGA3dDXSignatureMinPrecision;
1672 
1673 typedef
1674 #include "vmware_pack_begin.h"
1675 struct SVGA3dDXSignatureEntry {
1676    uint32 registerIndex;
1677    SVGA3dDXSignatureSemanticName semanticName;
1678    uint32 mask; /* Lower 4 bits represent X, Y, Z, W channels */
1679    SVGA3dDXSignatureRegisterComponentType componentType;
1680    SVGA3dDXSignatureMinPrecision minPrecision;
1681 }
1682 #include "vmware_pack_end.h"
1683 SVGA3dDXShaderSignatureEntry;
1684 
1685 #define SVGADX_SIGNATURE_HEADER_VERSION_0 0x08a92d12
1686 
1687 /*
1688  * The SVGA3dDXSignatureHeader structure is added after the shader
1689  * body in the mob that is bound to the shader.  It is followed by the
1690  * specified number of SVGA3dDXSignatureEntry structures for each of
1691  * the three types of signatures in the order (input, output, patch
1692  * constants).
1693  */
1694 typedef
1695 #include "vmware_pack_begin.h"
1696 struct SVGA3dDXSignatureHeader {
1697    uint32 headerVersion;
1698    uint32 numInputSignatures;
1699    uint32 numOutputSignatures;
1700    uint32 numPatchConstantSignatures;
1701 }
1702 #include "vmware_pack_end.h"
1703 SVGA3dDXShaderSignatureHeader;
1704 
1705 typedef
1706 #include "vmware_pack_begin.h"
1707 struct SVGA3dCmdDXDefineShader {
1708    SVGA3dShaderId shaderId;
1709    SVGA3dShaderType type;
1710    uint32 sizeInBytes; /* Number of bytes of shader text. */
1711 }
1712 #include "vmware_pack_end.h"
1713 SVGA3dCmdDXDefineShader; /* SVGA_3D_CMD_DX_DEFINE_SHADER */
1714 
1715 typedef
1716 #include "vmware_pack_begin.h"
1717 struct SVGACOTableDXShaderEntry {
1718    SVGA3dShaderType type;
1719    uint32 sizeInBytes;
1720    uint32 offsetInBytes;
1721    SVGAMobId mobid;
1722    uint32 pad[4];
1723 }
1724 #include "vmware_pack_end.h"
1725 SVGACOTableDXShaderEntry;
1726 
1727 typedef
1728 #include "vmware_pack_begin.h"
1729 struct SVGA3dCmdDXDestroyShader {
1730    SVGA3dShaderId shaderId;
1731 }
1732 #include "vmware_pack_end.h"
1733 SVGA3dCmdDXDestroyShader; /* SVGA_3D_CMD_DX_DESTROY_SHADER */
1734 
1735 typedef
1736 #include "vmware_pack_begin.h"
1737 struct SVGA3dCmdDXBindShader {
1738    uint32 cid;
1739    uint32 shid;
1740    SVGAMobId mobid;
1741    uint32 offsetInBytes;
1742 }
1743 #include "vmware_pack_end.h"
1744 SVGA3dCmdDXBindShader;   /* SVGA_3D_CMD_DX_BIND_SHADER */
1745 
1746 typedef
1747 #include "vmware_pack_begin.h"
1748 struct SVGA3dCmdDXBindAllShader {
1749    uint32 cid;
1750    SVGAMobId mobid;
1751 }
1752 #include "vmware_pack_end.h"
1753 SVGA3dCmdDXBindAllShader;   /* SVGA_3D_CMD_DX_BIND_ALL_SHADER */
1754 
1755 typedef
1756 #include "vmware_pack_begin.h"
1757 struct SVGA3dCmdDXCondBindAllShader {
1758    uint32 cid;
1759    SVGAMobId testMobid;
1760    SVGAMobId mobid;
1761 }
1762 #include "vmware_pack_end.h"
1763 SVGA3dCmdDXCondBindAllShader;   /* SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER */
1764 
1765 /*
1766  * The maximum number of streamout decl's in each streamout entry.
1767  */
1768 #define SVGA3D_MAX_DX10_STREAMOUT_DECLS 64
1769 #define SVGA3D_MAX_STREAMOUT_DECLS 512
1770 
1771 typedef
1772 #include "vmware_pack_begin.h"
1773 struct SVGA3dStreamOutputDeclarationEntry {
1774    uint32 outputSlot;
1775    uint32 registerIndex;
1776    uint8  registerMask;
1777    uint8  pad0;
1778    uint16 pad1;
1779    uint32 stream;
1780 }
1781 #include "vmware_pack_end.h"
1782 SVGA3dStreamOutputDeclarationEntry;
1783 
1784 typedef
1785 #include "vmware_pack_begin.h"
1786 struct SVGAOTableStreamOutputEntry {
1787    uint32 numOutputStreamEntries;
1788    SVGA3dStreamOutputDeclarationEntry decl[SVGA3D_MAX_DX10_STREAMOUT_DECLS];
1789    uint32 streamOutputStrideInBytes[SVGA3D_DX_MAX_SOTARGETS];
1790    uint32 rasterizedStream;
1791    uint32 numOutputStreamStrides;
1792    uint32 mobid;
1793    uint32 offsetInBytes;
1794    uint8 usesMob;
1795    uint8 pad0;
1796    uint16 pad1;
1797    uint32 pad2[246];
1798 }
1799 #include "vmware_pack_end.h"
1800 SVGACOTableDXStreamOutputEntry;
1801 
1802 typedef
1803 #include "vmware_pack_begin.h"
1804 struct SVGA3dCmdDXDefineStreamOutput {
1805    SVGA3dStreamOutputId soid;
1806    uint32 numOutputStreamEntries;
1807    SVGA3dStreamOutputDeclarationEntry decl[SVGA3D_MAX_DX10_STREAMOUT_DECLS];
1808    uint32 streamOutputStrideInBytes[SVGA3D_DX_MAX_SOTARGETS];
1809    uint32 rasterizedStream;
1810 }
1811 #include "vmware_pack_end.h"
1812 SVGA3dCmdDXDefineStreamOutput; /* SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT */
1813 
1814 /*
1815  * Version 2 needed in order to start validating and using the
1816  * rasterizedStream field.  Unfortunately the device wasn't validating
1817  * or using this field and the driver wasn't initializing it in shipped
1818  * code, so a new version of the command is needed to allow that code
1819  * to continue to work.  Also added new numOutputStreamStrides field.
1820  */
1821 
1822 #define SVGA3D_DX_SO_NO_RASTERIZED_STREAM 0xFFFFFFFF
1823 
1824 typedef
1825 #include "vmware_pack_begin.h"
1826 struct SVGA3dCmdDXDefineStreamOutputWithMob {
1827    SVGA3dStreamOutputId soid;
1828    uint32 numOutputStreamEntries;
1829    uint32 numOutputStreamStrides;
1830    uint32 streamOutputStrideInBytes[SVGA3D_DX_MAX_SOTARGETS];
1831    uint32 rasterizedStream;
1832 }
1833 #include "vmware_pack_end.h"
1834 SVGA3dCmdDXDefineStreamOutputWithMob;
1835 /* SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT_WITH_MOB */
1836 
1837 typedef
1838 #include "vmware_pack_begin.h"
1839 struct SVGA3dCmdDXBindStreamOutput {
1840    SVGA3dStreamOutputId soid;
1841    uint32 mobid;
1842    uint32 offsetInBytes;
1843    uint32 sizeInBytes;
1844 }
1845 #include "vmware_pack_end.h"
1846 SVGA3dCmdDXBindStreamOutput; /* SVGA_3D_CMD_DX_BIND_STREAMOUTPUT */
1847 
1848 typedef
1849 #include "vmware_pack_begin.h"
1850 struct SVGA3dCmdDXDestroyStreamOutput {
1851    SVGA3dStreamOutputId soid;
1852 }
1853 #include "vmware_pack_end.h"
1854 SVGA3dCmdDXDestroyStreamOutput; /* SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT */
1855 
1856 typedef
1857 #include "vmware_pack_begin.h"
1858 struct SVGA3dCmdDXSetStreamOutput {
1859    SVGA3dStreamOutputId soid;
1860 }
1861 #include "vmware_pack_end.h"
1862 SVGA3dCmdDXSetStreamOutput; /* SVGA_3D_CMD_DX_SET_STREAMOUTPUT */
1863 
1864 typedef
1865 #include "vmware_pack_begin.h"
1866 struct SVGA3dCmdDXSetMinLOD {
1867    SVGA3dSurfaceId sid;
1868    float minLOD;
1869 }
1870 #include "vmware_pack_end.h"
1871 SVGA3dCmdDXSetMinLOD; /* SVGA_3D_CMD_DX_SET_MIN_LOD */
1872 
1873 typedef
1874 #include "vmware_pack_begin.h"
1875 struct {
1876    uint64 value;
1877    uint32 mobId;
1878    uint32 mobOffset;
1879 }
1880 #include "vmware_pack_end.h"
1881 SVGA3dCmdDXMobFence64;  /* SVGA_3D_CMD_DX_MOB_FENCE_64 */
1882 
1883 /*
1884  * SVGA3dCmdSetCOTable --
1885  *
1886  * This command allows the guest to bind a mob to a context-object table.
1887  */
1888 typedef
1889 #include "vmware_pack_begin.h"
1890 struct SVGA3dCmdDXSetCOTable {
1891    uint32 cid;
1892    uint32 mobid;
1893    SVGACOTableType type;
1894    uint32 validSizeInBytes;
1895 }
1896 #include "vmware_pack_end.h"
1897 SVGA3dCmdDXSetCOTable; /* SVGA_3D_CMD_DX_SET_COTABLE */
1898 
1899 /*
1900  * Guests using SVGA_3D_CMD_DX_GROW_COTABLE are promising that
1901  * the new COTable contains the same contents as the old one, except possibly
1902  * for some new invalid entries at the end.
1903  *
1904  * If there is an old cotable mob bound, it also has to still be valid.
1905  *
1906  * (Otherwise, guests should use the DXSetCOTableBase command.)
1907  */
1908 typedef
1909 #include "vmware_pack_begin.h"
1910 struct SVGA3dCmdDXGrowCOTable {
1911    uint32 cid;
1912    uint32 mobid;
1913    SVGACOTableType type;
1914    uint32 validSizeInBytes;
1915 }
1916 #include "vmware_pack_end.h"
1917 SVGA3dCmdDXGrowCOTable; /* SVGA_3D_CMD_DX_GROW_COTABLE */
1918 
1919 typedef
1920 #include "vmware_pack_begin.h"
1921 struct SVGA3dCmdDXReadbackCOTable {
1922    uint32 cid;
1923    SVGACOTableType type;
1924 }
1925 #include "vmware_pack_end.h"
1926 SVGA3dCmdDXReadbackCOTable; /* SVGA_3D_CMD_DX_READBACK_COTABLE */
1927 
1928 typedef
1929 #include "vmware_pack_begin.h"
1930 struct SVGA3dCOTableData {
1931    uint32 mobid;
1932 }
1933 #include "vmware_pack_end.h"
1934 SVGA3dCOTableData;
1935 
1936 typedef
1937 #include "vmware_pack_begin.h"
1938 struct SVGA3dBufferBinding {
1939    uint32 bufferId;
1940    uint32 stride;
1941    uint32 offset;
1942 }
1943 #include "vmware_pack_end.h"
1944 SVGA3dBufferBinding;
1945 
1946 typedef
1947 #include "vmware_pack_begin.h"
1948 struct SVGA3dConstantBufferBinding {
1949    uint32 sid;
1950    uint32 offsetInBytes;
1951    uint32 sizeInBytes;
1952 }
1953 #include "vmware_pack_end.h"
1954 SVGA3dConstantBufferBinding;
1955 
1956 typedef
1957 #include "vmware_pack_begin.h"
1958 struct SVGADXInputAssemblyMobFormat {
1959    uint32 layoutId;
1960    SVGA3dBufferBinding vertexBuffers[SVGA3D_DX_MAX_VERTEXBUFFERS];
1961    uint32 indexBufferSid;
1962    uint32 pad;
1963    uint32 indexBufferOffset;
1964    uint32 indexBufferFormat;
1965    uint32 topology;
1966 }
1967 #include "vmware_pack_end.h"
1968 SVGADXInputAssemblyMobFormat;
1969 
1970 typedef
1971 #include "vmware_pack_begin.h"
1972 struct SVGADXContextMobFormat {
1973    SVGADXInputAssemblyMobFormat inputAssembly;
1974 
1975    struct {
1976       uint32 blendStateId;
1977       uint32 blendFactor[4];
1978       uint32 sampleMask;
1979       uint32 depthStencilStateId;
1980       uint32 stencilRef;
1981       uint32 rasterizerStateId;
1982       uint32 depthStencilViewId;
1983       uint32 renderTargetViewIds[SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS];
1984    } renderState;
1985 
1986    uint32 pad0[8];
1987 
1988    struct {
1989       uint32 targets[SVGA3D_DX_MAX_SOTARGETS];
1990       uint32 soid;
1991    } streamOut;
1992 
1993    uint32 pad1[10];
1994 
1995    uint32 uavSpliceIndex;
1996 
1997    uint8 numViewports;
1998    uint8 numScissorRects;
1999    uint16 pad2[1];
2000 
2001    uint32 pad3[3];
2002 
2003    SVGA3dViewport viewports[SVGA3D_DX_MAX_VIEWPORTS];
2004    uint32 pad4[32];
2005 
2006    SVGASignedRect scissorRects[SVGA3D_DX_MAX_SCISSORRECTS];
2007    uint32 pad5[64];
2008 
2009    struct {
2010       uint32 queryID;
2011       uint32 value;
2012    } predication;
2013 
2014    SVGAMobId shaderIfaceMobid;
2015    uint32 shaderIfaceOffset;
2016    struct {
2017       uint32 shaderId;
2018       SVGA3dConstantBufferBinding constantBuffers[SVGA3D_DX_MAX_CONSTBUFFERS];
2019       uint32 shaderResources[SVGA3D_DX_MAX_SRVIEWS];
2020       uint32 samplers[SVGA3D_DX_MAX_SAMPLERS];
2021    } shaderState[SVGA3D_NUM_SHADERTYPE];
2022    uint32 pad6[26];
2023 
2024    SVGA3dQueryId queryID[SVGA3D_MAX_QUERY];
2025 
2026    SVGA3dCOTableData cotables[SVGA_COTABLE_MAX];
2027 
2028    uint32 pad7[64];
2029 
2030    uint32 uaViewIds[SVGA3D_DX11_1_MAX_UAVIEWS];
2031    uint32 csuaViewIds[SVGA3D_DX11_1_MAX_UAVIEWS];
2032 
2033    uint32 pad8[188];
2034 }
2035 #include "vmware_pack_end.h"
2036 SVGADXContextMobFormat;
2037 
2038 /*
2039  * There is conflicting documentation on max class instances (253 vs 256).  The
2040  * lower value is the one used throughout the device, but since mob format is
2041  * more involved to increase if needed, conservatively use the higher one here.
2042  */
2043 #define SVGA3D_DX_MAX_CLASS_INSTANCES_PADDED 256
2044 
2045 typedef
2046 #include "vmware_pack_begin.h"
2047 struct SVGADXShaderIfaceMobFormat {
2048    struct {
2049       uint32 numClassInstances;
2050       uint32 iface[SVGA3D_DX_MAX_CLASS_INSTANCES_PADDED];
2051       SVGA3dIfaceData data[SVGA3D_DX_MAX_CLASS_INSTANCES_PADDED];
2052    } shaderIfaceState[SVGA3D_NUM_SHADERTYPE];
2053 
2054    uint32 pad0[1018];
2055 }
2056 #include "vmware_pack_end.h"
2057 SVGADXShaderIfaceMobFormat;
2058 
2059 typedef
2060 #include "vmware_pack_begin.h"
2061 struct SVGA3dCmdDXTempSetContext {
2062    uint32 dxcid;
2063 }
2064 #include "vmware_pack_end.h"
2065 SVGA3dCmdDXTempSetContext; /* SVGA_3D_CMD_DX_TEMP_SET_CONTEXT */
2066 
2067 #endif /* _SVGA3D_DX_H_ */
2068