1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
2 /**********************************************************
3  * Copyright 2012-2015 VMware, Inc.
4  *
5  * Permission is hereby granted, free of charge, to any person
6  * obtaining a copy of this software and associated documentation
7  * files (the "Software"), to deal in the Software without
8  * restriction, including without limitation the rights to use, copy,
9  * modify, merge, publish, distribute, sublicense, and/or sell copies
10  * of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24  *
25  **********************************************************/
26 
27 /*
28  * svga3d_types.h --
29  *
30  *       SVGA 3d hardware definitions for basic types
31  */
32 
33 #ifndef _SVGA3D_TYPES_H_
34 #define _SVGA3D_TYPES_H_
35 
36 #define INCLUDE_ALLOW_MODULE
37 #define INCLUDE_ALLOW_USERLEVEL
38 #define INCLUDE_ALLOW_VMCORE
39 
40 #include "includeCheck.h"
41 
42 /*
43  * Generic Types
44  */
45 
46 #define SVGA3D_INVALID_ID         ((uint32)-1)
47 
48 typedef uint8 SVGABool8;   /* 8-bit Bool definition */
49 typedef uint32 SVGA3dBool; /* 32-bit Bool definition */
50 typedef uint32 SVGA3dColor; /* a, r, g, b */
51 
52 typedef uint32 SVGA3dSurfaceId;
53 
54 typedef
55 #include "vmware_pack_begin.h"
56 struct {
57    uint32 numerator;
58    uint32 denominator;
59 }
60 #include "vmware_pack_end.h"
61 SVGA3dFraction64;
62 
63 typedef
64 #include "vmware_pack_begin.h"
65 struct SVGA3dCopyRect {
66    uint32               x;
67    uint32               y;
68    uint32               w;
69    uint32               h;
70    uint32               srcx;
71    uint32               srcy;
72 }
73 #include "vmware_pack_end.h"
74 SVGA3dCopyRect;
75 
76 typedef
77 #include "vmware_pack_begin.h"
78 struct SVGA3dCopyBox {
79    uint32               x;
80    uint32               y;
81    uint32               z;
82    uint32               w;
83    uint32               h;
84    uint32               d;
85    uint32               srcx;
86    uint32               srcy;
87    uint32               srcz;
88 }
89 #include "vmware_pack_end.h"
90 SVGA3dCopyBox;
91 
92 typedef
93 #include "vmware_pack_begin.h"
94 struct SVGA3dRect {
95    uint32               x;
96    uint32               y;
97    uint32               w;
98    uint32               h;
99 }
100 #include "vmware_pack_end.h"
101 SVGA3dRect;
102 
103 typedef
104 #include "vmware_pack_begin.h"
105 struct {
106    uint32               x;
107    uint32               y;
108    uint32               z;
109    uint32               w;
110    uint32               h;
111    uint32               d;
112 }
113 #include "vmware_pack_end.h"
114 SVGA3dBox;
115 
116 typedef
117 #include "vmware_pack_begin.h"
118 struct {
119    int32                x;
120    int32                y;
121    int32                z;
122    int32                w;
123    int32                h;
124    int32                d;
125 }
126 #include "vmware_pack_end.h"
127 SVGA3dSignedBox;
128 
129 typedef
130 #include "vmware_pack_begin.h"
131 struct {
132    uint32               x;
133    uint32               y;
134    uint32               z;
135 }
136 #include "vmware_pack_end.h"
137 SVGA3dPoint;
138 
139 /*
140  * Surface formats.
141  */
142 typedef enum SVGA3dSurfaceFormat {
143    SVGA3D_FORMAT_INVALID               = 0,
144 
145    SVGA3D_X8R8G8B8                     = 1,
146    SVGA3D_FORMAT_MIN                   = 1,
147 
148    SVGA3D_A8R8G8B8                     = 2,
149 
150    SVGA3D_R5G6B5                       = 3,
151    SVGA3D_X1R5G5B5                     = 4,
152    SVGA3D_A1R5G5B5                     = 5,
153    SVGA3D_A4R4G4B4                     = 6,
154 
155    SVGA3D_Z_D32                        = 7,
156    SVGA3D_Z_D16                        = 8,
157    SVGA3D_Z_D24S8                      = 9,
158    SVGA3D_Z_D15S1                      = 10,
159 
160    SVGA3D_LUMINANCE8                   = 11,
161    SVGA3D_LUMINANCE4_ALPHA4            = 12,
162    SVGA3D_LUMINANCE16                  = 13,
163    SVGA3D_LUMINANCE8_ALPHA8            = 14,
164 
165    SVGA3D_DXT1                         = 15,
166    SVGA3D_DXT2                         = 16,
167    SVGA3D_DXT3                         = 17,
168    SVGA3D_DXT4                         = 18,
169    SVGA3D_DXT5                         = 19,
170 
171    SVGA3D_BUMPU8V8                     = 20,
172    SVGA3D_BUMPL6V5U5                   = 21,
173    SVGA3D_BUMPX8L8V8U8                 = 22,
174    SVGA3D_FORMAT_DEAD1                 = 23,
175 
176    SVGA3D_ARGB_S10E5                   = 24,   /* 16-bit floating-point ARGB */
177    SVGA3D_ARGB_S23E8                   = 25,   /* 32-bit floating-point ARGB */
178 
179    SVGA3D_A2R10G10B10                  = 26,
180 
181    /* signed formats */
182    SVGA3D_V8U8                         = 27,
183    SVGA3D_Q8W8V8U8                     = 28,
184    SVGA3D_CxV8U8                       = 29,
185 
186    /* mixed formats */
187    SVGA3D_X8L8V8U8                     = 30,
188    SVGA3D_A2W10V10U10                  = 31,
189 
190    SVGA3D_ALPHA8                       = 32,
191 
192    /* Single- and dual-component floating point formats */
193    SVGA3D_R_S10E5                      = 33,
194    SVGA3D_R_S23E8                      = 34,
195    SVGA3D_RG_S10E5                     = 35,
196    SVGA3D_RG_S23E8                     = 36,
197 
198    SVGA3D_BUFFER                       = 37,
199 
200    SVGA3D_Z_D24X8                      = 38,
201 
202    SVGA3D_V16U16                       = 39,
203 
204    SVGA3D_G16R16                       = 40,
205    SVGA3D_A16B16G16R16                 = 41,
206 
207    /* Packed Video formats */
208    SVGA3D_UYVY                         = 42,
209    SVGA3D_YUY2                         = 43,
210 
211    /* Planar video formats */
212    SVGA3D_NV12                         = 44,
213 
214    SVGA3D_FORMAT_DEAD2                 = 45,
215 
216    SVGA3D_R32G32B32A32_TYPELESS        = 46,
217    SVGA3D_R32G32B32A32_UINT            = 47,
218    SVGA3D_R32G32B32A32_SINT            = 48,
219    SVGA3D_R32G32B32_TYPELESS           = 49,
220    SVGA3D_R32G32B32_FLOAT              = 50,
221    SVGA3D_R32G32B32_UINT               = 51,
222    SVGA3D_R32G32B32_SINT               = 52,
223    SVGA3D_R16G16B16A16_TYPELESS        = 53,
224    SVGA3D_R16G16B16A16_UINT            = 54,
225    SVGA3D_R16G16B16A16_SNORM           = 55,
226    SVGA3D_R16G16B16A16_SINT            = 56,
227    SVGA3D_R32G32_TYPELESS              = 57,
228    SVGA3D_R32G32_UINT                  = 58,
229    SVGA3D_R32G32_SINT                  = 59,
230    SVGA3D_R32G8X24_TYPELESS            = 60,
231    SVGA3D_D32_FLOAT_S8X24_UINT         = 61,
232    SVGA3D_R32_FLOAT_X8X24              = 62,
233    SVGA3D_X32_G8X24_UINT               = 63,
234    SVGA3D_R10G10B10A2_TYPELESS         = 64,
235    SVGA3D_R10G10B10A2_UINT             = 65,
236    SVGA3D_R11G11B10_FLOAT              = 66,
237    SVGA3D_R8G8B8A8_TYPELESS            = 67,
238    SVGA3D_R8G8B8A8_UNORM               = 68,
239    SVGA3D_R8G8B8A8_UNORM_SRGB          = 69,
240    SVGA3D_R8G8B8A8_UINT                = 70,
241    SVGA3D_R8G8B8A8_SINT                = 71,
242    SVGA3D_R16G16_TYPELESS              = 72,
243    SVGA3D_R16G16_UINT                  = 73,
244    SVGA3D_R16G16_SINT                  = 74,
245    SVGA3D_R32_TYPELESS                 = 75,
246    SVGA3D_D32_FLOAT                    = 76,
247    SVGA3D_R32_UINT                     = 77,
248    SVGA3D_R32_SINT                     = 78,
249    SVGA3D_R24G8_TYPELESS               = 79,
250    SVGA3D_D24_UNORM_S8_UINT            = 80,
251    SVGA3D_R24_UNORM_X8                 = 81,
252    SVGA3D_X24_G8_UINT                  = 82,
253    SVGA3D_R8G8_TYPELESS                = 83,
254    SVGA3D_R8G8_UNORM                   = 84,
255    SVGA3D_R8G8_UINT                    = 85,
256    SVGA3D_R8G8_SINT                    = 86,
257    SVGA3D_R16_TYPELESS                 = 87,
258    SVGA3D_R16_UNORM                    = 88,
259    SVGA3D_R16_UINT                     = 89,
260    SVGA3D_R16_SNORM                    = 90,
261    SVGA3D_R16_SINT                     = 91,
262    SVGA3D_R8_TYPELESS                  = 92,
263    SVGA3D_R8_UNORM                     = 93,
264    SVGA3D_R8_UINT                      = 94,
265    SVGA3D_R8_SNORM                     = 95,
266    SVGA3D_R8_SINT                      = 96,
267    SVGA3D_P8                           = 97,
268    SVGA3D_R9G9B9E5_SHAREDEXP           = 98,
269    SVGA3D_R8G8_B8G8_UNORM              = 99,
270    SVGA3D_G8R8_G8B8_UNORM              = 100,
271    SVGA3D_BC1_TYPELESS                 = 101,
272    SVGA3D_BC1_UNORM_SRGB               = 102,
273    SVGA3D_BC2_TYPELESS                 = 103,
274    SVGA3D_BC2_UNORM_SRGB               = 104,
275    SVGA3D_BC3_TYPELESS                 = 105,
276    SVGA3D_BC3_UNORM_SRGB               = 106,
277    SVGA3D_BC4_TYPELESS                 = 107,
278    SVGA3D_ATI1                         = 108,   /* DX9-specific BC4_UNORM */
279    SVGA3D_BC4_SNORM                    = 109,
280    SVGA3D_BC5_TYPELESS                 = 110,
281    SVGA3D_ATI2                         = 111,   /* DX9-specific BC5_UNORM */
282    SVGA3D_BC5_SNORM                    = 112,
283    SVGA3D_R10G10B10_XR_BIAS_A2_UNORM   = 113,
284    SVGA3D_B8G8R8A8_TYPELESS            = 114,
285    SVGA3D_B8G8R8A8_UNORM_SRGB          = 115,
286    SVGA3D_B8G8R8X8_TYPELESS            = 116,
287    SVGA3D_B8G8R8X8_UNORM_SRGB          = 117,
288 
289    /* Advanced depth formats. */
290    SVGA3D_Z_DF16                       = 118,
291    SVGA3D_Z_DF24                       = 119,
292    SVGA3D_Z_D24S8_INT                  = 120,
293 
294    /* Planar video formats. */
295    SVGA3D_YV12                         = 121,
296 
297    SVGA3D_R32G32B32A32_FLOAT           = 122,
298    SVGA3D_R16G16B16A16_FLOAT           = 123,
299    SVGA3D_R16G16B16A16_UNORM           = 124,
300    SVGA3D_R32G32_FLOAT                 = 125,
301    SVGA3D_R10G10B10A2_UNORM            = 126,
302    SVGA3D_R8G8B8A8_SNORM               = 127,
303    SVGA3D_R16G16_FLOAT                 = 128,
304    SVGA3D_R16G16_UNORM                 = 129,
305    SVGA3D_R16G16_SNORM                 = 130,
306    SVGA3D_R32_FLOAT                    = 131,
307    SVGA3D_R8G8_SNORM                   = 132,
308    SVGA3D_R16_FLOAT                    = 133,
309    SVGA3D_D16_UNORM                    = 134,
310    SVGA3D_A8_UNORM                     = 135,
311    SVGA3D_BC1_UNORM                    = 136,
312    SVGA3D_BC2_UNORM                    = 137,
313    SVGA3D_BC3_UNORM                    = 138,
314    SVGA3D_B5G6R5_UNORM                 = 139,
315    SVGA3D_B5G5R5A1_UNORM               = 140,
316    SVGA3D_B8G8R8A8_UNORM               = 141,
317    SVGA3D_B8G8R8X8_UNORM               = 142,
318    SVGA3D_BC4_UNORM                    = 143,
319    SVGA3D_BC5_UNORM                    = 144,
320    SVGA3D_B4G4R4A4_UNORM               = 145,
321 
322    /* DX11 compressed formats */
323    SVGA3D_BC6H_TYPELESS                = 146,
324    SVGA3D_BC6H_UF16                    = 147,
325    SVGA3D_BC6H_SF16                    = 148,
326    SVGA3D_BC7_TYPELESS                 = 149,
327    SVGA3D_BC7_UNORM                    = 150,
328    SVGA3D_BC7_UNORM_SRGB               = 151,
329 
330    /* Video format with alpha */
331    SVGA3D_AYUV                         = 152,
332 
333    SVGA3D_FORMAT_MAX
334 } SVGA3dSurfaceFormat;
335 
336 /*
337  * SVGA3d Surface Flags --
338  */
339 #define SVGA3D_SURFACE_CUBEMAP                (1 << 0)
340 
341 /*
342  * HINT flags are not enforced by the device but are useful for
343  * performance.
344  */
345 #define SVGA3D_SURFACE_HINT_STATIC            (CONST64U(1) << 1)
346 #define SVGA3D_SURFACE_HINT_DYNAMIC           (CONST64U(1) << 2)
347 #define SVGA3D_SURFACE_HINT_INDEXBUFFER       (CONST64U(1) << 3)
348 #define SVGA3D_SURFACE_HINT_VERTEXBUFFER      (CONST64U(1) << 4)
349 #define SVGA3D_SURFACE_HINT_TEXTURE           (CONST64U(1) << 5)
350 #define SVGA3D_SURFACE_HINT_RENDERTARGET      (CONST64U(1) << 6)
351 #define SVGA3D_SURFACE_HINT_DEPTHSTENCIL      (CONST64U(1) << 7)
352 #define SVGA3D_SURFACE_HINT_WRITEONLY         (CONST64U(1) << 8)
353 #define SVGA3D_SURFACE_DEAD2                  (CONST64U(1) << 9)
354 #define SVGA3D_SURFACE_AUTOGENMIPMAPS         (CONST64U(1) << 10)
355 
356 #define SVGA3D_SURFACE_DEAD1                  (CONST64U(1) << 11)
357 
358 /*
359  * Is this surface using a base-level pitch for it's mob backing?
360  *
361  * This flag is not intended to be set by guest-drivers, but is instead
362  * set by the device when the surface is bound to a mob with a specified
363  * pitch.
364  */
365 #define SVGA3D_SURFACE_MOB_PITCH              (CONST64U(1) << 12)
366 
367 #define SVGA3D_SURFACE_INACTIVE               (CONST64U(1) << 13)
368 #define SVGA3D_SURFACE_HINT_RT_LOCKABLE       (CONST64U(1) << 14)
369 #define SVGA3D_SURFACE_VOLUME                 (CONST64U(1) << 15)
370 
371 /*
372  * Required to be set on a surface to bind it to a screen target.
373  */
374 #define SVGA3D_SURFACE_SCREENTARGET           (CONST64U(1) << 16)
375 
376 /*
377  * Align images in the guest-backing mob to 16-bytes.
378  */
379 #define SVGA3D_SURFACE_ALIGN16                (CONST64U(1) << 17)
380 
381 #define SVGA3D_SURFACE_1D                     (CONST64U(1) << 18)
382 #define SVGA3D_SURFACE_ARRAY                  (CONST64U(1) << 19)
383 
384 /*
385  * Bind flags.
386  * These are enforced for any surface defined with DefineGBSurface_v2.
387  */
388 #define SVGA3D_SURFACE_BIND_VERTEX_BUFFER     (CONST64U(1) << 20)
389 #define SVGA3D_SURFACE_BIND_INDEX_BUFFER      (CONST64U(1) << 21)
390 #define SVGA3D_SURFACE_BIND_CONSTANT_BUFFER   (CONST64U(1) << 22)
391 #define SVGA3D_SURFACE_BIND_SHADER_RESOURCE   (CONST64U(1) << 23)
392 #define SVGA3D_SURFACE_BIND_RENDER_TARGET     (CONST64U(1) << 24)
393 #define SVGA3D_SURFACE_BIND_DEPTH_STENCIL     (CONST64U(1) << 25)
394 #define SVGA3D_SURFACE_BIND_STREAM_OUTPUT     (CONST64U(1) << 26)
395 
396 /*
397  * The STAGING flags notes that the surface will not be used directly by the
398  * drawing pipeline, i.e. that it will not be bound to any bind point.
399  * Staging surfaces may be used by copy operations to move data in and out
400  * of other surfaces.  No bind flags may be set on surfaces with this flag.
401  *
402  * The HINT_INDIRECT_UPDATE flag suggests that the surface will receive
403  * updates indirectly, i.e. the surface will not be updated directly, but
404  * will receive copies from staging surfaces.
405  */
406 #define SVGA3D_SURFACE_STAGING_UPLOAD         (CONST64U(1) << 27)
407 #define SVGA3D_SURFACE_STAGING_DOWNLOAD       (CONST64U(1) << 28)
408 #define SVGA3D_SURFACE_HINT_INDIRECT_UPDATE   (CONST64U(1) << 29)
409 
410 /*
411  * Setting this flag allow this surface to be used with the
412  * SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER command.  It is only valid for
413  * buffer surfaces, and no bind flags are allowed to be set on surfaces
414  * with this flag except SVGA3D_SURFACE_TRANSFER_TO_BUFFER.
415  */
416 #define SVGA3D_SURFACE_TRANSFER_FROM_BUFFER   (CONST64U(1) << 30)
417 
418 /*
419  * Reserved for video operations.
420  */
421 #define SVGA3D_SURFACE_RESERVED1              (CONST64U(1) << 31)
422 
423 /*
424  * Specifies that a surface is multisample, and therefore requires the full
425  * mob-backing to store all the samples.
426  */
427 #define SVGA3D_SURFACE_MULTISAMPLE            (CONST64U(1) << 32)
428 
429 /*
430  * Specified that the surface is allowed to be bound to a UAView.
431  */
432 #define SVGA3D_SURFACE_BIND_UAVIEW            (CONST64U(1) << 33)
433 
434 /*
435  * Setting this flag allow this surface to be used with the
436  * SVGA_3D_CMD_DX_TRANSFER_TO_BUFFER command.  It is only valid for
437  * buffer surfaces, and no bind flags are allowed to be set on surfaces
438  * with this flag except SVGA3D_SURFACE_TRANSFER_FROM_BUFFER.
439  */
440 #define SVGA3D_SURFACE_TRANSFER_TO_BUFFER     (CONST64U(1) << 34)
441 
442 #define SVGA3D_SURFACE_BIND_LOGICOPS          (CONST64U(1) << 35)
443 
444 /*
445  * Optional flags for use with SVGA3D_SURFACE_BIND_UAVIEW
446  */
447 #define SVGA3D_SURFACE_BIND_RAW_VIEWS         (CONST64U(1) << 36)
448 #define SVGA3D_SURFACE_BUFFER_STRUCTURED      (CONST64U(1) << 37)
449 
450 #define SVGA3D_SURFACE_DRAWINDIRECT_ARGS      (CONST64U(1) << 38)
451 #define SVGA3D_SURFACE_RESOURCE_CLAMP         (CONST64U(1) << 39)
452 
453 #define SVGA3D_SURFACE_FLAG_MAX               (CONST64U(1) << 40)
454 
455 /*
456  * Surface flags types:
457  *
458  * SVGA3dSurface1Flags:  Lower 32-bits of flags.
459  * SVGA3dSurface2Flags:  Upper 32-bits of flags.
460  * SVGA3dSurfaceAllFlags: Full 64-bits of flags.
461  */
462 typedef uint32 SVGA3dSurface1Flags;
463 typedef uint32 SVGA3dSurface2Flags;
464 typedef uint64 SVGA3dSurfaceAllFlags;
465 
466 #define SVGA3D_SURFACE_FLAGS1_MASK ((uint64_t)MAX_UINT32)
467 #define SVGA3D_SURFACE_FLAGS2_MASK (MAX_UINT64 & ~SVGA3D_SURFACE_FLAGS1_MASK)
468 
469 #define SVGA3D_SURFACE_HB_DISALLOWED_MASK        \
470         (  SVGA3D_SURFACE_MOB_PITCH    |         \
471            SVGA3D_SURFACE_SCREENTARGET |         \
472            SVGA3D_SURFACE_ALIGN16 |              \
473            SVGA3D_SURFACE_BIND_CONSTANT_BUFFER | \
474            SVGA3D_SURFACE_BIND_STREAM_OUTPUT |   \
475            SVGA3D_SURFACE_STAGING_UPLOAD |       \
476            SVGA3D_SURFACE_STAGING_DOWNLOAD |     \
477            SVGA3D_SURFACE_HINT_INDIRECT_UPDATE | \
478            SVGA3D_SURFACE_TRANSFER_FROM_BUFFER | \
479            SVGA3D_SURFACE_RESERVED1 |             \
480            SVGA3D_SURFACE_MULTISAMPLE |          \
481            SVGA3D_SURFACE_BIND_UAVIEW |          \
482            SVGA3D_SURFACE_TRANSFER_TO_BUFFER |   \
483            SVGA3D_SURFACE_BIND_LOGICOPS |        \
484            SVGA3D_SURFACE_BIND_RAW_VIEWS |       \
485            SVGA3D_SURFACE_BUFFER_STRUCTURED |    \
486            SVGA3D_SURFACE_DRAWINDIRECT_ARGS |    \
487            SVGA3D_SURFACE_RESOURCE_CLAMP         \
488         )
489 
490 #define SVGA3D_SURFACE_HB_PRESENT_DISALLOWED_MASK   \
491        (   SVGA3D_SURFACE_1D |                      \
492            SVGA3D_SURFACE_RESERVED1 |                \
493            SVGA3D_SURFACE_MULTISAMPLE               \
494         )
495 
496 #define SVGA3D_SURFACE_2D_DISALLOWED_MASK           \
497         (  SVGA3D_SURFACE_CUBEMAP |                 \
498            SVGA3D_SURFACE_AUTOGENMIPMAPS |          \
499            SVGA3D_SURFACE_VOLUME |                  \
500            SVGA3D_SURFACE_1D |                      \
501            SVGA3D_SURFACE_BIND_VERTEX_BUFFER |      \
502            SVGA3D_SURFACE_BIND_INDEX_BUFFER |       \
503            SVGA3D_SURFACE_BIND_CONSTANT_BUFFER |    \
504            SVGA3D_SURFACE_BIND_DEPTH_STENCIL |      \
505            SVGA3D_SURFACE_BIND_STREAM_OUTPUT |      \
506            SVGA3D_SURFACE_TRANSFER_FROM_BUFFER |    \
507            SVGA3D_SURFACE_RESERVED1 |                \
508            SVGA3D_SURFACE_MULTISAMPLE |             \
509            SVGA3D_SURFACE_BIND_UAVIEW |             \
510            SVGA3D_SURFACE_TRANSFER_TO_BUFFER |      \
511            SVGA3D_SURFACE_BIND_RAW_VIEWS |          \
512            SVGA3D_SURFACE_BUFFER_STRUCTURED |       \
513            SVGA3D_SURFACE_DRAWINDIRECT_ARGS |       \
514            SVGA3D_SURFACE_RESOURCE_CLAMP            \
515         )
516 
517 #define SVGA3D_SURFACE_BASICOPS_DISALLOWED_MASK     \
518         (  SVGA3D_SURFACE_CUBEMAP |                 \
519            SVGA3D_SURFACE_AUTOGENMIPMAPS |          \
520            SVGA3D_SURFACE_VOLUME |                  \
521            SVGA3D_SURFACE_1D |                      \
522            SVGA3D_SURFACE_RESERVED1 |                \
523            SVGA3D_SURFACE_MULTISAMPLE               \
524         )
525 
526 #define SVGA3D_SURFACE_SCREENTARGET_DISALLOWED_MASK \
527         (  SVGA3D_SURFACE_CUBEMAP |                 \
528            SVGA3D_SURFACE_AUTOGENMIPMAPS |          \
529            SVGA3D_SURFACE_VOLUME |                  \
530            SVGA3D_SURFACE_1D |                      \
531            SVGA3D_SURFACE_BIND_VERTEX_BUFFER |      \
532            SVGA3D_SURFACE_BIND_INDEX_BUFFER |       \
533            SVGA3D_SURFACE_BIND_CONSTANT_BUFFER |    \
534            SVGA3D_SURFACE_BIND_DEPTH_STENCIL |      \
535            SVGA3D_SURFACE_BIND_STREAM_OUTPUT |      \
536            SVGA3D_SURFACE_INACTIVE |                \
537            SVGA3D_SURFACE_STAGING_UPLOAD |          \
538            SVGA3D_SURFACE_STAGING_DOWNLOAD |        \
539            SVGA3D_SURFACE_HINT_INDIRECT_UPDATE |    \
540            SVGA3D_SURFACE_TRANSFER_FROM_BUFFER |    \
541            SVGA3D_SURFACE_RESERVED1 |                \
542            SVGA3D_SURFACE_MULTISAMPLE |             \
543            SVGA3D_SURFACE_BIND_UAVIEW |             \
544            SVGA3D_SURFACE_TRANSFER_TO_BUFFER |      \
545            SVGA3D_SURFACE_BIND_RAW_VIEWS |          \
546            SVGA3D_SURFACE_BUFFER_STRUCTURED |       \
547            SVGA3D_SURFACE_DRAWINDIRECT_ARGS |       \
548            SVGA3D_SURFACE_RESOURCE_CLAMP            \
549         )
550 
551 #define SVGA3D_SURFACE_BUFFER_DISALLOWED_MASK       \
552         (  SVGA3D_SURFACE_CUBEMAP |                 \
553            SVGA3D_SURFACE_AUTOGENMIPMAPS |          \
554            SVGA3D_SURFACE_VOLUME |                  \
555            SVGA3D_SURFACE_1D |                      \
556            SVGA3D_SURFACE_DEAD2 |                   \
557            SVGA3D_SURFACE_ARRAY |                   \
558            SVGA3D_SURFACE_MULTISAMPLE |             \
559            SVGA3D_SURFACE_MOB_PITCH |               \
560            SVGA3D_SURFACE_RESOURCE_CLAMP            \
561         )
562 
563 #define SVGA3D_SURFACE_MULTISAMPLE_DISALLOWED_MASK  \
564         (  SVGA3D_SURFACE_CUBEMAP |                 \
565            SVGA3D_SURFACE_AUTOGENMIPMAPS |          \
566            SVGA3D_SURFACE_VOLUME |                  \
567            SVGA3D_SURFACE_1D |                      \
568            SVGA3D_SURFACE_SCREENTARGET |            \
569            SVGA3D_SURFACE_MOB_PITCH |               \
570            SVGA3D_SURFACE_TRANSFER_FROM_BUFFER |    \
571            SVGA3D_SURFACE_RESERVED1 |                \
572            SVGA3D_SURFACE_BIND_UAVIEW |             \
573            SVGA3D_SURFACE_TRANSFER_TO_BUFFER |      \
574            SVGA3D_SURFACE_BIND_LOGICOPS |           \
575            SVGA3D_SURFACE_BIND_RAW_VIEWS |          \
576            SVGA3D_SURFACE_BUFFER_STRUCTURED |       \
577            SVGA3D_SURFACE_DRAWINDIRECT_ARGS         \
578         )
579 
580 #define SVGA3D_SURFACE_DX_ONLY_MASK              \
581         (  SVGA3D_SURFACE_BIND_STREAM_OUTPUT |   \
582            SVGA3D_SURFACE_STAGING_UPLOAD |       \
583            SVGA3D_SURFACE_STAGING_DOWNLOAD |     \
584            SVGA3D_SURFACE_TRANSFER_FROM_BUFFER | \
585            SVGA3D_SURFACE_TRANSFER_TO_BUFFER     \
586         )
587 
588 #define SVGA3D_SURFACE_STAGING_MASK             \
589         (  SVGA3D_SURFACE_STAGING_UPLOAD |      \
590            SVGA3D_SURFACE_STAGING_DOWNLOAD      \
591         )
592 
593 #define SVGA3D_SURFACE_BIND_MASK                  \
594         (  SVGA3D_SURFACE_BIND_VERTEX_BUFFER   |  \
595            SVGA3D_SURFACE_BIND_INDEX_BUFFER    |  \
596            SVGA3D_SURFACE_BIND_CONSTANT_BUFFER |  \
597            SVGA3D_SURFACE_BIND_SHADER_RESOURCE |  \
598            SVGA3D_SURFACE_BIND_RENDER_TARGET   |  \
599            SVGA3D_SURFACE_BIND_DEPTH_STENCIL   |  \
600            SVGA3D_SURFACE_BIND_STREAM_OUTPUT   |  \
601            SVGA3D_SURFACE_BIND_UAVIEW          |  \
602            SVGA3D_SURFACE_BIND_LOGICOPS        |  \
603            SVGA3D_SURFACE_BIND_RAW_VIEWS          \
604         )
605 
606 #define SVGA3D_SURFACE_VADECODE_DISALLOWED_MASK     \
607         (  SVGA3D_SURFACE_CUBEMAP |                 \
608            SVGA3D_SURFACE_HINT_STATIC |             \
609            SVGA3D_SURFACE_HINT_DYNAMIC |            \
610            SVGA3D_SURFACE_HINT_INDEXBUFFER |        \
611            SVGA3D_SURFACE_HINT_VERTEXBUFFER |       \
612            SVGA3D_SURFACE_HINT_TEXTURE |            \
613            SVGA3D_SURFACE_HINT_RENDERTARGET |       \
614            SVGA3D_SURFACE_HINT_DEPTHSTENCIL |       \
615            SVGA3D_SURFACE_HINT_WRITEONLY |          \
616            SVGA3D_SURFACE_DEAD2 |                   \
617            SVGA3D_SURFACE_AUTOGENMIPMAPS |          \
618            SVGA3D_SURFACE_HINT_RT_LOCKABLE |        \
619            SVGA3D_SURFACE_VOLUME |                  \
620            SVGA3D_SURFACE_SCREENTARGET |            \
621            SVGA3D_SURFACE_1D |                      \
622            SVGA3D_SURFACE_BIND_VERTEX_BUFFER |      \
623            SVGA3D_SURFACE_BIND_INDEX_BUFFER |       \
624            SVGA3D_SURFACE_BIND_CONSTANT_BUFFER |    \
625            SVGA3D_SURFACE_BIND_RENDER_TARGET |      \
626            SVGA3D_SURFACE_BIND_SHADER_RESOURCE |    \
627            SVGA3D_SURFACE_BIND_DEPTH_STENCIL |      \
628            SVGA3D_SURFACE_BIND_STREAM_OUTPUT |      \
629            SVGA3D_SURFACE_INACTIVE |                \
630            SVGA3D_SURFACE_STAGING_UPLOAD |          \
631            SVGA3D_SURFACE_STAGING_DOWNLOAD |        \
632            SVGA3D_SURFACE_HINT_INDIRECT_UPDATE |    \
633            SVGA3D_SURFACE_TRANSFER_FROM_BUFFER  |   \
634            SVGA3D_SURFACE_MULTISAMPLE |             \
635            SVGA3D_SURFACE_BIND_UAVIEW |             \
636            SVGA3D_SURFACE_TRANSFER_TO_BUFFER |      \
637            SVGA3D_SURFACE_BIND_LOGICOPS |           \
638            SVGA3D_SURFACE_BIND_RAW_VIEWS |          \
639            SVGA3D_SURFACE_BUFFER_STRUCTURED |       \
640            SVGA3D_SURFACE_DRAWINDIRECT_ARGS |       \
641            SVGA3D_SURFACE_RESOURCE_CLAMP            \
642         )
643 
644 #define SVGA3D_SURFACE_VAPROCESSFRAME_OUTPUT_DISALLOWED_MASK     \
645         (  SVGA3D_SURFACE_HINT_INDEXBUFFER |                     \
646            SVGA3D_SURFACE_HINT_VERTEXBUFFER |                    \
647            SVGA3D_SURFACE_HINT_DEPTHSTENCIL |                    \
648            SVGA3D_SURFACE_DEAD2 |                                \
649            SVGA3D_SURFACE_VOLUME |                               \
650            SVGA3D_SURFACE_1D |                                   \
651            SVGA3D_SURFACE_BIND_VERTEX_BUFFER |                   \
652            SVGA3D_SURFACE_BIND_INDEX_BUFFER |                    \
653            SVGA3D_SURFACE_BIND_CONSTANT_BUFFER |                 \
654            SVGA3D_SURFACE_BIND_DEPTH_STENCIL |                   \
655            SVGA3D_SURFACE_BIND_STREAM_OUTPUT |                   \
656            SVGA3D_SURFACE_INACTIVE |                             \
657            SVGA3D_SURFACE_STAGING_UPLOAD |                       \
658            SVGA3D_SURFACE_STAGING_DOWNLOAD |                     \
659            SVGA3D_SURFACE_TRANSFER_FROM_BUFFER |                 \
660            SVGA3D_SURFACE_VADECODE |                             \
661            SVGA3D_SURFACE_MULTISAMPLE |                          \
662            SVGA3D_SURFACE_BIND_UAVIEW |                          \
663            SVGA3D_SURFACE_TRANSFER_TO_BUFFER |                   \
664            SVGA3D_SURFACE_BIND_LOGICOPS |                        \
665            SVGA3D_SURFACE_BIND_RAW_VIEWS |                       \
666            SVGA3D_SURFACE_BUFFER_STRUCTURED |                    \
667            SVGA3D_SURFACE_DRAWINDIRECT_ARGS |                    \
668            SVGA3D_SURFACE_RESOURCE_CLAMP         \
669         )
670 
671 #define SVGA3D_SURFACE_VAPROCESSFRAME_INPUT_DISALLOWED_MASK     \
672         ( SVGA3D_SURFACE_CUBEMAP |                              \
673           SVGA3D_SURFACE_HINT_INDEXBUFFER |                     \
674           SVGA3D_SURFACE_HINT_VERTEXBUFFER |                    \
675           SVGA3D_SURFACE_HINT_DEPTHSTENCIL |                    \
676           SVGA3D_SURFACE_DEAD2 |                                \
677           SVGA3D_SURFACE_VOLUME |                               \
678           SVGA3D_SURFACE_SCREENTARGET |                         \
679           SVGA3D_SURFACE_1D |                                   \
680           SVGA3D_SURFACE_BIND_VERTEX_BUFFER |                   \
681           SVGA3D_SURFACE_BIND_INDEX_BUFFER |                    \
682           SVGA3D_SURFACE_BIND_CONSTANT_BUFFER |                 \
683           SVGA3D_SURFACE_BIND_DEPTH_STENCIL |                   \
684           SVGA3D_SURFACE_BIND_STREAM_OUTPUT |                   \
685           SVGA3D_SURFACE_STAGING_UPLOAD |                       \
686           SVGA3D_SURFACE_STAGING_DOWNLOAD |                     \
687           SVGA3D_SURFACE_TRANSFER_FROM_BUFFER |                 \
688           SVGA3D_SURFACE_MULTISAMPLE |                          \
689           SVGA3D_SURFACE_BIND_UAVIEW |                          \
690           SVGA3D_SURFACE_TRANSFER_TO_BUFFER |                   \
691           SVGA3D_SURFACE_BIND_LOGICOPS |                        \
692           SVGA3D_SURFACE_BIND_RAW_VIEWS |                       \
693           SVGA3D_SURFACE_BUFFER_STRUCTURED |                    \
694           SVGA3D_SURFACE_DRAWINDIRECT_ARGS |                    \
695           SVGA3D_SURFACE_RESOURCE_CLAMP                         \
696         )
697 
698 #define SVGA3D_SURFACE_LOGICOPS_DISALLOWED_MASK     \
699         (  SVGA3D_SURFACE_CUBEMAP |                 \
700            SVGA3D_SURFACE_DEAD2 |                   \
701            SVGA3D_SURFACE_AUTOGENMIPMAPS |          \
702            SVGA3D_SURFACE_VOLUME |                  \
703            SVGA3D_SURFACE_1D |                      \
704            SVGA3D_SURFACE_BIND_VERTEX_BUFFER |      \
705            SVGA3D_SURFACE_BIND_INDEX_BUFFER |       \
706            SVGA3D_SURFACE_BIND_CONSTANT_BUFFER |    \
707            SVGA3D_SURFACE_BIND_DEPTH_STENCIL |      \
708            SVGA3D_SURFACE_BIND_STREAM_OUTPUT |      \
709            SVGA3D_SURFACE_TRANSFER_FROM_BUFFER |    \
710            SVGA3D_SURFACE_VADECODE |                \
711            SVGA3D_SURFACE_MULTISAMPLE |             \
712            SVGA3D_SURFACE_BIND_UAVIEW |             \
713            SVGA3D_SURFACE_TRANSFER_TO_BUFFER |      \
714            SVGA3D_SURFACE_BIND_RAW_VIEWS |          \
715            SVGA3D_SURFACE_BUFFER_STRUCTURED |       \
716            SVGA3D_SURFACE_DRAWINDIRECT_ARGS |       \
717            SVGA3D_SURFACE_RESOURCE_CLAMP            \
718         )
719 
720 #define SVGA3D_BUFFER_STRUCTURED_STRIDE_MAX 2048
721 
722 
723 /*
724  * These are really the D3DFORMAT_OP defines from the wdk. We need
725  * them so that we can query the host for what the supported surface
726  * operations are (when we're using the D3D backend, in particular),
727  * and so we can send those operations to the guest.
728  */
729 typedef enum {
730    SVGA3DFORMAT_OP_TEXTURE                               = 0x00000001,
731    SVGA3DFORMAT_OP_VOLUMETEXTURE                         = 0x00000002,
732    SVGA3DFORMAT_OP_CUBETEXTURE                           = 0x00000004,
733    SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET                = 0x00000008,
734    SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET              = 0x00000010,
735    SVGA3DFORMAT_OP_ZSTENCIL                              = 0x00000040,
736    SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH   = 0x00000080,
737 
738 /*
739  * This format can be used as a render target if the current display mode
740  * is the same depth if the alpha channel is ignored. e.g. if the device
741  * can render to A8R8G8B8 when the display mode is X8R8G8B8, then the
742  * format op list entry for A8R8G8B8 should have this cap.
743  */
744    SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET  = 0x00000100,
745 
746 /*
747  * This format contains DirectDraw support (including Flip).  This flag
748  * should not to be set on alpha formats.
749  */
750    SVGA3DFORMAT_OP_DISPLAYMODE                           = 0x00000400,
751 
752 /*
753  * The rasterizer can support some level of Direct3D support in this format
754  * and implies that the driver can create a Context in this mode (for some
755  * render target format).  When this flag is set, the SVGA3DFORMAT_OP_DISPLAYMODE
756  * flag must also be set.
757  */
758    SVGA3DFORMAT_OP_3DACCELERATION                        = 0x00000800,
759 
760 /*
761  * This is set for a private format when the driver has put the bpp in
762  * the structure.
763  */
764    SVGA3DFORMAT_OP_PIXELSIZE                             = 0x00001000,
765 
766 /*
767  * Indicates that this format can be converted to any RGB format for which
768  * SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB is specified.
769  */
770    SVGA3DFORMAT_OP_CONVERT_TO_ARGB                       = 0x00002000,
771 
772 /*
773  * Indicates that this format can be used to create offscreen plain surfaces.
774  */
775    SVGA3DFORMAT_OP_OFFSCREENPLAIN                        = 0x00004000,
776 
777 /*
778  * Indicated that this format can be read as an SRGB texture (meaning that the
779  * sampler will linearize the looked up data).
780  */
781    SVGA3DFORMAT_OP_SRGBREAD                              = 0x00008000,
782 
783 /*
784  * Indicates that this format can be used in the bumpmap instructions.
785  */
786    SVGA3DFORMAT_OP_BUMPMAP                               = 0x00010000,
787 
788 /*
789  * Indicates that this format can be sampled by the displacement map sampler.
790  */
791    SVGA3DFORMAT_OP_DMAP                                  = 0x00020000,
792 
793 /*
794  * Indicates that this format cannot be used with texture filtering.
795  */
796    SVGA3DFORMAT_OP_NOFILTER                              = 0x00040000,
797 
798 /*
799  * Indicates that format conversions are supported to this RGB format if
800  * SVGA3DFORMAT_OP_CONVERT_TO_ARGB is specified in the source format.
801  */
802    SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB                    = 0x00080000,
803 
804 /*
805  * Indicated that this format can be written as an SRGB target
806  * (meaning that the pixel pipe will DE-linearize data on output to format)
807  */
808    SVGA3DFORMAT_OP_SRGBWRITE                             = 0x00100000,
809 
810 /*
811  * Indicates that this format cannot be used with alpha blending.
812  */
813    SVGA3DFORMAT_OP_NOALPHABLEND                          = 0x00200000,
814 
815 /*
816  * Indicates that the device can auto-generated sublevels for resources
817  * of this format.
818  */
819    SVGA3DFORMAT_OP_AUTOGENMIPMAP                         = 0x00400000,
820 
821 /*
822  * Indicates that this format can be used by vertex texture sampler.
823  */
824    SVGA3DFORMAT_OP_VERTEXTEXTURE                         = 0x00800000,
825 
826 /*
827  * Indicates that this format supports neither texture coordinate
828  * wrap modes, nor mipmapping.
829  */
830    SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP                  = 0x01000000
831 } SVGA3dFormatOp;
832 
833 #define SVGA3D_FORMAT_POSITIVE                             \
834    (SVGA3DFORMAT_OP_TEXTURE                              | \
835     SVGA3DFORMAT_OP_VOLUMETEXTURE                        | \
836     SVGA3DFORMAT_OP_CUBETEXTURE                          | \
837     SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET               | \
838     SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET             | \
839     SVGA3DFORMAT_OP_ZSTENCIL                             | \
840     SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH  | \
841     SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET | \
842     SVGA3DFORMAT_OP_DISPLAYMODE                          | \
843     SVGA3DFORMAT_OP_3DACCELERATION                       | \
844     SVGA3DFORMAT_OP_PIXELSIZE                            | \
845     SVGA3DFORMAT_OP_CONVERT_TO_ARGB                      | \
846     SVGA3DFORMAT_OP_OFFSCREENPLAIN                       | \
847     SVGA3DFORMAT_OP_SRGBREAD                             | \
848     SVGA3DFORMAT_OP_BUMPMAP                              | \
849     SVGA3DFORMAT_OP_DMAP                                 | \
850     SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB                   | \
851     SVGA3DFORMAT_OP_SRGBWRITE                            | \
852     SVGA3DFORMAT_OP_AUTOGENMIPMAP                        | \
853     SVGA3DFORMAT_OP_VERTEXTEXTURE)
854 
855 #define SVGA3D_FORMAT_NEGATIVE               \
856    (SVGA3DFORMAT_OP_NOFILTER               | \
857     SVGA3DFORMAT_OP_NOALPHABLEND           | \
858     SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP)
859 
860 /*
861  * This structure is a conversion of SVGA3DFORMAT_OP_*
862  * Entries must be located at the same position.
863  */
864 typedef union {
865    uint32 value;
866    struct {
867       uint32 texture : 1;
868       uint32 volumeTexture : 1;
869       uint32 cubeTexture : 1;
870       uint32 offscreenRenderTarget : 1;
871       uint32 sameFormatRenderTarget : 1;
872       uint32 unknown1 : 1;
873       uint32 zStencil : 1;
874       uint32 zStencilArbitraryDepth : 1;
875       uint32 sameFormatUpToAlpha : 1;
876       uint32 unknown2 : 1;
877       uint32 displayMode : 1;
878       uint32 acceleration3d : 1;
879       uint32 pixelSize : 1;
880       uint32 convertToARGB : 1;
881       uint32 offscreenPlain : 1;
882       uint32 sRGBRead : 1;
883       uint32 bumpMap : 1;
884       uint32 dmap : 1;
885       uint32 noFilter : 1;
886       uint32 memberOfGroupARGB : 1;
887       uint32 sRGBWrite : 1;
888       uint32 noAlphaBlend : 1;
889       uint32 autoGenMipMap : 1;
890       uint32 vertexTexture : 1;
891       uint32 noTexCoordWrapNorMip : 1;
892    };
893 } SVGA3dSurfaceFormatCaps;
894 
895 /*
896  * SVGA_3D_CMD_SETRENDERSTATE Types.  All value types
897  * must fit in a uint32.
898  */
899 
900 typedef enum {
901    SVGA3D_RS_INVALID                   = 0,
902    SVGA3D_RS_MIN                       = 1,
903    SVGA3D_RS_ZENABLE                   = 1,     /* SVGA3dBool */
904    SVGA3D_RS_ZWRITEENABLE              = 2,     /* SVGA3dBool */
905    SVGA3D_RS_ALPHATESTENABLE           = 3,     /* SVGA3dBool */
906    SVGA3D_RS_DITHERENABLE              = 4,     /* SVGA3dBool */
907    SVGA3D_RS_BLENDENABLE               = 5,     /* SVGA3dBool */
908    SVGA3D_RS_FOGENABLE                 = 6,     /* SVGA3dBool */
909    SVGA3D_RS_SPECULARENABLE            = 7,     /* SVGA3dBool */
910    SVGA3D_RS_STENCILENABLE             = 8,     /* SVGA3dBool */
911    SVGA3D_RS_LIGHTINGENABLE            = 9,     /* SVGA3dBool */
912    SVGA3D_RS_NORMALIZENORMALS          = 10,    /* SVGA3dBool */
913    SVGA3D_RS_POINTSPRITEENABLE         = 11,    /* SVGA3dBool */
914    SVGA3D_RS_POINTSCALEENABLE          = 12,    /* SVGA3dBool */
915    SVGA3D_RS_STENCILREF                = 13,    /* uint32 */
916    SVGA3D_RS_STENCILMASK               = 14,    /* uint32 */
917    SVGA3D_RS_STENCILWRITEMASK          = 15,    /* uint32 */
918    SVGA3D_RS_FOGSTART                  = 16,    /* float */
919    SVGA3D_RS_FOGEND                    = 17,    /* float */
920    SVGA3D_RS_FOGDENSITY                = 18,    /* float */
921    SVGA3D_RS_POINTSIZE                 = 19,    /* float */
922    SVGA3D_RS_POINTSIZEMIN              = 20,    /* float */
923    SVGA3D_RS_POINTSIZEMAX              = 21,    /* float */
924    SVGA3D_RS_POINTSCALE_A              = 22,    /* float */
925    SVGA3D_RS_POINTSCALE_B              = 23,    /* float */
926    SVGA3D_RS_POINTSCALE_C              = 24,    /* float */
927    SVGA3D_RS_FOGCOLOR                  = 25,    /* SVGA3dColor */
928    SVGA3D_RS_AMBIENT                   = 26,    /* SVGA3dColor */
929    SVGA3D_RS_CLIPPLANEENABLE           = 27,    /* SVGA3dClipPlanes */
930    SVGA3D_RS_FOGMODE                   = 28,    /* SVGA3dFogMode */
931    SVGA3D_RS_FILLMODE                  = 29,    /* SVGA3dFillMode */
932    SVGA3D_RS_SHADEMODE                 = 30,    /* SVGA3dShadeMode */
933    SVGA3D_RS_LINEPATTERN               = 31,    /* SVGA3dLinePattern */
934    SVGA3D_RS_SRCBLEND                  = 32,    /* SVGA3dBlendOp */
935    SVGA3D_RS_DSTBLEND                  = 33,    /* SVGA3dBlendOp */
936    SVGA3D_RS_BLENDEQUATION             = 34,    /* SVGA3dBlendEquation */
937    SVGA3D_RS_CULLMODE                  = 35,    /* SVGA3dFace */
938    SVGA3D_RS_ZFUNC                     = 36,    /* SVGA3dCmpFunc */
939    SVGA3D_RS_ALPHAFUNC                 = 37,    /* SVGA3dCmpFunc */
940    SVGA3D_RS_STENCILFUNC               = 38,    /* SVGA3dCmpFunc */
941    SVGA3D_RS_STENCILFAIL               = 39,    /* SVGA3dStencilOp */
942    SVGA3D_RS_STENCILZFAIL              = 40,    /* SVGA3dStencilOp */
943    SVGA3D_RS_STENCILPASS               = 41,    /* SVGA3dStencilOp */
944    SVGA3D_RS_ALPHAREF                  = 42,    /* float (0.0 .. 1.0) */
945    SVGA3D_RS_FRONTWINDING              = 43,    /* SVGA3dFrontWinding */
946    SVGA3D_RS_COORDINATETYPE            = 44,    /* SVGA3dCoordinateType */
947    SVGA3D_RS_ZBIAS                     = 45,    /* float */
948    SVGA3D_RS_RANGEFOGENABLE            = 46,    /* SVGA3dBool */
949    SVGA3D_RS_COLORWRITEENABLE          = 47,    /* SVGA3dColorMask */
950    SVGA3D_RS_VERTEXMATERIALENABLE      = 48,    /* SVGA3dBool */
951    SVGA3D_RS_DIFFUSEMATERIALSOURCE     = 49,    /* SVGA3dVertexMaterial */
952    SVGA3D_RS_SPECULARMATERIALSOURCE    = 50,    /* SVGA3dVertexMaterial */
953    SVGA3D_RS_AMBIENTMATERIALSOURCE     = 51,    /* SVGA3dVertexMaterial */
954    SVGA3D_RS_EMISSIVEMATERIALSOURCE    = 52,    /* SVGA3dVertexMaterial */
955    SVGA3D_RS_TEXTUREFACTOR             = 53,    /* SVGA3dColor */
956    SVGA3D_RS_LOCALVIEWER               = 54,    /* SVGA3dBool */
957    SVGA3D_RS_SCISSORTESTENABLE         = 55,    /* SVGA3dBool */
958    SVGA3D_RS_BLENDCOLOR                = 56,    /* SVGA3dColor */
959    SVGA3D_RS_STENCILENABLE2SIDED       = 57,    /* SVGA3dBool */
960    SVGA3D_RS_CCWSTENCILFUNC            = 58,    /* SVGA3dCmpFunc */
961    SVGA3D_RS_CCWSTENCILFAIL            = 59,    /* SVGA3dStencilOp */
962    SVGA3D_RS_CCWSTENCILZFAIL           = 60,    /* SVGA3dStencilOp */
963    SVGA3D_RS_CCWSTENCILPASS            = 61,    /* SVGA3dStencilOp */
964    SVGA3D_RS_VERTEXBLEND               = 62,    /* SVGA3dVertexBlendFlags */
965    SVGA3D_RS_SLOPESCALEDEPTHBIAS       = 63,    /* float */
966    SVGA3D_RS_DEPTHBIAS                 = 64,    /* float */
967 
968 
969    /*
970     * Output Gamma Level
971     *
972     * Output gamma effects the gamma curve of colors that are output from the
973     * rendering pipeline.  A value of 1.0 specifies a linear color space. If the
974     * value is <= 0.0, gamma correction is ignored and linear color space is
975     * used.
976     */
977 
978    SVGA3D_RS_OUTPUTGAMMA               = 65,    /* float */
979    SVGA3D_RS_ZVISIBLE                  = 66,    /* SVGA3dBool */
980    SVGA3D_RS_LASTPIXEL                 = 67,    /* SVGA3dBool */
981    SVGA3D_RS_CLIPPING                  = 68,    /* SVGA3dBool */
982    SVGA3D_RS_WRAP0                     = 69,    /* SVGA3dWrapFlags */
983    SVGA3D_RS_WRAP1                     = 70,    /* SVGA3dWrapFlags */
984    SVGA3D_RS_WRAP2                     = 71,    /* SVGA3dWrapFlags */
985    SVGA3D_RS_WRAP3                     = 72,    /* SVGA3dWrapFlags */
986    SVGA3D_RS_WRAP4                     = 73,    /* SVGA3dWrapFlags */
987    SVGA3D_RS_WRAP5                     = 74,    /* SVGA3dWrapFlags */
988    SVGA3D_RS_WRAP6                     = 75,    /* SVGA3dWrapFlags */
989    SVGA3D_RS_WRAP7                     = 76,    /* SVGA3dWrapFlags */
990    SVGA3D_RS_WRAP8                     = 77,    /* SVGA3dWrapFlags */
991    SVGA3D_RS_WRAP9                     = 78,    /* SVGA3dWrapFlags */
992    SVGA3D_RS_WRAP10                    = 79,    /* SVGA3dWrapFlags */
993    SVGA3D_RS_WRAP11                    = 80,    /* SVGA3dWrapFlags */
994    SVGA3D_RS_WRAP12                    = 81,    /* SVGA3dWrapFlags */
995    SVGA3D_RS_WRAP13                    = 82,    /* SVGA3dWrapFlags */
996    SVGA3D_RS_WRAP14                    = 83,    /* SVGA3dWrapFlags */
997    SVGA3D_RS_WRAP15                    = 84,    /* SVGA3dWrapFlags */
998    SVGA3D_RS_MULTISAMPLEANTIALIAS      = 85,    /* SVGA3dBool */
999    SVGA3D_RS_MULTISAMPLEMASK           = 86,    /* uint32 */
1000    SVGA3D_RS_INDEXEDVERTEXBLENDENABLE  = 87,    /* SVGA3dBool */
1001    SVGA3D_RS_TWEENFACTOR               = 88,    /* float */
1002    SVGA3D_RS_ANTIALIASEDLINEENABLE     = 89,    /* SVGA3dBool */
1003    SVGA3D_RS_COLORWRITEENABLE1         = 90,    /* SVGA3dColorMask */
1004    SVGA3D_RS_COLORWRITEENABLE2         = 91,    /* SVGA3dColorMask */
1005    SVGA3D_RS_COLORWRITEENABLE3         = 92,    /* SVGA3dColorMask */
1006    SVGA3D_RS_SEPARATEALPHABLENDENABLE  = 93,    /* SVGA3dBool */
1007    SVGA3D_RS_SRCBLENDALPHA             = 94,    /* SVGA3dBlendOp */
1008    SVGA3D_RS_DSTBLENDALPHA             = 95,    /* SVGA3dBlendOp */
1009    SVGA3D_RS_BLENDEQUATIONALPHA        = 96,    /* SVGA3dBlendEquation */
1010    SVGA3D_RS_TRANSPARENCYANTIALIAS     = 97,    /* SVGA3dTransparencyAntialiasType */
1011    SVGA3D_RS_LINEWIDTH                 = 98,    /* float */
1012    SVGA3D_RS_MAX
1013 } SVGA3dRenderStateName;
1014 
1015 typedef enum {
1016    SVGA3D_TRANSPARENCYANTIALIAS_NORMAL            = 0,
1017    SVGA3D_TRANSPARENCYANTIALIAS_ALPHATOCOVERAGE   = 1,
1018    SVGA3D_TRANSPARENCYANTIALIAS_SUPERSAMPLE       = 2,
1019    SVGA3D_TRANSPARENCYANTIALIAS_MAX
1020 } SVGA3dTransparencyAntialiasType;
1021 
1022 typedef enum {
1023    SVGA3D_VERTEXMATERIAL_NONE     = 0,    /* Use the value in the current material */
1024    SVGA3D_VERTEXMATERIAL_DIFFUSE  = 1,    /* Use the value in the diffuse component */
1025    SVGA3D_VERTEXMATERIAL_SPECULAR = 2,    /* Use the value in the specular component */
1026    SVGA3D_VERTEXMATERIAL_MAX      = 3,
1027 } SVGA3dVertexMaterial;
1028 
1029 typedef enum {
1030    SVGA3D_FILLMODE_INVALID = 0,
1031    SVGA3D_FILLMODE_MIN     = 1,
1032    SVGA3D_FILLMODE_POINT   = 1,
1033    SVGA3D_FILLMODE_LINE    = 2,
1034    SVGA3D_FILLMODE_FILL    = 3,
1035    SVGA3D_FILLMODE_MAX
1036 } SVGA3dFillModeType;
1037 
1038 
1039 typedef
1040 #include "vmware_pack_begin.h"
1041 union {
1042    struct {
1043       uint16   mode;       /* SVGA3dFillModeType */
1044       uint16   face;       /* SVGA3dFace */
1045    };
1046    uint32 uintValue;
1047 }
1048 #include "vmware_pack_end.h"
1049 SVGA3dFillMode;
1050 
1051 typedef enum {
1052    SVGA3D_SHADEMODE_INVALID = 0,
1053    SVGA3D_SHADEMODE_FLAT    = 1,
1054    SVGA3D_SHADEMODE_SMOOTH  = 2,
1055    SVGA3D_SHADEMODE_PHONG   = 3,     /* Not supported */
1056    SVGA3D_SHADEMODE_MAX
1057 } SVGA3dShadeMode;
1058 
1059 typedef
1060 #include "vmware_pack_begin.h"
1061 union {
1062    struct {
1063       uint16 repeat;
1064       uint16 pattern;
1065    };
1066    uint32 uintValue;
1067 }
1068 #include "vmware_pack_end.h"
1069 SVGA3dLinePattern;
1070 
1071 typedef enum {
1072    SVGA3D_BLENDOP_INVALID             = 0,
1073    SVGA3D_BLENDOP_MIN                 = 1,
1074    SVGA3D_BLENDOP_ZERO                = 1,
1075    SVGA3D_BLENDOP_ONE                 = 2,
1076    SVGA3D_BLENDOP_SRCCOLOR            = 3,
1077    SVGA3D_BLENDOP_INVSRCCOLOR         = 4,
1078    SVGA3D_BLENDOP_SRCALPHA            = 5,
1079    SVGA3D_BLENDOP_INVSRCALPHA         = 6,
1080    SVGA3D_BLENDOP_DESTALPHA           = 7,
1081    SVGA3D_BLENDOP_INVDESTALPHA        = 8,
1082    SVGA3D_BLENDOP_DESTCOLOR           = 9,
1083    SVGA3D_BLENDOP_INVDESTCOLOR        = 10,
1084    SVGA3D_BLENDOP_SRCALPHASAT         = 11,
1085    SVGA3D_BLENDOP_BLENDFACTOR         = 12,
1086    SVGA3D_BLENDOP_INVBLENDFACTOR      = 13,
1087    SVGA3D_BLENDOP_SRC1COLOR           = 14,
1088    SVGA3D_BLENDOP_INVSRC1COLOR        = 15,
1089    SVGA3D_BLENDOP_SRC1ALPHA           = 16,
1090    SVGA3D_BLENDOP_INVSRC1ALPHA        = 17,
1091    SVGA3D_BLENDOP_BLENDFACTORALPHA    = 18,
1092    SVGA3D_BLENDOP_INVBLENDFACTORALPHA = 19,
1093    SVGA3D_BLENDOP_MAX
1094 } SVGA3dBlendOp;
1095 
1096 typedef enum {
1097    SVGA3D_BLENDEQ_INVALID            = 0,
1098    SVGA3D_BLENDEQ_MIN                = 1,
1099    SVGA3D_BLENDEQ_ADD                = 1,
1100    SVGA3D_BLENDEQ_SUBTRACT           = 2,
1101    SVGA3D_BLENDEQ_REVSUBTRACT        = 3,
1102    SVGA3D_BLENDEQ_MINIMUM            = 4,
1103    SVGA3D_BLENDEQ_MAXIMUM            = 5,
1104    SVGA3D_BLENDEQ_MAX
1105 } SVGA3dBlendEquation;
1106 
1107 typedef enum {
1108    SVGA3D_DX11_LOGICOP_MIN           = 0,
1109    SVGA3D_DX11_LOGICOP_CLEAR         = 0,
1110    SVGA3D_DX11_LOGICOP_SET           = 1,
1111    SVGA3D_DX11_LOGICOP_COPY          = 2,
1112    SVGA3D_DX11_LOGICOP_COPY_INVERTED = 3,
1113    SVGA3D_DX11_LOGICOP_NOOP          = 4,
1114    SVGA3D_DX11_LOGICOP_INVERT        = 5,
1115    SVGA3D_DX11_LOGICOP_AND           = 6,
1116    SVGA3D_DX11_LOGICOP_NAND          = 7,
1117    SVGA3D_DX11_LOGICOP_OR            = 8,
1118    SVGA3D_DX11_LOGICOP_NOR           = 9,
1119    SVGA3D_DX11_LOGICOP_XOR           = 10,
1120    SVGA3D_DX11_LOGICOP_EQUIV         = 11,
1121    SVGA3D_DX11_LOGICOP_AND_REVERSE   = 12,
1122    SVGA3D_DX11_LOGICOP_AND_INVERTED  = 13,
1123    SVGA3D_DX11_LOGICOP_OR_REVERSE    = 14,
1124    SVGA3D_DX11_LOGICOP_OR_INVERTED   = 15,
1125    SVGA3D_DX11_LOGICOP_MAX
1126 } SVGA3dDX11LogicOp;
1127 
1128 typedef enum {
1129    SVGA3D_FRONTWINDING_INVALID = 0,
1130    SVGA3D_FRONTWINDING_CW      = 1,
1131    SVGA3D_FRONTWINDING_CCW     = 2,
1132    SVGA3D_FRONTWINDING_MAX
1133 } SVGA3dFrontWinding;
1134 
1135 typedef enum {
1136    SVGA3D_FACE_INVALID  = 0,
1137    SVGA3D_FACE_NONE     = 1,
1138    SVGA3D_FACE_MIN      = 1,
1139    SVGA3D_FACE_FRONT    = 2,
1140    SVGA3D_FACE_BACK     = 3,
1141    SVGA3D_FACE_FRONT_BACK = 4,
1142    SVGA3D_FACE_MAX
1143 } SVGA3dFace;
1144 
1145 /*
1146  * The order and the values should not be changed
1147  */
1148 
1149 typedef enum {
1150    SVGA3D_CMP_INVALID              = 0,
1151    SVGA3D_CMP_NEVER                = 1,
1152    SVGA3D_CMP_LESS                 = 2,
1153    SVGA3D_CMP_EQUAL                = 3,
1154    SVGA3D_CMP_LESSEQUAL            = 4,
1155    SVGA3D_CMP_GREATER              = 5,
1156    SVGA3D_CMP_NOTEQUAL             = 6,
1157    SVGA3D_CMP_GREATEREQUAL         = 7,
1158    SVGA3D_CMP_ALWAYS               = 8,
1159    SVGA3D_CMP_MAX
1160 } SVGA3dCmpFunc;
1161 
1162 /*
1163  * SVGA3D_FOGFUNC_* specifies the fog equation, or PER_VERTEX which allows
1164  * the fog factor to be specified in the alpha component of the specular
1165  * (a.k.a. secondary) vertex color.
1166  */
1167 typedef enum {
1168    SVGA3D_FOGFUNC_INVALID          = 0,
1169    SVGA3D_FOGFUNC_EXP              = 1,
1170    SVGA3D_FOGFUNC_EXP2             = 2,
1171    SVGA3D_FOGFUNC_LINEAR           = 3,
1172    SVGA3D_FOGFUNC_PER_VERTEX       = 4
1173 } SVGA3dFogFunction;
1174 
1175 /*
1176  * SVGA3D_FOGTYPE_* specifies if fog factors are computed on a per-vertex
1177  * or per-pixel basis.
1178  */
1179 typedef enum {
1180    SVGA3D_FOGTYPE_INVALID          = 0,
1181    SVGA3D_FOGTYPE_VERTEX           = 1,
1182    SVGA3D_FOGTYPE_PIXEL            = 2,
1183    SVGA3D_FOGTYPE_MAX              = 3
1184 } SVGA3dFogType;
1185 
1186 /*
1187  * SVGA3D_FOGBASE_* selects depth or range-based fog. Depth-based fog is
1188  * computed using the eye Z value of each pixel (or vertex), whereas range-
1189  * based fog is computed using the actual distance (range) to the eye.
1190  */
1191 typedef enum {
1192    SVGA3D_FOGBASE_INVALID          = 0,
1193    SVGA3D_FOGBASE_DEPTHBASED       = 1,
1194    SVGA3D_FOGBASE_RANGEBASED       = 2,
1195    SVGA3D_FOGBASE_MAX              = 3
1196 } SVGA3dFogBase;
1197 
1198 typedef enum {
1199    SVGA3D_STENCILOP_INVALID        = 0,
1200    SVGA3D_STENCILOP_MIN            = 1,
1201    SVGA3D_STENCILOP_KEEP           = 1,
1202    SVGA3D_STENCILOP_ZERO           = 2,
1203    SVGA3D_STENCILOP_REPLACE        = 3,
1204    SVGA3D_STENCILOP_INCRSAT        = 4,
1205    SVGA3D_STENCILOP_DECRSAT        = 5,
1206    SVGA3D_STENCILOP_INVERT         = 6,
1207    SVGA3D_STENCILOP_INCR           = 7,
1208    SVGA3D_STENCILOP_DECR           = 8,
1209    SVGA3D_STENCILOP_MAX
1210 } SVGA3dStencilOp;
1211 
1212 typedef enum {
1213    SVGA3D_CLIPPLANE_0              = (1 << 0),
1214    SVGA3D_CLIPPLANE_1              = (1 << 1),
1215    SVGA3D_CLIPPLANE_2              = (1 << 2),
1216    SVGA3D_CLIPPLANE_3              = (1 << 3),
1217    SVGA3D_CLIPPLANE_4              = (1 << 4),
1218    SVGA3D_CLIPPLANE_5              = (1 << 5),
1219 } SVGA3dClipPlanes;
1220 
1221 typedef enum {
1222    SVGA3D_CLEAR_COLOR              = 0x1,
1223    SVGA3D_CLEAR_DEPTH              = 0x2,
1224    SVGA3D_CLEAR_STENCIL            = 0x4,
1225 
1226    /*
1227     * Hint only, must be used together with SVGA3D_CLEAR_COLOR. If
1228     * SVGA3D_CLEAR_DEPTH or SVGA3D_CLEAR_STENCIL bit is set, this
1229     * bit will be ignored.
1230     */
1231    SVGA3D_CLEAR_COLORFILL          = 0x8
1232 } SVGA3dClearFlag;
1233 
1234 typedef enum {
1235    SVGA3D_RT_DEPTH                 = 0,
1236    SVGA3D_RT_MIN                   = 0,
1237    SVGA3D_RT_STENCIL               = 1,
1238    SVGA3D_RT_COLOR0                = 2,
1239    SVGA3D_RT_COLOR1                = 3,
1240    SVGA3D_RT_COLOR2                = 4,
1241    SVGA3D_RT_COLOR3                = 5,
1242    SVGA3D_RT_COLOR4                = 6,
1243    SVGA3D_RT_COLOR5                = 7,
1244    SVGA3D_RT_COLOR6                = 8,
1245    SVGA3D_RT_COLOR7                = 9,
1246    SVGA3D_RT_MAX,
1247    SVGA3D_RT_INVALID               = ((uint32)-1),
1248 } SVGA3dRenderTargetType;
1249 
1250 #define SVGA3D_MAX_RT_COLOR (SVGA3D_RT_COLOR7 - SVGA3D_RT_COLOR0 + 1)
1251 
1252 typedef
1253 #include "vmware_pack_begin.h"
1254 union {
1255    struct {
1256       uint32  red   : 1;
1257       uint32  green : 1;
1258       uint32  blue  : 1;
1259       uint32  alpha : 1;
1260    };
1261    uint32 uintValue;
1262 }
1263 #include "vmware_pack_end.h"
1264 SVGA3dColorMask;
1265 
1266 typedef enum {
1267    SVGA3D_VBLEND_DISABLE            = 0,
1268    SVGA3D_VBLEND_1WEIGHT            = 1,
1269    SVGA3D_VBLEND_2WEIGHT            = 2,
1270    SVGA3D_VBLEND_3WEIGHT            = 3,
1271    SVGA3D_VBLEND_MAX                = 4,
1272 } SVGA3dVertexBlendFlags;
1273 
1274 typedef enum {
1275    SVGA3D_WRAPCOORD_0   = 1 << 0,
1276    SVGA3D_WRAPCOORD_1   = 1 << 1,
1277    SVGA3D_WRAPCOORD_2   = 1 << 2,
1278    SVGA3D_WRAPCOORD_3   = 1 << 3,
1279    SVGA3D_WRAPCOORD_ALL = 0xF,
1280 } SVGA3dWrapFlags;
1281 
1282 /*
1283  * SVGA_3D_CMD_TEXTURESTATE Types.  All value types
1284  * must fit in a uint32.
1285  */
1286 
1287 typedef enum {
1288    SVGA3D_TS_INVALID                    = 0,
1289    SVGA3D_TS_MIN                        = 1,
1290    SVGA3D_TS_BIND_TEXTURE               = 1,    /* SVGA3dSurfaceId */
1291    SVGA3D_TS_COLOROP                    = 2,    /* SVGA3dTextureCombiner */
1292    SVGA3D_TS_COLORARG1                  = 3,    /* SVGA3dTextureArgData */
1293    SVGA3D_TS_COLORARG2                  = 4,    /* SVGA3dTextureArgData */
1294    SVGA3D_TS_ALPHAOP                    = 5,    /* SVGA3dTextureCombiner */
1295    SVGA3D_TS_ALPHAARG1                  = 6,    /* SVGA3dTextureArgData */
1296    SVGA3D_TS_ALPHAARG2                  = 7,    /* SVGA3dTextureArgData */
1297    SVGA3D_TS_ADDRESSU                   = 8,    /* SVGA3dTextureAddress */
1298    SVGA3D_TS_ADDRESSV                   = 9,    /* SVGA3dTextureAddress */
1299    SVGA3D_TS_MIPFILTER                  = 10,   /* SVGA3dTextureFilter */
1300    SVGA3D_TS_MAGFILTER                  = 11,   /* SVGA3dTextureFilter */
1301    SVGA3D_TS_MINFILTER                  = 12,   /* SVGA3dTextureFilter */
1302    SVGA3D_TS_BORDERCOLOR                = 13,   /* SVGA3dColor */
1303    SVGA3D_TS_TEXCOORDINDEX              = 14,   /* uint32 */
1304    SVGA3D_TS_TEXTURETRANSFORMFLAGS      = 15,   /* SVGA3dTexTransformFlags */
1305    SVGA3D_TS_TEXCOORDGEN                = 16,   /* SVGA3dTextureCoordGen */
1306    SVGA3D_TS_BUMPENVMAT00               = 17,   /* float */
1307    SVGA3D_TS_BUMPENVMAT01               = 18,   /* float */
1308    SVGA3D_TS_BUMPENVMAT10               = 19,   /* float */
1309    SVGA3D_TS_BUMPENVMAT11               = 20,   /* float */
1310    SVGA3D_TS_TEXTURE_MIPMAP_LEVEL       = 21,   /* uint32 */
1311    SVGA3D_TS_TEXTURE_LOD_BIAS           = 22,   /* float */
1312    SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL  = 23,   /* uint32 */
1313    SVGA3D_TS_ADDRESSW                   = 24,   /* SVGA3dTextureAddress */
1314 
1315 
1316    /*
1317     * Sampler Gamma Level
1318     *
1319     * Sampler gamma effects the color of samples taken from the sampler.  A
1320     * value of 1.0 will produce linear samples.  If the value is <= 0.0 the
1321     * gamma value is ignored and a linear space is used.
1322     */
1323 
1324    SVGA3D_TS_GAMMA                      = 25,   /* float */
1325    SVGA3D_TS_BUMPENVLSCALE              = 26,   /* float */
1326    SVGA3D_TS_BUMPENVLOFFSET             = 27,   /* float */
1327    SVGA3D_TS_COLORARG0                  = 28,   /* SVGA3dTextureArgData */
1328    SVGA3D_TS_ALPHAARG0                  = 29,   /* SVGA3dTextureArgData */
1329    SVGA3D_TS_PREGB_MAX                  = 30,   /* Max value before GBObjects */
1330    SVGA3D_TS_CONSTANT                   = 30,   /* SVGA3dColor */
1331    SVGA3D_TS_COLOR_KEY_ENABLE           = 31,   /* SVGA3dBool */
1332    SVGA3D_TS_COLOR_KEY                  = 32,   /* SVGA3dColor */
1333    SVGA3D_TS_MAX
1334 } SVGA3dTextureStateName;
1335 
1336 typedef enum {
1337    SVGA3D_TC_INVALID                   = 0,
1338    SVGA3D_TC_DISABLE                   = 1,
1339    SVGA3D_TC_SELECTARG1                = 2,
1340    SVGA3D_TC_SELECTARG2                = 3,
1341    SVGA3D_TC_MODULATE                  = 4,
1342    SVGA3D_TC_ADD                       = 5,
1343    SVGA3D_TC_ADDSIGNED                 = 6,
1344    SVGA3D_TC_SUBTRACT                  = 7,
1345    SVGA3D_TC_BLENDTEXTUREALPHA         = 8,
1346    SVGA3D_TC_BLENDDIFFUSEALPHA         = 9,
1347    SVGA3D_TC_BLENDCURRENTALPHA         = 10,
1348    SVGA3D_TC_BLENDFACTORALPHA          = 11,
1349    SVGA3D_TC_MODULATE2X                = 12,
1350    SVGA3D_TC_MODULATE4X                = 13,
1351    SVGA3D_TC_DSDT                      = 14,
1352    SVGA3D_TC_DOTPRODUCT3               = 15,
1353    SVGA3D_TC_BLENDTEXTUREALPHAPM       = 16,
1354    SVGA3D_TC_ADDSIGNED2X               = 17,
1355    SVGA3D_TC_ADDSMOOTH                 = 18,
1356    SVGA3D_TC_PREMODULATE               = 19,
1357    SVGA3D_TC_MODULATEALPHA_ADDCOLOR    = 20,
1358    SVGA3D_TC_MODULATECOLOR_ADDALPHA    = 21,
1359    SVGA3D_TC_MODULATEINVALPHA_ADDCOLOR = 22,
1360    SVGA3D_TC_MODULATEINVCOLOR_ADDALPHA = 23,
1361    SVGA3D_TC_BUMPENVMAPLUMINANCE       = 24,
1362    SVGA3D_TC_MULTIPLYADD               = 25,
1363    SVGA3D_TC_LERP                      = 26,
1364    SVGA3D_TC_MAX
1365 } SVGA3dTextureCombiner;
1366 
1367 #define SVGA3D_TC_CAP_BIT(svga3d_tc_op) (svga3d_tc_op ? (1 << (svga3d_tc_op - 1)) : 0)
1368 
1369 typedef enum {
1370    SVGA3D_TEX_ADDRESS_INVALID    = 0,
1371    SVGA3D_TEX_ADDRESS_MIN        = 1,
1372    SVGA3D_TEX_ADDRESS_WRAP       = 1,
1373    SVGA3D_TEX_ADDRESS_MIRROR     = 2,
1374    SVGA3D_TEX_ADDRESS_CLAMP      = 3,
1375    SVGA3D_TEX_ADDRESS_BORDER     = 4,
1376    SVGA3D_TEX_ADDRESS_MIRRORONCE = 5,
1377    SVGA3D_TEX_ADDRESS_EDGE       = 6,
1378    SVGA3D_TEX_ADDRESS_MAX
1379 } SVGA3dTextureAddress;
1380 
1381 /*
1382  * SVGA3D_TEX_FILTER_NONE as the minification filter means mipmapping is
1383  * disabled, and the rasterizer should use the magnification filter instead.
1384  */
1385 typedef enum {
1386    SVGA3D_TEX_FILTER_NONE           = 0,
1387    SVGA3D_TEX_FILTER_MIN            = 0,
1388    SVGA3D_TEX_FILTER_NEAREST        = 1,
1389    SVGA3D_TEX_FILTER_LINEAR         = 2,
1390    SVGA3D_TEX_FILTER_ANISOTROPIC    = 3,
1391    SVGA3D_TEX_FILTER_FLATCUBIC      = 4, /* Deprecated, not implemented */
1392    SVGA3D_TEX_FILTER_GAUSSIANCUBIC  = 5, /* Deprecated, not implemented */
1393    SVGA3D_TEX_FILTER_PYRAMIDALQUAD  = 6, /* Not currently implemented */
1394    SVGA3D_TEX_FILTER_GAUSSIANQUAD   = 7, /* Not currently implemented */
1395    SVGA3D_TEX_FILTER_MAX
1396 } SVGA3dTextureFilter;
1397 
1398 typedef enum {
1399    SVGA3D_TEX_TRANSFORM_OFF    = 0,
1400    SVGA3D_TEX_TRANSFORM_S      = (1 << 0),
1401    SVGA3D_TEX_TRANSFORM_T      = (1 << 1),
1402    SVGA3D_TEX_TRANSFORM_R      = (1 << 2),
1403    SVGA3D_TEX_TRANSFORM_Q      = (1 << 3),
1404    SVGA3D_TEX_PROJECTED        = (1 << 15),
1405 } SVGA3dTexTransformFlags;
1406 
1407 typedef enum {
1408    SVGA3D_TEXCOORD_GEN_OFF              = 0,
1409    SVGA3D_TEXCOORD_GEN_EYE_POSITION     = 1,
1410    SVGA3D_TEXCOORD_GEN_EYE_NORMAL       = 2,
1411    SVGA3D_TEXCOORD_GEN_REFLECTIONVECTOR = 3,
1412    SVGA3D_TEXCOORD_GEN_SPHERE           = 4,
1413    SVGA3D_TEXCOORD_GEN_MAX
1414 } SVGA3dTextureCoordGen;
1415 
1416 /*
1417  * Texture argument constants for texture combiner
1418  */
1419 typedef enum {
1420    SVGA3D_TA_INVALID    = 0,
1421    SVGA3D_TA_TFACTOR    = 1,
1422    SVGA3D_TA_PREVIOUS   = 2,
1423    SVGA3D_TA_DIFFUSE    = 3,
1424    SVGA3D_TA_TEXTURE    = 4,
1425    SVGA3D_TA_SPECULAR   = 5,
1426    SVGA3D_TA_CONSTANT   = 6,
1427    SVGA3D_TA_MAX
1428 } SVGA3dTextureArgData;
1429 
1430 #define SVGA3D_TM_MASK_LEN 4
1431 
1432 /* Modifiers for texture argument constants defined above. */
1433 typedef enum {
1434    SVGA3D_TM_NONE       = 0,
1435    SVGA3D_TM_ALPHA      = (1 << SVGA3D_TM_MASK_LEN),
1436    SVGA3D_TM_ONE_MINUS  = (2 << SVGA3D_TM_MASK_LEN),
1437 } SVGA3dTextureArgModifier;
1438 
1439 /*
1440  * Vertex declarations
1441  *
1442  * Notes:
1443  *
1444  * SVGA3D_DECLUSAGE_POSITIONT is for pre-transformed vertices. If you
1445  * draw with any POSITIONT vertex arrays, the programmable vertex
1446  * pipeline will be implicitly disabled. Drawing will take place as if
1447  * no vertex shader was bound.
1448  */
1449 
1450 typedef enum {
1451    SVGA3D_DECLUSAGE_POSITION     = 0,
1452    SVGA3D_DECLUSAGE_BLENDWEIGHT,
1453    SVGA3D_DECLUSAGE_BLENDINDICES,
1454    SVGA3D_DECLUSAGE_NORMAL,
1455    SVGA3D_DECLUSAGE_PSIZE,
1456    SVGA3D_DECLUSAGE_TEXCOORD,
1457    SVGA3D_DECLUSAGE_TANGENT,
1458    SVGA3D_DECLUSAGE_BINORMAL,
1459    SVGA3D_DECLUSAGE_TESSFACTOR,
1460    SVGA3D_DECLUSAGE_POSITIONT,
1461    SVGA3D_DECLUSAGE_COLOR,
1462    SVGA3D_DECLUSAGE_FOG,
1463    SVGA3D_DECLUSAGE_DEPTH,
1464    SVGA3D_DECLUSAGE_SAMPLE,
1465    SVGA3D_DECLUSAGE_MAX
1466 } SVGA3dDeclUsage;
1467 
1468 typedef enum {
1469    SVGA3D_DECLMETHOD_DEFAULT     = 0,
1470    SVGA3D_DECLMETHOD_PARTIALU,
1471    SVGA3D_DECLMETHOD_PARTIALV,
1472    SVGA3D_DECLMETHOD_CROSSUV,          /* Normal */
1473    SVGA3D_DECLMETHOD_UV,
1474    SVGA3D_DECLMETHOD_LOOKUP,           /* Lookup a displacement map */
1475    SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED, /* Lookup a pre-sampled displacement */
1476                                        /* map */
1477 } SVGA3dDeclMethod;
1478 
1479 typedef enum {
1480    SVGA3D_DECLTYPE_FLOAT1        =  0,
1481    SVGA3D_DECLTYPE_FLOAT2        =  1,
1482    SVGA3D_DECLTYPE_FLOAT3        =  2,
1483    SVGA3D_DECLTYPE_FLOAT4        =  3,
1484    SVGA3D_DECLTYPE_D3DCOLOR      =  4,
1485    SVGA3D_DECLTYPE_UBYTE4        =  5,
1486    SVGA3D_DECLTYPE_SHORT2        =  6,
1487    SVGA3D_DECLTYPE_SHORT4        =  7,
1488    SVGA3D_DECLTYPE_UBYTE4N       =  8,
1489    SVGA3D_DECLTYPE_SHORT2N       =  9,
1490    SVGA3D_DECLTYPE_SHORT4N       = 10,
1491    SVGA3D_DECLTYPE_USHORT2N      = 11,
1492    SVGA3D_DECLTYPE_USHORT4N      = 12,
1493    SVGA3D_DECLTYPE_UDEC3         = 13,
1494    SVGA3D_DECLTYPE_DEC3N         = 14,
1495    SVGA3D_DECLTYPE_FLOAT16_2     = 15,
1496    SVGA3D_DECLTYPE_FLOAT16_4     = 16,
1497    SVGA3D_DECLTYPE_MAX,
1498 } SVGA3dDeclType;
1499 
1500 /*
1501  * This structure is used for the divisor for geometry instancing;
1502  * it's a direct translation of the Direct3D equivalent.
1503  */
1504 typedef union {
1505    struct {
1506       /*
1507        * For index data, this number represents the number of instances to draw.
1508        * For instance data, this number represents the number of
1509        * instances/vertex in this stream
1510        */
1511       uint32 count : 30;
1512 
1513       /*
1514        * This is 1 if this is supposed to be the data that is repeated for
1515        * every instance.
1516        */
1517       uint32 indexedData : 1;
1518 
1519       /*
1520        * This is 1 if this is supposed to be the per-instance data.
1521        */
1522       uint32 instanceData : 1;
1523    };
1524 
1525    uint32 value;
1526 } SVGA3dVertexDivisor;
1527 
1528 typedef enum {
1529    /*
1530     * SVGA3D_PRIMITIVE_INVALID is a valid primitive type.
1531     *
1532     * List MIN second so debuggers will think INVALID is
1533     * the correct name.
1534     */
1535    SVGA3D_PRIMITIVE_INVALID                     = 0,
1536    SVGA3D_PRIMITIVE_MIN                         = 0,
1537    SVGA3D_PRIMITIVE_TRIANGLELIST                = 1,
1538    SVGA3D_PRIMITIVE_POINTLIST                   = 2,
1539    SVGA3D_PRIMITIVE_LINELIST                    = 3,
1540    SVGA3D_PRIMITIVE_LINESTRIP                   = 4,
1541    SVGA3D_PRIMITIVE_TRIANGLESTRIP               = 5,
1542    SVGA3D_PRIMITIVE_TRIANGLEFAN                 = 6,
1543    SVGA3D_PRIMITIVE_LINELIST_ADJ                = 7,
1544    SVGA3D_PRIMITIVE_PREDX_MAX                   = 7,
1545    SVGA3D_PRIMITIVE_LINESTRIP_ADJ               = 8,
1546    SVGA3D_PRIMITIVE_TRIANGLELIST_ADJ            = 9,
1547    SVGA3D_PRIMITIVE_TRIANGLESTRIP_ADJ           = 10,
1548    SVGA3D_PRIMITIVE_DX10_MAX                    = 11,
1549    SVGA3D_PRIMITIVE_1_CONTROL_POINT_PATCH       = 11,
1550    SVGA3D_PRIMITIVE_2_CONTROL_POINT_PATCH       = 12,
1551    SVGA3D_PRIMITIVE_3_CONTROL_POINT_PATCH       = 13,
1552    SVGA3D_PRIMITIVE_4_CONTROL_POINT_PATCH       = 14,
1553    SVGA3D_PRIMITIVE_5_CONTROL_POINT_PATCH       = 15,
1554    SVGA3D_PRIMITIVE_6_CONTROL_POINT_PATCH       = 16,
1555    SVGA3D_PRIMITIVE_7_CONTROL_POINT_PATCH       = 17,
1556    SVGA3D_PRIMITIVE_8_CONTROL_POINT_PATCH       = 18,
1557    SVGA3D_PRIMITIVE_9_CONTROL_POINT_PATCH       = 19,
1558    SVGA3D_PRIMITIVE_10_CONTROL_POINT_PATCH      = 20,
1559    SVGA3D_PRIMITIVE_11_CONTROL_POINT_PATCH      = 21,
1560    SVGA3D_PRIMITIVE_12_CONTROL_POINT_PATCH      = 22,
1561    SVGA3D_PRIMITIVE_13_CONTROL_POINT_PATCH      = 23,
1562    SVGA3D_PRIMITIVE_14_CONTROL_POINT_PATCH      = 24,
1563    SVGA3D_PRIMITIVE_15_CONTROL_POINT_PATCH      = 25,
1564    SVGA3D_PRIMITIVE_16_CONTROL_POINT_PATCH      = 26,
1565    SVGA3D_PRIMITIVE_17_CONTROL_POINT_PATCH      = 27,
1566    SVGA3D_PRIMITIVE_18_CONTROL_POINT_PATCH      = 28,
1567    SVGA3D_PRIMITIVE_19_CONTROL_POINT_PATCH      = 29,
1568    SVGA3D_PRIMITIVE_20_CONTROL_POINT_PATCH      = 30,
1569    SVGA3D_PRIMITIVE_21_CONTROL_POINT_PATCH      = 31,
1570    SVGA3D_PRIMITIVE_22_CONTROL_POINT_PATCH      = 32,
1571    SVGA3D_PRIMITIVE_23_CONTROL_POINT_PATCH      = 33,
1572    SVGA3D_PRIMITIVE_24_CONTROL_POINT_PATCH      = 34,
1573    SVGA3D_PRIMITIVE_25_CONTROL_POINT_PATCH      = 35,
1574    SVGA3D_PRIMITIVE_26_CONTROL_POINT_PATCH      = 36,
1575    SVGA3D_PRIMITIVE_27_CONTROL_POINT_PATCH      = 37,
1576    SVGA3D_PRIMITIVE_28_CONTROL_POINT_PATCH      = 38,
1577    SVGA3D_PRIMITIVE_29_CONTROL_POINT_PATCH      = 39,
1578    SVGA3D_PRIMITIVE_30_CONTROL_POINT_PATCH      = 40,
1579    SVGA3D_PRIMITIVE_31_CONTROL_POINT_PATCH      = 41,
1580    SVGA3D_PRIMITIVE_32_CONTROL_POINT_PATCH      = 42,
1581    SVGA3D_PRIMITIVE_MAX                         = 43
1582 } SVGA3dPrimitiveType;
1583 
1584 typedef enum {
1585    SVGA3D_COORDINATE_INVALID                   = 0,
1586    SVGA3D_COORDINATE_LEFTHANDED                = 1,
1587    SVGA3D_COORDINATE_RIGHTHANDED               = 2,
1588    SVGA3D_COORDINATE_MAX
1589 } SVGA3dCoordinateType;
1590 
1591 typedef enum {
1592    SVGA3D_TRANSFORM_INVALID                     = 0,
1593    SVGA3D_TRANSFORM_WORLD                       = 1,
1594    SVGA3D_TRANSFORM_MIN                         = 1,
1595    SVGA3D_TRANSFORM_VIEW                        = 2,
1596    SVGA3D_TRANSFORM_PROJECTION                  = 3,
1597    SVGA3D_TRANSFORM_TEXTURE0                    = 4,
1598    SVGA3D_TRANSFORM_TEXTURE1                    = 5,
1599    SVGA3D_TRANSFORM_TEXTURE2                    = 6,
1600    SVGA3D_TRANSFORM_TEXTURE3                    = 7,
1601    SVGA3D_TRANSFORM_TEXTURE4                    = 8,
1602    SVGA3D_TRANSFORM_TEXTURE5                    = 9,
1603    SVGA3D_TRANSFORM_TEXTURE6                    = 10,
1604    SVGA3D_TRANSFORM_TEXTURE7                    = 11,
1605    SVGA3D_TRANSFORM_WORLD1                      = 12,
1606    SVGA3D_TRANSFORM_WORLD2                      = 13,
1607    SVGA3D_TRANSFORM_WORLD3                      = 14,
1608    SVGA3D_TRANSFORM_MAX
1609 } SVGA3dTransformType;
1610 
1611 typedef enum {
1612    SVGA3D_LIGHTTYPE_INVALID                     = 0,
1613    SVGA3D_LIGHTTYPE_MIN                         = 1,
1614    SVGA3D_LIGHTTYPE_POINT                       = 1,
1615    SVGA3D_LIGHTTYPE_SPOT1                       = 2, /* 1-cone, in degrees */
1616    SVGA3D_LIGHTTYPE_SPOT2                       = 3, /* 2-cone, in radians */
1617    SVGA3D_LIGHTTYPE_DIRECTIONAL                 = 4,
1618    SVGA3D_LIGHTTYPE_MAX
1619 } SVGA3dLightType;
1620 
1621 typedef enum {
1622    SVGA3D_CUBEFACE_POSX                         = 0,
1623    SVGA3D_CUBEFACE_NEGX                         = 1,
1624    SVGA3D_CUBEFACE_POSY                         = 2,
1625    SVGA3D_CUBEFACE_NEGY                         = 3,
1626    SVGA3D_CUBEFACE_POSZ                         = 4,
1627    SVGA3D_CUBEFACE_NEGZ                         = 5,
1628 } SVGA3dCubeFace;
1629 
1630 typedef enum {
1631    SVGA3D_SHADERTYPE_INVALID                    = 0,
1632    SVGA3D_SHADERTYPE_MIN                        = 1,
1633    SVGA3D_SHADERTYPE_VS                         = 1,
1634    SVGA3D_SHADERTYPE_PS                         = 2,
1635    SVGA3D_SHADERTYPE_PREDX_MAX                  = 3,
1636    SVGA3D_SHADERTYPE_GS                         = 3,
1637    SVGA3D_SHADERTYPE_DX10_MAX                   = 4,
1638    SVGA3D_SHADERTYPE_HS                         = 4,
1639    SVGA3D_SHADERTYPE_DS                         = 5,
1640    SVGA3D_SHADERTYPE_CS                         = 6,
1641    SVGA3D_SHADERTYPE_MAX                        = 7
1642 } SVGA3dShaderType;
1643 
1644 #define SVGA3D_NUM_SHADERTYPE_PREDX \
1645    (SVGA3D_SHADERTYPE_PREDX_MAX - SVGA3D_SHADERTYPE_MIN)
1646 
1647 #define SVGA3D_NUM_SHADERTYPE_DX10 \
1648    (SVGA3D_SHADERTYPE_DX10_MAX - SVGA3D_SHADERTYPE_MIN)
1649 
1650 #define SVGA3D_NUM_SHADERTYPE \
1651    (SVGA3D_SHADERTYPE_MAX - SVGA3D_SHADERTYPE_MIN)
1652 
1653 typedef enum {
1654    SVGA3D_CONST_TYPE_MIN                        = 0,
1655    SVGA3D_CONST_TYPE_FLOAT                      = 0,
1656    SVGA3D_CONST_TYPE_INT                        = 1,
1657    SVGA3D_CONST_TYPE_BOOL                       = 2,
1658    SVGA3D_CONST_TYPE_MAX                        = 3,
1659 } SVGA3dShaderConstType;
1660 
1661 /*
1662  * Register limits for shader consts.
1663  */
1664 #define SVGA3D_CONSTREG_MAX            256
1665 #define SVGA3D_CONSTINTREG_MAX         16
1666 #define SVGA3D_CONSTBOOLREG_MAX        16
1667 
1668 typedef enum {
1669    SVGA3D_STRETCH_BLT_POINT                     = 0,
1670    SVGA3D_STRETCH_BLT_LINEAR                    = 1,
1671    SVGA3D_STRETCH_BLT_MAX
1672 } SVGA3dStretchBltMode;
1673 
1674 typedef enum {
1675    SVGA3D_QUERYTYPE_INVALID                     = ((uint8)-1),
1676    SVGA3D_QUERYTYPE_MIN                         = 0,
1677    SVGA3D_QUERYTYPE_OCCLUSION                   = 0,
1678    SVGA3D_QUERYTYPE_TIMESTAMP                   = 1,
1679    SVGA3D_QUERYTYPE_TIMESTAMPDISJOINT           = 2,
1680    SVGA3D_QUERYTYPE_PIPELINESTATS               = 3,
1681    SVGA3D_QUERYTYPE_OCCLUSIONPREDICATE          = 4,
1682    SVGA3D_QUERYTYPE_STREAMOUTPUTSTATS           = 5,
1683    SVGA3D_QUERYTYPE_STREAMOVERFLOWPREDICATE     = 6,
1684    SVGA3D_QUERYTYPE_OCCLUSION64                 = 7,
1685    SVGA3D_QUERYTYPE_DX10_MAX                    = 8,
1686    SVGA3D_QUERYTYPE_SOSTATS_STREAM0             = 8,
1687    SVGA3D_QUERYTYPE_SOSTATS_STREAM1             = 9,
1688    SVGA3D_QUERYTYPE_SOSTATS_STREAM2             = 10,
1689    SVGA3D_QUERYTYPE_SOSTATS_STREAM3             = 11,
1690    SVGA3D_QUERYTYPE_SOP_STREAM0                 = 12,
1691    SVGA3D_QUERYTYPE_SOP_STREAM1                 = 13,
1692    SVGA3D_QUERYTYPE_SOP_STREAM2                 = 14,
1693    SVGA3D_QUERYTYPE_SOP_STREAM3                 = 15,
1694    SVGA3D_QUERYTYPE_MAX
1695 } SVGA3dQueryType;
1696 
1697 typedef uint8 SVGA3dQueryTypeUint8;
1698 
1699 #define SVGA3D_NUM_QUERYTYPE  (SVGA3D_QUERYTYPE_MAX - SVGA3D_QUERYTYPE_MIN)
1700 
1701 /*
1702  * This is the maximum number of queries per context that can be active
1703  * simultaneously between a beginQuery and endQuery.
1704  */
1705 #define SVGA3D_MAX_QUERY 64
1706 
1707 /*
1708  * Query result buffer formats
1709  */
1710 typedef
1711 #include "vmware_pack_begin.h"
1712 struct {
1713    uint32 samplesRendered;
1714 }
1715 #include "vmware_pack_end.h"
1716 SVGADXOcclusionQueryResult;
1717 
1718 typedef
1719 #include "vmware_pack_begin.h"
1720 struct {
1721    uint32 passed;
1722 }
1723 #include "vmware_pack_end.h"
1724 SVGADXEventQueryResult;
1725 
1726 typedef
1727 #include "vmware_pack_begin.h"
1728 struct {
1729    uint64 timestamp;
1730 }
1731 #include "vmware_pack_end.h"
1732 SVGADXTimestampQueryResult;
1733 
1734 typedef
1735 #include "vmware_pack_begin.h"
1736 struct {
1737    uint64 realFrequency;
1738    uint32 disjoint;
1739 }
1740 #include "vmware_pack_end.h"
1741 SVGADXTimestampDisjointQueryResult;
1742 
1743 typedef
1744 #include "vmware_pack_begin.h"
1745 struct {
1746    uint64 inputAssemblyVertices;
1747    uint64 inputAssemblyPrimitives;
1748    uint64 vertexShaderInvocations;
1749    uint64 geometryShaderInvocations;
1750    uint64 geometryShaderPrimitives;
1751    uint64 clipperInvocations;
1752    uint64 clipperPrimitives;
1753    uint64 pixelShaderInvocations;
1754    uint64 hullShaderInvocations;
1755    uint64 domainShaderInvocations;
1756    uint64 computeShaderInvocations;
1757 }
1758 #include "vmware_pack_end.h"
1759 SVGADXPipelineStatisticsQueryResult;
1760 
1761 typedef
1762 #include "vmware_pack_begin.h"
1763 struct {
1764    uint32 anySamplesRendered;
1765 }
1766 #include "vmware_pack_end.h"
1767 SVGADXOcclusionPredicateQueryResult;
1768 
1769 typedef
1770 #include "vmware_pack_begin.h"
1771 struct {
1772    uint64 numPrimitivesWritten;
1773    uint64 numPrimitivesRequired;
1774 }
1775 #include "vmware_pack_end.h"
1776 SVGADXStreamOutStatisticsQueryResult;
1777 
1778 typedef
1779 #include "vmware_pack_begin.h"
1780 struct {
1781    uint32 overflowed;
1782 }
1783 #include "vmware_pack_end.h"
1784 SVGADXStreamOutPredicateQueryResult;
1785 
1786 typedef
1787 #include "vmware_pack_begin.h"
1788 struct {
1789    uint64 samplesRendered;
1790 }
1791 #include "vmware_pack_end.h"
1792 SVGADXOcclusion64QueryResult;
1793 
1794 /*
1795  * SVGADXQueryResultUnion is not intended for use in the protocol, but is
1796  * very helpful when working with queries generically.
1797  */
1798 typedef
1799 #include "vmware_pack_begin.h"
1800 union SVGADXQueryResultUnion {
1801    SVGADXOcclusionQueryResult occ;
1802    SVGADXEventQueryResult event;
1803    SVGADXTimestampQueryResult ts;
1804    SVGADXTimestampDisjointQueryResult tsDisjoint;
1805    SVGADXPipelineStatisticsQueryResult pipelineStats;
1806    SVGADXOcclusionPredicateQueryResult occPred;
1807    SVGADXStreamOutStatisticsQueryResult soStats;
1808    SVGADXStreamOutPredicateQueryResult soPred;
1809    SVGADXOcclusion64QueryResult occ64;
1810 }
1811 #include "vmware_pack_end.h"
1812 SVGADXQueryResultUnion;
1813 
1814 typedef enum {
1815    SVGA3D_QUERYSTATE_PENDING     = 0,      /* Query is not finished yet */
1816    SVGA3D_QUERYSTATE_SUCCEEDED   = 1,      /* Completed successfully */
1817    SVGA3D_QUERYSTATE_FAILED      = 2,      /* Completed unsuccessfully */
1818    SVGA3D_QUERYSTATE_NEW         = 3,      /* Never submitted (guest only) */
1819 } SVGA3dQueryState;
1820 
1821 typedef enum {
1822    SVGA3D_WRITE_HOST_VRAM        = 1,
1823    SVGA3D_READ_HOST_VRAM         = 2,
1824 } SVGA3dTransferType;
1825 
1826 #define SVGA3D_LOGICOP_INVALID  0
1827 #define SVGA3D_LOGICOP_MIN      1
1828 #define SVGA3D_LOGICOP_COPY     1
1829 #define SVGA3D_LOGICOP_NOT      2
1830 #define SVGA3D_LOGICOP_AND      3
1831 #define SVGA3D_LOGICOP_OR       4
1832 #define SVGA3D_LOGICOP_XOR      5
1833 #define SVGA3D_LOGICOP_NXOR     6
1834 #define SVGA3D_LOGICOP_ROP3     7
1835 #define SVGA3D_LOGICOP_MAX      8
1836 
1837 typedef uint16 SVGA3dLogicOp;
1838 
1839 #define SVGA3D_LOGICOP_ROP3_INVALID ((uint16) -1)
1840 #define SVGA3D_LOGICOP_ROP3_MIN     0
1841 #define SVGA3D_LOGICOP_ROP3_MAX     256
1842 
1843 typedef uint16 SVGA3dLogicOpRop3;
1844 
1845 typedef
1846 #include "vmware_pack_begin.h"
1847 struct {
1848    union {
1849       struct {
1850          uint16  function;       // SVGA3dFogFunction
1851          uint8   type;           // SVGA3dFogType
1852          uint8   base;           // SVGA3dFogBase
1853       };
1854       uint32     uintValue;
1855    };
1856 }
1857 #include "vmware_pack_end.h"
1858 SVGA3dFogMode;
1859 
1860 /*
1861  * Uniquely identify one image (a 1D/2D/3D array) from a surface. This
1862  * is a surface ID as well as face/mipmap indices.
1863  */
1864 typedef
1865 #include "vmware_pack_begin.h"
1866 struct SVGA3dSurfaceImageId {
1867    uint32 sid;
1868    uint32 face;
1869    uint32 mipmap;
1870 }
1871 #include "vmware_pack_end.h"
1872 SVGA3dSurfaceImageId;
1873 
1874 typedef
1875 #include "vmware_pack_begin.h"
1876 struct SVGA3dSubSurfaceId {
1877    uint32 sid;
1878    uint32 subResourceId;
1879 }
1880 #include "vmware_pack_end.h"
1881 SVGA3dSubSurfaceId;
1882 
1883 typedef
1884 #include "vmware_pack_begin.h"
1885 struct {
1886    uint32               width;
1887    uint32               height;
1888    uint32               depth;
1889 }
1890 #include "vmware_pack_end.h"
1891 SVGA3dSize;
1892 
1893 /*
1894  * Guest-backed objects definitions.
1895  */
1896 typedef enum {
1897    SVGA_OTABLE_MOB             = 0,
1898    SVGA_OTABLE_MIN             = 0,
1899    SVGA_OTABLE_SURFACE         = 1,
1900    SVGA_OTABLE_CONTEXT         = 2,
1901    SVGA_OTABLE_SHADER          = 3,
1902    SVGA_OTABLE_SCREENTARGET    = 4,
1903 
1904    SVGA_OTABLE_DX9_MAX         = 5,
1905 
1906    SVGA_OTABLE_DXCONTEXT       = 5,
1907    SVGA_OTABLE_DX_MAX          = 6,
1908 
1909    SVGA_OTABLE_RESERVED1       = 6,
1910    SVGA_OTABLE_RESERVED2       = 7,
1911 
1912    /*
1913     * Additions to this table need to be tied to HW-version features and
1914     * checkpointed accordingly.
1915     */
1916    SVGA_OTABLE_DEVEL_MAX       = 8,
1917    SVGA_OTABLE_MAX             = 8
1918 } SVGAOTableType;
1919 
1920 typedef enum {
1921    SVGA_COTABLE_MIN             = 0,
1922    SVGA_COTABLE_RTVIEW          = 0,
1923    SVGA_COTABLE_DSVIEW          = 1,
1924    SVGA_COTABLE_SRVIEW          = 2,
1925    SVGA_COTABLE_ELEMENTLAYOUT   = 3,
1926    SVGA_COTABLE_BLENDSTATE      = 4,
1927    SVGA_COTABLE_DEPTHSTENCIL    = 5,
1928    SVGA_COTABLE_RASTERIZERSTATE = 6,
1929    SVGA_COTABLE_SAMPLER         = 7,
1930    SVGA_COTABLE_STREAMOUTPUT    = 8,
1931    SVGA_COTABLE_DXQUERY         = 9,
1932    SVGA_COTABLE_DXSHADER        = 10,
1933    SVGA_COTABLE_DX10_MAX        = 11,
1934    SVGA_COTABLE_UAVIEW          = 11,
1935    SVGA_COTABLE_MAX             = 12,
1936 } SVGACOTableType;
1937 
1938 /*
1939  * The largest size (number of entries) allowed in a COTable.
1940  */
1941 #define SVGA_COTABLE_MAX_IDS (MAX_UINT16 - 2)
1942 
1943 typedef enum SVGAMobFormat {
1944    SVGA3D_MOBFMT_INVALID     = SVGA3D_INVALID_ID,
1945    SVGA3D_MOBFMT_PTDEPTH_0   = 0,
1946    SVGA3D_MOBFMT_MIN         = 0,
1947    SVGA3D_MOBFMT_PTDEPTH_1   = 1,
1948    SVGA3D_MOBFMT_PTDEPTH_2   = 2,
1949    SVGA3D_MOBFMT_RANGE       = 3,
1950    SVGA3D_MOBFMT_PTDEPTH64_0 = 4,
1951    SVGA3D_MOBFMT_PTDEPTH64_1 = 5,
1952    SVGA3D_MOBFMT_PTDEPTH64_2 = 6,
1953    SVGA3D_MOBFMT_PREDX_MAX   = 7,
1954    SVGA3D_MOBFMT_EMPTY       = 7,
1955    SVGA3D_MOBFMT_MAX,
1956 
1957    /*
1958     * This isn't actually used by the guest, but is a mob-format used
1959     * internally by the SVGA device (and is therefore not binary compatible).
1960     */
1961    SVGA3D_MOBFMT_HB,
1962 } SVGAMobFormat;
1963 
1964 #define SVGA3D_MOB_EMPTY_BASE 1
1965 
1966 /*
1967  * Multisample pattern types.
1968  */
1969 
1970 typedef enum SVGA3dMSPattern {
1971    SVGA3D_MS_PATTERN_NONE     = 0,
1972    SVGA3D_MS_PATTERN_MIN      = 0,
1973    SVGA3D_MS_PATTERN_STANDARD = 1,
1974    SVGA3D_MS_PATTERN_CENTER   = 2,
1975    SVGA3D_MS_PATTERN_MAX      = 3,
1976 } SVGA3dMSPattern;
1977 
1978 /*
1979  * Precision settings for each sample.
1980  */
1981 
1982 typedef enum SVGA3dMSQualityLevel {
1983    SVGA3D_MS_QUALITY_NONE = 0,
1984    SVGA3D_MS_QUALITY_MIN  = 0,
1985    SVGA3D_MS_QUALITY_FULL = 1,
1986    SVGA3D_MS_QUALITY_MAX  = 2,
1987 } SVGA3dMSQualityLevel;
1988 
1989 /*
1990  * Screen Target Update Flags
1991  */
1992 
1993 typedef enum SVGA3dFrameUpdateType {
1994    SVGA3D_FRAME_END     = 0,
1995    SVGA3D_FRAME_PARTIAL = 1,
1996    SVGA3D_FRAME_UNKNOWN = 2,
1997    SVGA3D_FRAME_MAX     = 3,
1998 } SVGA3dFrameUpdateType;
1999 
2000 #endif /* _SVGA3D_TYPES_H_ */
2001