1 /*	$NetBSD: svga3d_dx.h,v 1.3 2021/12/18 23:45:45 riastradh Exp $	*/
2 
3 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
4 /**********************************************************
5  * Copyright 2012-2015 VMware, Inc.
6  *
7  * Permission is hereby granted, free of charge, to any person
8  * obtaining a copy of this software and associated documentation
9  * files (the "Software"), to deal in the Software without
10  * restriction, including without limitation the rights to use, copy,
11  * modify, merge, publish, distribute, sublicense, and/or sell copies
12  * of the Software, and to permit persons to whom the Software is
13  * furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be
16  * included in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
22  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25  * SOFTWARE.
26  *
27  **********************************************************/
28 
29 /*
30  * svga3d_dx.h --
31  *
32  *       SVGA 3d hardware definitions for DX10 support.
33  */
34 
35 #ifndef _SVGA3D_DX_H_
36 #define _SVGA3D_DX_H_
37 
38 #define INCLUDE_ALLOW_MODULE
39 #define INCLUDE_ALLOW_USERLEVEL
40 #define INCLUDE_ALLOW_VMCORE
41 #include "includeCheck.h"
42 
43 #include "svga3d_limits.h"
44 
45 #define SVGA3D_INPUT_MIN               0
46 #define SVGA3D_INPUT_PER_VERTEX_DATA   0
47 #define SVGA3D_INPUT_PER_INSTANCE_DATA 1
48 #define SVGA3D_INPUT_MAX               2
49 typedef uint32 SVGA3dInputClassification;
50 
51 #define SVGA3D_RESOURCE_TYPE_MIN      1
52 #define SVGA3D_RESOURCE_BUFFER        1
53 #define SVGA3D_RESOURCE_TEXTURE1D     2
54 #define SVGA3D_RESOURCE_TEXTURE2D     3
55 #define SVGA3D_RESOURCE_TEXTURE3D     4
56 #define SVGA3D_RESOURCE_TEXTURECUBE   5
57 #define SVGA3D_RESOURCE_TYPE_DX10_MAX 6
58 #define SVGA3D_RESOURCE_BUFFEREX      6
59 #define SVGA3D_RESOURCE_TYPE_MAX      7
60 typedef uint32 SVGA3dResourceType;
61 
62 #define SVGA3D_COLOR_WRITE_ENABLE_RED     (1 << 0)
63 #define SVGA3D_COLOR_WRITE_ENABLE_GREEN   (1 << 1)
64 #define SVGA3D_COLOR_WRITE_ENABLE_BLUE    (1 << 2)
65 #define SVGA3D_COLOR_WRITE_ENABLE_ALPHA   (1 << 3)
66 #define SVGA3D_COLOR_WRITE_ENABLE_ALL     (SVGA3D_COLOR_WRITE_ENABLE_RED |   \
67                                            SVGA3D_COLOR_WRITE_ENABLE_GREEN | \
68                                            SVGA3D_COLOR_WRITE_ENABLE_BLUE |  \
69                                            SVGA3D_COLOR_WRITE_ENABLE_ALPHA)
70 typedef uint8 SVGA3dColorWriteEnable;
71 
72 #define SVGA3D_DEPTH_WRITE_MASK_ZERO   0
73 #define SVGA3D_DEPTH_WRITE_MASK_ALL    1
74 typedef uint8 SVGA3dDepthWriteMask;
75 
76 #define SVGA3D_FILTER_MIP_LINEAR  (1 << 0)
77 #define SVGA3D_FILTER_MAG_LINEAR  (1 << 2)
78 #define SVGA3D_FILTER_MIN_LINEAR  (1 << 4)
79 #define SVGA3D_FILTER_ANISOTROPIC (1 << 6)
80 #define SVGA3D_FILTER_COMPARE     (1 << 7)
81 typedef uint32 SVGA3dFilter;
82 
83 #define SVGA3D_CULL_INVALID 0
84 #define SVGA3D_CULL_MIN     1
85 #define SVGA3D_CULL_NONE    1
86 #define SVGA3D_CULL_FRONT   2
87 #define SVGA3D_CULL_BACK    3
88 #define SVGA3D_CULL_MAX     4
89 typedef uint8 SVGA3dCullMode;
90 
91 #define SVGA3D_COMPARISON_INVALID         0
92 #define SVGA3D_COMPARISON_MIN             1
93 #define SVGA3D_COMPARISON_NEVER           1
94 #define SVGA3D_COMPARISON_LESS            2
95 #define SVGA3D_COMPARISON_EQUAL           3
96 #define SVGA3D_COMPARISON_LESS_EQUAL      4
97 #define SVGA3D_COMPARISON_GREATER         5
98 #define SVGA3D_COMPARISON_NOT_EQUAL       6
99 #define SVGA3D_COMPARISON_GREATER_EQUAL   7
100 #define SVGA3D_COMPARISON_ALWAYS          8
101 #define SVGA3D_COMPARISON_MAX             9
102 typedef uint8 SVGA3dComparisonFunc;
103 
104 /*
105  * SVGA3D_MULTISAMPLE_RAST_DISABLE disables MSAA for all primitives.
106  * SVGA3D_MULTISAMPLE_RAST_DISABLE_LINE, which is supported in SM41,
107  * disables MSAA for lines only.
108  */
109 #define SVGA3D_MULTISAMPLE_RAST_DISABLE        0
110 #define SVGA3D_MULTISAMPLE_RAST_ENABLE         1
111 #define SVGA3D_MULTISAMPLE_RAST_DX_MAX         1
112 #define SVGA3D_MULTISAMPLE_RAST_DISABLE_LINE   2
113 #define SVGA3D_MULTISAMPLE_RAST_MAX            2
114 typedef uint8 SVGA3dMultisampleRastEnable;
115 
116 #define SVGA3D_DX_MAX_VERTEXBUFFERS 32
117 #define SVGA3D_DX_MAX_VERTEXINPUTREGISTERS 16
118 #define SVGA3D_DX_SM41_MAX_VERTEXINPUTREGISTERS 32
119 #define SVGA3D_DX_MAX_SOTARGETS 4
120 #define SVGA3D_DX_MAX_SRVIEWS 128
121 #define SVGA3D_DX_MAX_CONSTBUFFERS 16
122 #define SVGA3D_DX_MAX_SAMPLERS 16
123 
124 #define SVGA3D_DX_MAX_CONSTBUF_BINDING_SIZE (4096 * 4 * (uint32)sizeof(uint32))
125 
126 typedef uint32 SVGA3dShaderResourceViewId;
127 typedef uint32 SVGA3dRenderTargetViewId;
128 typedef uint32 SVGA3dDepthStencilViewId;
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
151 #include "vmware_pack_begin.h"
152 struct {
153    uint32 cid;
154    SVGAMobId mobid;
155 }
156 #include "vmware_pack_end.h"
157 SVGAOTableDXContextEntry;
158 
159 typedef
160 #include "vmware_pack_begin.h"
161 struct SVGA3dCmdDXDefineContext {
162    uint32 cid;
163 }
164 #include "vmware_pack_end.h"
165 SVGA3dCmdDXDefineContext;   /* SVGA_3D_CMD_DX_DEFINE_CONTEXT */
166 
167 typedef
168 #include "vmware_pack_begin.h"
169 struct SVGA3dCmdDXDestroyContext {
170    uint32 cid;
171 }
172 #include "vmware_pack_end.h"
173 SVGA3dCmdDXDestroyContext;   /* SVGA_3D_CMD_DX_DESTROY_CONTEXT */
174 
175 /*
176  * Bind a DX context.
177  *
178  * validContents should be set to 0 for new contexts,
179  * and 1 if this is an old context which is getting paged
180  * back on to the device.
181  *
182  * For new contexts, it is recommended that the driver
183  * issue commands to initialize all interesting state
184  * prior to rendering.
185  */
186 typedef
187 #include "vmware_pack_begin.h"
188 struct SVGA3dCmdDXBindContext {
189    uint32 cid;
190    SVGAMobId mobid;
191    uint32 validContents;
192 }
193 #include "vmware_pack_end.h"
194 SVGA3dCmdDXBindContext;   /* SVGA_3D_CMD_DX_BIND_CONTEXT */
195 
196 /*
197  * Readback a DX context.
198  * (Request that the device flush the contents back into guest memory.)
199  */
200 typedef
201 #include "vmware_pack_begin.h"
202 struct SVGA3dCmdDXReadbackContext {
203    uint32 cid;
204 }
205 #include "vmware_pack_end.h"
206 SVGA3dCmdDXReadbackContext;   /* SVGA_3D_CMD_DX_READBACK_CONTEXT */
207 
208 /*
209  * Invalidate a guest-backed context.
210  */
211 typedef
212 #include "vmware_pack_begin.h"
213 struct SVGA3dCmdDXInvalidateContext {
214    uint32 cid;
215 }
216 #include "vmware_pack_end.h"
217 SVGA3dCmdDXInvalidateContext;   /* SVGA_3D_CMD_DX_INVALIDATE_CONTEXT */
218 
219 typedef
220 #include "vmware_pack_begin.h"
221 struct SVGA3dCmdDXSetSingleConstantBuffer {
222    uint32 slot;
223    SVGA3dShaderType type;
224    SVGA3dSurfaceId sid;
225    uint32 offsetInBytes;
226    uint32 sizeInBytes;
227 }
228 #include "vmware_pack_end.h"
229 SVGA3dCmdDXSetSingleConstantBuffer;
230 /* SVGA_3D_CMD_DX_SET_SINGLE_CONSTANT_BUFFER */
231 
232 typedef
233 #include "vmware_pack_begin.h"
234 struct SVGA3dCmdDXSetShaderResources {
235    uint32 startView;
236    SVGA3dShaderType type;
237 
238    /*
239     * Followed by a variable number of SVGA3dShaderResourceViewId's.
240     */
241 }
242 #include "vmware_pack_end.h"
243 SVGA3dCmdDXSetShaderResources; /* SVGA_3D_CMD_DX_SET_SHADER_RESOURCES */
244 
245 typedef
246 #include "vmware_pack_begin.h"
247 struct SVGA3dCmdDXSetShader {
248    SVGA3dShaderId shaderId;
249    SVGA3dShaderType type;
250 }
251 #include "vmware_pack_end.h"
252 SVGA3dCmdDXSetShader; /* SVGA_3D_CMD_DX_SET_SHADER */
253 
254 typedef
255 #include "vmware_pack_begin.h"
256 struct SVGA3dCmdDXSetSamplers {
257    uint32 startSampler;
258    SVGA3dShaderType type;
259 
260    /*
261     * Followed by a variable number of SVGA3dSamplerId's.
262     */
263 }
264 #include "vmware_pack_end.h"
265 SVGA3dCmdDXSetSamplers; /* SVGA_3D_CMD_DX_SET_SAMPLERS */
266 
267 typedef
268 #include "vmware_pack_begin.h"
269 struct SVGA3dCmdDXDraw {
270    uint32 vertexCount;
271    uint32 startVertexLocation;
272 }
273 #include "vmware_pack_end.h"
274 SVGA3dCmdDXDraw; /* SVGA_3D_CMD_DX_DRAW */
275 
276 typedef
277 #include "vmware_pack_begin.h"
278 struct SVGA3dCmdDXDrawIndexed {
279    uint32 indexCount;
280    uint32 startIndexLocation;
281    int32  baseVertexLocation;
282 }
283 #include "vmware_pack_end.h"
284 SVGA3dCmdDXDrawIndexed; /* SVGA_3D_CMD_DX_DRAW_INDEXED */
285 
286 typedef
287 #include "vmware_pack_begin.h"
288 struct SVGA3dCmdDXDrawInstanced {
289    uint32 vertexCountPerInstance;
290    uint32 instanceCount;
291    uint32 startVertexLocation;
292    uint32 startInstanceLocation;
293 }
294 #include "vmware_pack_end.h"
295 SVGA3dCmdDXDrawInstanced; /* SVGA_3D_CMD_DX_DRAW_INSTANCED */
296 
297 typedef
298 #include "vmware_pack_begin.h"
299 struct SVGA3dCmdDXDrawIndexedInstanced {
300    uint32 indexCountPerInstance;
301    uint32 instanceCount;
302    uint32 startIndexLocation;
303    int32  baseVertexLocation;
304    uint32 startInstanceLocation;
305 }
306 #include "vmware_pack_end.h"
307 SVGA3dCmdDXDrawIndexedInstanced; /* SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED */
308 
309 typedef
310 #include "vmware_pack_begin.h"
311 struct SVGA3dCmdDXDrawAuto {
312    uint32 pad0;
313 }
314 #include "vmware_pack_end.h"
315 SVGA3dCmdDXDrawAuto; /* SVGA_3D_CMD_DX_DRAW_AUTO */
316 
317 typedef
318 #include "vmware_pack_begin.h"
319 struct SVGA3dCmdDXSetInputLayout {
320    SVGA3dElementLayoutId elementLayoutId;
321 }
322 #include "vmware_pack_end.h"
323 SVGA3dCmdDXSetInputLayout; /* SVGA_3D_CMD_DX_SET_INPUT_LAYOUT */
324 
325 typedef
326 #include "vmware_pack_begin.h"
327 struct SVGA3dVertexBuffer {
328    SVGA3dSurfaceId sid;
329    uint32 stride;
330    uint32 offset;
331 }
332 #include "vmware_pack_end.h"
333 SVGA3dVertexBuffer;
334 
335 typedef
336 #include "vmware_pack_begin.h"
337 struct SVGA3dCmdDXSetVertexBuffers {
338    uint32 startBuffer;
339    /* Followed by a variable number of SVGA3dVertexBuffer's. */
340 }
341 #include "vmware_pack_end.h"
342 SVGA3dCmdDXSetVertexBuffers; /* SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS */
343 
344 typedef
345 #include "vmware_pack_begin.h"
346 struct SVGA3dCmdDXSetIndexBuffer {
347    SVGA3dSurfaceId sid;
348    SVGA3dSurfaceFormat format;
349    uint32 offset;
350 }
351 #include "vmware_pack_end.h"
352 SVGA3dCmdDXSetIndexBuffer; /* SVGA_3D_CMD_DX_SET_INDEX_BUFFER */
353 
354 typedef
355 #include "vmware_pack_begin.h"
356 struct SVGA3dCmdDXSetTopology {
357    SVGA3dPrimitiveType topology;
358 }
359 #include "vmware_pack_end.h"
360 SVGA3dCmdDXSetTopology; /* SVGA_3D_CMD_DX_SET_TOPOLOGY */
361 
362 typedef
363 #include "vmware_pack_begin.h"
364 struct SVGA3dCmdDXSetRenderTargets {
365    SVGA3dDepthStencilViewId depthStencilViewId;
366    /* Followed by a variable number of SVGA3dRenderTargetViewId's. */
367 }
368 #include "vmware_pack_end.h"
369 SVGA3dCmdDXSetRenderTargets; /* SVGA_3D_CMD_DX_SET_RENDERTARGETS */
370 
371 typedef
372 #include "vmware_pack_begin.h"
373 struct SVGA3dCmdDXSetBlendState {
374    SVGA3dBlendStateId blendId;
375    float blendFactor[4];
376    uint32 sampleMask;
377 }
378 #include "vmware_pack_end.h"
379 SVGA3dCmdDXSetBlendState; /* SVGA_3D_CMD_DX_SET_BLEND_STATE */
380 
381 typedef
382 #include "vmware_pack_begin.h"
383 struct SVGA3dCmdDXSetDepthStencilState {
384    SVGA3dDepthStencilStateId depthStencilId;
385    uint32 stencilRef;
386 }
387 #include "vmware_pack_end.h"
388 SVGA3dCmdDXSetDepthStencilState; /* SVGA_3D_CMD_DX_SET_DEPTHSTENCIL_STATE */
389 
390 typedef
391 #include "vmware_pack_begin.h"
392 struct SVGA3dCmdDXSetRasterizerState {
393    SVGA3dRasterizerStateId rasterizerId;
394 }
395 #include "vmware_pack_end.h"
396 SVGA3dCmdDXSetRasterizerState; /* SVGA_3D_CMD_DX_SET_RASTERIZER_STATE */
397 
398 #define SVGA3D_DXQUERY_FLAG_PREDICATEHINT (1 << 0)
399 typedef uint32 SVGA3dDXQueryFlags;
400 
401 /*
402  * The SVGADXQueryDeviceState and SVGADXQueryDeviceBits are used by the device
403  * to track query state transitions, but are not intended to be used by the
404  * driver.
405  */
406 #define SVGADX_QDSTATE_INVALID   ((uint8)-1) /* Query has no state */
407 #define SVGADX_QDSTATE_MIN       0
408 #define SVGADX_QDSTATE_IDLE      0   /* Query hasn't started yet */
409 #define SVGADX_QDSTATE_ACTIVE    1   /* Query is actively gathering data */
410 #define SVGADX_QDSTATE_PENDING   2   /* Query is waiting for results */
411 #define SVGADX_QDSTATE_FINISHED  3   /* Query has completed */
412 #define SVGADX_QDSTATE_MAX       4
413 typedef uint8 SVGADXQueryDeviceState;
414 
415 typedef
416 #include "vmware_pack_begin.h"
417 struct {
418    SVGA3dQueryTypeUint8 type;
419    uint16 pad0;
420    SVGADXQueryDeviceState state;
421    SVGA3dDXQueryFlags flags;
422    SVGAMobId mobid;
423    uint32 offset;
424 }
425 #include "vmware_pack_end.h"
426 SVGACOTableDXQueryEntry;
427 
428 typedef
429 #include "vmware_pack_begin.h"
430 struct SVGA3dCmdDXDefineQuery {
431    SVGA3dQueryId queryId;
432    SVGA3dQueryType type;
433    SVGA3dDXQueryFlags flags;
434 }
435 #include "vmware_pack_end.h"
436 SVGA3dCmdDXDefineQuery; /* SVGA_3D_CMD_DX_DEFINE_QUERY */
437 
438 typedef
439 #include "vmware_pack_begin.h"
440 struct SVGA3dCmdDXDestroyQuery {
441    SVGA3dQueryId queryId;
442 }
443 #include "vmware_pack_end.h"
444 SVGA3dCmdDXDestroyQuery; /* SVGA_3D_CMD_DX_DESTROY_QUERY */
445 
446 typedef
447 #include "vmware_pack_begin.h"
448 struct SVGA3dCmdDXBindQuery {
449    SVGA3dQueryId queryId;
450    SVGAMobId mobid;
451 }
452 #include "vmware_pack_end.h"
453 SVGA3dCmdDXBindQuery; /* SVGA_3D_CMD_DX_BIND_QUERY */
454 
455 typedef
456 #include "vmware_pack_begin.h"
457 struct SVGA3dCmdDXSetQueryOffset {
458    SVGA3dQueryId queryId;
459    uint32 mobOffset;
460 }
461 #include "vmware_pack_end.h"
462 SVGA3dCmdDXSetQueryOffset; /* SVGA_3D_CMD_DX_SET_QUERY_OFFSET */
463 
464 typedef
465 #include "vmware_pack_begin.h"
466 struct SVGA3dCmdDXBeginQuery {
467    SVGA3dQueryId queryId;
468 }
469 #include "vmware_pack_end.h"
470 SVGA3dCmdDXBeginQuery; /* SVGA_3D_CMD_DX_QUERY_BEGIN */
471 
472 typedef
473 #include "vmware_pack_begin.h"
474 struct SVGA3dCmdDXEndQuery {
475    SVGA3dQueryId queryId;
476 }
477 #include "vmware_pack_end.h"
478 SVGA3dCmdDXEndQuery; /* SVGA_3D_CMD_DX_QUERY_END */
479 
480 typedef
481 #include "vmware_pack_begin.h"
482 struct SVGA3dCmdDXReadbackQuery {
483    SVGA3dQueryId queryId;
484 }
485 #include "vmware_pack_end.h"
486 SVGA3dCmdDXReadbackQuery; /* SVGA_3D_CMD_DX_READBACK_QUERY */
487 
488 typedef
489 #include "vmware_pack_begin.h"
490 struct SVGA3dCmdDXMoveQuery {
491    SVGA3dQueryId queryId;
492    SVGAMobId mobid;
493    uint32 mobOffset;
494 }
495 #include "vmware_pack_end.h"
496 SVGA3dCmdDXMoveQuery; /* SVGA_3D_CMD_DX_MOVE_QUERY */
497 
498 typedef
499 #include "vmware_pack_begin.h"
500 struct SVGA3dCmdDXBindAllQuery {
501    uint32 cid;
502    SVGAMobId mobid;
503 }
504 #include "vmware_pack_end.h"
505 SVGA3dCmdDXBindAllQuery; /* SVGA_3D_CMD_DX_BIND_ALL_QUERY */
506 
507 typedef
508 #include "vmware_pack_begin.h"
509 struct SVGA3dCmdDXReadbackAllQuery {
510    uint32 cid;
511 }
512 #include "vmware_pack_end.h"
513 SVGA3dCmdDXReadbackAllQuery; /* SVGA_3D_CMD_DX_READBACK_ALL_QUERY */
514 
515 typedef
516 #include "vmware_pack_begin.h"
517 struct SVGA3dCmdDXSetPredication {
518    SVGA3dQueryId queryId;
519    uint32 predicateValue;
520 }
521 #include "vmware_pack_end.h"
522 SVGA3dCmdDXSetPredication; /* SVGA_3D_CMD_DX_SET_PREDICATION */
523 
524 typedef
525 #include "vmware_pack_begin.h"
526 struct MKS3dDXSOState {
527    uint32 offset;       /* Starting offset */
528    uint32 intOffset;    /* Internal offset */
529    uint32 vertexCount;  /* vertices written */
530    uint32 sizeInBytes;  /* max bytes to write */
531 }
532 #include "vmware_pack_end.h"
533 SVGA3dDXSOState;
534 
535 /* Set the offset field to this value to append SO values to the buffer */
536 #define SVGA3D_DX_SO_OFFSET_APPEND ((uint32) ~0u)
537 
538 typedef
539 #include "vmware_pack_begin.h"
540 struct SVGA3dSoTarget {
541    SVGA3dSurfaceId sid;
542    uint32 offset;
543    uint32 sizeInBytes;
544 }
545 #include "vmware_pack_end.h"
546 SVGA3dSoTarget;
547 
548 typedef
549 #include "vmware_pack_begin.h"
550 struct SVGA3dCmdDXSetSOTargets {
551    uint32 pad0;
552    /* Followed by a variable number of SVGA3dSOTarget's. */
553 }
554 #include "vmware_pack_end.h"
555 SVGA3dCmdDXSetSOTargets; /* SVGA_3D_CMD_DX_SET_SOTARGETS */
556 
557 typedef
558 #include "vmware_pack_begin.h"
559 struct SVGA3dViewport
560 {
561    float x;
562    float y;
563    float width;
564    float height;
565    float minDepth;
566    float maxDepth;
567 }
568 #include "vmware_pack_end.h"
569 SVGA3dViewport;
570 
571 typedef
572 #include "vmware_pack_begin.h"
573 struct SVGA3dCmdDXSetViewports {
574    uint32 pad0;
575    /* Followed by a variable number of SVGA3dViewport's. */
576 }
577 #include "vmware_pack_end.h"
578 SVGA3dCmdDXSetViewports; /* SVGA_3D_CMD_DX_SET_VIEWPORTS */
579 
580 #define SVGA3D_DX_MAX_VIEWPORTS  16
581 
582 typedef
583 #include "vmware_pack_begin.h"
584 struct SVGA3dCmdDXSetScissorRects {
585    uint32 pad0;
586    /* Followed by a variable number of SVGASignedRect's. */
587 }
588 #include "vmware_pack_end.h"
589 SVGA3dCmdDXSetScissorRects; /* SVGA_3D_CMD_DX_SET_SCISSORRECTS */
590 
591 #define SVGA3D_DX_MAX_SCISSORRECTS  16
592 
593 typedef
594 #include "vmware_pack_begin.h"
595 struct SVGA3dCmdDXClearRenderTargetView {
596    SVGA3dRenderTargetViewId renderTargetViewId;
597    SVGA3dRGBAFloat rgba;
598 }
599 #include "vmware_pack_end.h"
600 SVGA3dCmdDXClearRenderTargetView; /* SVGA_3D_CMD_DX_CLEAR_RENDERTARGET_VIEW */
601 
602 typedef
603 #include "vmware_pack_begin.h"
604 struct SVGA3dCmdDXClearDepthStencilView {
605    uint16 flags;
606    uint16 stencil;
607    SVGA3dDepthStencilViewId depthStencilViewId;
608    float depth;
609 }
610 #include "vmware_pack_end.h"
611 SVGA3dCmdDXClearDepthStencilView; /* SVGA_3D_CMD_DX_CLEAR_DEPTHSTENCIL_VIEW */
612 
613 typedef
614 #include "vmware_pack_begin.h"
615 struct SVGA3dCmdDXPredCopyRegion {
616    SVGA3dSurfaceId dstSid;
617    uint32 dstSubResource;
618    SVGA3dSurfaceId srcSid;
619    uint32 srcSubResource;
620    SVGA3dCopyBox box;
621 }
622 #include "vmware_pack_end.h"
623 SVGA3dCmdDXPredCopyRegion;
624 /* SVGA_3D_CMD_DX_PRED_COPY_REGION */
625 
626 typedef
627 #include "vmware_pack_begin.h"
628 struct SVGA3dCmdDXPredCopy {
629    SVGA3dSurfaceId dstSid;
630    SVGA3dSurfaceId srcSid;
631 }
632 #include "vmware_pack_end.h"
633 SVGA3dCmdDXPredCopy; /* SVGA_3D_CMD_DX_PRED_COPY */
634 
635 typedef
636 #include "vmware_pack_begin.h"
637 struct SVGA3dCmdDXPredConvertRegion {
638    SVGA3dSurfaceId dstSid;
639    uint32 dstSubResource;
640    SVGA3dBox destBox;
641    SVGA3dSurfaceId srcSid;
642    uint32 srcSubResource;
643    SVGA3dBox srcBox;
644 }
645 #include "vmware_pack_end.h"
646 SVGA3dCmdDXPredConvertRegion; /* SVGA_3D_CMD_DX_PRED_CONVERT_REGION */
647 
648 typedef
649 #include "vmware_pack_begin.h"
650 struct SVGA3dCmdDXPredConvert {
651    SVGA3dSurfaceId dstSid;
652    SVGA3dSurfaceId srcSid;
653 }
654 #include "vmware_pack_end.h"
655 SVGA3dCmdDXPredConvert; /* SVGA_3D_CMD_DX_PRED_CONVERT */
656 
657 typedef
658 #include "vmware_pack_begin.h"
659 struct SVGA3dCmdDXBufferCopy {
660    SVGA3dSurfaceId dest;
661    SVGA3dSurfaceId src;
662    uint32 destX;
663    uint32 srcX;
664    uint32 width;
665 }
666 #include "vmware_pack_end.h"
667 SVGA3dCmdDXBufferCopy;
668 /* SVGA_3D_CMD_DX_BUFFER_COPY */
669 
670 /*
671  * Perform a surface copy between a multisample, and a non-multisampled
672  * surface.
673  */
674 typedef
675 #include "vmware_pack_begin.h"
676 struct {
677    SVGA3dSurfaceId dstSid;
678    uint32 dstSubResource;
679    SVGA3dSurfaceId srcSid;
680    uint32 srcSubResource;
681    SVGA3dSurfaceFormat copyFormat;
682 }
683 #include "vmware_pack_end.h"
684 SVGA3dCmdDXResolveCopy;               /* SVGA_3D_CMD_DX_RESOLVE_COPY */
685 
686 /*
687  * Perform a predicated surface copy between a multisample, and a
688  * non-multisampled surface.
689  */
690 typedef
691 #include "vmware_pack_begin.h"
692 struct {
693    SVGA3dSurfaceId dstSid;
694    uint32 dstSubResource;
695    SVGA3dSurfaceId srcSid;
696    uint32 srcSubResource;
697    SVGA3dSurfaceFormat copyFormat;
698 }
699 #include "vmware_pack_end.h"
700 SVGA3dCmdDXPredResolveCopy;           /* SVGA_3D_CMD_DX_PRED_RESOLVE_COPY */
701 
702 typedef uint32 SVGA3dDXPresentBltMode;
703 #define SVGADX_PRESENTBLT_LINEAR           (1 << 0)
704 #define SVGADX_PRESENTBLT_FORCE_SRC_SRGB   (1 << 1)
705 #define SVGADX_PRESENTBLT_FORCE_SRC_XRBIAS (1 << 2)
706 #define SVGADX_PRESENTBLT_MODE_MAX         (1 << 3)
707 
708 typedef
709 #include "vmware_pack_begin.h"
710 struct SVGA3dCmdDXPresentBlt {
711    SVGA3dSurfaceId srcSid;
712    uint32 srcSubResource;
713    SVGA3dSurfaceId dstSid;
714    uint32 destSubResource;
715    SVGA3dBox boxSrc;
716    SVGA3dBox boxDest;
717    SVGA3dDXPresentBltMode mode;
718 }
719 #include "vmware_pack_end.h"
720 SVGA3dCmdDXPresentBlt; /* SVGA_3D_CMD_DX_PRESENTBLT*/
721 
722 typedef
723 #include "vmware_pack_begin.h"
724 struct SVGA3dCmdDXGenMips {
725    SVGA3dShaderResourceViewId shaderResourceViewId;
726 }
727 #include "vmware_pack_end.h"
728 SVGA3dCmdDXGenMips; /* SVGA_3D_CMD_DX_GENMIPS */
729 
730 /*
731  * Update a sub-resource in a guest-backed resource.
732  * (Inform the device that the guest-contents have been updated.)
733  */
734 typedef
735 #include "vmware_pack_begin.h"
736 struct SVGA3dCmdDXUpdateSubResource {
737    SVGA3dSurfaceId sid;
738    uint32 subResource;
739    SVGA3dBox box;
740 }
741 #include "vmware_pack_end.h"
742 SVGA3dCmdDXUpdateSubResource;   /* SVGA_3D_CMD_DX_UPDATE_SUBRESOURCE */
743 
744 /*
745  * Readback a subresource in a guest-backed resource.
746  * (Request the device to flush the dirty contents into the guest.)
747  */
748 typedef
749 #include "vmware_pack_begin.h"
750 struct SVGA3dCmdDXReadbackSubResource {
751    SVGA3dSurfaceId sid;
752    uint32 subResource;
753 }
754 #include "vmware_pack_end.h"
755 SVGA3dCmdDXReadbackSubResource;   /* SVGA_3D_CMD_DX_READBACK_SUBRESOURCE */
756 
757 /*
758  * Invalidate an image in a guest-backed surface.
759  * (Notify the device that the contents can be lost.)
760  */
761 typedef
762 #include "vmware_pack_begin.h"
763 struct SVGA3dCmdDXInvalidateSubResource {
764    SVGA3dSurfaceId sid;
765    uint32 subResource;
766 }
767 #include "vmware_pack_end.h"
768 SVGA3dCmdDXInvalidateSubResource;   /* SVGA_3D_CMD_DX_INVALIDATE_SUBRESOURCE */
769 
770 
771 /*
772  * Raw byte wise transfer from a buffer surface into another surface
773  * of the requested box.  Supported if 3d is enabled and SVGA_CAP_DX
774  * is set.  This command does not take a context.
775  */
776 typedef
777 #include "vmware_pack_begin.h"
778 struct SVGA3dCmdDXTransferFromBuffer {
779    SVGA3dSurfaceId srcSid;
780    uint32 srcOffset;
781    uint32 srcPitch;
782    uint32 srcSlicePitch;
783    SVGA3dSurfaceId destSid;
784    uint32 destSubResource;
785    SVGA3dBox destBox;
786 }
787 #include "vmware_pack_end.h"
788 SVGA3dCmdDXTransferFromBuffer;   /* SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER */
789 
790 
791 /*
792  * Raw byte wise transfer from a buffer surface into another surface
793  * of the requested box.  Supported if SVGA3D_DEVCAP_DXCONTEXT is set.
794  * The context is implied from the command buffer header.
795  */
796 typedef
797 #include "vmware_pack_begin.h"
798 struct SVGA3dCmdDXPredTransferFromBuffer {
799    SVGA3dSurfaceId srcSid;
800    uint32 srcOffset;
801    uint32 srcPitch;
802    uint32 srcSlicePitch;
803    SVGA3dSurfaceId destSid;
804    uint32 destSubResource;
805    SVGA3dBox destBox;
806 }
807 #include "vmware_pack_end.h"
808 SVGA3dCmdDXPredTransferFromBuffer;
809 /* SVGA_3D_CMD_DX_PRED_TRANSFER_FROM_BUFFER */
810 
811 
812 typedef
813 #include "vmware_pack_begin.h"
814 struct SVGA3dCmdDXSurfaceCopyAndReadback {
815    SVGA3dSurfaceId srcSid;
816    SVGA3dSurfaceId destSid;
817    SVGA3dCopyBox box;
818 }
819 #include "vmware_pack_end.h"
820 SVGA3dCmdDXSurfaceCopyAndReadback;
821 /* SVGA_3D_CMD_DX_SURFACE_COPY_AND_READBACK */
822 
823 /*
824  * SVGA_DX_HINT_NONE: Does nothing.
825  *
826  * SVGA_DX_HINT_PREFETCH_OBJECT:
827  * SVGA_DX_HINT_PREEVICT_OBJECT:
828  *      Consumes a SVGAObjectRef, and hints that the host should consider
829  *      fetching/evicting the specified object.
830  *
831  *      An id of SVGA3D_INVALID_ID can be used if the guest isn't sure
832  *      what object was affected.  (For instance, if the guest knows that
833  *      it is about to evict a DXShader, but doesn't know precisely which one,
834  *      the device can still use this to help limit it's search, or track
835  *      how many page-outs have happened.)
836  *
837  * SVGA_DX_HINT_PREFETCH_COBJECT:
838  * SVGA_DX_HINT_PREEVICT_COBJECT:
839  *      Same as the above, except they consume an SVGACObjectRef.
840  */
841 typedef uint32 SVGADXHintId;
842 #define SVGA_DX_HINT_NONE              0
843 #define SVGA_DX_HINT_PREFETCH_OBJECT   1
844 #define SVGA_DX_HINT_PREEVICT_OBJECT   2
845 #define SVGA_DX_HINT_PREFETCH_COBJECT  3
846 #define SVGA_DX_HINT_PREEVICT_COBJECT  4
847 #define SVGA_DX_HINT_MAX               5
848 
849 typedef
850 #include "vmware_pack_begin.h"
851 struct SVGAObjectRef {
852    SVGAOTableType type;
853    uint32 id;
854 }
855 #include "vmware_pack_end.h"
856 SVGAObjectRef;
857 
858 typedef
859 #include "vmware_pack_begin.h"
860 struct SVGACObjectRef {
861    SVGACOTableType type;
862    uint32 cid;
863    uint32 id;
864 }
865 #include "vmware_pack_end.h"
866 SVGACObjectRef;
867 
868 typedef
869 #include "vmware_pack_begin.h"
870 struct SVGA3dCmdDXHint {
871    SVGADXHintId hintId;
872 
873    /*
874     * Followed by variable sized data depending on the hintId.
875     */
876 }
877 #include "vmware_pack_end.h"
878 SVGA3dCmdDXHint;
879 /* SVGA_3D_CMD_DX_HINT */
880 
881 typedef
882 #include "vmware_pack_begin.h"
883 struct SVGA3dCmdDXBufferUpdate {
884    SVGA3dSurfaceId sid;
885    uint32 x;
886    uint32 width;
887 }
888 #include "vmware_pack_end.h"
889 SVGA3dCmdDXBufferUpdate;
890 /* SVGA_3D_CMD_DX_BUFFER_UPDATE */
891 
892 typedef
893 #include "vmware_pack_begin.h"
894 struct SVGA3dCmdDXSetConstantBufferOffset {
895    uint32 slot;
896    uint32 offsetInBytes;
897 }
898 #include "vmware_pack_end.h"
899 SVGA3dCmdDXSetConstantBufferOffset;
900 
901 typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetVSConstantBufferOffset;
902 /* SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET */
903 
904 typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetPSConstantBufferOffset;
905 /* SVGA_3D_CMD_DX_SET_PS_CONSTANT_BUFFER_OFFSET */
906 
907 typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetGSConstantBufferOffset;
908 /* SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET */
909 
910 
911 typedef
912 #include "vmware_pack_begin.h"
913 struct {
914    union {
915       struct {
916          uint32 firstElement;
917          uint32 numElements;
918          uint32 pad0;
919          uint32 pad1;
920       } buffer;
921       struct {
922          uint32 mostDetailedMip;
923          uint32 firstArraySlice;
924          uint32 mipLevels;
925          uint32 arraySize;
926       } tex; /* 1d, 2d, 3d, cube */
927       struct {
928          uint32 firstElement;
929          uint32 numElements;
930          uint32 flags;
931          uint32 pad0;
932       } bufferex;
933    };
934 }
935 #include "vmware_pack_end.h"
936 SVGA3dShaderResourceViewDesc;
937 
938 typedef
939 #include "vmware_pack_begin.h"
940 struct {
941    SVGA3dSurfaceId sid;
942    SVGA3dSurfaceFormat format;
943    SVGA3dResourceType resourceDimension;
944    SVGA3dShaderResourceViewDesc desc;
945    uint32 pad;
946 }
947 #include "vmware_pack_end.h"
948 SVGACOTableDXSRViewEntry;
949 
950 typedef
951 #include "vmware_pack_begin.h"
952 struct SVGA3dCmdDXDefineShaderResourceView {
953    SVGA3dShaderResourceViewId shaderResourceViewId;
954 
955    SVGA3dSurfaceId sid;
956    SVGA3dSurfaceFormat format;
957    SVGA3dResourceType resourceDimension;
958 
959    SVGA3dShaderResourceViewDesc desc;
960 }
961 #include "vmware_pack_end.h"
962 SVGA3dCmdDXDefineShaderResourceView;
963 /* SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW */
964 
965 typedef
966 #include "vmware_pack_begin.h"
967 struct SVGA3dCmdDXDestroyShaderResourceView {
968    SVGA3dShaderResourceViewId shaderResourceViewId;
969 }
970 #include "vmware_pack_end.h"
971 SVGA3dCmdDXDestroyShaderResourceView;
972 /* SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW */
973 
974 typedef
975 #include "vmware_pack_begin.h"
976 struct SVGA3dRenderTargetViewDesc {
977    union {
978       struct {
979          uint32 firstElement;
980          uint32 numElements;
981          uint32 padding0;
982       } buffer;
983       struct {
984          uint32 mipSlice;
985          uint32 firstArraySlice;
986          uint32 arraySize;
987       } tex;                    /* 1d, 2d, cube */
988       struct {
989          uint32 mipSlice;
990          uint32 firstW;
991          uint32 wSize;
992       } tex3D;
993    };
994 }
995 #include "vmware_pack_end.h"
996 SVGA3dRenderTargetViewDesc;
997 
998 typedef
999 #include "vmware_pack_begin.h"
1000 struct {
1001    SVGA3dSurfaceId sid;
1002    SVGA3dSurfaceFormat format;
1003    SVGA3dResourceType resourceDimension;
1004    SVGA3dRenderTargetViewDesc desc;
1005    uint32 pad[2];
1006 }
1007 #include "vmware_pack_end.h"
1008 SVGACOTableDXRTViewEntry;
1009 
1010 typedef
1011 #include "vmware_pack_begin.h"
1012 struct SVGA3dCmdDXDefineRenderTargetView {
1013    SVGA3dRenderTargetViewId renderTargetViewId;
1014 
1015    SVGA3dSurfaceId sid;
1016    SVGA3dSurfaceFormat format;
1017    SVGA3dResourceType resourceDimension;
1018 
1019    SVGA3dRenderTargetViewDesc desc;
1020 }
1021 #include "vmware_pack_end.h"
1022 SVGA3dCmdDXDefineRenderTargetView;
1023 /* SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW */
1024 
1025 typedef
1026 #include "vmware_pack_begin.h"
1027 struct SVGA3dCmdDXDestroyRenderTargetView {
1028    SVGA3dRenderTargetViewId renderTargetViewId;
1029 }
1030 #include "vmware_pack_end.h"
1031 SVGA3dCmdDXDestroyRenderTargetView;
1032 /* SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW */
1033 
1034 /*
1035  */
1036 #define SVGA3D_DXDSVIEW_CREATE_READ_ONLY_DEPTH   0x01
1037 #define SVGA3D_DXDSVIEW_CREATE_READ_ONLY_STENCIL 0x02
1038 #define SVGA3D_DXDSVIEW_CREATE_FLAG_MASK         0x03
1039 typedef uint8 SVGA3DCreateDSViewFlags;
1040 
1041 typedef
1042 #include "vmware_pack_begin.h"
1043 struct {
1044    SVGA3dSurfaceId sid;
1045    SVGA3dSurfaceFormat format;
1046    SVGA3dResourceType resourceDimension;
1047    uint32 mipSlice;
1048    uint32 firstArraySlice;
1049    uint32 arraySize;
1050    SVGA3DCreateDSViewFlags flags;
1051    uint8 pad0;
1052    uint16 pad1;
1053    uint32 pad2;
1054 }
1055 #include "vmware_pack_end.h"
1056 SVGACOTableDXDSViewEntry;
1057 
1058 typedef
1059 #include "vmware_pack_begin.h"
1060 struct SVGA3dCmdDXDefineDepthStencilView {
1061    SVGA3dDepthStencilViewId depthStencilViewId;
1062 
1063    SVGA3dSurfaceId sid;
1064    SVGA3dSurfaceFormat format;
1065    SVGA3dResourceType resourceDimension;
1066    uint32 mipSlice;
1067    uint32 firstArraySlice;
1068    uint32 arraySize;
1069    SVGA3DCreateDSViewFlags flags;
1070    uint8 pad0;
1071    uint16 pad1;
1072 }
1073 #include "vmware_pack_end.h"
1074 SVGA3dCmdDXDefineDepthStencilView;
1075 /* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW */
1076 
1077 typedef
1078 #include "vmware_pack_begin.h"
1079 struct SVGA3dCmdDXDestroyDepthStencilView {
1080    SVGA3dDepthStencilViewId depthStencilViewId;
1081 }
1082 #include "vmware_pack_end.h"
1083 SVGA3dCmdDXDestroyDepthStencilView;
1084 /* SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW */
1085 
1086 typedef
1087 #include "vmware_pack_begin.h"
1088 struct SVGA3dInputElementDesc {
1089    uint32 inputSlot;
1090    uint32 alignedByteOffset;
1091    SVGA3dSurfaceFormat format;
1092    SVGA3dInputClassification inputSlotClass;
1093    uint32 instanceDataStepRate;
1094    uint32 inputRegister;
1095 }
1096 #include "vmware_pack_end.h"
1097 SVGA3dInputElementDesc;
1098 
1099 typedef
1100 #include "vmware_pack_begin.h"
1101 struct {
1102    uint32 elid;
1103    uint32 numDescs;
1104    SVGA3dInputElementDesc desc[32];
1105    uint32 pad[62];
1106 }
1107 #include "vmware_pack_end.h"
1108 SVGACOTableDXElementLayoutEntry;
1109 
1110 typedef
1111 #include "vmware_pack_begin.h"
1112 struct SVGA3dCmdDXDefineElementLayout {
1113    SVGA3dElementLayoutId elementLayoutId;
1114    /* Followed by a variable number of SVGA3dInputElementDesc's. */
1115 }
1116 #include "vmware_pack_end.h"
1117 SVGA3dCmdDXDefineElementLayout;
1118 /* SVGA_3D_CMD_DX_DEFINE_ELEMENTLAYOUT */
1119 
1120 typedef
1121 #include "vmware_pack_begin.h"
1122 struct SVGA3dCmdDXDestroyElementLayout {
1123    SVGA3dElementLayoutId elementLayoutId;
1124 }
1125 #include "vmware_pack_end.h"
1126 SVGA3dCmdDXDestroyElementLayout;
1127 /* SVGA_3D_CMD_DX_DESTROY_ELEMENTLAYOUT */
1128 
1129 
1130 #define SVGA3D_DX_MAX_RENDER_TARGETS 8
1131 
1132 typedef
1133 #include "vmware_pack_begin.h"
1134 struct SVGA3dDXBlendStatePerRT {
1135       uint8 blendEnable;
1136       uint8 srcBlend;
1137       uint8 destBlend;
1138       uint8 blendOp;
1139       uint8 srcBlendAlpha;
1140       uint8 destBlendAlpha;
1141       uint8 blendOpAlpha;
1142       SVGA3dColorWriteEnable renderTargetWriteMask;
1143       uint8 logicOpEnable;
1144       uint8 logicOp;
1145       uint16 pad0;
1146 }
1147 #include "vmware_pack_end.h"
1148 SVGA3dDXBlendStatePerRT;
1149 
1150 typedef
1151 #include "vmware_pack_begin.h"
1152 struct {
1153    uint8 alphaToCoverageEnable;
1154    uint8 independentBlendEnable;
1155    uint16 pad0;
1156    SVGA3dDXBlendStatePerRT perRT[SVGA3D_MAX_RENDER_TARGETS];
1157    uint32 pad1[7];
1158 }
1159 #include "vmware_pack_end.h"
1160 SVGACOTableDXBlendStateEntry;
1161 
1162 /*
1163  */
1164 typedef
1165 #include "vmware_pack_begin.h"
1166 struct SVGA3dCmdDXDefineBlendState {
1167    SVGA3dBlendStateId blendId;
1168    uint8 alphaToCoverageEnable;
1169    uint8 independentBlendEnable;
1170    uint16 pad0;
1171    SVGA3dDXBlendStatePerRT perRT[SVGA3D_MAX_RENDER_TARGETS];
1172 }
1173 #include "vmware_pack_end.h"
1174 SVGA3dCmdDXDefineBlendState; /* SVGA_3D_CMD_DX_DEFINE_BLEND_STATE */
1175 
1176 typedef
1177 #include "vmware_pack_begin.h"
1178 struct SVGA3dCmdDXDestroyBlendState {
1179    SVGA3dBlendStateId blendId;
1180 }
1181 #include "vmware_pack_end.h"
1182 SVGA3dCmdDXDestroyBlendState; /* SVGA_3D_CMD_DX_DESTROY_BLEND_STATE */
1183 
1184 typedef
1185 #include "vmware_pack_begin.h"
1186 struct {
1187    uint8 depthEnable;
1188    SVGA3dDepthWriteMask depthWriteMask;
1189    SVGA3dComparisonFunc depthFunc;
1190    uint8 stencilEnable;
1191    uint8 frontEnable;
1192    uint8 backEnable;
1193    uint8 stencilReadMask;
1194    uint8 stencilWriteMask;
1195 
1196    uint8 frontStencilFailOp;
1197    uint8 frontStencilDepthFailOp;
1198    uint8 frontStencilPassOp;
1199    SVGA3dComparisonFunc frontStencilFunc;
1200 
1201    uint8 backStencilFailOp;
1202    uint8 backStencilDepthFailOp;
1203    uint8 backStencilPassOp;
1204    SVGA3dComparisonFunc backStencilFunc;
1205 }
1206 #include "vmware_pack_end.h"
1207 SVGACOTableDXDepthStencilEntry;
1208 
1209 /*
1210  */
1211 typedef
1212 #include "vmware_pack_begin.h"
1213 struct SVGA3dCmdDXDefineDepthStencilState {
1214    SVGA3dDepthStencilStateId depthStencilId;
1215 
1216    uint8 depthEnable;
1217    SVGA3dDepthWriteMask depthWriteMask;
1218    SVGA3dComparisonFunc depthFunc;
1219    uint8 stencilEnable;
1220    uint8 frontEnable;
1221    uint8 backEnable;
1222    uint8 stencilReadMask;
1223    uint8 stencilWriteMask;
1224 
1225    uint8 frontStencilFailOp;
1226    uint8 frontStencilDepthFailOp;
1227    uint8 frontStencilPassOp;
1228    SVGA3dComparisonFunc frontStencilFunc;
1229 
1230    uint8 backStencilFailOp;
1231    uint8 backStencilDepthFailOp;
1232    uint8 backStencilPassOp;
1233    SVGA3dComparisonFunc backStencilFunc;
1234 }
1235 #include "vmware_pack_end.h"
1236 SVGA3dCmdDXDefineDepthStencilState;
1237 /* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_STATE */
1238 
1239 typedef
1240 #include "vmware_pack_begin.h"
1241 struct SVGA3dCmdDXDestroyDepthStencilState {
1242    SVGA3dDepthStencilStateId depthStencilId;
1243 }
1244 #include "vmware_pack_end.h"
1245 SVGA3dCmdDXDestroyDepthStencilState;
1246 /* SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_STATE */
1247 
1248 typedef
1249 #include "vmware_pack_begin.h"
1250 struct {
1251    uint8 fillMode;
1252    SVGA3dCullMode cullMode;
1253    uint8 frontCounterClockwise;
1254    uint8 provokingVertexLast;
1255    int32 depthBias;
1256    float depthBiasClamp;
1257    float slopeScaledDepthBias;
1258    uint8 depthClipEnable;
1259    uint8 scissorEnable;
1260    SVGA3dMultisampleRastEnable multisampleEnable;
1261    uint8 antialiasedLineEnable;
1262    float lineWidth;
1263    uint8 lineStippleEnable;
1264    uint8 lineStippleFactor;
1265    uint16 lineStipplePattern;
1266    uint32 forcedSampleCount;
1267 }
1268 #include "vmware_pack_end.h"
1269 SVGACOTableDXRasterizerStateEntry;
1270 
1271 /*
1272  */
1273 typedef
1274 #include "vmware_pack_begin.h"
1275 struct SVGA3dCmdDXDefineRasterizerState {
1276    SVGA3dRasterizerStateId rasterizerId;
1277 
1278    uint8 fillMode;
1279    SVGA3dCullMode cullMode;
1280    uint8 frontCounterClockwise;
1281    uint8 provokingVertexLast;
1282    int32 depthBias;
1283    float depthBiasClamp;
1284    float slopeScaledDepthBias;
1285    uint8 depthClipEnable;
1286    uint8 scissorEnable;
1287    SVGA3dMultisampleRastEnable multisampleEnable;
1288    uint8 antialiasedLineEnable;
1289    float lineWidth;
1290    uint8 lineStippleEnable;
1291    uint8 lineStippleFactor;
1292    uint16 lineStipplePattern;
1293 }
1294 #include "vmware_pack_end.h"
1295 SVGA3dCmdDXDefineRasterizerState;
1296 /* SVGA_3D_CMD_DX_DEFINE_RASTERIZER_STATE */
1297 
1298 typedef
1299 #include "vmware_pack_begin.h"
1300 struct SVGA3dCmdDXDestroyRasterizerState {
1301    SVGA3dRasterizerStateId rasterizerId;
1302 }
1303 #include "vmware_pack_end.h"
1304 SVGA3dCmdDXDestroyRasterizerState;
1305 /* SVGA_3D_CMD_DX_DESTROY_RASTERIZER_STATE */
1306 
1307 typedef
1308 #include "vmware_pack_begin.h"
1309 struct {
1310    SVGA3dFilter filter;
1311    uint8 addressU;
1312    uint8 addressV;
1313    uint8 addressW;
1314    uint8 pad0;
1315    float mipLODBias;
1316    uint8 maxAnisotropy;
1317    SVGA3dComparisonFunc comparisonFunc;
1318    uint16 pad1;
1319    SVGA3dRGBAFloat borderColor;
1320    float minLOD;
1321    float maxLOD;
1322    uint32 pad2[6];
1323 }
1324 #include "vmware_pack_end.h"
1325 SVGACOTableDXSamplerEntry;
1326 
1327 /*
1328  */
1329 typedef
1330 #include "vmware_pack_begin.h"
1331 struct SVGA3dCmdDXDefineSamplerState {
1332    SVGA3dSamplerId samplerId;
1333    SVGA3dFilter filter;
1334    uint8 addressU;
1335    uint8 addressV;
1336    uint8 addressW;
1337    uint8 pad0;
1338    float mipLODBias;
1339    uint8 maxAnisotropy;
1340    SVGA3dComparisonFunc comparisonFunc;
1341    uint16 pad1;
1342    SVGA3dRGBAFloat borderColor;
1343    float minLOD;
1344    float maxLOD;
1345 }
1346 #include "vmware_pack_end.h"
1347 SVGA3dCmdDXDefineSamplerState; /* SVGA_3D_CMD_DX_DEFINE_SAMPLER_STATE */
1348 
1349 typedef
1350 #include "vmware_pack_begin.h"
1351 struct SVGA3dCmdDXDestroySamplerState {
1352    SVGA3dSamplerId samplerId;
1353 }
1354 #include "vmware_pack_end.h"
1355 SVGA3dCmdDXDestroySamplerState; /* SVGA_3D_CMD_DX_DESTROY_SAMPLER_STATE */
1356 
1357 typedef
1358 #include "vmware_pack_begin.h"
1359 struct SVGA3dCmdDXDefineShader {
1360    SVGA3dShaderId shaderId;
1361    SVGA3dShaderType type;
1362    uint32 sizeInBytes; /* Number of bytes of shader text. */
1363 }
1364 #include "vmware_pack_end.h"
1365 SVGA3dCmdDXDefineShader; /* SVGA_3D_CMD_DX_DEFINE_SHADER */
1366 
1367 typedef
1368 #include "vmware_pack_begin.h"
1369 struct SVGACOTableDXShaderEntry {
1370    SVGA3dShaderType type;
1371    uint32 sizeInBytes;
1372    uint32 offsetInBytes;
1373    SVGAMobId mobid;
1374    uint32 pad[4];
1375 }
1376 #include "vmware_pack_end.h"
1377 SVGACOTableDXShaderEntry;
1378 
1379 typedef
1380 #include "vmware_pack_begin.h"
1381 struct SVGA3dCmdDXDestroyShader {
1382    SVGA3dShaderId shaderId;
1383 }
1384 #include "vmware_pack_end.h"
1385 SVGA3dCmdDXDestroyShader; /* SVGA_3D_CMD_DX_DESTROY_SHADER */
1386 
1387 typedef
1388 #include "vmware_pack_begin.h"
1389 struct SVGA3dCmdDXBindShader {
1390    uint32 cid;
1391    uint32 shid;
1392    SVGAMobId mobid;
1393    uint32 offsetInBytes;
1394 }
1395 #include "vmware_pack_end.h"
1396 SVGA3dCmdDXBindShader;   /* SVGA_3D_CMD_DX_BIND_SHADER */
1397 
1398 typedef
1399 #include "vmware_pack_begin.h"
1400 struct SVGA3dCmdDXBindAllShader {
1401    uint32 cid;
1402    SVGAMobId mobid;
1403 }
1404 #include "vmware_pack_end.h"
1405 SVGA3dCmdDXBindAllShader;   /* SVGA_3D_CMD_DX_BIND_ALL_SHADER */
1406 
1407 typedef
1408 #include "vmware_pack_begin.h"
1409 struct SVGA3dCmdDXCondBindAllShader {
1410    uint32 cid;
1411    SVGAMobId testMobid;
1412    SVGAMobId mobid;
1413 }
1414 #include "vmware_pack_end.h"
1415 SVGA3dCmdDXCondBindAllShader;   /* SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER */
1416 
1417 /*
1418  * The maximum number of streamout decl's in each streamout entry.
1419  */
1420 #define SVGA3D_MAX_STREAMOUT_DECLS 64
1421 
1422 typedef
1423 #include "vmware_pack_begin.h"
1424 struct SVGA3dStreamOutputDeclarationEntry {
1425    uint32 outputSlot;
1426    uint32 registerIndex;
1427    uint8  registerMask;
1428    uint8  pad0;
1429    uint16 pad1;
1430    uint32 stream;
1431 }
1432 #include "vmware_pack_end.h"
1433 SVGA3dStreamOutputDeclarationEntry;
1434 
1435 typedef
1436 #include "vmware_pack_begin.h"
1437 struct SVGAOTableStreamOutputEntry {
1438    uint32 numOutputStreamEntries;
1439    SVGA3dStreamOutputDeclarationEntry decl[SVGA3D_MAX_STREAMOUT_DECLS];
1440    uint32 streamOutputStrideInBytes[SVGA3D_DX_MAX_SOTARGETS];
1441    uint32 rasterizedStream;
1442    uint32 pad[250];
1443 }
1444 #include "vmware_pack_end.h"
1445 SVGACOTableDXStreamOutputEntry;
1446 
1447 typedef
1448 #include "vmware_pack_begin.h"
1449 struct SVGA3dCmdDXDefineStreamOutput {
1450    SVGA3dStreamOutputId soid;
1451    uint32 numOutputStreamEntries;
1452    SVGA3dStreamOutputDeclarationEntry decl[SVGA3D_MAX_STREAMOUT_DECLS];
1453    uint32 streamOutputStrideInBytes[SVGA3D_DX_MAX_SOTARGETS];
1454    uint32 rasterizedStream;
1455 }
1456 #include "vmware_pack_end.h"
1457 SVGA3dCmdDXDefineStreamOutput; /* SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT */
1458 
1459 typedef
1460 #include "vmware_pack_begin.h"
1461 struct SVGA3dCmdDXDestroyStreamOutput {
1462    SVGA3dStreamOutputId soid;
1463 }
1464 #include "vmware_pack_end.h"
1465 SVGA3dCmdDXDestroyStreamOutput; /* SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT */
1466 
1467 typedef
1468 #include "vmware_pack_begin.h"
1469 struct SVGA3dCmdDXSetStreamOutput {
1470    SVGA3dStreamOutputId soid;
1471 }
1472 #include "vmware_pack_end.h"
1473 SVGA3dCmdDXSetStreamOutput; /* SVGA_3D_CMD_DX_SET_STREAMOUTPUT */
1474 
1475 typedef
1476 #include "vmware_pack_begin.h"
1477 struct {
1478    uint64 value;
1479    uint32 mobId;
1480    uint32 mobOffset;
1481 }
1482 #include "vmware_pack_end.h"
1483 SVGA3dCmdDXMobFence64;  /* SVGA_3D_CMD_DX_MOB_FENCE_64 */
1484 
1485 /*
1486  * SVGA3dCmdSetCOTable --
1487  *
1488  * This command allows the guest to bind a mob to a context-object table.
1489  */
1490 typedef
1491 #include "vmware_pack_begin.h"
1492 struct SVGA3dCmdDXSetCOTable {
1493    uint32 cid;
1494    uint32 mobid;
1495    SVGACOTableType type;
1496    uint32 validSizeInBytes;
1497 }
1498 #include "vmware_pack_end.h"
1499 SVGA3dCmdDXSetCOTable; /* SVGA_3D_CMD_DX_SET_COTABLE */
1500 
1501 /*
1502  * Guests using SVGA_3D_CMD_DX_GROW_COTABLE are promising that
1503  * the new COTable contains the same contents as the old one, except possibly
1504  * for some new invalid entries at the end.
1505  *
1506  * If there is an old cotable mob bound, it also has to still be valid.
1507  *
1508  * (Otherwise, guests should use the DXSetCOTableBase command.)
1509  */
1510 typedef
1511 #include "vmware_pack_begin.h"
1512 struct SVGA3dCmdDXGrowCOTable {
1513    uint32 cid;
1514    uint32 mobid;
1515    SVGACOTableType type;
1516    uint32 validSizeInBytes;
1517 }
1518 #include "vmware_pack_end.h"
1519 SVGA3dCmdDXGrowCOTable; /* SVGA_3D_CMD_DX_GROW_COTABLE */
1520 
1521 typedef
1522 #include "vmware_pack_begin.h"
1523 struct SVGA3dCmdDXReadbackCOTable {
1524    uint32 cid;
1525    SVGACOTableType type;
1526 }
1527 #include "vmware_pack_end.h"
1528 SVGA3dCmdDXReadbackCOTable; /* SVGA_3D_CMD_DX_READBACK_COTABLE */
1529 
1530 typedef
1531 #include "vmware_pack_begin.h"
1532 struct SVGA3dCOTableData {
1533    uint32 mobid;
1534 }
1535 #include "vmware_pack_end.h"
1536 SVGA3dCOTableData;
1537 
1538 typedef
1539 #include "vmware_pack_begin.h"
1540 struct SVGA3dBufferBinding {
1541    uint32 bufferId;
1542    uint32 stride;
1543    uint32 offset;
1544 }
1545 #include "vmware_pack_end.h"
1546 SVGA3dBufferBinding;
1547 
1548 typedef
1549 #include "vmware_pack_begin.h"
1550 struct SVGA3dConstantBufferBinding {
1551    uint32 sid;
1552    uint32 offsetInBytes;
1553    uint32 sizeInBytes;
1554 }
1555 #include "vmware_pack_end.h"
1556 SVGA3dConstantBufferBinding;
1557 
1558 typedef
1559 #include "vmware_pack_begin.h"
1560 struct SVGADXInputAssemblyMobFormat {
1561    uint32 layoutId;
1562    SVGA3dBufferBinding vertexBuffers[SVGA3D_DX_MAX_VERTEXBUFFERS];
1563    uint32 indexBufferSid;
1564    uint32 pad;
1565    uint32 indexBufferOffset;
1566    uint32 indexBufferFormat;
1567    uint32 topology;
1568 }
1569 #include "vmware_pack_end.h"
1570 SVGADXInputAssemblyMobFormat;
1571 
1572 typedef
1573 #include "vmware_pack_begin.h"
1574 struct SVGADXContextMobFormat {
1575    SVGADXInputAssemblyMobFormat inputAssembly;
1576 
1577    struct {
1578       uint32 blendStateId;
1579       uint32 blendFactor[4];
1580       uint32 sampleMask;
1581       uint32 depthStencilStateId;
1582       uint32 stencilRef;
1583       uint32 rasterizerStateId;
1584       uint32 depthStencilViewId;
1585       uint32 renderTargetViewIds[SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS];
1586       uint32 unorderedAccessViewIds[SVGA3D_MAX_UAVIEWS];
1587    } renderState;
1588 
1589    struct {
1590       uint32 targets[SVGA3D_DX_MAX_SOTARGETS];
1591       uint32 soid;
1592    } streamOut;
1593    uint32 pad0[11];
1594 
1595    uint8 numViewports;
1596    uint8 numScissorRects;
1597    uint16 pad1[1];
1598 
1599    uint32 pad2[3];
1600 
1601    SVGA3dViewport viewports[SVGA3D_DX_MAX_VIEWPORTS];
1602    uint32 pad3[32];
1603 
1604    SVGASignedRect scissorRects[SVGA3D_DX_MAX_SCISSORRECTS];
1605    uint32 pad4[64];
1606 
1607    struct {
1608       uint32 queryID;
1609       uint32 value;
1610    } predication;
1611    uint32 pad5[2];
1612 
1613    struct {
1614       uint32 shaderId;
1615       SVGA3dConstantBufferBinding constantBuffers[SVGA3D_DX_MAX_CONSTBUFFERS];
1616       uint32 shaderResources[SVGA3D_DX_MAX_SRVIEWS];
1617       uint32 samplers[SVGA3D_DX_MAX_SAMPLERS];
1618    } shaderState[SVGA3D_NUM_SHADERTYPE];
1619    uint32 pad6[26];
1620 
1621    SVGA3dQueryId queryID[SVGA3D_MAX_QUERY];
1622 
1623    SVGA3dCOTableData cotables[SVGA_COTABLE_MAX];
1624    uint32 pad7[380];
1625 }
1626 #include "vmware_pack_end.h"
1627 SVGADXContextMobFormat;
1628 
1629 typedef
1630 #include "vmware_pack_begin.h"
1631 struct SVGA3dCmdDXTempSetContext {
1632    uint32 dxcid;
1633 }
1634 #include "vmware_pack_end.h"
1635 SVGA3dCmdDXTempSetContext; /* SVGA_3D_CMD_DX_TEMP_SET_CONTEXT */
1636 
1637 #endif /* _SVGA3D_DX_H_ */
1638