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