• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
2 /*
3  * Copyright (c) 2012-2023 Broadcom. All Rights Reserved. The term
4  * "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
5  *
6  * Permission is hereby granted, free of charge, to any person
7  * obtaining a copy of this software and associated documentation
8  * files (the "Software"), to deal in the Software without
9  * restriction, including without limitation the rights to use, copy,
10  * modify, merge, publish, distribute, sublicense, and/or sell copies
11  * of the Software, and to permit persons to whom the Software is
12  * furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be
15  * included in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24  * SOFTWARE.
25  *
26  */
27 
28 /*
29  * svga3d_dx.h --
30  *
31  *    SVGA 3d hardware definitions for DX10 support.
32  */
33 
34 #ifndef _SVGA3D_DX_H_
35 #define _SVGA3D_DX_H_
36 
37 #include "svga3d_limits.h"
38 #include "svga3d_types.h"
39 #include "svga_reg.h"
40 
41 #define SVGA3D_INPUT_MIN               0
42 #define SVGA3D_INPUT_PER_VERTEX_DATA   0
43 #define SVGA3D_INPUT_PER_INSTANCE_DATA 1
44 #define SVGA3D_INPUT_MAX               2
45 typedef uint32 SVGA3dInputClassification;
46 
47 #define SVGA3D_COLOR_WRITE_ENABLE_RED   (1 << 0)
48 #define SVGA3D_COLOR_WRITE_ENABLE_GREEN (1 << 1)
49 #define SVGA3D_COLOR_WRITE_ENABLE_BLUE  (1 << 2)
50 #define SVGA3D_COLOR_WRITE_ENABLE_ALPHA (1 << 3)
51 #define SVGA3D_COLOR_WRITE_ENABLE_ALL                                          \
52    (SVGA3D_COLOR_WRITE_ENABLE_RED | SVGA3D_COLOR_WRITE_ENABLE_GREEN |          \
53     SVGA3D_COLOR_WRITE_ENABLE_BLUE | SVGA3D_COLOR_WRITE_ENABLE_ALPHA)
54 typedef uint8 SVGA3dColorWriteEnable;
55 
56 #define SVGA3D_DEPTH_WRITE_MASK_ZERO 0
57 #define SVGA3D_DEPTH_WRITE_MASK_ALL  1
58 typedef uint8 SVGA3dDepthWriteMask;
59 
60 #define SVGA3D_FILTER_MIP_LINEAR  (1 << 0)
61 #define SVGA3D_FILTER_MAG_LINEAR  (1 << 2)
62 #define SVGA3D_FILTER_MIN_LINEAR  (1 << 4)
63 #define SVGA3D_FILTER_ANISOTROPIC (1 << 6)
64 #define SVGA3D_FILTER_COMPARE     (1 << 7)
65 typedef uint32 SVGA3dFilter;
66 
67 #define SVGA3D_CULL_INVALID 0
68 #define SVGA3D_CULL_MIN     1
69 #define SVGA3D_CULL_NONE    1
70 #define SVGA3D_CULL_FRONT   2
71 #define SVGA3D_CULL_BACK    3
72 #define SVGA3D_CULL_MAX     4
73 typedef uint8 SVGA3dCullMode;
74 
75 #define SVGA3D_COMPARISON_INVALID       0
76 #define SVGA3D_COMPARISON_MIN           1
77 #define SVGA3D_COMPARISON_NEVER         1
78 #define SVGA3D_COMPARISON_LESS          2
79 #define SVGA3D_COMPARISON_EQUAL         3
80 #define SVGA3D_COMPARISON_LESS_EQUAL    4
81 #define SVGA3D_COMPARISON_GREATER       5
82 #define SVGA3D_COMPARISON_NOT_EQUAL     6
83 #define SVGA3D_COMPARISON_GREATER_EQUAL 7
84 #define SVGA3D_COMPARISON_ALWAYS        8
85 #define SVGA3D_COMPARISON_MAX           9
86 typedef uint8 SVGA3dComparisonFunc;
87 
88 #define SVGA3D_MULTISAMPLE_RAST_DISABLE      0
89 #define SVGA3D_MULTISAMPLE_RAST_ENABLE       1
90 #define SVGA3D_MULTISAMPLE_RAST_DX_MAX       1
91 #define SVGA3D_MULTISAMPLE_RAST_DISABLE_LINE 2
92 #define SVGA3D_MULTISAMPLE_RAST_MAX          2
93 typedef uint8 SVGA3dMultisampleRastEnable;
94 
95 #define SVGA3D_DX_MAX_VERTEXBUFFERS             32
96 #define SVGA3D_DX_MAX_VERTEXINPUTREGISTERS      16
97 #define SVGA3D_DX_SM41_MAX_VERTEXINPUTREGISTERS 32
98 #define SVGA3D_DX_MAX_SOTARGETS                 4
99 #define SVGA3D_DX_MAX_SRVIEWS                   128
100 #define SVGA3D_DX_MAX_CONSTBUFFERS              16
101 #define SVGA3D_DX_MAX_SAMPLERS                  16
102 #define SVGA3D_DX_MAX_CLASS_INSTANCES           253
103 
104 #define SVGA3D_DX_MAX_CONSTBUF_BINDING_SIZE (4096 * 4 * (uint32)sizeof(uint32))
105 
106 typedef uint32 SVGA3dShaderResourceViewId;
107 typedef uint32 SVGA3dRenderTargetViewId;
108 typedef uint32 SVGA3dDepthStencilViewId;
109 typedef uint32 SVGA3dUAViewId;
110 
111 typedef uint32 SVGA3dShaderId;
112 typedef uint32 SVGA3dElementLayoutId;
113 typedef uint32 SVGA3dSamplerId;
114 typedef uint32 SVGA3dBlendStateId;
115 typedef uint32 SVGA3dDepthStencilStateId;
116 typedef uint32 SVGA3dRasterizerStateId;
117 typedef uint32 SVGA3dQueryId;
118 typedef uint32 SVGA3dStreamOutputId;
119 
120 typedef union {
121    struct {
122       uint32 r;
123       uint32 g;
124       uint32 b;
125       uint32 a;
126    };
127 
128    uint32 value[4];
129 } SVGA3dRGBAUint32;
130 
131 #pragma pack(push, 1)
132 typedef struct {
133    uint32 cid;
134    SVGAMobId mobid;
135 } SVGAOTableDXContextEntry;
136 #pragma pack(pop)
137 
138 #pragma pack(push, 1)
139 typedef struct SVGA3dCmdDXDefineContext {
140    uint32 cid;
141 } SVGA3dCmdDXDefineContext;
142 #pragma pack(pop)
143 
144 #pragma pack(push, 1)
145 typedef struct SVGA3dCmdDXDestroyContext {
146    uint32 cid;
147 } SVGA3dCmdDXDestroyContext;
148 #pragma pack(pop)
149 
150 #pragma pack(push, 1)
151 typedef struct SVGA3dCmdDXBindContext {
152    uint32 cid;
153    SVGAMobId mobid;
154    uint32 validContents;
155 } SVGA3dCmdDXBindContext;
156 #pragma pack(pop)
157 
158 #pragma pack(push, 1)
159 typedef struct SVGA3dCmdDXReadbackContext {
160    uint32 cid;
161 } SVGA3dCmdDXReadbackContext;
162 #pragma pack(pop)
163 
164 #pragma pack(push, 1)
165 typedef struct SVGA3dCmdDXInvalidateContext {
166    uint32 cid;
167 } SVGA3dCmdDXInvalidateContext;
168 #pragma pack(pop)
169 
170 #pragma pack(push, 1)
171 typedef struct SVGA3dCmdDXSetSingleConstantBuffer {
172    uint32 slot;
173    SVGA3dShaderType type;
174    SVGA3dSurfaceId sid;
175    uint32 offsetInBytes;
176    uint32 sizeInBytes;
177 } SVGA3dCmdDXSetSingleConstantBuffer;
178 #pragma pack(pop)
179 
180 #pragma pack(push, 1)
181 typedef struct SVGA3dCmdDXSetShaderResources {
182    uint32 startView;
183    SVGA3dShaderType type;
184 
185 } SVGA3dCmdDXSetShaderResources;
186 #pragma pack(pop)
187 
188 #pragma pack(push, 1)
189 typedef struct SVGA3dCmdDXSetShader {
190    SVGA3dShaderId shaderId;
191    SVGA3dShaderType type;
192 } SVGA3dCmdDXSetShader;
193 #pragma pack(pop)
194 
195 typedef union {
196    struct {
197       uint32 cbOffset : 12;
198       uint32 cbId     : 4;
199       uint32 baseSamp : 4;
200       uint32 baseTex  : 7;
201       uint32 reserved : 5;
202    };
203    uint32 value;
204 } SVGA3dIfaceData;
205 
206 #pragma pack(push, 1)
207 typedef struct SVGA3dCmdDXSetShaderIface {
208    SVGA3dShaderType type;
209    uint32 numClassInstances;
210    uint32 index;
211    uint32 iface;
212    SVGA3dIfaceData data;
213 } SVGA3dCmdDXSetShaderIface;
214 #pragma pack(pop)
215 
216 #pragma pack(push, 1)
217 typedef struct SVGA3dCmdDXBindShaderIface {
218    uint32 cid;
219    SVGAMobId mobid;
220    uint32 offsetInBytes;
221 } SVGA3dCmdDXBindShaderIface;
222 #pragma pack(pop)
223 
224 #pragma pack(push, 1)
225 typedef struct SVGA3dCmdDXSetSamplers {
226    uint32 startSampler;
227    SVGA3dShaderType type;
228 
229 } SVGA3dCmdDXSetSamplers;
230 #pragma pack(pop)
231 
232 #pragma pack(push, 1)
233 typedef struct SVGA3dCmdDXDraw {
234    uint32 vertexCount;
235    uint32 startVertexLocation;
236 } SVGA3dCmdDXDraw;
237 #pragma pack(pop)
238 
239 #pragma pack(push, 1)
240 typedef struct SVGA3dCmdDXDrawIndexed {
241    uint32 indexCount;
242    uint32 startIndexLocation;
243    int32 baseVertexLocation;
244 } SVGA3dCmdDXDrawIndexed;
245 #pragma pack(pop)
246 
247 #pragma pack(push, 1)
248 typedef struct SVGA3dCmdDXDrawInstanced {
249    uint32 vertexCountPerInstance;
250    uint32 instanceCount;
251    uint32 startVertexLocation;
252    uint32 startInstanceLocation;
253 } SVGA3dCmdDXDrawInstanced;
254 #pragma pack(pop)
255 
256 #pragma pack(push, 1)
257 typedef struct SVGA3dCmdDXDrawIndexedInstanced {
258    uint32 indexCountPerInstance;
259    uint32 instanceCount;
260    uint32 startIndexLocation;
261    int32 baseVertexLocation;
262    uint32 startInstanceLocation;
263 } SVGA3dCmdDXDrawIndexedInstanced;
264 #pragma pack(pop)
265 
266 #pragma pack(push, 1)
267 typedef struct SVGA3dCmdDXDrawIndexedInstancedIndirect {
268    SVGA3dSurfaceId argsBufferSid;
269    uint32 byteOffsetForArgs;
270 } SVGA3dCmdDXDrawIndexedInstancedIndirect;
271 #pragma pack(pop)
272 
273 #pragma pack(push, 1)
274 typedef struct SVGA3dCmdDXDrawInstancedIndirect {
275    SVGA3dSurfaceId argsBufferSid;
276    uint32 byteOffsetForArgs;
277 } SVGA3dCmdDXDrawInstancedIndirect;
278 #pragma pack(pop)
279 
280 #pragma pack(push, 1)
281 typedef struct SVGA3dCmdDXDrawAuto {
282    uint32 pad0;
283 } SVGA3dCmdDXDrawAuto;
284 #pragma pack(pop)
285 
286 #pragma pack(push, 1)
287 typedef struct SVGA3dCmdDXDispatch {
288    uint32 threadGroupCountX;
289    uint32 threadGroupCountY;
290    uint32 threadGroupCountZ;
291 } SVGA3dCmdDXDispatch;
292 #pragma pack(pop)
293 
294 #pragma pack(push, 1)
295 typedef struct SVGA3dCmdDXDispatchIndirect {
296    SVGA3dSurfaceId argsBufferSid;
297    uint32 byteOffsetForArgs;
298 } SVGA3dCmdDXDispatchIndirect;
299 #pragma pack(pop)
300 
301 #pragma pack(push, 1)
302 typedef struct SVGA3dCmdDXSetInputLayout {
303    SVGA3dElementLayoutId elementLayoutId;
304 } SVGA3dCmdDXSetInputLayout;
305 #pragma pack(pop)
306 
307 #pragma pack(push, 1)
308 typedef struct SVGA3dVertexBuffer {
309    SVGA3dSurfaceId sid;
310    uint32 stride;
311    uint32 offset;
312 } SVGA3dVertexBuffer;
313 #pragma pack(pop)
314 
315 #pragma pack(push, 1)
316 typedef struct SVGA3dCmdDXSetVertexBuffers {
317    uint32 startBuffer;
318 
319 } SVGA3dCmdDXSetVertexBuffers;
320 #pragma pack(pop)
321 
322 #pragma pack(push, 1)
323 typedef struct SVGA3dVertexBuffer_v2 {
324    SVGA3dSurfaceId sid;
325    uint32 stride;
326    uint32 offset;
327    uint32 sizeInBytes;
328 } SVGA3dVertexBuffer_v2;
329 #pragma pack(pop)
330 
331 #pragma pack(push, 1)
332 typedef struct SVGA3dCmdDXSetVertexBuffers_v2 {
333    uint32 startBuffer;
334 
335 } SVGA3dCmdDXSetVertexBuffers_v2;
336 #pragma pack(pop)
337 
338 #pragma pack(push, 1)
339 typedef struct SVGA3dVertexBufferOffsetAndSize {
340    uint32 stride;
341    uint32 offset;
342    uint32 sizeInBytes;
343 } SVGA3dVertexBufferOffsetAndSize;
344 #pragma pack(pop)
345 
346 #pragma pack(push, 1)
347 typedef struct SVGA3dCmdDXSetVertexBuffersOffsetAndSize {
348    uint32 startBuffer;
349 
350 } SVGA3dCmdDXSetVertexBuffersOffsetAndSize;
351 #pragma pack(pop)
352 
353 #pragma pack(push, 1)
354 typedef struct SVGA3dCmdDXSetIndexBuffer {
355    SVGA3dSurfaceId sid;
356    SVGA3dSurfaceFormat format;
357    uint32 offset;
358 } SVGA3dCmdDXSetIndexBuffer;
359 #pragma pack(pop)
360 
361 #pragma pack(push, 1)
362 typedef struct SVGA3dCmdDXSetIndexBuffer_v2 {
363    SVGA3dSurfaceId sid;
364    SVGA3dSurfaceFormat format;
365    uint32 offset;
366    uint32 sizeInBytes;
367 } SVGA3dCmdDXSetIndexBuffer_v2;
368 #pragma pack(pop)
369 
370 #pragma pack(push, 1)
371 typedef struct SVGA3dCmdDXSetIndexBufferOffsetAndSize {
372    SVGA3dSurfaceFormat format;
373    uint32 offset;
374    uint32 sizeInBytes;
375 } SVGA3dCmdDXSetIndexBufferOffsetAndSize;
376 #pragma pack(pop)
377 
378 #pragma pack(push, 1)
379 typedef struct SVGA3dCmdDXSetTopology {
380    SVGA3dPrimitiveType topology;
381 } SVGA3dCmdDXSetTopology;
382 #pragma pack(pop)
383 
384 #pragma pack(push, 1)
385 typedef struct SVGA3dCmdDXSetRenderTargets {
386    SVGA3dDepthStencilViewId depthStencilViewId;
387 
388 } SVGA3dCmdDXSetRenderTargets;
389 #pragma pack(pop)
390 
391 #pragma pack(push, 1)
392 typedef struct SVGA3dCmdDXSetBlendState {
393    SVGA3dBlendStateId blendId;
394    float blendFactor[4];
395    uint32 sampleMask;
396 } SVGA3dCmdDXSetBlendState;
397 #pragma pack(pop)
398 
399 #pragma pack(push, 1)
400 typedef struct SVGA3dCmdDXSetDepthStencilState {
401    SVGA3dDepthStencilStateId depthStencilId;
402    uint32 stencilRef;
403 } SVGA3dCmdDXSetDepthStencilState;
404 #pragma pack(pop)
405 
406 #pragma pack(push, 1)
407 typedef struct SVGA3dCmdDXSetRasterizerState {
408    SVGA3dRasterizerStateId rasterizerId;
409 } SVGA3dCmdDXSetRasterizerState;
410 #pragma pack(pop)
411 
412 #define SVGA3D_DXQUERY_FLAG_PREDICATEHINT (1 << 0)
413 typedef uint32 SVGA3dDXQueryFlags;
414 
415 #define SVGADX_QDSTATE_INVALID  ((uint8) - 1)
416 #define SVGADX_QDSTATE_MIN      0
417 #define SVGADX_QDSTATE_IDLE     0
418 #define SVGADX_QDSTATE_ACTIVE   1
419 #define SVGADX_QDSTATE_PENDING  2
420 #define SVGADX_QDSTATE_FINISHED 3
421 #define SVGADX_QDSTATE_MAX      4
422 typedef uint8 SVGADXQueryDeviceState;
423 
424 #pragma pack(push, 1)
425 typedef struct {
426    SVGA3dQueryTypeUint8 type;
427    uint16 pad0;
428    SVGADXQueryDeviceState state;
429    SVGA3dDXQueryFlags flags;
430    SVGAMobId mobid;
431    uint32 offset;
432 } SVGACOTableDXQueryEntry;
433 #pragma pack(pop)
434 
435 #pragma pack(push, 1)
436 typedef struct SVGA3dCmdDXDefineQuery {
437    SVGA3dQueryId queryId;
438    SVGA3dQueryType type;
439    SVGA3dDXQueryFlags flags;
440 } SVGA3dCmdDXDefineQuery;
441 #pragma pack(pop)
442 
443 #pragma pack(push, 1)
444 typedef struct SVGA3dCmdDXDestroyQuery {
445    SVGA3dQueryId queryId;
446 } SVGA3dCmdDXDestroyQuery;
447 #pragma pack(pop)
448 
449 #pragma pack(push, 1)
450 typedef struct SVGA3dCmdDXBindQuery {
451    SVGA3dQueryId queryId;
452    SVGAMobId mobid;
453 } SVGA3dCmdDXBindQuery;
454 #pragma pack(pop)
455 
456 #pragma pack(push, 1)
457 typedef struct SVGA3dCmdDXSetQueryOffset {
458    SVGA3dQueryId queryId;
459    uint32 mobOffset;
460 } SVGA3dCmdDXSetQueryOffset;
461 #pragma pack(pop)
462 
463 #pragma pack(push, 1)
464 typedef struct SVGA3dCmdDXBeginQuery {
465    SVGA3dQueryId queryId;
466 } SVGA3dCmdDXBeginQuery;
467 #pragma pack(pop)
468 
469 #pragma pack(push, 1)
470 typedef struct SVGA3dCmdDXEndQuery {
471    SVGA3dQueryId queryId;
472 } SVGA3dCmdDXEndQuery;
473 #pragma pack(pop)
474 
475 #pragma pack(push, 1)
476 typedef struct SVGA3dCmdDXReadbackQuery {
477    SVGA3dQueryId queryId;
478 } SVGA3dCmdDXReadbackQuery;
479 #pragma pack(pop)
480 
481 #pragma pack(push, 1)
482 typedef struct SVGA3dCmdDXMoveQuery {
483    SVGA3dQueryId queryId;
484    SVGAMobId mobid;
485    uint32 mobOffset;
486 } SVGA3dCmdDXMoveQuery;
487 #pragma pack(pop)
488 
489 #pragma pack(push, 1)
490 typedef struct SVGA3dCmdDXBindAllQuery {
491    uint32 cid;
492    SVGAMobId mobid;
493 } SVGA3dCmdDXBindAllQuery;
494 #pragma pack(pop)
495 
496 #pragma pack(push, 1)
497 typedef struct SVGA3dCmdDXReadbackAllQuery {
498    uint32 cid;
499 } SVGA3dCmdDXReadbackAllQuery;
500 #pragma pack(pop)
501 
502 #pragma pack(push, 1)
503 typedef struct SVGA3dCmdDXSetPredication {
504    SVGA3dQueryId queryId;
505    uint32 predicateValue;
506 } SVGA3dCmdDXSetPredication;
507 #pragma pack(pop)
508 
509 #pragma pack(push, 1)
510 typedef struct SVGA3dDXSOState {
511    uint32 offset;
512    uint32 intOffset;
513    uint32 dead1;
514    uint32 dead2;
515 } SVGA3dDXSOState;
516 #pragma pack(pop)
517 
518 #define SVGA3D_DX_SO_OFFSET_APPEND ((uint32)~0u)
519 
520 #pragma pack(push, 1)
521 typedef struct SVGA3dSoTarget {
522    SVGA3dSurfaceId sid;
523    uint32 offset;
524    uint32 sizeInBytes;
525 } SVGA3dSoTarget;
526 #pragma pack(pop)
527 
528 #pragma pack(push, 1)
529 typedef struct SVGA3dCmdDXSetSOTargets {
530    uint32 pad0;
531 
532 } SVGA3dCmdDXSetSOTargets;
533 #pragma pack(pop)
534 
535 #pragma pack(push, 1)
536 typedef struct SVGA3dViewport {
537    float x;
538    float y;
539    float width;
540    float height;
541    float minDepth;
542    float maxDepth;
543 } SVGA3dViewport;
544 #pragma pack(pop)
545 
546 #pragma pack(push, 1)
547 typedef struct SVGA3dCmdDXSetViewports {
548    uint32 pad0;
549 
550 } SVGA3dCmdDXSetViewports;
551 #pragma pack(pop)
552 
553 #define SVGA3D_DX_MAX_VIEWPORTS 16
554 
555 #pragma pack(push, 1)
556 typedef struct SVGA3dCmdDXSetScissorRects {
557    uint32 pad0;
558 
559 } SVGA3dCmdDXSetScissorRects;
560 #pragma pack(pop)
561 
562 #define SVGA3D_DX_MAX_SCISSORRECTS 16
563 
564 #pragma pack(push, 1)
565 typedef struct SVGA3dCmdDXClearRenderTargetView {
566    SVGA3dRenderTargetViewId renderTargetViewId;
567    SVGA3dRGBAFloat rgba;
568 } SVGA3dCmdDXClearRenderTargetView;
569 #pragma pack(pop)
570 
571 #pragma pack(push, 1)
572 typedef struct SVGA3dCmdDXClearDepthStencilView {
573    uint16 flags;
574    uint16 stencil;
575    SVGA3dDepthStencilViewId depthStencilViewId;
576    float depth;
577 } SVGA3dCmdDXClearDepthStencilView;
578 #pragma pack(pop)
579 
580 #pragma pack(push, 1)
581 typedef struct SVGA3dCmdDXPredCopyRegion {
582    SVGA3dSurfaceId dstSid;
583    uint32 dstSubResource;
584    SVGA3dSurfaceId srcSid;
585    uint32 srcSubResource;
586    SVGA3dCopyBox box;
587 } SVGA3dCmdDXPredCopyRegion;
588 #pragma pack(pop)
589 
590 #pragma pack(push, 1)
591 typedef struct SVGA3dCmdDXPredStagingCopyRegion {
592    SVGA3dSurfaceId dstSid;
593    uint32 dstSubResource;
594    SVGA3dSurfaceId srcSid;
595    uint32 srcSubResource;
596    SVGA3dCopyBox box;
597    uint8 readback;
598    uint8 unsynchronized;
599    uint8 mustBeZero[2];
600 } SVGA3dCmdDXPredStagingCopyRegion;
601 #pragma pack(pop)
602 
603 #pragma pack(push, 1)
604 typedef struct SVGA3dCmdDXPredCopy {
605    SVGA3dSurfaceId dstSid;
606    SVGA3dSurfaceId srcSid;
607 } SVGA3dCmdDXPredCopy;
608 #pragma pack(pop)
609 
610 #pragma pack(push, 1)
611 typedef struct SVGA3dCmdDXPredConvertRegion {
612    SVGA3dSurfaceId dstSid;
613    uint32 dstSubResource;
614    SVGA3dBox destBox;
615    SVGA3dSurfaceId srcSid;
616    uint32 srcSubResource;
617    SVGA3dBox srcBox;
618 } SVGA3dCmdDXPredConvertRegion;
619 #pragma pack(pop)
620 
621 #pragma pack(push, 1)
622 typedef struct SVGA3dCmdDXPredStagingConvertRegion {
623    SVGA3dSurfaceId dstSid;
624    uint32 dstSubResource;
625    SVGA3dBox destBox;
626    SVGA3dSurfaceId srcSid;
627    uint32 srcSubResource;
628    SVGA3dBox srcBox;
629    uint8 readback;
630    uint8 unsynchronized;
631    uint8 mustBeZero[2];
632 } SVGA3dCmdDXPredStagingConvertRegion;
633 #pragma pack(pop)
634 
635 #pragma pack(push, 1)
636 typedef struct SVGA3dCmdDXPredConvert {
637    SVGA3dSurfaceId dstSid;
638    SVGA3dSurfaceId srcSid;
639 } SVGA3dCmdDXPredConvert;
640 #pragma pack(pop)
641 
642 #pragma pack(push, 1)
643 typedef struct SVGA3dCmdDXPredStagingConvert {
644    SVGA3dSurfaceId dstSid;
645    SVGA3dSurfaceId srcSid;
646    uint8 readback;
647    uint8 unsynchronized;
648    uint8 mustBeZero[2];
649 } SVGA3dCmdDXPredStagingConvert;
650 #pragma pack(pop)
651 
652 #pragma pack(push, 1)
653 typedef struct SVGA3dCmdDXBufferCopy {
654    SVGA3dSurfaceId dest;
655    SVGA3dSurfaceId src;
656    uint32 destX;
657    uint32 srcX;
658    uint32 width;
659 } SVGA3dCmdDXBufferCopy;
660 #pragma pack(pop)
661 
662 #pragma pack(push, 1)
663 typedef struct SVGA3dCmdDXStagingBufferCopy {
664    SVGA3dSurfaceId dest;
665    SVGA3dSurfaceId src;
666    uint32 destX;
667    uint32 srcX;
668    uint32 width;
669    uint8 readback;
670    uint8 unsynchronized;
671    uint8 mustBeZero[2];
672 } SVGA3dCmdDXStagingBufferCopy;
673 #pragma pack(pop)
674 
675 #pragma pack(push, 1)
676 typedef struct {
677    SVGA3dSurfaceId dstSid;
678    uint32 dstSubResource;
679    SVGA3dSurfaceId srcSid;
680    uint32 srcSubResource;
681    SVGA3dSurfaceFormat copyFormat;
682 } SVGA3dCmdDXResolveCopy;
683 #pragma pack(pop)
684 
685 #pragma pack(push, 1)
686 typedef struct {
687    SVGA3dSurfaceId dstSid;
688    uint32 dstSubResource;
689    SVGA3dSurfaceId srcSid;
690    uint32 srcSubResource;
691    SVGA3dSurfaceFormat copyFormat;
692 } SVGA3dCmdDXPredResolveCopy;
693 #pragma pack(pop)
694 
695 typedef uint32 SVGA3dDXPresentBltMode;
696 #define SVGADX_PRESENTBLT_LINEAR           (1 << 0)
697 #define SVGADX_PRESENTBLT_FORCE_SRC_SRGB   (1 << 1)
698 #define SVGADX_PRESENTBLT_FORCE_SRC_XRBIAS (1 << 2)
699 #define SVGADX_PRESENTBLT_MODE_MAX         (1 << 3)
700 
701 #pragma pack(push, 1)
702 typedef struct SVGA3dCmdDXPresentBlt {
703    SVGA3dSurfaceId srcSid;
704    uint32 srcSubResource;
705    SVGA3dSurfaceId dstSid;
706    uint32 destSubResource;
707    SVGA3dBox boxSrc;
708    SVGA3dBox boxDest;
709    SVGA3dDXPresentBltMode mode;
710 } SVGA3dCmdDXPresentBlt;
711 #pragma pack(pop)
712 
713 #pragma pack(push, 1)
714 typedef struct SVGA3dCmdDXGenMips {
715    SVGA3dShaderResourceViewId shaderResourceViewId;
716 } SVGA3dCmdDXGenMips;
717 #pragma pack(pop)
718 
719 #pragma pack(push, 1)
720 typedef struct SVGA3dCmdDXUpdateSubResource {
721    SVGA3dSurfaceId sid;
722    uint32 subResource;
723    SVGA3dBox box;
724 } SVGA3dCmdDXUpdateSubResource;
725 #pragma pack(pop)
726 
727 #pragma pack(push, 1)
728 typedef struct SVGA3dCmdDXReadbackSubResource {
729    SVGA3dSurfaceId sid;
730    uint32 subResource;
731 } SVGA3dCmdDXReadbackSubResource;
732 #pragma pack(pop)
733 
734 #pragma pack(push, 1)
735 typedef struct SVGA3dCmdDXInvalidateSubResource {
736    SVGA3dSurfaceId sid;
737    uint32 subResource;
738 } SVGA3dCmdDXInvalidateSubResource;
739 #pragma pack(pop)
740 
741 #pragma pack(push, 1)
742 typedef struct SVGA3dCmdDXTransferFromBuffer {
743    SVGA3dSurfaceId srcSid;
744    uint32 srcOffset;
745    uint32 srcPitch;
746    uint32 srcSlicePitch;
747    SVGA3dSurfaceId destSid;
748    uint32 destSubResource;
749    SVGA3dBox destBox;
750 } SVGA3dCmdDXTransferFromBuffer;
751 #pragma pack(pop)
752 
753 #define SVGA3D_TRANSFER_TO_BUFFER_READBACK   (1 << 0)
754 #define SVGA3D_TRANSFER_TO_BUFFER_FLAGS_MASK (1 << 0)
755 typedef uint32 SVGA3dTransferToBufferFlags;
756 
757 #pragma pack(push, 1)
758 typedef struct SVGA3dCmdDXTransferToBuffer {
759    SVGA3dSurfaceId srcSid;
760    uint32 srcSubResource;
761    SVGA3dBox srcBox;
762    SVGA3dSurfaceId destSid;
763    uint32 destOffset;
764    uint32 destPitch;
765    uint32 destSlicePitch;
766    SVGA3dTransferToBufferFlags flags;
767 } SVGA3dCmdDXTransferToBuffer;
768 #pragma pack(pop)
769 
770 #pragma pack(push, 1)
771 typedef struct SVGA3dCmdDXPredTransferFromBuffer {
772    SVGA3dSurfaceId srcSid;
773    uint32 srcOffset;
774    uint32 srcPitch;
775    uint32 srcSlicePitch;
776    SVGA3dSurfaceId destSid;
777    uint32 destSubResource;
778    SVGA3dBox destBox;
779 } SVGA3dCmdDXPredTransferFromBuffer;
780 #pragma pack(pop)
781 
782 #pragma pack(push, 1)
783 typedef struct SVGA3dCmdDXSurfaceCopyAndReadback {
784    SVGA3dSurfaceId srcSid;
785    SVGA3dSurfaceId destSid;
786    SVGA3dCopyBox box;
787 } SVGA3dCmdDXSurfaceCopyAndReadback;
788 #pragma pack(pop)
789 
790 typedef uint32 SVGADXHintId;
791 #define SVGA_DX_HINT_NONE             0
792 #define SVGA_DX_HINT_PREFETCH_OBJECT  1
793 #define SVGA_DX_HINT_PREEVICT_OBJECT  2
794 #define SVGA_DX_HINT_PREFETCH_COBJECT 3
795 #define SVGA_DX_HINT_PREEVICT_COBJECT 4
796 #define SVGA_DX_HINT_MAX              5
797 
798 #pragma pack(push, 1)
799 typedef struct SVGAObjectRef {
800    SVGAOTableType type;
801    uint32 id;
802 } SVGAObjectRef;
803 #pragma pack(pop)
804 
805 #pragma pack(push, 1)
806 typedef struct SVGACObjectRef {
807    SVGACOTableType type;
808    uint32 cid;
809    uint32 id;
810 } SVGACObjectRef;
811 #pragma pack(pop)
812 
813 #pragma pack(push, 1)
814 typedef struct SVGA3dCmdDXHint {
815    SVGADXHintId hintId;
816 
817 } SVGA3dCmdDXHint;
818 #pragma pack(pop)
819 
820 #pragma pack(push, 1)
821 typedef struct SVGA3dCmdDXBufferUpdate {
822    SVGA3dSurfaceId sid;
823    uint32 x;
824    uint32 width;
825 } SVGA3dCmdDXBufferUpdate;
826 #pragma pack(pop)
827 
828 #pragma pack(push, 1)
829 typedef struct SVGA3dCmdDXSetConstantBufferOffset {
830    uint32 slot;
831    uint32 offsetInBytes;
832 } SVGA3dCmdDXSetConstantBufferOffset;
833 #pragma pack(pop)
834 
835 typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetVSConstantBufferOffset;
836 
837 typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetPSConstantBufferOffset;
838 
839 typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetGSConstantBufferOffset;
840 
841 typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetHSConstantBufferOffset;
842 
843 typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetDSConstantBufferOffset;
844 
845 typedef SVGA3dCmdDXSetConstantBufferOffset SVGA3dCmdDXSetCSConstantBufferOffset;
846 
847 #define SVGA3D_BUFFEREX_SRV_RAW        (1 << 0)
848 #define SVGA3D_BUFFEREX_SRV_FLAGS_MAX  (1 << 1)
849 #define SVGA3D_BUFFEREX_SRV_FLAGS_MASK (SVGA3D_BUFFEREX_SRV_FLAGS_MAX - 1)
850 typedef uint32 SVGA3dBufferExFlags;
851 
852 #pragma pack(push, 1)
853 typedef struct {
854    union {
855       struct {
856          uint32 firstElement;
857          uint32 numElements;
858          uint32 pad0;
859          uint32 pad1;
860       } buffer;
861       struct {
862          uint32 mostDetailedMip;
863          uint32 firstArraySlice;
864          uint32 mipLevels;
865          uint32 arraySize;
866       } tex;
867       struct {
868          uint32 firstElement;
869          uint32 numElements;
870          SVGA3dBufferExFlags flags;
871          uint32 pad0;
872       } bufferex;
873    };
874 } SVGA3dShaderResourceViewDesc;
875 #pragma pack(pop)
876 
877 #pragma pack(push, 1)
878 typedef struct {
879    SVGA3dSurfaceId sid;
880    SVGA3dSurfaceFormat format;
881    SVGA3dResourceType resourceDimension;
882    SVGA3dShaderResourceViewDesc desc;
883    uint32 pad;
884 } SVGACOTableDXSRViewEntry;
885 #pragma pack(pop)
886 
887 #pragma pack(push, 1)
888 typedef struct SVGA3dCmdDXDefineShaderResourceView {
889    SVGA3dShaderResourceViewId shaderResourceViewId;
890 
891    SVGA3dSurfaceId sid;
892    SVGA3dSurfaceFormat format;
893    SVGA3dResourceType resourceDimension;
894 
895    SVGA3dShaderResourceViewDesc desc;
896 } SVGA3dCmdDXDefineShaderResourceView;
897 #pragma pack(pop)
898 
899 #pragma pack(push, 1)
900 typedef struct SVGA3dCmdDXDestroyShaderResourceView {
901    SVGA3dShaderResourceViewId shaderResourceViewId;
902 } SVGA3dCmdDXDestroyShaderResourceView;
903 #pragma pack(pop)
904 
905 #pragma pack(push, 1)
906 typedef struct SVGA3dRenderTargetViewDesc {
907    union {
908       struct {
909          uint32 firstElement;
910          uint32 numElements;
911          uint32 padding0;
912       } buffer;
913       struct {
914          uint32 mipSlice;
915          uint32 firstArraySlice;
916          uint32 arraySize;
917       } tex;
918       struct {
919          uint32 mipSlice;
920          uint32 firstW;
921          uint32 wSize;
922       } tex3D;
923    };
924 } SVGA3dRenderTargetViewDesc;
925 #pragma pack(pop)
926 
927 #pragma pack(push, 1)
928 typedef struct {
929    SVGA3dSurfaceId sid;
930    SVGA3dSurfaceFormat format;
931    SVGA3dResourceType resourceDimension;
932    SVGA3dRenderTargetViewDesc desc;
933    uint32 pad[2];
934 } SVGACOTableDXRTViewEntry;
935 #pragma pack(pop)
936 
937 #pragma pack(push, 1)
938 typedef struct SVGA3dCmdDXDefineRenderTargetView {
939    SVGA3dRenderTargetViewId renderTargetViewId;
940 
941    SVGA3dSurfaceId sid;
942    SVGA3dSurfaceFormat format;
943    SVGA3dResourceType resourceDimension;
944 
945    SVGA3dRenderTargetViewDesc desc;
946 } SVGA3dCmdDXDefineRenderTargetView;
947 #pragma pack(pop)
948 
949 #pragma pack(push, 1)
950 typedef struct SVGA3dCmdDXDestroyRenderTargetView {
951    SVGA3dRenderTargetViewId renderTargetViewId;
952 } SVGA3dCmdDXDestroyRenderTargetView;
953 #pragma pack(pop)
954 
955 #define SVGA3D_DXDSVIEW_CREATE_READ_ONLY_DEPTH   0x01
956 #define SVGA3D_DXDSVIEW_CREATE_READ_ONLY_STENCIL 0x02
957 #define SVGA3D_DXDSVIEW_CREATE_FLAG_MASK         0x03
958 typedef uint8 SVGA3DCreateDSViewFlags;
959 
960 #pragma pack(push, 1)
961 typedef struct {
962    SVGA3dSurfaceId sid;
963    SVGA3dSurfaceFormat format;
964    SVGA3dResourceType resourceDimension;
965    uint32 mipSlice;
966    uint32 firstArraySlice;
967    uint32 arraySize;
968    SVGA3DCreateDSViewFlags flags;
969    uint8 pad0;
970    uint16 pad1;
971    uint32 pad2;
972 } SVGACOTableDXDSViewEntry;
973 #pragma pack(pop)
974 
975 #pragma pack(push, 1)
976 typedef struct SVGA3dCmdDXDefineDepthStencilView {
977    SVGA3dDepthStencilViewId depthStencilViewId;
978 
979    SVGA3dSurfaceId sid;
980    SVGA3dSurfaceFormat format;
981    SVGA3dResourceType resourceDimension;
982    uint32 mipSlice;
983    uint32 firstArraySlice;
984    uint32 arraySize;
985    SVGA3DCreateDSViewFlags flags;
986    uint8 pad0;
987    uint16 pad1;
988 } SVGA3dCmdDXDefineDepthStencilView;
989 #pragma pack(pop)
990 
991 #pragma pack(push, 1)
992 typedef struct SVGA3dCmdDXDefineDepthStencilView_v2 {
993    SVGA3dDepthStencilViewId depthStencilViewId;
994 
995    SVGA3dSurfaceId sid;
996    SVGA3dSurfaceFormat format;
997    SVGA3dResourceType resourceDimension;
998    uint32 mipSlice;
999    uint32 firstArraySlice;
1000    uint32 arraySize;
1001    SVGA3DCreateDSViewFlags flags;
1002    uint8 pad0;
1003    uint16 pad1;
1004 } SVGA3dCmdDXDefineDepthStencilView_v2;
1005 #pragma pack(pop)
1006 
1007 #pragma pack(push, 1)
1008 typedef struct SVGA3dCmdDXDestroyDepthStencilView {
1009    SVGA3dDepthStencilViewId depthStencilViewId;
1010 } SVGA3dCmdDXDestroyDepthStencilView;
1011 #pragma pack(pop)
1012 
1013 #define SVGA3D_UABUFFER_RAW     (1 << 0)
1014 #define SVGA3D_UABUFFER_APPEND  (1 << 1)
1015 #define SVGA3D_UABUFFER_COUNTER (1 << 2)
1016 typedef uint32 SVGA3dUABufferFlags;
1017 
1018 #pragma pack(push, 1)
1019 typedef struct {
1020    union {
1021       struct {
1022          uint32 firstElement;
1023          uint32 numElements;
1024          SVGA3dUABufferFlags flags;
1025          uint32 padding0;
1026          uint32 padding1;
1027       } buffer;
1028       struct {
1029          uint32 mipSlice;
1030          uint32 firstArraySlice;
1031          uint32 arraySize;
1032          uint32 padding0;
1033          uint32 padding1;
1034       } tex;
1035       struct {
1036          uint32 mipSlice;
1037          uint32 firstW;
1038          uint32 wSize;
1039          uint32 padding0;
1040          uint32 padding1;
1041       } tex3D;
1042    };
1043 } SVGA3dUAViewDesc;
1044 #pragma pack(pop)
1045 
1046 #pragma pack(push, 1)
1047 typedef struct {
1048    SVGA3dSurfaceId sid;
1049    SVGA3dSurfaceFormat format;
1050    SVGA3dResourceType resourceDimension;
1051    SVGA3dUAViewDesc desc;
1052    uint32 structureCount;
1053    uint32 pad[7];
1054 } SVGACOTableDXUAViewEntry;
1055 #pragma pack(pop)
1056 
1057 #pragma pack(push, 1)
1058 typedef struct SVGA3dCmdDXDefineUAView {
1059    SVGA3dUAViewId uaViewId;
1060 
1061    SVGA3dSurfaceId sid;
1062    SVGA3dSurfaceFormat format;
1063    SVGA3dResourceType resourceDimension;
1064 
1065    SVGA3dUAViewDesc desc;
1066 } SVGA3dCmdDXDefineUAView;
1067 #pragma pack(pop)
1068 
1069 #pragma pack(push, 1)
1070 typedef struct SVGA3dCmdDXDestroyUAView {
1071    SVGA3dUAViewId uaViewId;
1072 } SVGA3dCmdDXDestroyUAView;
1073 #pragma pack(pop)
1074 
1075 #pragma pack(push, 1)
1076 typedef struct SVGA3dCmdDXClearUAViewUint {
1077    SVGA3dUAViewId uaViewId;
1078    SVGA3dRGBAUint32 value;
1079 } SVGA3dCmdDXClearUAViewUint;
1080 #pragma pack(pop)
1081 
1082 #pragma pack(push, 1)
1083 typedef struct SVGA3dCmdDXClearUAViewFloat {
1084    SVGA3dUAViewId uaViewId;
1085    SVGA3dRGBAFloat value;
1086 } SVGA3dCmdDXClearUAViewFloat;
1087 #pragma pack(pop)
1088 
1089 #pragma pack(push, 1)
1090 typedef struct SVGA3dCmdDXCopyStructureCount {
1091    SVGA3dUAViewId srcUAViewId;
1092    SVGA3dSurfaceId destSid;
1093    uint32 destByteOffset;
1094 } SVGA3dCmdDXCopyStructureCount;
1095 #pragma pack(pop)
1096 
1097 #pragma pack(push, 1)
1098 typedef struct SVGA3dCmdDXSetStructureCount {
1099    SVGA3dUAViewId uaViewId;
1100    uint32 structureCount;
1101 } SVGA3dCmdDXSetStructureCount;
1102 #pragma pack(pop)
1103 
1104 #pragma pack(push, 1)
1105 typedef struct SVGA3dCmdDXSetUAViews {
1106    uint32 uavSpliceIndex;
1107 
1108 } SVGA3dCmdDXSetUAViews;
1109 #pragma pack(pop)
1110 
1111 #pragma pack(push, 1)
1112 typedef struct SVGA3dCmdDXSetCSUAViews {
1113    uint32 startIndex;
1114 
1115 } SVGA3dCmdDXSetCSUAViews;
1116 #pragma pack(pop)
1117 
1118 #pragma pack(push, 1)
1119 typedef struct SVGA3dInputElementDesc {
1120    uint32 inputSlot;
1121    uint32 alignedByteOffset;
1122    SVGA3dSurfaceFormat format;
1123    SVGA3dInputClassification inputSlotClass;
1124    uint32 instanceDataStepRate;
1125    uint32 inputRegister;
1126 } SVGA3dInputElementDesc;
1127 #pragma pack(pop)
1128 
1129 #pragma pack(push, 1)
1130 typedef struct {
1131    uint32 elid;
1132    uint32 numDescs;
1133    SVGA3dInputElementDesc descs[32];
1134    uint32 pad[62];
1135 } SVGACOTableDXElementLayoutEntry;
1136 #pragma pack(pop)
1137 
1138 #pragma pack(push, 1)
1139 typedef struct SVGA3dCmdDXDefineElementLayout {
1140    SVGA3dElementLayoutId elementLayoutId;
1141 
1142 } SVGA3dCmdDXDefineElementLayout;
1143 #pragma pack(pop)
1144 
1145 #pragma pack(push, 1)
1146 typedef struct SVGA3dCmdDXDestroyElementLayout {
1147    SVGA3dElementLayoutId elementLayoutId;
1148 } SVGA3dCmdDXDestroyElementLayout;
1149 #pragma pack(pop)
1150 
1151 #define SVGA3D_DX_MAX_RENDER_TARGETS 8
1152 
1153 #pragma pack(push, 1)
1154 typedef struct SVGA3dDXBlendStatePerRT {
1155    uint8 blendEnable;
1156    uint8 srcBlend;
1157    uint8 destBlend;
1158    uint8 blendOp;
1159    uint8 srcBlendAlpha;
1160    uint8 destBlendAlpha;
1161    uint8 blendOpAlpha;
1162    SVGA3dColorWriteEnable renderTargetWriteMask;
1163    uint8 logicOpEnable;
1164    uint8 logicOp;
1165    uint16 pad0;
1166 } SVGA3dDXBlendStatePerRT;
1167 #pragma pack(pop)
1168 
1169 #pragma pack(push, 1)
1170 typedef struct {
1171    uint8 alphaToCoverageEnable;
1172    uint8 independentBlendEnable;
1173    uint16 pad0;
1174    SVGA3dDXBlendStatePerRT perRT[SVGA3D_DX_MAX_RENDER_TARGETS];
1175    uint32 pad1[7];
1176 } SVGACOTableDXBlendStateEntry;
1177 #pragma pack(pop)
1178 
1179 #pragma pack(push, 1)
1180 typedef struct SVGA3dCmdDXDefineBlendState {
1181    SVGA3dBlendStateId blendId;
1182    uint8 alphaToCoverageEnable;
1183    uint8 independentBlendEnable;
1184    uint16 pad0;
1185    SVGA3dDXBlendStatePerRT perRT[SVGA3D_DX_MAX_RENDER_TARGETS];
1186 } SVGA3dCmdDXDefineBlendState;
1187 #pragma pack(pop)
1188 
1189 #pragma pack(push, 1)
1190 typedef struct SVGA3dCmdDXDestroyBlendState {
1191    SVGA3dBlendStateId blendId;
1192 } SVGA3dCmdDXDestroyBlendState;
1193 #pragma pack(pop)
1194 
1195 #pragma pack(push, 1)
1196 typedef struct {
1197    uint8 depthEnable;
1198    SVGA3dDepthWriteMask depthWriteMask;
1199    SVGA3dComparisonFunc depthFunc;
1200    uint8 stencilEnable;
1201    uint8 frontEnable;
1202    uint8 backEnable;
1203    uint8 stencilReadMask;
1204    uint8 stencilWriteMask;
1205 
1206    uint8 frontStencilFailOp;
1207    uint8 frontStencilDepthFailOp;
1208    uint8 frontStencilPassOp;
1209    SVGA3dComparisonFunc frontStencilFunc;
1210 
1211    uint8 backStencilFailOp;
1212    uint8 backStencilDepthFailOp;
1213    uint8 backStencilPassOp;
1214    SVGA3dComparisonFunc backStencilFunc;
1215 } SVGACOTableDXDepthStencilEntry;
1216 #pragma pack(pop)
1217 
1218 #pragma pack(push, 1)
1219 typedef struct SVGA3dCmdDXDefineDepthStencilState {
1220    SVGA3dDepthStencilStateId depthStencilId;
1221 
1222    uint8 depthEnable;
1223    SVGA3dDepthWriteMask depthWriteMask;
1224    SVGA3dComparisonFunc depthFunc;
1225    uint8 stencilEnable;
1226    uint8 frontEnable;
1227    uint8 backEnable;
1228    uint8 stencilReadMask;
1229    uint8 stencilWriteMask;
1230 
1231    uint8 frontStencilFailOp;
1232    uint8 frontStencilDepthFailOp;
1233    uint8 frontStencilPassOp;
1234    SVGA3dComparisonFunc frontStencilFunc;
1235 
1236    uint8 backStencilFailOp;
1237    uint8 backStencilDepthFailOp;
1238    uint8 backStencilPassOp;
1239    SVGA3dComparisonFunc backStencilFunc;
1240 } SVGA3dCmdDXDefineDepthStencilState;
1241 #pragma pack(pop)
1242 
1243 #pragma pack(push, 1)
1244 typedef struct SVGA3dCmdDXDestroyDepthStencilState {
1245    SVGA3dDepthStencilStateId depthStencilId;
1246 } SVGA3dCmdDXDestroyDepthStencilState;
1247 #pragma pack(pop)
1248 
1249 #pragma pack(push, 1)
1250 typedef struct {
1251    uint8 fillMode;
1252    SVGA3dCullMode cullMode;
1253    uint8 frontCounterClockwise;
1254    uint8 provokingVertexLast;
1255    int32 depthBias;
1256    float depthBiasClamp;
1257    float slopeScaledDepthBias;
1258    uint8 depthClipEnable;
1259    uint8 scissorEnable;
1260    SVGA3dMultisampleRastEnable multisampleEnable;
1261    uint8 antialiasedLineEnable;
1262    float lineWidth;
1263    uint8 lineStippleEnable;
1264    uint8 lineStippleFactor;
1265    uint16 lineStipplePattern;
1266    uint8 forcedSampleCount;
1267    uint8 mustBeZero[3];
1268 } SVGACOTableDXRasterizerStateEntry;
1269 #pragma pack(pop)
1270 
1271 #pragma pack(push, 1)
1272 typedef struct SVGA3dCmdDXDefineRasterizerState {
1273    SVGA3dRasterizerStateId rasterizerId;
1274 
1275    uint8 fillMode;
1276    SVGA3dCullMode cullMode;
1277    uint8 frontCounterClockwise;
1278    uint8 provokingVertexLast;
1279    int32 depthBias;
1280    float depthBiasClamp;
1281    float slopeScaledDepthBias;
1282    uint8 depthClipEnable;
1283    uint8 scissorEnable;
1284    SVGA3dMultisampleRastEnable multisampleEnable;
1285    uint8 antialiasedLineEnable;
1286    float lineWidth;
1287    uint8 lineStippleEnable;
1288    uint8 lineStippleFactor;
1289    uint16 lineStipplePattern;
1290 } SVGA3dCmdDXDefineRasterizerState;
1291 #pragma pack(pop)
1292 
1293 #pragma pack(push, 1)
1294 typedef struct SVGA3dCmdDXDefineRasterizerState_v2 {
1295    SVGA3dRasterizerStateId rasterizerId;
1296 
1297    uint8 fillMode;
1298    SVGA3dCullMode cullMode;
1299    uint8 frontCounterClockwise;
1300    uint8 provokingVertexLast;
1301    int32 depthBias;
1302    float depthBiasClamp;
1303    float slopeScaledDepthBias;
1304    uint8 depthClipEnable;
1305    uint8 scissorEnable;
1306    SVGA3dMultisampleRastEnable multisampleEnable;
1307    uint8 antialiasedLineEnable;
1308    float lineWidth;
1309    uint8 lineStippleEnable;
1310    uint8 lineStippleFactor;
1311    uint16 lineStipplePattern;
1312    uint32 forcedSampleCount;
1313 } SVGA3dCmdDXDefineRasterizerState_v2;
1314 #pragma pack(pop)
1315 
1316 #pragma pack(push, 1)
1317 typedef struct SVGA3dCmdDXDestroyRasterizerState {
1318    SVGA3dRasterizerStateId rasterizerId;
1319 } SVGA3dCmdDXDestroyRasterizerState;
1320 #pragma pack(pop)
1321 
1322 #pragma pack(push, 1)
1323 typedef struct {
1324    SVGA3dFilter filter;
1325    uint8 addressU;
1326    uint8 addressV;
1327    uint8 addressW;
1328    uint8 pad0;
1329    float mipLODBias;
1330    uint8 maxAnisotropy;
1331    SVGA3dComparisonFunc comparisonFunc;
1332    uint16 pad1;
1333    SVGA3dRGBAFloat borderColor;
1334    float minLOD;
1335    float maxLOD;
1336    uint32 pad2[6];
1337 } SVGACOTableDXSamplerEntry;
1338 #pragma pack(pop)
1339 
1340 #pragma pack(push, 1)
1341 typedef struct SVGA3dCmdDXDefineSamplerState {
1342    SVGA3dSamplerId samplerId;
1343    SVGA3dFilter filter;
1344    uint8 addressU;
1345    uint8 addressV;
1346    uint8 addressW;
1347    uint8 pad0;
1348    float mipLODBias;
1349    uint8 maxAnisotropy;
1350    SVGA3dComparisonFunc comparisonFunc;
1351    uint16 pad1;
1352    SVGA3dRGBAFloat borderColor;
1353    float minLOD;
1354    float maxLOD;
1355 } SVGA3dCmdDXDefineSamplerState;
1356 #pragma pack(pop)
1357 
1358 #pragma pack(push, 1)
1359 typedef struct SVGA3dCmdDXDestroySamplerState {
1360    SVGA3dSamplerId samplerId;
1361 } SVGA3dCmdDXDestroySamplerState;
1362 #pragma pack(pop)
1363 
1364 #define SVGADX_SIGNATURE_SEMANTIC_NAME_UNDEFINED                         0
1365 #define SVGADX_SIGNATURE_SEMANTIC_NAME_POSITION                          1
1366 #define SVGADX_SIGNATURE_SEMANTIC_NAME_CLIP_DISTANCE                     2
1367 #define SVGADX_SIGNATURE_SEMANTIC_NAME_CULL_DISTANCE                     3
1368 #define SVGADX_SIGNATURE_SEMANTIC_NAME_RENDER_TARGET_ARRAY_INDEX         4
1369 #define SVGADX_SIGNATURE_SEMANTIC_NAME_VIEWPORT_ARRAY_INDEX              5
1370 #define SVGADX_SIGNATURE_SEMANTIC_NAME_VERTEX_ID                         6
1371 #define SVGADX_SIGNATURE_SEMANTIC_NAME_PRIMITIVE_ID                      7
1372 #define SVGADX_SIGNATURE_SEMANTIC_NAME_INSTANCE_ID                       8
1373 #define SVGADX_SIGNATURE_SEMANTIC_NAME_IS_FRONT_FACE                     9
1374 #define SVGADX_SIGNATURE_SEMANTIC_NAME_SAMPLE_INDEX                      10
1375 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_EQ_0_EDGE_TESSFACTOR 11
1376 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_EQ_0_EDGE_TESSFACTOR 12
1377 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_EQ_1_EDGE_TESSFACTOR 13
1378 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_EQ_1_EDGE_TESSFACTOR 14
1379 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_INSIDE_TESSFACTOR    15
1380 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_INSIDE_TESSFACTOR    16
1381 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_U_EQ_0_EDGE_TESSFACTOR  17
1382 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_V_EQ_0_EDGE_TESSFACTOR  18
1383 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_W_EQ_0_EDGE_TESSFACTOR  19
1384 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_INSIDE_TESSFACTOR       20
1385 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_LINE_DETAIL_TESSFACTOR      21
1386 #define SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_LINE_DENSITY_TESSFACTOR     22
1387 #define SVGADX_SIGNATURE_SEMANTIC_NAME_MAX                               23
1388 typedef uint32 SVGA3dDXSignatureSemanticName;
1389 
1390 #define SVGADX_SIGNATURE_REGISTER_COMPONENT_UNKNOWN 0
1391 #define SVGADX_SIGNATURE_REGISTER_COMPONENT_UINT32  1
1392 #define SVGADX_SIGNATURE_REGISTER_COMPONENT_INT32   2
1393 #define SVGADX_SIGNATURE_REGISTER_COMPONENT_FLOAT   3
1394 typedef uint32 SVGA3dDXSignatureRegisterComponentType;
1395 
1396 #define SVGADX_SIGNATURE_MIN_PRECISION_DEFAULT 0
1397 typedef uint32 SVGA3dDXSignatureMinPrecision;
1398 
1399 #pragma pack(push, 1)
1400 typedef struct SVGA3dDXSignatureEntry {
1401    uint32 registerIndex;
1402    SVGA3dDXSignatureSemanticName semanticName;
1403    uint32 mask;
1404    SVGA3dDXSignatureRegisterComponentType componentType;
1405    SVGA3dDXSignatureMinPrecision minPrecision;
1406 } SVGA3dDXShaderSignatureEntry;
1407 #pragma pack(pop)
1408 
1409 #define SVGADX_SIGNATURE_HEADER_VERSION_0 0x08a92d12
1410 
1411 #pragma pack(push, 1)
1412 typedef struct SVGA3dDXSignatureHeader {
1413    uint32 headerVersion;
1414    uint32 numInputSignatures;
1415    uint32 numOutputSignatures;
1416    uint32 numPatchConstantSignatures;
1417 } SVGA3dDXShaderSignatureHeader;
1418 #pragma pack(pop)
1419 
1420 #pragma pack(push, 1)
1421 typedef struct SVGA3dCmdDXDefineShader {
1422    SVGA3dShaderId shaderId;
1423    SVGA3dShaderType type;
1424    uint32 sizeInBytes;
1425 } SVGA3dCmdDXDefineShader;
1426 #pragma pack(pop)
1427 
1428 #pragma pack(push, 1)
1429 typedef struct SVGACOTableDXShaderEntry {
1430    SVGA3dShaderType type;
1431    uint32 sizeInBytes;
1432    uint32 offsetInBytes;
1433    SVGAMobId mobid;
1434    uint32 pad[4];
1435 } SVGACOTableDXShaderEntry;
1436 #pragma pack(pop)
1437 
1438 #pragma pack(push, 1)
1439 typedef struct SVGA3dCmdDXDestroyShader {
1440    SVGA3dShaderId shaderId;
1441 } SVGA3dCmdDXDestroyShader;
1442 #pragma pack(pop)
1443 
1444 #pragma pack(push, 1)
1445 typedef struct SVGA3dCmdDXBindShader {
1446    uint32 cid;
1447    uint32 shid;
1448    SVGAMobId mobid;
1449    uint32 offsetInBytes;
1450 } SVGA3dCmdDXBindShader;
1451 #pragma pack(pop)
1452 
1453 #pragma pack(push, 1)
1454 typedef struct SVGA3dCmdDXBindAllShader {
1455    uint32 cid;
1456    SVGAMobId mobid;
1457 } SVGA3dCmdDXBindAllShader;
1458 #pragma pack(pop)
1459 
1460 #pragma pack(push, 1)
1461 typedef struct SVGA3dCmdDXCondBindAllShader {
1462    uint32 cid;
1463    SVGAMobId testMobid;
1464    SVGAMobId mobid;
1465 } SVGA3dCmdDXCondBindAllShader;
1466 #pragma pack(pop)
1467 
1468 #define SVGA3D_MAX_DX10_STREAMOUT_DECLS 64
1469 #define SVGA3D_MAX_STREAMOUT_DECLS      512
1470 
1471 #pragma pack(push, 1)
1472 typedef struct SVGA3dStreamOutputDeclarationEntry {
1473    uint32 outputSlot;
1474    uint32 registerIndex;
1475    uint8 registerMask;
1476    uint8 pad0;
1477    uint16 pad1;
1478    uint32 stream;
1479 } SVGA3dStreamOutputDeclarationEntry;
1480 #pragma pack(pop)
1481 
1482 #pragma pack(push, 1)
1483 typedef struct SVGAOTableStreamOutputEntry {
1484    uint32 numOutputStreamEntries;
1485    SVGA3dStreamOutputDeclarationEntry decl[SVGA3D_MAX_DX10_STREAMOUT_DECLS];
1486    uint32 streamOutputStrideInBytes[SVGA3D_DX_MAX_SOTARGETS];
1487    uint32 rasterizedStream;
1488    uint32 numOutputStreamStrides;
1489    uint32 mobid;
1490    uint32 offsetInBytes;
1491    uint8 usesMob;
1492    uint8 pad0;
1493    uint16 pad1;
1494    uint32 pad2[246];
1495 } SVGACOTableDXStreamOutputEntry;
1496 #pragma pack(pop)
1497 
1498 #pragma pack(push, 1)
1499 typedef struct SVGA3dCmdDXDefineStreamOutput {
1500    SVGA3dStreamOutputId soid;
1501    uint32 numOutputStreamEntries;
1502    SVGA3dStreamOutputDeclarationEntry decl[SVGA3D_MAX_DX10_STREAMOUT_DECLS];
1503    uint32 streamOutputStrideInBytes[SVGA3D_DX_MAX_SOTARGETS];
1504    uint32 rasterizedStream;
1505 } SVGA3dCmdDXDefineStreamOutput;
1506 #pragma pack(pop)
1507 
1508 #define SVGA3D_DX_SO_NO_RASTERIZED_STREAM 0xFFFFFFFF
1509 
1510 #pragma pack(push, 1)
1511 typedef struct SVGA3dCmdDXDefineStreamOutputWithMob {
1512    SVGA3dStreamOutputId soid;
1513    uint32 numOutputStreamEntries;
1514    uint32 numOutputStreamStrides;
1515    uint32 streamOutputStrideInBytes[SVGA3D_DX_MAX_SOTARGETS];
1516    uint32 rasterizedStream;
1517 } SVGA3dCmdDXDefineStreamOutputWithMob;
1518 #pragma pack(pop)
1519 
1520 #pragma pack(push, 1)
1521 typedef struct SVGA3dCmdDXBindStreamOutput {
1522    SVGA3dStreamOutputId soid;
1523    uint32 mobid;
1524    uint32 offsetInBytes;
1525    uint32 sizeInBytes;
1526 } SVGA3dCmdDXBindStreamOutput;
1527 #pragma pack(pop)
1528 
1529 #pragma pack(push, 1)
1530 typedef struct SVGA3dCmdDXDestroyStreamOutput {
1531    SVGA3dStreamOutputId soid;
1532 } SVGA3dCmdDXDestroyStreamOutput;
1533 #pragma pack(pop)
1534 
1535 #pragma pack(push, 1)
1536 typedef struct SVGA3dCmdDXSetStreamOutput {
1537    SVGA3dStreamOutputId soid;
1538 } SVGA3dCmdDXSetStreamOutput;
1539 #pragma pack(pop)
1540 
1541 #pragma pack(push, 1)
1542 typedef struct SVGA3dCmdDXSetMinLOD {
1543    SVGA3dSurfaceId sid;
1544    float minLOD;
1545 } SVGA3dCmdDXSetMinLOD;
1546 #pragma pack(pop)
1547 
1548 #pragma pack(push, 1)
1549 typedef struct {
1550    uint64 value;
1551    uint32 mobId;
1552    uint32 mobOffset;
1553 } SVGA3dCmdDXMobFence64;
1554 #pragma pack(pop)
1555 
1556 #pragma pack(push, 1)
1557 typedef struct SVGA3dCmdDXSetCOTable {
1558    uint32 cid;
1559    uint32 mobid;
1560    SVGACOTableType type;
1561    uint32 validSizeInBytes;
1562 } SVGA3dCmdDXSetCOTable;
1563 #pragma pack(pop)
1564 
1565 #pragma pack(push, 1)
1566 typedef struct SVGA3dCmdDXGrowCOTable {
1567    uint32 cid;
1568    uint32 mobid;
1569    SVGACOTableType type;
1570    uint32 validSizeInBytes;
1571 } SVGA3dCmdDXGrowCOTable;
1572 #pragma pack(pop)
1573 
1574 #pragma pack(push, 1)
1575 typedef struct SVGA3dCmdDXReadbackCOTable {
1576    uint32 cid;
1577    SVGACOTableType type;
1578 } SVGA3dCmdDXReadbackCOTable;
1579 #pragma pack(pop)
1580 
1581 #pragma pack(push, 1)
1582 typedef struct SVGA3dCmdDXCopyCOTableIntoMob {
1583    uint32 cid;
1584    SVGACOTableType type;
1585    uint32 mobid;
1586 } SVGA3dCmdDXCopyCOTableIntoMob;
1587 #pragma pack(pop)
1588 
1589 #pragma pack(push, 1)
1590 typedef struct SVGA3dCmdDXPredStagingCopy {
1591    SVGA3dSurfaceId dstSid;
1592    SVGA3dSurfaceId srcSid;
1593    uint8 readback;
1594    uint8 unsynchronized;
1595    uint8 mustBeZero[2];
1596 
1597 } SVGA3dCmdDXPredStagingCopy;
1598 #pragma pack(pop)
1599 
1600 #pragma pack(push, 1)
1601 typedef struct SVGA3dCmdDXStagingCopy {
1602    SVGA3dSurfaceId dstSid;
1603    SVGA3dSurfaceId srcSid;
1604    uint8 readback;
1605    uint8 unsynchronized;
1606    uint8 mustBeZero[2];
1607 
1608 } SVGA3dCmdDXStagingCopy;
1609 #pragma pack(pop)
1610 
1611 #pragma pack(push, 1)
1612 typedef struct SVGA3dCOTableData {
1613    uint32 mobid;
1614 } SVGA3dCOTableData;
1615 #pragma pack(pop)
1616 
1617 #pragma pack(push, 1)
1618 typedef struct SVGA3dBufferBinding {
1619    uint32 bufferId;
1620    uint32 stride;
1621    uint32 offset;
1622 } SVGA3dBufferBinding;
1623 #pragma pack(pop)
1624 
1625 #pragma pack(push, 1)
1626 typedef struct SVGA3dConstantBufferBinding {
1627    uint32 sid;
1628    uint32 offsetInBytes;
1629    uint32 sizeInBytes;
1630 } SVGA3dConstantBufferBinding;
1631 #pragma pack(pop)
1632 
1633 #pragma pack(push, 1)
1634 typedef struct SVGADXInputAssemblyMobFormat {
1635    uint32 layoutId;
1636    SVGA3dBufferBinding vertexBuffers[SVGA3D_DX_MAX_VERTEXBUFFERS];
1637    uint32 indexBufferSid;
1638    uint32 pad;
1639    uint32 indexBufferOffset;
1640    uint32 indexBufferFormat;
1641    uint32 topology;
1642 } SVGADXInputAssemblyMobFormat;
1643 #pragma pack(pop)
1644 
1645 #pragma pack(push, 1)
1646 typedef struct SVGADXContextMobFormat {
1647    SVGADXInputAssemblyMobFormat inputAssembly;
1648 
1649    struct {
1650       uint32 blendStateId;
1651       uint32 blendFactor[4];
1652       uint32 sampleMask;
1653       uint32 depthStencilStateId;
1654       uint32 stencilRef;
1655       uint32 rasterizerStateId;
1656       uint32 depthStencilViewId;
1657       uint32 renderTargetViewIds[SVGA3D_DX_MAX_RENDER_TARGETS];
1658    } renderState;
1659 
1660    uint32 pad0[8];
1661 
1662    struct {
1663       uint32 targets[SVGA3D_DX_MAX_SOTARGETS];
1664       uint32 soid;
1665    } streamOut;
1666 
1667    uint32 pad1[10];
1668 
1669    uint32 uavSpliceIndex;
1670 
1671    uint8 numViewports;
1672    uint8 numScissorRects;
1673    uint16 pad2[1];
1674 
1675    uint32 pad3[3];
1676 
1677    SVGA3dViewport viewports[SVGA3D_DX_MAX_VIEWPORTS];
1678    uint32 pad4[32];
1679 
1680    SVGASignedRect scissorRects[SVGA3D_DX_MAX_SCISSORRECTS];
1681    uint32 pad5[64];
1682 
1683    struct {
1684       uint32 queryID;
1685       uint32 value;
1686    } predication;
1687 
1688    SVGAMobId shaderIfaceMobid;
1689    uint32 shaderIfaceOffset;
1690    struct {
1691       uint32 shaderId;
1692       SVGA3dConstantBufferBinding constantBuffers[SVGA3D_DX_MAX_CONSTBUFFERS];
1693       uint32 shaderResources[SVGA3D_DX_MAX_SRVIEWS];
1694       uint32 samplers[SVGA3D_DX_MAX_SAMPLERS];
1695    } shaderState[SVGA3D_NUM_SHADERTYPE];
1696    uint32 pad6[26];
1697 
1698    SVGA3dQueryId queryID[SVGA3D_MAX_QUERY];
1699 
1700    SVGA3dCOTableData cotables[SVGA_COTABLE_MAX];
1701 
1702    uint32 pad7[64];
1703 
1704    uint32 uaViewIds[SVGA3D_DX11_1_MAX_UAVIEWS];
1705    uint32 csuaViewIds[SVGA3D_DX11_1_MAX_UAVIEWS];
1706 
1707    uint32 pad8[188];
1708 } SVGADXContextMobFormat;
1709 #pragma pack(pop)
1710 
1711 #define SVGA3D_DX_MAX_CLASS_INSTANCES_PADDED 256
1712 
1713 #pragma pack(push, 1)
1714 typedef struct SVGADXShaderIfaceMobFormat {
1715    struct {
1716       uint32 numClassInstances;
1717       uint32 iface[SVGA3D_DX_MAX_CLASS_INSTANCES_PADDED];
1718       SVGA3dIfaceData data[SVGA3D_DX_MAX_CLASS_INSTANCES_PADDED];
1719    } shaderIfaceState[SVGA3D_NUM_SHADERTYPE];
1720 
1721    uint32 pad0[1018];
1722 } SVGADXShaderIfaceMobFormat;
1723 #pragma pack(pop)
1724 
1725 #define SVGA_MOB_FENCE_FLAG_IRQ (1 << 0)
1726 #define SVGA_MOB_FENCE_MASK     (SVGA_MOB_FENCE_FLAG_IRQ)
1727 typedef uint32 SVGAMobFenceFlags;
1728 
1729 #pragma pack(push, 1)
1730 typedef struct {
1731    uint64 value;
1732    uint32 mobId;
1733    uint32 mobOffset;
1734    uint32 flags;
1735 } SVGA3dCmdDXMobFenceWithFlags;
1736 #pragma pack(pop)
1737 
1738 #endif
1739