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 SVGA3dCmdDXDrawIndexedInstancedIndirect {
316   SVGA3dSurfaceId argsBufferSid;
317   uint32 byteOffsetForArgs;
318}
319#include "vmware_pack_end.h"
320SVGA3dCmdDXDrawIndexedInstancedIndirect;
321/* SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED_INDIRECT */
322
323typedef
324#include "vmware_pack_begin.h"
325struct SVGA3dCmdDXDrawInstancedIndirect {
326   SVGA3dSurfaceId argsBufferSid;
327   uint32 byteOffsetForArgs;
328}
329#include "vmware_pack_end.h"
330SVGA3dCmdDXDrawInstancedIndirect;
331/* SVGA_3D_CMD_DX_DRAW_INSTANCED_INDIRECT */
332
333typedef
334#include "vmware_pack_begin.h"
335struct SVGA3dCmdDXDrawAuto {
336   uint32 pad0;
337}
338#include "vmware_pack_end.h"
339SVGA3dCmdDXDrawAuto; /* SVGA_3D_CMD_DX_DRAW_AUTO */
340
341typedef
342#include "vmware_pack_begin.h"
343struct SVGA3dCmdDXDispatch {
344   uint32 threadGroupCountX;
345   uint32 threadGroupCountY;
346   uint32 threadGroupCountZ;
347}
348#include "vmware_pack_end.h"
349SVGA3dCmdDXDispatch;
350/* SVGA_3D_CMD_DX_DISPATCH */
351
352typedef
353#include "vmware_pack_begin.h"
354struct SVGA3dCmdDXDispatchIndirect {
355   SVGA3dSurfaceId argsBufferSid;
356   uint32 byteOffsetForArgs;
357}
358#include "vmware_pack_end.h"
359SVGA3dCmdDXDispatchIndirect;
360/* SVGA_3D_CMD_DX_DISPATCH_INDIRECT */
361
362typedef
363#include "vmware_pack_begin.h"
364struct SVGA3dCmdDXSetInputLayout {
365   SVGA3dElementLayoutId elementLayoutId;
366}
367#include "vmware_pack_end.h"
368SVGA3dCmdDXSetInputLayout; /* SVGA_3D_CMD_DX_SET_INPUT_LAYOUT */
369
370typedef
371#include "vmware_pack_begin.h"
372struct SVGA3dVertexBuffer {
373   SVGA3dSurfaceId sid;
374   uint32 stride;
375   uint32 offset;
376}
377#include "vmware_pack_end.h"
378SVGA3dVertexBuffer;
379
380typedef
381#include "vmware_pack_begin.h"
382struct SVGA3dCmdDXSetVertexBuffers {
383   uint32 startBuffer;
384   /* Followed by a variable number of SVGA3dVertexBuffer's. */
385}
386#include "vmware_pack_end.h"
387SVGA3dCmdDXSetVertexBuffers; /* SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS */
388
389typedef
390#include "vmware_pack_begin.h"
391struct SVGA3dCmdDXSetIndexBuffer {
392   SVGA3dSurfaceId sid;
393   SVGA3dSurfaceFormat format;
394   uint32 offset;
395}
396#include "vmware_pack_end.h"
397SVGA3dCmdDXSetIndexBuffer; /* SVGA_3D_CMD_DX_SET_INDEX_BUFFER */
398
399typedef
400#include "vmware_pack_begin.h"
401struct SVGA3dCmdDXSetTopology {
402   SVGA3dPrimitiveType topology;
403}
404#include "vmware_pack_end.h"
405SVGA3dCmdDXSetTopology; /* SVGA_3D_CMD_DX_SET_TOPOLOGY */
406
407typedef
408#include "vmware_pack_begin.h"
409struct SVGA3dCmdDXSetRenderTargets {
410   SVGA3dDepthStencilViewId depthStencilViewId;
411   /* Followed by a variable number of SVGA3dRenderTargetViewId's. */
412}
413#include "vmware_pack_end.h"
414SVGA3dCmdDXSetRenderTargets; /* SVGA_3D_CMD_DX_SET_RENDERTARGETS */
415
416typedef
417#include "vmware_pack_begin.h"
418struct SVGA3dCmdDXSetBlendState {
419   SVGA3dBlendStateId blendId;
420   float blendFactor[4];
421   uint32 sampleMask;
422}
423#include "vmware_pack_end.h"
424SVGA3dCmdDXSetBlendState; /* SVGA_3D_CMD_DX_SET_BLEND_STATE */
425
426typedef
427#include "vmware_pack_begin.h"
428struct SVGA3dCmdDXSetDepthStencilState {
429   SVGA3dDepthStencilStateId depthStencilId;
430   uint32 stencilRef;
431}
432#include "vmware_pack_end.h"
433SVGA3dCmdDXSetDepthStencilState; /* SVGA_3D_CMD_DX_SET_DEPTHSTENCIL_STATE */
434
435typedef
436#include "vmware_pack_begin.h"
437struct SVGA3dCmdDXSetRasterizerState {
438   SVGA3dRasterizerStateId rasterizerId;
439}
440#include "vmware_pack_end.h"
441SVGA3dCmdDXSetRasterizerState; /* SVGA_3D_CMD_DX_SET_RASTERIZER_STATE */
442
443/* Matches D3D10DDI_QUERY_MISCFLAG and D3D10_QUERY_MISC_FLAG */
444#define SVGA3D_DXQUERY_FLAG_PREDICATEHINT (1 << 0)
445typedef uint32 SVGA3dDXQueryFlags;
446
447/*
448 * The SVGADXQueryDeviceState and SVGADXQueryDeviceBits are used by the device
449 * to track query state transitions, but are not intended to be used by the
450 * driver.
451 */
452#define SVGADX_QDSTATE_INVALID   ((uint8)-1) /* Query has no state */
453#define SVGADX_QDSTATE_MIN       0
454#define SVGADX_QDSTATE_IDLE      0   /* Query hasn't started yet */
455#define SVGADX_QDSTATE_ACTIVE    1   /* Query is actively gathering data */
456#define SVGADX_QDSTATE_PENDING   2   /* Query is waiting for results */
457#define SVGADX_QDSTATE_FINISHED  3   /* Query has completed */
458#define SVGADX_QDSTATE_MAX       4
459typedef uint8 SVGADXQueryDeviceState;
460
461typedef
462#include "vmware_pack_begin.h"
463struct {
464   SVGA3dQueryTypeUint8 type;
465   uint16 pad0;
466   SVGADXQueryDeviceState state;
467   SVGA3dDXQueryFlags flags;
468   SVGAMobId mobid;
469   uint32 offset;
470}
471#include "vmware_pack_end.h"
472SVGACOTableDXQueryEntry;
473
474typedef
475#include "vmware_pack_begin.h"
476struct SVGA3dCmdDXDefineQuery {
477   SVGA3dQueryId queryId;
478   SVGA3dQueryType type;
479   SVGA3dDXQueryFlags flags;
480}
481#include "vmware_pack_end.h"
482SVGA3dCmdDXDefineQuery; /* SVGA_3D_CMD_DX_DEFINE_QUERY */
483
484typedef
485#include "vmware_pack_begin.h"
486struct SVGA3dCmdDXDestroyQuery {
487   SVGA3dQueryId queryId;
488}
489#include "vmware_pack_end.h"
490SVGA3dCmdDXDestroyQuery; /* SVGA_3D_CMD_DX_DESTROY_QUERY */
491
492typedef
493#include "vmware_pack_begin.h"
494struct SVGA3dCmdDXBindQuery {
495   SVGA3dQueryId queryId;
496   SVGAMobId mobid;
497}
498#include "vmware_pack_end.h"
499SVGA3dCmdDXBindQuery; /* SVGA_3D_CMD_DX_BIND_QUERY */
500
501typedef
502#include "vmware_pack_begin.h"
503struct SVGA3dCmdDXSetQueryOffset {
504   SVGA3dQueryId queryId;
505   uint32 mobOffset;
506}
507#include "vmware_pack_end.h"
508SVGA3dCmdDXSetQueryOffset; /* SVGA_3D_CMD_DX_SET_QUERY_OFFSET */
509
510typedef
511#include "vmware_pack_begin.h"
512struct SVGA3dCmdDXBeginQuery {
513   SVGA3dQueryId queryId;
514}
515#include "vmware_pack_end.h"
516SVGA3dCmdDXBeginQuery; /* SVGA_3D_CMD_DX_QUERY_BEGIN */
517
518typedef
519#include "vmware_pack_begin.h"
520struct SVGA3dCmdDXEndQuery {
521   SVGA3dQueryId queryId;
522}
523#include "vmware_pack_end.h"
524SVGA3dCmdDXEndQuery; /* SVGA_3D_CMD_DX_QUERY_END */
525
526typedef
527#include "vmware_pack_begin.h"
528struct SVGA3dCmdDXReadbackQuery {
529   SVGA3dQueryId queryId;
530}
531#include "vmware_pack_end.h"
532SVGA3dCmdDXReadbackQuery; /* SVGA_3D_CMD_DX_READBACK_QUERY */
533
534typedef
535#include "vmware_pack_begin.h"
536struct SVGA3dCmdDXMoveQuery {
537   SVGA3dQueryId queryId;
538   SVGAMobId mobid;
539   uint32 mobOffset;
540}
541#include "vmware_pack_end.h"
542SVGA3dCmdDXMoveQuery; /* SVGA_3D_CMD_DX_MOVE_QUERY */
543
544typedef
545#include "vmware_pack_begin.h"
546struct SVGA3dCmdDXBindAllQuery {
547   uint32 cid;
548   SVGAMobId mobid;
549}
550#include "vmware_pack_end.h"
551SVGA3dCmdDXBindAllQuery; /* SVGA_3D_CMD_DX_BIND_ALL_QUERY */
552
553typedef
554#include "vmware_pack_begin.h"
555struct SVGA3dCmdDXReadbackAllQuery {
556   uint32 cid;
557}
558#include "vmware_pack_end.h"
559SVGA3dCmdDXReadbackAllQuery; /* SVGA_3D_CMD_DX_READBACK_ALL_QUERY */
560
561typedef
562#include "vmware_pack_begin.h"
563struct SVGA3dCmdDXSetPredication {
564   SVGA3dQueryId queryId;
565   uint32 predicateValue;
566}
567#include "vmware_pack_end.h"
568SVGA3dCmdDXSetPredication; /* SVGA_3D_CMD_DX_SET_PREDICATION */
569
570typedef
571#include "vmware_pack_begin.h"
572struct MKS3dDXSOState {
573   uint32 offset;       /* Starting offset */
574   uint32 intOffset;    /* Internal offset */
575   uint32 vertexCount;  /* vertices written */
576   uint32 sizeInBytes;  /* max bytes to write */
577}
578#include "vmware_pack_end.h"
579SVGA3dDXSOState;
580
581/* Set the offset field to this value to append SO values to the buffer */
582#define SVGA3D_DX_SO_OFFSET_APPEND ((uint32) ~0u)
583
584typedef
585#include "vmware_pack_begin.h"
586struct SVGA3dSoTarget {
587   SVGA3dSurfaceId sid;
588   uint32 offset;
589   uint32 sizeInBytes;
590}
591#include "vmware_pack_end.h"
592SVGA3dSoTarget;
593
594typedef
595#include "vmware_pack_begin.h"
596struct SVGA3dCmdDXSetSOTargets {
597   uint32 pad0;
598   /* Followed by a variable number of SVGA3dSOTarget's. */
599}
600#include "vmware_pack_end.h"
601SVGA3dCmdDXSetSOTargets; /* SVGA_3D_CMD_DX_SET_SOTARGETS */
602
603typedef
604#include "vmware_pack_begin.h"
605struct SVGA3dViewport
606{
607   float x;
608   float y;
609   float width;
610   float height;
611   float minDepth;
612   float maxDepth;
613}
614#include "vmware_pack_end.h"
615SVGA3dViewport;
616
617typedef
618#include "vmware_pack_begin.h"
619struct SVGA3dCmdDXSetViewports {
620   uint32 pad0;
621   /* Followed by a variable number of SVGA3dViewport's. */
622}
623#include "vmware_pack_end.h"
624SVGA3dCmdDXSetViewports; /* SVGA_3D_CMD_DX_SET_VIEWPORTS */
625
626#define SVGA3D_DX_MAX_VIEWPORTS  16
627
628typedef
629#include "vmware_pack_begin.h"
630struct SVGA3dCmdDXSetScissorRects {
631   uint32 pad0;
632   /* Followed by a variable number of SVGASignedRect's. */
633}
634#include "vmware_pack_end.h"
635SVGA3dCmdDXSetScissorRects; /* SVGA_3D_CMD_DX_SET_SCISSORRECTS */
636
637#define SVGA3D_DX_MAX_SCISSORRECTS  16
638
639typedef
640#include "vmware_pack_begin.h"
641struct SVGA3dCmdDXClearRenderTargetView {
642   SVGA3dRenderTargetViewId renderTargetViewId;
643   SVGA3dRGBAFloat rgba;
644}
645#include "vmware_pack_end.h"
646SVGA3dCmdDXClearRenderTargetView; /* SVGA_3D_CMD_DX_CLEAR_RENDERTARGET_VIEW */
647
648typedef
649#include "vmware_pack_begin.h"
650struct SVGA3dCmdDXClearDepthStencilView {
651   uint16 flags;
652   uint16 stencil;
653   SVGA3dDepthStencilViewId depthStencilViewId;
654   float depth;
655}
656#include "vmware_pack_end.h"
657SVGA3dCmdDXClearDepthStencilView; /* SVGA_3D_CMD_DX_CLEAR_DEPTHSTENCIL_VIEW */
658
659typedef
660#include "vmware_pack_begin.h"
661struct SVGA3dCmdDXPredCopyRegion {
662   SVGA3dSurfaceId dstSid;
663   uint32 dstSubResource;
664   SVGA3dSurfaceId srcSid;
665   uint32 srcSubResource;
666   SVGA3dCopyBox box;
667}
668#include "vmware_pack_end.h"
669SVGA3dCmdDXPredCopyRegion;
670/* SVGA_3D_CMD_DX_PRED_COPY_REGION */
671
672typedef
673#include "vmware_pack_begin.h"
674struct SVGA3dCmdDXPredCopy {
675   SVGA3dSurfaceId dstSid;
676   SVGA3dSurfaceId srcSid;
677}
678#include "vmware_pack_end.h"
679SVGA3dCmdDXPredCopy; /* SVGA_3D_CMD_DX_PRED_COPY */
680
681typedef
682#include "vmware_pack_begin.h"
683struct SVGA3dCmdDXPredConvertRegion {
684   SVGA3dSurfaceId dstSid;
685   uint32 dstSubResource;
686   SVGA3dSurfaceId srcSid;
687   uint32 srcSubResource;
688   SVGA3dCopyBox box;
689}
690#include "vmware_pack_end.h"
691SVGA3dCmdDXPredConvertRegion; /* SVGA_3D_CMD_DX_PRED_CONVERT_REGION */
692
693typedef
694#include "vmware_pack_begin.h"
695struct SVGA3dCmdDXPredConvert {
696   SVGA3dSurfaceId dstSid;
697   SVGA3dSurfaceId srcSid;
698}
699#include "vmware_pack_end.h"
700SVGA3dCmdDXPredConvert; /* SVGA_3D_CMD_DX_PRED_CONVERT */
701
702typedef
703#include "vmware_pack_begin.h"
704struct SVGA3dCmdDXBufferCopy {
705   SVGA3dSurfaceId dest;
706   SVGA3dSurfaceId src;
707   uint32 destX;
708   uint32 srcX;
709   uint32 width;
710}
711#include "vmware_pack_end.h"
712SVGA3dCmdDXBufferCopy;
713/* SVGA_3D_CMD_DX_BUFFER_COPY */
714
715/*
716 * Perform a surface copy between a multisample, and a non-multisampled
717 * surface.
718 */
719typedef
720#include "vmware_pack_begin.h"
721struct {
722   SVGA3dSurfaceId dstSid;
723   uint32 dstSubResource;
724   SVGA3dSurfaceId srcSid;
725   uint32 srcSubResource;
726   SVGA3dSurfaceFormat copyFormat;
727}
728#include "vmware_pack_end.h"
729SVGA3dCmdDXResolveCopy;               /* SVGA_3D_CMD_DX_RESOLVE_COPY */
730
731/*
732 * Perform a predicated surface copy between a multisample, and a
733 * non-multisampled surface.
734 */
735typedef
736#include "vmware_pack_begin.h"
737struct {
738   SVGA3dSurfaceId dstSid;
739   uint32 dstSubResource;
740   SVGA3dSurfaceId srcSid;
741   uint32 srcSubResource;
742   SVGA3dSurfaceFormat copyFormat;
743}
744#include "vmware_pack_end.h"
745SVGA3dCmdDXPredResolveCopy;           /* SVGA_3D_CMD_DX_PRED_RESOLVE_COPY */
746
747typedef uint32 SVGA3dDXStretchBltMode;
748#define SVGADX_STRETCHBLT_LINEAR         (1 << 0)
749#define SVGADX_STRETCHBLT_FORCE_SRC_SRGB (1 << 1)
750#define SVGADX_STRETCHBLT_MODE_MAX       (1 << 2)
751
752typedef
753#include "vmware_pack_begin.h"
754struct SVGA3dCmdDXStretchBlt {
755   SVGA3dSurfaceId srcSid;
756   uint32 srcSubResource;
757   SVGA3dSurfaceId dstSid;
758   uint32 destSubResource;
759   SVGA3dBox boxSrc;
760   SVGA3dBox boxDest;
761   SVGA3dDXStretchBltMode mode;
762}
763#include "vmware_pack_end.h"
764SVGA3dCmdDXStretchBlt; /* SVGA_3D_CMD_DX_STRETCHBLT */
765
766typedef
767#include "vmware_pack_begin.h"
768struct SVGA3dCmdDXGenMips {
769   SVGA3dShaderResourceViewId shaderResourceViewId;
770}
771#include "vmware_pack_end.h"
772SVGA3dCmdDXGenMips; /* SVGA_3D_CMD_DX_GENMIPS */
773
774/*
775 * Update a sub-resource in a guest-backed resource.
776 * (Inform the device that the guest-contents have been updated.)
777 */
778typedef
779#include "vmware_pack_begin.h"
780struct SVGA3dCmdDXUpdateSubResource {
781   SVGA3dSurfaceId sid;
782   uint32 subResource;
783   SVGA3dBox box;
784}
785#include "vmware_pack_end.h"
786SVGA3dCmdDXUpdateSubResource;   /* SVGA_3D_CMD_DX_UPDATE_SUBRESOURCE */
787
788/*
789 * Readback a subresource in a guest-backed resource.
790 * (Request the device to flush the dirty contents into the guest.)
791 */
792typedef
793#include "vmware_pack_begin.h"
794struct SVGA3dCmdDXReadbackSubResource {
795   SVGA3dSurfaceId sid;
796   uint32 subResource;
797}
798#include "vmware_pack_end.h"
799SVGA3dCmdDXReadbackSubResource;   /* SVGA_3D_CMD_DX_READBACK_SUBRESOURCE */
800
801/*
802 * Invalidate an image in a guest-backed surface.
803 * (Notify the device that the contents can be lost.)
804 */
805typedef
806#include "vmware_pack_begin.h"
807struct SVGA3dCmdDXInvalidateSubResource {
808   SVGA3dSurfaceId sid;
809   uint32 subResource;
810}
811#include "vmware_pack_end.h"
812SVGA3dCmdDXInvalidateSubResource;   /* SVGA_3D_CMD_DX_INVALIDATE_SUBRESOURCE */
813
814
815/*
816 * Raw byte wise transfer from a buffer surface into another surface
817 * of the requested box.  Supported if 3d is enabled and SVGA_CAP_DX
818 * is set.  This command does not take a context.
819 */
820typedef
821#include "vmware_pack_begin.h"
822struct SVGA3dCmdDXTransferFromBuffer {
823   SVGA3dSurfaceId srcSid;
824   uint32 srcOffset;
825   uint32 srcPitch;
826   uint32 srcSlicePitch;
827   SVGA3dSurfaceId destSid;
828   uint32 destSubResource;
829   SVGA3dBox destBox;
830}
831#include "vmware_pack_end.h"
832SVGA3dCmdDXTransferFromBuffer;   /* SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER */
833
834
835/*
836 * Raw byte wise transfer from a buffer surface into another surface
837 * of the requested box.  Supported if SVGA3D_DEVCAP_DXCONTEXT is set.
838 * The context is implied from the command buffer header.
839 */
840typedef
841#include "vmware_pack_begin.h"
842struct SVGA3dCmdDXPredTransferFromBuffer {
843   SVGA3dSurfaceId srcSid;
844   uint32 srcOffset;
845   uint32 srcPitch;
846   uint32 srcSlicePitch;
847   SVGA3dSurfaceId destSid;
848   uint32 destSubResource;
849   SVGA3dBox destBox;
850}
851#include "vmware_pack_end.h"
852SVGA3dCmdDXPredTransferFromBuffer;
853/* SVGA_3D_CMD_DX_PRED_TRANSFER_FROM_BUFFER */
854
855
856typedef
857#include "vmware_pack_begin.h"
858struct SVGA3dCmdDXSurfaceCopyAndReadback {
859   SVGA3dSurfaceId srcSid;
860   SVGA3dSurfaceId destSid;
861   SVGA3dCopyBox box;
862}
863#include "vmware_pack_end.h"
864SVGA3dCmdDXSurfaceCopyAndReadback;
865/* SVGA_3D_CMD_DX_SURFACE_COPY_AND_READBACK */
866
867/*
868 * SVGA_DX_HINT_NONE: Does nothing.
869 *
870 * SVGA_DX_HINT_PREFETCH_OBJECT:
871 * SVGA_DX_HINT_PREEVICT_OBJECT:
872 *      Consumes a SVGAObjectRef, and hints that the host should consider
873 *      fetching/evicting the specified object.
874 *
875 *      An id of SVGA3D_INVALID_ID can be used if the guest isn't sure
876 *      what object was affected.  (For instance, if the guest knows that
877 *      it is about to evict a DXShader, but doesn't know precisely which one,
878 *      the device can still use this to help limit it's search, or track
879 *      how many page-outs have happened.)
880 *
881 * SVGA_DX_HINT_PREFETCH_COBJECT:
882 * SVGA_DX_HINT_PREEVICT_COBJECT:
883 *      Same as the above, except they consume an SVGACObjectRef.
884 */
885typedef uint32 SVGADXHintId;
886#define SVGA_DX_HINT_NONE              0
887#define SVGA_DX_HINT_PREFETCH_OBJECT   1
888#define SVGA_DX_HINT_PREEVICT_OBJECT   2
889#define SVGA_DX_HINT_PREFETCH_COBJECT  3
890#define SVGA_DX_HINT_PREEVICT_COBJECT  4
891#define SVGA_DX_HINT_MAX               5
892
893typedef
894#include "vmware_pack_begin.h"
895struct SVGAObjectRef {
896   SVGAOTableType type;
897   uint32 id;
898}
899#include "vmware_pack_end.h"
900SVGAObjectRef;
901
902typedef
903#include "vmware_pack_begin.h"
904struct SVGACObjectRef {
905   SVGACOTableType type;
906   uint32 cid;
907   uint32 id;
908}
909#include "vmware_pack_end.h"
910SVGACObjectRef;
911
912typedef
913#include "vmware_pack_begin.h"
914struct SVGA3dCmdDXHint {
915   SVGADXHintId hintId;
916
917   /*
918    * Followed by variable sized data depending on the hintId.
919    */
920}
921#include "vmware_pack_end.h"
922SVGA3dCmdDXHint;
923/* SVGA_3D_CMD_DX_HINT */
924
925typedef
926#include "vmware_pack_begin.h"
927struct SVGA3dCmdDXBufferUpdate {
928   SVGA3dSurfaceId sid;
929   uint32 x;
930   uint32 width;
931}
932#include "vmware_pack_end.h"
933SVGA3dCmdDXBufferUpdate;
934/* SVGA_3D_CMD_DX_BUFFER_UPDATE */
935
936typedef
937#include "vmware_pack_begin.h"
938struct SVGA3dCmdDXSetConstantBufferOffset {
939   uint32 slot;
940   uint32 offsetInBytes;
941}
942#include "vmware_pack_end.h"
943SVGA3dCmdDXSetConstantBufferOffset;
944
945typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetVSConstantBufferOffset;
946/* SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET */
947
948typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetPSConstantBufferOffset;
949/* SVGA_3D_CMD_DX_SET_PS_CONSTANT_BUFFER_OFFSET */
950
951typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetGSConstantBufferOffset;
952/* SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET */
953
954
955typedef
956#include "vmware_pack_begin.h"
957struct {
958   union {
959      struct {
960         uint32 firstElement;
961         uint32 numElements;
962         uint32 pad0;
963         uint32 pad1;
964      } buffer;
965      struct {
966         uint32 mostDetailedMip;
967         uint32 firstArraySlice;
968         uint32 mipLevels;
969         uint32 arraySize;
970      } tex;
971      struct {
972         uint32 firstElement;  // D3D11DDIARG_BUFFEREX_SHADERRESOURCEVIEW
973         uint32 numElements;
974         uint32 flags;
975         uint32 pad0;
976      } bufferex;
977   };
978}
979#include "vmware_pack_end.h"
980SVGA3dShaderResourceViewDesc;
981
982typedef
983#include "vmware_pack_begin.h"
984struct {
985   SVGA3dSurfaceId sid;
986   SVGA3dSurfaceFormat format;
987   SVGA3dResourceType resourceDimension;
988   SVGA3dShaderResourceViewDesc desc;
989   uint32 pad;
990}
991#include "vmware_pack_end.h"
992SVGACOTableDXSRViewEntry;
993
994typedef
995#include "vmware_pack_begin.h"
996struct SVGA3dCmdDXDefineShaderResourceView {
997   SVGA3dShaderResourceViewId shaderResourceViewId;
998
999   SVGA3dSurfaceId sid;
1000   SVGA3dSurfaceFormat format;
1001   SVGA3dResourceType resourceDimension;
1002
1003   SVGA3dShaderResourceViewDesc desc;
1004}
1005#include "vmware_pack_end.h"
1006SVGA3dCmdDXDefineShaderResourceView;
1007/* SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW */
1008
1009typedef
1010#include "vmware_pack_begin.h"
1011struct SVGA3dCmdDXDestroyShaderResourceView {
1012   SVGA3dShaderResourceViewId shaderResourceViewId;
1013}
1014#include "vmware_pack_end.h"
1015SVGA3dCmdDXDestroyShaderResourceView;
1016/* SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW */
1017
1018typedef
1019#include "vmware_pack_begin.h"
1020struct SVGA3dRenderTargetViewDesc {
1021   union {
1022      struct {
1023         uint32 firstElement;
1024         uint32 numElements;
1025      } buffer;
1026      struct {
1027         uint32 mipSlice;
1028         uint32 firstArraySlice;
1029         uint32 arraySize;
1030      } tex;                    /* 1d, 2d, cube */
1031      struct {
1032         uint32 mipSlice;
1033         uint32 firstW;
1034         uint32 wSize;
1035      } tex3D;
1036   };
1037}
1038#include "vmware_pack_end.h"
1039SVGA3dRenderTargetViewDesc;
1040
1041typedef
1042#include "vmware_pack_begin.h"
1043struct {
1044   SVGA3dSurfaceId sid;
1045   SVGA3dSurfaceFormat format;
1046   SVGA3dResourceType resourceDimension;
1047   SVGA3dRenderTargetViewDesc desc;
1048   uint32 pad[2];
1049}
1050#include "vmware_pack_end.h"
1051SVGACOTableDXRTViewEntry;
1052
1053typedef
1054#include "vmware_pack_begin.h"
1055struct SVGA3dCmdDXDefineRenderTargetView {
1056   SVGA3dRenderTargetViewId renderTargetViewId;
1057
1058   SVGA3dSurfaceId sid;
1059   SVGA3dSurfaceFormat format;
1060   SVGA3dResourceType resourceDimension;
1061
1062   SVGA3dRenderTargetViewDesc desc;
1063}
1064#include "vmware_pack_end.h"
1065SVGA3dCmdDXDefineRenderTargetView;
1066/* SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW */
1067
1068typedef
1069#include "vmware_pack_begin.h"
1070struct SVGA3dCmdDXDestroyRenderTargetView {
1071   SVGA3dRenderTargetViewId renderTargetViewId;
1072}
1073#include "vmware_pack_end.h"
1074SVGA3dCmdDXDestroyRenderTargetView;
1075/* SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW */
1076
1077/*
1078 * Create Depth-stencil view flags
1079 * http://msdn.microsoft.com/en-us/library/windows/hardware/ff542167(v=vs.85).aspx
1080 */
1081#define SVGA3D_DXDSVIEW_CREATE_READ_ONLY_DEPTH   0x01
1082#define SVGA3D_DXDSVIEW_CREATE_READ_ONLY_STENCIL 0x02
1083#define SVGA3D_DXDSVIEW_CREATE_FLAG_MASK         0x03
1084typedef uint8 SVGA3DCreateDSViewFlags;
1085
1086typedef
1087#include "vmware_pack_begin.h"
1088struct {
1089   SVGA3dSurfaceId sid;
1090   SVGA3dSurfaceFormat format;
1091   SVGA3dResourceType resourceDimension;
1092   uint32 mipSlice;
1093   uint32 firstArraySlice;
1094   uint32 arraySize;
1095   SVGA3DCreateDSViewFlags flags;
1096   uint8 pad0;
1097   uint16 pad1;
1098   uint32 pad2;
1099}
1100#include "vmware_pack_end.h"
1101SVGACOTableDXDSViewEntry;
1102
1103typedef
1104#include "vmware_pack_begin.h"
1105struct SVGA3dCmdDXDefineDepthStencilView {
1106   SVGA3dDepthStencilViewId depthStencilViewId;
1107
1108   SVGA3dSurfaceId sid;
1109   SVGA3dSurfaceFormat format;
1110   SVGA3dResourceType resourceDimension;
1111   uint32 mipSlice;
1112   uint32 firstArraySlice;
1113   uint32 arraySize;
1114   SVGA3DCreateDSViewFlags flags;  /* D3D11DDIARG_CREATEDEPTHSTENCILVIEW */
1115   uint8 pad0;
1116   uint16 pad1;
1117}
1118#include "vmware_pack_end.h"
1119SVGA3dCmdDXDefineDepthStencilView;
1120/* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW */
1121
1122typedef
1123#include "vmware_pack_begin.h"
1124struct SVGA3dCmdDXDestroyDepthStencilView {
1125   SVGA3dDepthStencilViewId depthStencilViewId;
1126}
1127#include "vmware_pack_end.h"
1128SVGA3dCmdDXDestroyDepthStencilView;
1129/* SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW */
1130
1131typedef
1132#include "vmware_pack_begin.h"
1133struct SVGA3dInputElementDesc {
1134   uint32 inputSlot;
1135   uint32 alignedByteOffset;
1136   SVGA3dSurfaceFormat format;
1137   SVGA3dInputClassification inputSlotClass;
1138   uint32 instanceDataStepRate;
1139   uint32 inputRegister;
1140}
1141#include "vmware_pack_end.h"
1142SVGA3dInputElementDesc;
1143
1144typedef
1145#include "vmware_pack_begin.h"
1146struct {
1147   uint32 elid;
1148   uint32 numDescs;
1149   SVGA3dInputElementDesc descs[32];
1150   uint32 pad[62];
1151}
1152#include "vmware_pack_end.h"
1153SVGACOTableDXElementLayoutEntry;
1154
1155typedef
1156#include "vmware_pack_begin.h"
1157struct SVGA3dCmdDXDefineElementLayout {
1158   SVGA3dElementLayoutId elementLayoutId;
1159   /* Followed by a variable number of SVGA3dInputElementDesc's. */
1160}
1161#include "vmware_pack_end.h"
1162SVGA3dCmdDXDefineElementLayout;
1163/* SVGA_3D_CMD_DX_DEFINE_ELEMENTLAYOUT */
1164
1165typedef
1166#include "vmware_pack_begin.h"
1167struct SVGA3dCmdDXDestroyElementLayout {
1168   SVGA3dElementLayoutId elementLayoutId;
1169}
1170#include "vmware_pack_end.h"
1171SVGA3dCmdDXDestroyElementLayout;
1172/* SVGA_3D_CMD_DX_DESTROY_ELEMENTLAYOUT */
1173
1174
1175#define SVGA3D_DX_MAX_RENDER_TARGETS 8
1176
1177typedef
1178#include "vmware_pack_begin.h"
1179struct SVGA3dDXBlendStatePerRT {
1180      uint8 blendEnable;
1181      uint8 srcBlend;
1182      uint8 destBlend;
1183      uint8 blendOp;
1184      uint8 srcBlendAlpha;
1185      uint8 destBlendAlpha;
1186      uint8 blendOpAlpha;
1187      SVGA3dColorWriteEnable renderTargetWriteMask;
1188      uint8 logicOpEnable;
1189      uint8 logicOp;
1190      uint16 pad0;
1191}
1192#include "vmware_pack_end.h"
1193SVGA3dDXBlendStatePerRT;
1194
1195typedef
1196#include "vmware_pack_begin.h"
1197struct {
1198   uint8 alphaToCoverageEnable;
1199   uint8 independentBlendEnable;
1200   uint16 pad0;
1201   SVGA3dDXBlendStatePerRT perRT[SVGA3D_MAX_RENDER_TARGETS];
1202   uint32 pad1[7];
1203}
1204#include "vmware_pack_end.h"
1205SVGACOTableDXBlendStateEntry;
1206
1207/*
1208 * XXX - DX10 style (not 10.1 at this point)
1209 * XXX - For more information see
1210 *    http://msdn.microsoft.com/en-us/library/ff541919%28v=VS.85%29.aspx
1211 */
1212typedef
1213#include "vmware_pack_begin.h"
1214struct SVGA3dCmdDXDefineBlendState {
1215   SVGA3dBlendStateId blendId;
1216   uint8 alphaToCoverageEnable;
1217   uint8 independentBlendEnable;
1218   uint16 pad0;
1219   SVGA3dDXBlendStatePerRT perRT[SVGA3D_MAX_RENDER_TARGETS];
1220}
1221#include "vmware_pack_end.h"
1222SVGA3dCmdDXDefineBlendState; /* SVGA_3D_CMD_DX_DEFINE_BLEND_STATE */
1223
1224typedef
1225#include "vmware_pack_begin.h"
1226struct SVGA3dCmdDXDestroyBlendState {
1227   SVGA3dBlendStateId blendId;
1228}
1229#include "vmware_pack_end.h"
1230SVGA3dCmdDXDestroyBlendState; /* SVGA_3D_CMD_DX_DESTROY_BLEND_STATE */
1231
1232typedef
1233#include "vmware_pack_begin.h"
1234struct {
1235   uint8 depthEnable;
1236   SVGA3dDepthWriteMask depthWriteMask;
1237   SVGA3dComparisonFunc depthFunc;
1238   uint8 stencilEnable;
1239   uint8 frontEnable;
1240   uint8 backEnable;
1241   uint8 stencilReadMask;
1242   uint8 stencilWriteMask;
1243
1244   uint8 frontStencilFailOp;
1245   uint8 frontStencilDepthFailOp;
1246   uint8 frontStencilPassOp;
1247   SVGA3dComparisonFunc frontStencilFunc;
1248
1249   uint8 backStencilFailOp;
1250   uint8 backStencilDepthFailOp;
1251   uint8 backStencilPassOp;
1252   SVGA3dComparisonFunc backStencilFunc;
1253}
1254#include "vmware_pack_end.h"
1255SVGACOTableDXDepthStencilEntry;
1256
1257/*
1258 * XXX - For more information see
1259 *    http://msdn.microsoft.com/en-us/library/ff541944%28v=VS.85%29.aspx
1260 */
1261typedef
1262#include "vmware_pack_begin.h"
1263struct SVGA3dCmdDXDefineDepthStencilState {
1264   SVGA3dDepthStencilStateId depthStencilId;
1265
1266   uint8 depthEnable;
1267   SVGA3dDepthWriteMask depthWriteMask;
1268   SVGA3dComparisonFunc depthFunc;
1269   uint8 stencilEnable;
1270   uint8 frontEnable;
1271   uint8 backEnable;
1272   uint8 stencilReadMask;
1273   uint8 stencilWriteMask;
1274
1275   uint8 frontStencilFailOp;
1276   uint8 frontStencilDepthFailOp;
1277   uint8 frontStencilPassOp;
1278   SVGA3dComparisonFunc frontStencilFunc;
1279
1280   uint8 backStencilFailOp;
1281   uint8 backStencilDepthFailOp;
1282   uint8 backStencilPassOp;
1283   SVGA3dComparisonFunc backStencilFunc;
1284}
1285#include "vmware_pack_end.h"
1286SVGA3dCmdDXDefineDepthStencilState;
1287/* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_STATE */
1288
1289typedef
1290#include "vmware_pack_begin.h"
1291struct SVGA3dCmdDXDestroyDepthStencilState {
1292   SVGA3dDepthStencilStateId depthStencilId;
1293}
1294#include "vmware_pack_end.h"
1295SVGA3dCmdDXDestroyDepthStencilState;
1296/* SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_STATE */
1297
1298typedef
1299#include "vmware_pack_begin.h"
1300struct {
1301   uint8 fillMode;
1302   SVGA3dCullMode cullMode;
1303   uint8 frontCounterClockwise;
1304   uint8 provokingVertexLast;
1305   int32 depthBias;
1306   float depthBiasClamp;
1307   float slopeScaledDepthBias;
1308   uint8 depthClipEnable;
1309   uint8 scissorEnable;
1310   SVGA3dMultisampleEnable multisampleEnable;
1311   uint8 antialiasedLineEnable;
1312   float lineWidth;
1313   uint8 lineStippleEnable;
1314   uint8 lineStippleFactor;
1315   uint16 lineStipplePattern;
1316   uint32 forcedSampleCount;
1317}
1318#include "vmware_pack_end.h"
1319SVGACOTableDXRasterizerStateEntry;
1320
1321/*
1322 * XXX - For more information see
1323 *    http://msdn.microsoft.com/en-us/library/ff541988%28v=VS.85%29.aspx
1324 */
1325typedef
1326#include "vmware_pack_begin.h"
1327struct SVGA3dCmdDXDefineRasterizerState {
1328   SVGA3dRasterizerStateId rasterizerId;
1329
1330   uint8 fillMode;
1331   SVGA3dCullMode cullMode;
1332   uint8 frontCounterClockwise;
1333   uint8 provokingVertexLast;
1334   int32 depthBias;
1335   float depthBiasClamp;
1336   float slopeScaledDepthBias;
1337   uint8 depthClipEnable;
1338   uint8 scissorEnable;
1339   SVGA3dMultisampleEnable multisampleEnable;
1340   uint8 antialiasedLineEnable;
1341   float lineWidth;
1342   uint8 lineStippleEnable;
1343   uint8 lineStippleFactor;
1344   uint16 lineStipplePattern;
1345}
1346#include "vmware_pack_end.h"
1347SVGA3dCmdDXDefineRasterizerState;
1348/* SVGA_3D_CMD_DX_DEFINE_RASTERIZER_STATE */
1349
1350typedef
1351#include "vmware_pack_begin.h"
1352struct SVGA3dCmdDXDestroyRasterizerState {
1353   SVGA3dRasterizerStateId rasterizerId;
1354}
1355#include "vmware_pack_end.h"
1356SVGA3dCmdDXDestroyRasterizerState;
1357/* SVGA_3D_CMD_DX_DESTROY_RASTERIZER_STATE */
1358
1359typedef
1360#include "vmware_pack_begin.h"
1361struct {
1362   SVGA3dFilter filter;
1363   uint8 addressU;
1364   uint8 addressV;
1365   uint8 addressW;
1366   uint8 pad0;
1367   float mipLODBias;
1368   uint8 maxAnisotropy;
1369   SVGA3dComparisonFunc comparisonFunc;
1370   uint16 pad1;
1371   SVGA3dRGBAFloat borderColor;
1372   float minLOD;
1373   float maxLOD;
1374   uint32 pad2[6];
1375}
1376#include "vmware_pack_end.h"
1377SVGACOTableDXSamplerEntry;
1378
1379/*
1380 * XXX - For more information see
1381 *    http://msdn.microsoft.com/en-us/library/ff542011%28v=VS.85%29.aspx
1382 */
1383typedef
1384#include "vmware_pack_begin.h"
1385struct SVGA3dCmdDXDefineSamplerState {
1386   SVGA3dSamplerId samplerId;
1387   SVGA3dFilter filter;
1388   uint8 addressU;
1389   uint8 addressV;
1390   uint8 addressW;
1391   uint8 pad0;
1392   float mipLODBias;
1393   uint8 maxAnisotropy;
1394   SVGA3dComparisonFunc comparisonFunc;
1395   uint16 pad1;
1396   SVGA3dRGBAFloat borderColor;
1397   float minLOD;
1398   float maxLOD;
1399}
1400#include "vmware_pack_end.h"
1401SVGA3dCmdDXDefineSamplerState; /* SVGA_3D_CMD_DX_DEFINE_SAMPLER_STATE */
1402
1403typedef
1404#include "vmware_pack_begin.h"
1405struct SVGA3dCmdDXDestroySamplerState {
1406   SVGA3dSamplerId samplerId;
1407}
1408#include "vmware_pack_end.h"
1409SVGA3dCmdDXDestroySamplerState; /* SVGA_3D_CMD_DX_DESTROY_SAMPLER_STATE */
1410
1411
1412#define SVGADX_SIGNATURE_SEMANTIC_NAME_UNDEFINED                          0
1413#define SVGADX_SIGNATURE_SEMANTIC_NAME_POSITION                           1
1414#define SVGADX_SIGNATURE_SEMANTIC_NAME_CLIP_DISTANCE                      2
1415#define SVGADX_SIGNATURE_SEMANTIC_NAME_CULL_DISTANCE                      3
1416#define SVGADX_SIGNATURE_SEMANTIC_NAME_RENDER_TARGET_ARRAY_INDEX          4
1417#define SVGADX_SIGNATURE_SEMANTIC_NAME_VIEWPORT_ARRAY_INDEX               5
1418#define SVGADX_SIGNATURE_SEMANTIC_NAME_VERTEX_ID                          6
1419#define SVGADX_SIGNATURE_SEMANTIC_NAME_PRIMITIVE_ID                       7
1420#define SVGADX_SIGNATURE_SEMANTIC_NAME_INSTANCE_ID                        8
1421#define SVGADX_SIGNATURE_SEMANTIC_NAME_IS_FRONT_FACE                      9
1422#define SVGADX_SIGNATURE_SEMANTIC_NAME_SAMPLE_INDEX                       10
1423#define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_EQ_0_EDGE_TESSFACTOR  11
1424#define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_EQ_0_EDGE_TESSFACTOR  12
1425#define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_EQ_1_EDGE_TESSFACTOR  13
1426#define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_EQ_1_EDGE_TESSFACTOR  14
1427#define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_INSIDE_TESSFACTOR     15
1428#define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_INSIDE_TESSFACTOR     16
1429#define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_U_EQ_0_EDGE_TESSFACTOR   17
1430#define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_V_EQ_0_EDGE_TESSFACTOR   18
1431#define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_W_EQ_0_EDGE_TESSFACTOR   19
1432#define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_INSIDE_TESSFACTOR        20
1433#define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_LINE_DETAIL_TESSFACTOR       21
1434#define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_LINE_DENSITY_TESSFACTOR      22
1435#define SVGADX_SIGNATURE_SEMANTIC_NAME_MAX                                23
1436typedef uint32 SVGA3dDXSignatureSemanticName;
1437
1438#define SVGADX_SIGNATURE_REGISTER_COMPONENT_UNKNOWN 0
1439typedef uint32 SVGA3dDXSignatureRegisterComponentType;
1440
1441#define SVGADX_SIGNATURE_MIN_PRECISION_DEFAULT 0
1442typedef uint32 SVGA3dDXSignatureMinPrecision;
1443
1444typedef
1445#include "vmware_pack_begin.h"
1446struct SVGA3dDXSignatureEntry {
1447   uint32 registerIndex;
1448   SVGA3dDXSignatureSemanticName semanticName;
1449   uint32 mask; /* Lower 4 bits represent X, Y, Z, W channels */
1450   SVGA3dDXSignatureRegisterComponentType componentType;
1451   SVGA3dDXSignatureMinPrecision minPrecision;
1452}
1453#include "vmware_pack_end.h"
1454SVGA3dDXShaderSignatureEntry;
1455
1456#define SVGADX_SIGNATURE_HEADER_VERSION_0 0x08a92d12
1457
1458/*
1459 * The SVGA3dDXSignatureHeader structure is added after the shader
1460 * body in the mob that is bound to the shader.  It is followed by the
1461 * specified number of SVGA3dDXSignatureEntry structures for each of
1462 * the three types of signatures in the order (input, output, patch
1463 * constants).
1464 */
1465typedef
1466#include "vmware_pack_begin.h"
1467struct SVGA3dDXSignatureHeader {
1468   uint32 headerVersion;
1469   uint32 numInputSignatures;
1470   uint32 numOutputSignatures;
1471   uint32 numPatchConstantSignatures;
1472}
1473#include "vmware_pack_end.h"
1474SVGA3dDXShaderSignatureHeader;
1475
1476
1477typedef
1478#include "vmware_pack_begin.h"
1479struct SVGA3dCmdDXDefineShader {
1480   SVGA3dShaderId shaderId;
1481   SVGA3dShaderType type;
1482   uint32 sizeInBytes; /* Number of bytes of shader text. */
1483}
1484#include "vmware_pack_end.h"
1485SVGA3dCmdDXDefineShader; /* SVGA_3D_CMD_DX_DEFINE_SHADER */
1486
1487typedef
1488#include "vmware_pack_begin.h"
1489struct SVGACOTableDXShaderEntry {
1490   SVGA3dShaderType type;
1491   uint32 sizeInBytes;
1492   uint32 offsetInBytes;
1493   SVGAMobId mobid;
1494   uint32 pad[4];
1495}
1496#include "vmware_pack_end.h"
1497SVGACOTableDXShaderEntry;
1498
1499typedef
1500#include "vmware_pack_begin.h"
1501struct SVGA3dCmdDXDestroyShader {
1502   SVGA3dShaderId shaderId;
1503}
1504#include "vmware_pack_end.h"
1505SVGA3dCmdDXDestroyShader; /* SVGA_3D_CMD_DX_DESTROY_SHADER */
1506
1507typedef
1508#include "vmware_pack_begin.h"
1509struct SVGA3dCmdDXBindShader {
1510   uint32 cid;
1511   uint32 shid;
1512   SVGAMobId mobid;
1513   uint32 offsetInBytes;
1514}
1515#include "vmware_pack_end.h"
1516SVGA3dCmdDXBindShader;   /* SVGA_3D_CMD_DX_BIND_SHADER */
1517
1518typedef
1519#include "vmware_pack_begin.h"
1520struct SVGA3dCmdDXBindAllShader {
1521   uint32 cid;
1522   SVGAMobId mobid;
1523}
1524#include "vmware_pack_end.h"
1525SVGA3dCmdDXBindAllShader;   /* SVGA_3D_CMD_DX_BIND_ALL_SHADER */
1526
1527typedef
1528#include "vmware_pack_begin.h"
1529struct SVGA3dCmdDXCondBindAllShader {
1530   uint32 cid;
1531   SVGAMobId testMobid;
1532   SVGAMobId mobid;
1533}
1534#include "vmware_pack_end.h"
1535SVGA3dCmdDXCondBindAllShader;   /* SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER */
1536
1537/*
1538 * The maximum number of streamout decl's in each streamout entry.
1539 */
1540#define SVGA3D_MAX_DX10_STREAMOUT_DECLS 64
1541#define SVGA3D_MAX_STREAMOUT_DECLS 512
1542
1543typedef
1544#include "vmware_pack_begin.h"
1545struct SVGA3dStreamOutputDeclarationEntry {
1546   uint32 outputSlot;
1547   uint32 registerIndex;
1548   uint8  registerMask;
1549   uint8  pad0;
1550   uint16 pad1;
1551   uint32 stream;
1552}
1553#include "vmware_pack_end.h"
1554SVGA3dStreamOutputDeclarationEntry;
1555
1556typedef
1557#include "vmware_pack_begin.h"
1558struct SVGAOTableStreamOutputEntry {
1559   uint32 numOutputStreamEntries;
1560   SVGA3dStreamOutputDeclarationEntry decl[SVGA3D_MAX_DX10_STREAMOUT_DECLS];
1561   uint32 streamOutputStrideInBytes[SVGA3D_DX_MAX_SOTARGETS];
1562   uint32 rasterizedStream;
1563   uint32 numOutputStreamStrides;
1564   uint32 mobid;
1565   uint32 offsetInBytes;
1566   uint8 usesMob;
1567   uint8 pad0;
1568   uint16 pad1;
1569   uint32 pad2[246];
1570}
1571#include "vmware_pack_end.h"
1572SVGACOTableDXStreamOutputEntry;
1573
1574typedef
1575#include "vmware_pack_begin.h"
1576struct SVGA3dCmdDXDefineStreamOutput {
1577   SVGA3dStreamOutputId soid;
1578   uint32 numOutputStreamEntries;
1579   SVGA3dStreamOutputDeclarationEntry decl[SVGA3D_MAX_DX10_STREAMOUT_DECLS];
1580   uint32 streamOutputStrideInBytes[SVGA3D_DX_MAX_SOTARGETS];
1581   uint32 rasterizedStream;
1582}
1583#include "vmware_pack_end.h"
1584SVGA3dCmdDXDefineStreamOutput; /* SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT */
1585
1586/*
1587 * Version 2 needed in order to start validating and using the
1588 * rasterizedStream field.  Unfortunately the device wasn't validating
1589 * or using this field and the driver wasn't initializing it in shipped
1590 * code, so a new version of the command is needed to allow that code
1591 * to continue to work.  Also added new numOutputStreamStrides field.
1592 */
1593
1594#define SVGA3D_DX_SO_NO_RASTERIZED_STREAM 0xFFFFFFFF
1595
1596typedef
1597#include "vmware_pack_begin.h"
1598struct SVGA3dCmdDXDefineStreamOutputWithMob {
1599   SVGA3dStreamOutputId soid;
1600   uint32 numOutputStreamEntries;
1601   uint32 numOutputStreamStrides;
1602   uint32 streamOutputStrideInBytes[SVGA3D_DX_MAX_SOTARGETS];
1603   uint32 rasterizedStream;
1604}
1605#include "vmware_pack_end.h"
1606SVGA3dCmdDXDefineStreamOutputWithMob;
1607/* SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT_WITH_MOB */
1608
1609typedef
1610#include "vmware_pack_begin.h"
1611struct SVGA3dCmdDXBindStreamOutput {
1612   SVGA3dStreamOutputId soid;
1613   uint32 mobid;
1614   uint32 offsetInBytes;
1615   uint32 sizeInBytes;
1616}
1617#include "vmware_pack_end.h"
1618SVGA3dCmdDXBindStreamOutput; /* SVGA_3D_CMD_DX_BIND_STREAMOUTPUT */
1619
1620typedef
1621#include "vmware_pack_begin.h"
1622struct SVGA3dCmdDXDestroyStreamOutput {
1623   SVGA3dStreamOutputId soid;
1624}
1625#include "vmware_pack_end.h"
1626SVGA3dCmdDXDestroyStreamOutput; /* SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT */
1627
1628typedef
1629#include "vmware_pack_begin.h"
1630struct SVGA3dCmdDXSetStreamOutput {
1631   SVGA3dStreamOutputId soid;
1632}
1633#include "vmware_pack_end.h"
1634SVGA3dCmdDXSetStreamOutput; /* SVGA_3D_CMD_DX_SET_STREAMOUTPUT */
1635
1636typedef
1637#include "vmware_pack_begin.h"
1638struct SVGA3dCmdDXSetMinLOD {
1639   SVGA3dSurfaceId sid;
1640   float minLOD;
1641}
1642#include "vmware_pack_end.h"
1643SVGA3dCmdDXSetMinLOD; /* SVGA_3D_CMD_DX_SET_MIN_LOD */
1644
1645typedef
1646#include "vmware_pack_begin.h"
1647struct {
1648   uint64 value;
1649   uint32 mobId;
1650   uint32 mobOffset;
1651}
1652#include "vmware_pack_end.h"
1653SVGA3dCmdDXMobFence64;  /* SVGA_3D_CMD_DX_MOB_FENCE_64 */
1654
1655/*
1656 * SVGA3dCmdSetCOTable --
1657 *
1658 * This command allows the guest to bind a mob to a context-object table.
1659 */
1660typedef
1661#include "vmware_pack_begin.h"
1662struct SVGA3dCmdDXSetCOTable {
1663   uint32 cid;
1664   uint32 mobid;
1665   SVGACOTableType type;
1666   uint32 validSizeInBytes;
1667}
1668#include "vmware_pack_end.h"
1669SVGA3dCmdDXSetCOTable; /* SVGA_3D_CMD_DX_SET_COTABLE */
1670
1671/*
1672 * Guests using SVGA_3D_CMD_DX_GROW_COTABLE are promising that
1673 * the new COTable contains the same contents as the old one, except possibly
1674 * for some new invalid entries at the end.
1675 *
1676 * If there is an old cotable mob bound, it also has to still be valid.
1677 *
1678 * (Otherwise, guests should use the DXSetCOTableBase command.)
1679 */
1680typedef
1681#include "vmware_pack_begin.h"
1682struct SVGA3dCmdDXGrowCOTable {
1683   uint32 cid;
1684   uint32 mobid;
1685   SVGACOTableType type;
1686   uint32 validSizeInBytes;
1687}
1688#include "vmware_pack_end.h"
1689SVGA3dCmdDXGrowCOTable; /* SVGA_3D_CMD_DX_GROW_COTABLE */
1690
1691typedef
1692#include "vmware_pack_begin.h"
1693struct SVGA3dCmdDXReadbackCOTable {
1694   uint32 cid;
1695   SVGACOTableType type;
1696}
1697#include "vmware_pack_end.h"
1698SVGA3dCmdDXReadbackCOTable; /* SVGA_3D_CMD_DX_READBACK_COTABLE */
1699
1700typedef
1701#include "vmware_pack_begin.h"
1702struct SVGA3dCOTableData {
1703   uint32 mobid;
1704}
1705#include "vmware_pack_end.h"
1706SVGA3dCOTableData;
1707
1708typedef
1709#include "vmware_pack_begin.h"
1710struct SVGA3dBufferBinding {
1711   uint32 bufferId;
1712   uint32 stride;
1713   uint32 offset;
1714}
1715#include "vmware_pack_end.h"
1716SVGA3dBufferBinding;
1717
1718typedef
1719#include "vmware_pack_begin.h"
1720struct SVGA3dConstantBufferBinding {
1721   uint32 sid;
1722   uint32 offsetInBytes;
1723   uint32 sizeInBytes;
1724}
1725#include "vmware_pack_end.h"
1726SVGA3dConstantBufferBinding;
1727
1728typedef
1729#include "vmware_pack_begin.h"
1730struct SVGADXInputAssemblyMobFormat {
1731   uint32 layoutId;
1732   SVGA3dBufferBinding vertexBuffers[SVGA3D_DX_MAX_VERTEXBUFFERS];
1733   uint32 indexBufferSid;
1734   uint32 pad;
1735   uint32 indexBufferOffset;
1736   uint32 indexBufferFormat;
1737   uint32 topology;
1738}
1739#include "vmware_pack_end.h"
1740SVGADXInputAssemblyMobFormat;
1741
1742typedef
1743#include "vmware_pack_begin.h"
1744struct SVGADXContextMobFormat {
1745   SVGADXInputAssemblyMobFormat inputAssembly;
1746
1747   struct {
1748      uint32 blendStateId;
1749      uint32 blendFactor[4];
1750      uint32 sampleMask;
1751      uint32 depthStencilStateId;
1752      uint32 stencilRef;
1753      uint32 rasterizerStateId;
1754      uint32 depthStencilViewId;
1755      uint32 renderTargetViewIds[SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS];
1756      uint32 unorderedAccessViewIds[SVGA3D_MAX_UAVIEWS];
1757   } renderState;
1758
1759   struct {
1760      uint32 targets[SVGA3D_DX_MAX_SOTARGETS];
1761      uint32 soid;
1762   } streamOut;
1763   uint32 pad0[11];
1764
1765   uint8 numViewports;
1766   uint8 numScissorRects;
1767   uint16 pad1[1];
1768
1769   uint32 pad2[3];
1770
1771   SVGA3dViewport viewports[SVGA3D_DX_MAX_VIEWPORTS];
1772   uint32 pad3[32];
1773
1774   SVGASignedRect scissorRects[SVGA3D_DX_MAX_SCISSORRECTS];
1775   uint32 pad4[64];
1776
1777   struct {
1778      uint32 queryID;
1779      uint32 value;
1780   } predication;
1781   uint32 pad5[2];
1782
1783   struct {
1784      uint32 shaderId;
1785      SVGA3dConstantBufferBinding constantBuffers[SVGA3D_DX_MAX_CONSTBUFFERS];
1786      uint32 shaderResources[SVGA3D_DX_MAX_SRVIEWS];
1787      uint32 samplers[SVGA3D_DX_MAX_SAMPLERS];
1788   } shaderState[SVGA3D_NUM_SHADERTYPE];
1789   uint32 pad6[26];
1790
1791   SVGA3dQueryId queryID[SVGA3D_MAX_QUERY];
1792
1793   SVGA3dCOTableData cotables[SVGA_COTABLE_MAX];
1794   uint32 pad7[380];
1795}
1796#include "vmware_pack_end.h"
1797SVGADXContextMobFormat;
1798
1799#endif // _SVGA3D_DX_H_
1800