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