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