PageRenderTime 62ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/gpu/drm/vmwgfx/svga3d_reg.h

https://bitbucket.org/cresqo/cm7-p500-kernel
C Header | 1793 lines | 1112 code | 196 blank | 485 comment | 0 complexity | 552a390750e7a4f8018faf28bf2f6437 MD5 | raw file
Possible License(s): LGPL-2.0, AGPL-1.0, GPL-2.0
  1. /**********************************************************
  2. * Copyright 1998-2009 VMware, Inc. All rights reserved.
  3. *
  4. * Permission is hereby granted, free of charge, to any person
  5. * obtaining a copy of this software and associated documentation
  6. * files (the "Software"), to deal in the Software without
  7. * restriction, including without limitation the rights to use, copy,
  8. * modify, merge, publish, distribute, sublicense, and/or sell copies
  9. * of the Software, and to permit persons to whom the Software is
  10. * furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be
  13. * included in all copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  19. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  20. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  22. * SOFTWARE.
  23. *
  24. **********************************************************/
  25. /*
  26. * svga3d_reg.h --
  27. *
  28. * SVGA 3D hardware definitions
  29. */
  30. #ifndef _SVGA3D_REG_H_
  31. #define _SVGA3D_REG_H_
  32. #include "svga_reg.h"
  33. /*
  34. * 3D Hardware Version
  35. *
  36. * The hardware version is stored in the SVGA_FIFO_3D_HWVERSION fifo
  37. * register. Is set by the host and read by the guest. This lets
  38. * us make new guest drivers which are backwards-compatible with old
  39. * SVGA hardware revisions. It does not let us support old guest
  40. * drivers. Good enough for now.
  41. *
  42. */
  43. #define SVGA3D_MAKE_HWVERSION(major, minor) (((major) << 16) | ((minor) & 0xFF))
  44. #define SVGA3D_MAJOR_HWVERSION(version) ((version) >> 16)
  45. #define SVGA3D_MINOR_HWVERSION(version) ((version) & 0xFF)
  46. typedef enum {
  47. SVGA3D_HWVERSION_WS5_RC1 = SVGA3D_MAKE_HWVERSION(0, 1),
  48. SVGA3D_HWVERSION_WS5_RC2 = SVGA3D_MAKE_HWVERSION(0, 2),
  49. SVGA3D_HWVERSION_WS51_RC1 = SVGA3D_MAKE_HWVERSION(0, 3),
  50. SVGA3D_HWVERSION_WS6_B1 = SVGA3D_MAKE_HWVERSION(1, 1),
  51. SVGA3D_HWVERSION_FUSION_11 = SVGA3D_MAKE_HWVERSION(1, 4),
  52. SVGA3D_HWVERSION_WS65_B1 = SVGA3D_MAKE_HWVERSION(2, 0),
  53. SVGA3D_HWVERSION_CURRENT = SVGA3D_HWVERSION_WS65_B1,
  54. } SVGA3dHardwareVersion;
  55. /*
  56. * Generic Types
  57. */
  58. typedef uint32 SVGA3dBool; /* 32-bit Bool definition */
  59. #define SVGA3D_NUM_CLIPPLANES 6
  60. #define SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS 8
  61. /*
  62. * Surface formats.
  63. *
  64. * If you modify this list, be sure to keep GLUtil.c in sync. It
  65. * includes the internal format definition of each surface in
  66. * GLUtil_ConvertSurfaceFormat, and it contains a table of
  67. * human-readable names in GLUtil_GetFormatName.
  68. */
  69. typedef enum SVGA3dSurfaceFormat {
  70. SVGA3D_FORMAT_INVALID = 0,
  71. SVGA3D_X8R8G8B8 = 1,
  72. SVGA3D_A8R8G8B8 = 2,
  73. SVGA3D_R5G6B5 = 3,
  74. SVGA3D_X1R5G5B5 = 4,
  75. SVGA3D_A1R5G5B5 = 5,
  76. SVGA3D_A4R4G4B4 = 6,
  77. SVGA3D_Z_D32 = 7,
  78. SVGA3D_Z_D16 = 8,
  79. SVGA3D_Z_D24S8 = 9,
  80. SVGA3D_Z_D15S1 = 10,
  81. SVGA3D_LUMINANCE8 = 11,
  82. SVGA3D_LUMINANCE4_ALPHA4 = 12,
  83. SVGA3D_LUMINANCE16 = 13,
  84. SVGA3D_LUMINANCE8_ALPHA8 = 14,
  85. SVGA3D_DXT1 = 15,
  86. SVGA3D_DXT2 = 16,
  87. SVGA3D_DXT3 = 17,
  88. SVGA3D_DXT4 = 18,
  89. SVGA3D_DXT5 = 19,
  90. SVGA3D_BUMPU8V8 = 20,
  91. SVGA3D_BUMPL6V5U5 = 21,
  92. SVGA3D_BUMPX8L8V8U8 = 22,
  93. SVGA3D_BUMPL8V8U8 = 23,
  94. SVGA3D_ARGB_S10E5 = 24, /* 16-bit floating-point ARGB */
  95. SVGA3D_ARGB_S23E8 = 25, /* 32-bit floating-point ARGB */
  96. SVGA3D_A2R10G10B10 = 26,
  97. /* signed formats */
  98. SVGA3D_V8U8 = 27,
  99. SVGA3D_Q8W8V8U8 = 28,
  100. SVGA3D_CxV8U8 = 29,
  101. /* mixed formats */
  102. SVGA3D_X8L8V8U8 = 30,
  103. SVGA3D_A2W10V10U10 = 31,
  104. SVGA3D_ALPHA8 = 32,
  105. /* Single- and dual-component floating point formats */
  106. SVGA3D_R_S10E5 = 33,
  107. SVGA3D_R_S23E8 = 34,
  108. SVGA3D_RG_S10E5 = 35,
  109. SVGA3D_RG_S23E8 = 36,
  110. /*
  111. * Any surface can be used as a buffer object, but SVGA3D_BUFFER is
  112. * the most efficient format to use when creating new surfaces
  113. * expressly for index or vertex data.
  114. */
  115. SVGA3D_BUFFER = 37,
  116. SVGA3D_Z_D24X8 = 38,
  117. SVGA3D_V16U16 = 39,
  118. SVGA3D_G16R16 = 40,
  119. SVGA3D_A16B16G16R16 = 41,
  120. /* Packed Video formats */
  121. SVGA3D_UYVY = 42,
  122. SVGA3D_YUY2 = 43,
  123. SVGA3D_FORMAT_MAX
  124. } SVGA3dSurfaceFormat;
  125. typedef uint32 SVGA3dColor; /* a, r, g, b */
  126. /*
  127. * These match the D3DFORMAT_OP definitions used by Direct3D. We need
  128. * them so that we can query the host for what the supported surface
  129. * operations are (when we're using the D3D backend, in particular),
  130. * and so we can send those operations to the guest.
  131. */
  132. typedef enum {
  133. SVGA3DFORMAT_OP_TEXTURE = 0x00000001,
  134. SVGA3DFORMAT_OP_VOLUMETEXTURE = 0x00000002,
  135. SVGA3DFORMAT_OP_CUBETEXTURE = 0x00000004,
  136. SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET = 0x00000008,
  137. SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET = 0x00000010,
  138. SVGA3DFORMAT_OP_ZSTENCIL = 0x00000040,
  139. SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH = 0x00000080,
  140. /*
  141. * This format can be used as a render target if the current display mode
  142. * is the same depth if the alpha channel is ignored. e.g. if the device
  143. * can render to A8R8G8B8 when the display mode is X8R8G8B8, then the
  144. * format op list entry for A8R8G8B8 should have this cap.
  145. */
  146. SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET = 0x00000100,
  147. /*
  148. * This format contains DirectDraw support (including Flip). This flag
  149. * should not to be set on alpha formats.
  150. */
  151. SVGA3DFORMAT_OP_DISPLAYMODE = 0x00000400,
  152. /*
  153. * The rasterizer can support some level of Direct3D support in this format
  154. * and implies that the driver can create a Context in this mode (for some
  155. * render target format). When this flag is set, the SVGA3DFORMAT_OP_DISPLAYMODE
  156. * flag must also be set.
  157. */
  158. SVGA3DFORMAT_OP_3DACCELERATION = 0x00000800,
  159. /*
  160. * This is set for a private format when the driver has put the bpp in
  161. * the structure.
  162. */
  163. SVGA3DFORMAT_OP_PIXELSIZE = 0x00001000,
  164. /*
  165. * Indicates that this format can be converted to any RGB format for which
  166. * SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB is specified
  167. */
  168. SVGA3DFORMAT_OP_CONVERT_TO_ARGB = 0x00002000,
  169. /*
  170. * Indicates that this format can be used to create offscreen plain surfaces.
  171. */
  172. SVGA3DFORMAT_OP_OFFSCREENPLAIN = 0x00004000,
  173. /*
  174. * Indicated that this format can be read as an SRGB texture (meaning that the
  175. * sampler will linearize the looked up data)
  176. */
  177. SVGA3DFORMAT_OP_SRGBREAD = 0x00008000,
  178. /*
  179. * Indicates that this format can be used in the bumpmap instructions
  180. */
  181. SVGA3DFORMAT_OP_BUMPMAP = 0x00010000,
  182. /*
  183. * Indicates that this format can be sampled by the displacement map sampler
  184. */
  185. SVGA3DFORMAT_OP_DMAP = 0x00020000,
  186. /*
  187. * Indicates that this format cannot be used with texture filtering
  188. */
  189. SVGA3DFORMAT_OP_NOFILTER = 0x00040000,
  190. /*
  191. * Indicates that format conversions are supported to this RGB format if
  192. * SVGA3DFORMAT_OP_CONVERT_TO_ARGB is specified in the source format.
  193. */
  194. SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB = 0x00080000,
  195. /*
  196. * Indicated that this format can be written as an SRGB target (meaning that the
  197. * pixel pipe will DE-linearize data on output to format)
  198. */
  199. SVGA3DFORMAT_OP_SRGBWRITE = 0x00100000,
  200. /*
  201. * Indicates that this format cannot be used with alpha blending
  202. */
  203. SVGA3DFORMAT_OP_NOALPHABLEND = 0x00200000,
  204. /*
  205. * Indicates that the device can auto-generated sublevels for resources
  206. * of this format
  207. */
  208. SVGA3DFORMAT_OP_AUTOGENMIPMAP = 0x00400000,
  209. /*
  210. * Indicates that this format can be used by vertex texture sampler
  211. */
  212. SVGA3DFORMAT_OP_VERTEXTEXTURE = 0x00800000,
  213. /*
  214. * Indicates that this format supports neither texture coordinate wrap
  215. * modes, nor mipmapping
  216. */
  217. SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP = 0x01000000
  218. } SVGA3dFormatOp;
  219. /*
  220. * This structure is a conversion of SVGA3DFORMAT_OP_*.
  221. * Entries must be located at the same position.
  222. */
  223. typedef union {
  224. uint32 value;
  225. struct {
  226. uint32 texture : 1;
  227. uint32 volumeTexture : 1;
  228. uint32 cubeTexture : 1;
  229. uint32 offscreenRenderTarget : 1;
  230. uint32 sameFormatRenderTarget : 1;
  231. uint32 unknown1 : 1;
  232. uint32 zStencil : 1;
  233. uint32 zStencilArbitraryDepth : 1;
  234. uint32 sameFormatUpToAlpha : 1;
  235. uint32 unknown2 : 1;
  236. uint32 displayMode : 1;
  237. uint32 acceleration3d : 1;
  238. uint32 pixelSize : 1;
  239. uint32 convertToARGB : 1;
  240. uint32 offscreenPlain : 1;
  241. uint32 sRGBRead : 1;
  242. uint32 bumpMap : 1;
  243. uint32 dmap : 1;
  244. uint32 noFilter : 1;
  245. uint32 memberOfGroupARGB : 1;
  246. uint32 sRGBWrite : 1;
  247. uint32 noAlphaBlend : 1;
  248. uint32 autoGenMipMap : 1;
  249. uint32 vertexTexture : 1;
  250. uint32 noTexCoordWrapNorMip : 1;
  251. };
  252. } SVGA3dSurfaceFormatCaps;
  253. /*
  254. * SVGA_3D_CMD_SETRENDERSTATE Types. All value types
  255. * must fit in a uint32.
  256. */
  257. typedef enum {
  258. SVGA3D_RS_INVALID = 0,
  259. SVGA3D_RS_ZENABLE = 1, /* SVGA3dBool */
  260. SVGA3D_RS_ZWRITEENABLE = 2, /* SVGA3dBool */
  261. SVGA3D_RS_ALPHATESTENABLE = 3, /* SVGA3dBool */
  262. SVGA3D_RS_DITHERENABLE = 4, /* SVGA3dBool */
  263. SVGA3D_RS_BLENDENABLE = 5, /* SVGA3dBool */
  264. SVGA3D_RS_FOGENABLE = 6, /* SVGA3dBool */
  265. SVGA3D_RS_SPECULARENABLE = 7, /* SVGA3dBool */
  266. SVGA3D_RS_STENCILENABLE = 8, /* SVGA3dBool */
  267. SVGA3D_RS_LIGHTINGENABLE = 9, /* SVGA3dBool */
  268. SVGA3D_RS_NORMALIZENORMALS = 10, /* SVGA3dBool */
  269. SVGA3D_RS_POINTSPRITEENABLE = 11, /* SVGA3dBool */
  270. SVGA3D_RS_POINTSCALEENABLE = 12, /* SVGA3dBool */
  271. SVGA3D_RS_STENCILREF = 13, /* uint32 */
  272. SVGA3D_RS_STENCILMASK = 14, /* uint32 */
  273. SVGA3D_RS_STENCILWRITEMASK = 15, /* uint32 */
  274. SVGA3D_RS_FOGSTART = 16, /* float */
  275. SVGA3D_RS_FOGEND = 17, /* float */
  276. SVGA3D_RS_FOGDENSITY = 18, /* float */
  277. SVGA3D_RS_POINTSIZE = 19, /* float */
  278. SVGA3D_RS_POINTSIZEMIN = 20, /* float */
  279. SVGA3D_RS_POINTSIZEMAX = 21, /* float */
  280. SVGA3D_RS_POINTSCALE_A = 22, /* float */
  281. SVGA3D_RS_POINTSCALE_B = 23, /* float */
  282. SVGA3D_RS_POINTSCALE_C = 24, /* float */
  283. SVGA3D_RS_FOGCOLOR = 25, /* SVGA3dColor */
  284. SVGA3D_RS_AMBIENT = 26, /* SVGA3dColor */
  285. SVGA3D_RS_CLIPPLANEENABLE = 27, /* SVGA3dClipPlanes */
  286. SVGA3D_RS_FOGMODE = 28, /* SVGA3dFogMode */
  287. SVGA3D_RS_FILLMODE = 29, /* SVGA3dFillMode */
  288. SVGA3D_RS_SHADEMODE = 30, /* SVGA3dShadeMode */
  289. SVGA3D_RS_LINEPATTERN = 31, /* SVGA3dLinePattern */
  290. SVGA3D_RS_SRCBLEND = 32, /* SVGA3dBlendOp */
  291. SVGA3D_RS_DSTBLEND = 33, /* SVGA3dBlendOp */
  292. SVGA3D_RS_BLENDEQUATION = 34, /* SVGA3dBlendEquation */
  293. SVGA3D_RS_CULLMODE = 35, /* SVGA3dFace */
  294. SVGA3D_RS_ZFUNC = 36, /* SVGA3dCmpFunc */
  295. SVGA3D_RS_ALPHAFUNC = 37, /* SVGA3dCmpFunc */
  296. SVGA3D_RS_STENCILFUNC = 38, /* SVGA3dCmpFunc */
  297. SVGA3D_RS_STENCILFAIL = 39, /* SVGA3dStencilOp */
  298. SVGA3D_RS_STENCILZFAIL = 40, /* SVGA3dStencilOp */
  299. SVGA3D_RS_STENCILPASS = 41, /* SVGA3dStencilOp */
  300. SVGA3D_RS_ALPHAREF = 42, /* float (0.0 .. 1.0) */
  301. SVGA3D_RS_FRONTWINDING = 43, /* SVGA3dFrontWinding */
  302. SVGA3D_RS_COORDINATETYPE = 44, /* SVGA3dCoordinateType */
  303. SVGA3D_RS_ZBIAS = 45, /* float */
  304. SVGA3D_RS_RANGEFOGENABLE = 46, /* SVGA3dBool */
  305. SVGA3D_RS_COLORWRITEENABLE = 47, /* SVGA3dColorMask */
  306. SVGA3D_RS_VERTEXMATERIALENABLE = 48, /* SVGA3dBool */
  307. SVGA3D_RS_DIFFUSEMATERIALSOURCE = 49, /* SVGA3dVertexMaterial */
  308. SVGA3D_RS_SPECULARMATERIALSOURCE = 50, /* SVGA3dVertexMaterial */
  309. SVGA3D_RS_AMBIENTMATERIALSOURCE = 51, /* SVGA3dVertexMaterial */
  310. SVGA3D_RS_EMISSIVEMATERIALSOURCE = 52, /* SVGA3dVertexMaterial */
  311. SVGA3D_RS_TEXTUREFACTOR = 53, /* SVGA3dColor */
  312. SVGA3D_RS_LOCALVIEWER = 54, /* SVGA3dBool */
  313. SVGA3D_RS_SCISSORTESTENABLE = 55, /* SVGA3dBool */
  314. SVGA3D_RS_BLENDCOLOR = 56, /* SVGA3dColor */
  315. SVGA3D_RS_STENCILENABLE2SIDED = 57, /* SVGA3dBool */
  316. SVGA3D_RS_CCWSTENCILFUNC = 58, /* SVGA3dCmpFunc */
  317. SVGA3D_RS_CCWSTENCILFAIL = 59, /* SVGA3dStencilOp */
  318. SVGA3D_RS_CCWSTENCILZFAIL = 60, /* SVGA3dStencilOp */
  319. SVGA3D_RS_CCWSTENCILPASS = 61, /* SVGA3dStencilOp */
  320. SVGA3D_RS_VERTEXBLEND = 62, /* SVGA3dVertexBlendFlags */
  321. SVGA3D_RS_SLOPESCALEDEPTHBIAS = 63, /* float */
  322. SVGA3D_RS_DEPTHBIAS = 64, /* float */
  323. /*
  324. * Output Gamma Level
  325. *
  326. * Output gamma effects the gamma curve of colors that are output from the
  327. * rendering pipeline. A value of 1.0 specifies a linear color space. If the
  328. * value is <= 0.0, gamma correction is ignored and linear color space is
  329. * used.
  330. */
  331. SVGA3D_RS_OUTPUTGAMMA = 65, /* float */
  332. SVGA3D_RS_ZVISIBLE = 66, /* SVGA3dBool */
  333. SVGA3D_RS_LASTPIXEL = 67, /* SVGA3dBool */
  334. SVGA3D_RS_CLIPPING = 68, /* SVGA3dBool */
  335. SVGA3D_RS_WRAP0 = 69, /* SVGA3dWrapFlags */
  336. SVGA3D_RS_WRAP1 = 70, /* SVGA3dWrapFlags */
  337. SVGA3D_RS_WRAP2 = 71, /* SVGA3dWrapFlags */
  338. SVGA3D_RS_WRAP3 = 72, /* SVGA3dWrapFlags */
  339. SVGA3D_RS_WRAP4 = 73, /* SVGA3dWrapFlags */
  340. SVGA3D_RS_WRAP5 = 74, /* SVGA3dWrapFlags */
  341. SVGA3D_RS_WRAP6 = 75, /* SVGA3dWrapFlags */
  342. SVGA3D_RS_WRAP7 = 76, /* SVGA3dWrapFlags */
  343. SVGA3D_RS_WRAP8 = 77, /* SVGA3dWrapFlags */
  344. SVGA3D_RS_WRAP9 = 78, /* SVGA3dWrapFlags */
  345. SVGA3D_RS_WRAP10 = 79, /* SVGA3dWrapFlags */
  346. SVGA3D_RS_WRAP11 = 80, /* SVGA3dWrapFlags */
  347. SVGA3D_RS_WRAP12 = 81, /* SVGA3dWrapFlags */
  348. SVGA3D_RS_WRAP13 = 82, /* SVGA3dWrapFlags */
  349. SVGA3D_RS_WRAP14 = 83, /* SVGA3dWrapFlags */
  350. SVGA3D_RS_WRAP15 = 84, /* SVGA3dWrapFlags */
  351. SVGA3D_RS_MULTISAMPLEANTIALIAS = 85, /* SVGA3dBool */
  352. SVGA3D_RS_MULTISAMPLEMASK = 86, /* uint32 */
  353. SVGA3D_RS_INDEXEDVERTEXBLENDENABLE = 87, /* SVGA3dBool */
  354. SVGA3D_RS_TWEENFACTOR = 88, /* float */
  355. SVGA3D_RS_ANTIALIASEDLINEENABLE = 89, /* SVGA3dBool */
  356. SVGA3D_RS_COLORWRITEENABLE1 = 90, /* SVGA3dColorMask */
  357. SVGA3D_RS_COLORWRITEENABLE2 = 91, /* SVGA3dColorMask */
  358. SVGA3D_RS_COLORWRITEENABLE3 = 92, /* SVGA3dColorMask */
  359. SVGA3D_RS_SEPARATEALPHABLENDENABLE = 93, /* SVGA3dBool */
  360. SVGA3D_RS_SRCBLENDALPHA = 94, /* SVGA3dBlendOp */
  361. SVGA3D_RS_DSTBLENDALPHA = 95, /* SVGA3dBlendOp */
  362. SVGA3D_RS_BLENDEQUATIONALPHA = 96, /* SVGA3dBlendEquation */
  363. SVGA3D_RS_MAX
  364. } SVGA3dRenderStateName;
  365. typedef enum {
  366. SVGA3D_VERTEXMATERIAL_NONE = 0, /* Use the value in the current material */
  367. SVGA3D_VERTEXMATERIAL_DIFFUSE = 1, /* Use the value in the diffuse component */
  368. SVGA3D_VERTEXMATERIAL_SPECULAR = 2, /* Use the value in the specular component */
  369. } SVGA3dVertexMaterial;
  370. typedef enum {
  371. SVGA3D_FILLMODE_INVALID = 0,
  372. SVGA3D_FILLMODE_POINT = 1,
  373. SVGA3D_FILLMODE_LINE = 2,
  374. SVGA3D_FILLMODE_FILL = 3,
  375. SVGA3D_FILLMODE_MAX
  376. } SVGA3dFillModeType;
  377. typedef
  378. union {
  379. struct {
  380. uint16 mode; /* SVGA3dFillModeType */
  381. uint16 face; /* SVGA3dFace */
  382. };
  383. uint32 uintValue;
  384. } SVGA3dFillMode;
  385. typedef enum {
  386. SVGA3D_SHADEMODE_INVALID = 0,
  387. SVGA3D_SHADEMODE_FLAT = 1,
  388. SVGA3D_SHADEMODE_SMOOTH = 2,
  389. SVGA3D_SHADEMODE_PHONG = 3, /* Not supported */
  390. SVGA3D_SHADEMODE_MAX
  391. } SVGA3dShadeMode;
  392. typedef
  393. union {
  394. struct {
  395. uint16 repeat;
  396. uint16 pattern;
  397. };
  398. uint32 uintValue;
  399. } SVGA3dLinePattern;
  400. typedef enum {
  401. SVGA3D_BLENDOP_INVALID = 0,
  402. SVGA3D_BLENDOP_ZERO = 1,
  403. SVGA3D_BLENDOP_ONE = 2,
  404. SVGA3D_BLENDOP_SRCCOLOR = 3,
  405. SVGA3D_BLENDOP_INVSRCCOLOR = 4,
  406. SVGA3D_BLENDOP_SRCALPHA = 5,
  407. SVGA3D_BLENDOP_INVSRCALPHA = 6,
  408. SVGA3D_BLENDOP_DESTALPHA = 7,
  409. SVGA3D_BLENDOP_INVDESTALPHA = 8,
  410. SVGA3D_BLENDOP_DESTCOLOR = 9,
  411. SVGA3D_BLENDOP_INVDESTCOLOR = 10,
  412. SVGA3D_BLENDOP_SRCALPHASAT = 11,
  413. SVGA3D_BLENDOP_BLENDFACTOR = 12,
  414. SVGA3D_BLENDOP_INVBLENDFACTOR = 13,
  415. SVGA3D_BLENDOP_MAX
  416. } SVGA3dBlendOp;
  417. typedef enum {
  418. SVGA3D_BLENDEQ_INVALID = 0,
  419. SVGA3D_BLENDEQ_ADD = 1,
  420. SVGA3D_BLENDEQ_SUBTRACT = 2,
  421. SVGA3D_BLENDEQ_REVSUBTRACT = 3,
  422. SVGA3D_BLENDEQ_MINIMUM = 4,
  423. SVGA3D_BLENDEQ_MAXIMUM = 5,
  424. SVGA3D_BLENDEQ_MAX
  425. } SVGA3dBlendEquation;
  426. typedef enum {
  427. SVGA3D_FRONTWINDING_INVALID = 0,
  428. SVGA3D_FRONTWINDING_CW = 1,
  429. SVGA3D_FRONTWINDING_CCW = 2,
  430. SVGA3D_FRONTWINDING_MAX
  431. } SVGA3dFrontWinding;
  432. typedef enum {
  433. SVGA3D_FACE_INVALID = 0,
  434. SVGA3D_FACE_NONE = 1,
  435. SVGA3D_FACE_FRONT = 2,
  436. SVGA3D_FACE_BACK = 3,
  437. SVGA3D_FACE_FRONT_BACK = 4,
  438. SVGA3D_FACE_MAX
  439. } SVGA3dFace;
  440. /*
  441. * The order and the values should not be changed
  442. */
  443. typedef enum {
  444. SVGA3D_CMP_INVALID = 0,
  445. SVGA3D_CMP_NEVER = 1,
  446. SVGA3D_CMP_LESS = 2,
  447. SVGA3D_CMP_EQUAL = 3,
  448. SVGA3D_CMP_LESSEQUAL = 4,
  449. SVGA3D_CMP_GREATER = 5,
  450. SVGA3D_CMP_NOTEQUAL = 6,
  451. SVGA3D_CMP_GREATEREQUAL = 7,
  452. SVGA3D_CMP_ALWAYS = 8,
  453. SVGA3D_CMP_MAX
  454. } SVGA3dCmpFunc;
  455. /*
  456. * SVGA3D_FOGFUNC_* specifies the fog equation, or PER_VERTEX which allows
  457. * the fog factor to be specified in the alpha component of the specular
  458. * (a.k.a. secondary) vertex color.
  459. */
  460. typedef enum {
  461. SVGA3D_FOGFUNC_INVALID = 0,
  462. SVGA3D_FOGFUNC_EXP = 1,
  463. SVGA3D_FOGFUNC_EXP2 = 2,
  464. SVGA3D_FOGFUNC_LINEAR = 3,
  465. SVGA3D_FOGFUNC_PER_VERTEX = 4
  466. } SVGA3dFogFunction;
  467. /*
  468. * SVGA3D_FOGTYPE_* specifies if fog factors are computed on a per-vertex
  469. * or per-pixel basis.
  470. */
  471. typedef enum {
  472. SVGA3D_FOGTYPE_INVALID = 0,
  473. SVGA3D_FOGTYPE_VERTEX = 1,
  474. SVGA3D_FOGTYPE_PIXEL = 2,
  475. SVGA3D_FOGTYPE_MAX = 3
  476. } SVGA3dFogType;
  477. /*
  478. * SVGA3D_FOGBASE_* selects depth or range-based fog. Depth-based fog is
  479. * computed using the eye Z value of each pixel (or vertex), whereas range-
  480. * based fog is computed using the actual distance (range) to the eye.
  481. */
  482. typedef enum {
  483. SVGA3D_FOGBASE_INVALID = 0,
  484. SVGA3D_FOGBASE_DEPTHBASED = 1,
  485. SVGA3D_FOGBASE_RANGEBASED = 2,
  486. SVGA3D_FOGBASE_MAX = 3
  487. } SVGA3dFogBase;
  488. typedef enum {
  489. SVGA3D_STENCILOP_INVALID = 0,
  490. SVGA3D_STENCILOP_KEEP = 1,
  491. SVGA3D_STENCILOP_ZERO = 2,
  492. SVGA3D_STENCILOP_REPLACE = 3,
  493. SVGA3D_STENCILOP_INCRSAT = 4,
  494. SVGA3D_STENCILOP_DECRSAT = 5,
  495. SVGA3D_STENCILOP_INVERT = 6,
  496. SVGA3D_STENCILOP_INCR = 7,
  497. SVGA3D_STENCILOP_DECR = 8,
  498. SVGA3D_STENCILOP_MAX
  499. } SVGA3dStencilOp;
  500. typedef enum {
  501. SVGA3D_CLIPPLANE_0 = (1 << 0),
  502. SVGA3D_CLIPPLANE_1 = (1 << 1),
  503. SVGA3D_CLIPPLANE_2 = (1 << 2),
  504. SVGA3D_CLIPPLANE_3 = (1 << 3),
  505. SVGA3D_CLIPPLANE_4 = (1 << 4),
  506. SVGA3D_CLIPPLANE_5 = (1 << 5),
  507. } SVGA3dClipPlanes;
  508. typedef enum {
  509. SVGA3D_CLEAR_COLOR = 0x1,
  510. SVGA3D_CLEAR_DEPTH = 0x2,
  511. SVGA3D_CLEAR_STENCIL = 0x4
  512. } SVGA3dClearFlag;
  513. typedef enum {
  514. SVGA3D_RT_DEPTH = 0,
  515. SVGA3D_RT_STENCIL = 1,
  516. SVGA3D_RT_COLOR0 = 2,
  517. SVGA3D_RT_COLOR1 = 3,
  518. SVGA3D_RT_COLOR2 = 4,
  519. SVGA3D_RT_COLOR3 = 5,
  520. SVGA3D_RT_COLOR4 = 6,
  521. SVGA3D_RT_COLOR5 = 7,
  522. SVGA3D_RT_COLOR6 = 8,
  523. SVGA3D_RT_COLOR7 = 9,
  524. SVGA3D_RT_MAX,
  525. SVGA3D_RT_INVALID = ((uint32)-1),
  526. } SVGA3dRenderTargetType;
  527. #define SVGA3D_MAX_RT_COLOR (SVGA3D_RT_COLOR7 - SVGA3D_RT_COLOR0 + 1)
  528. typedef
  529. union {
  530. struct {
  531. uint32 red : 1;
  532. uint32 green : 1;
  533. uint32 blue : 1;
  534. uint32 alpha : 1;
  535. };
  536. uint32 uintValue;
  537. } SVGA3dColorMask;
  538. typedef enum {
  539. SVGA3D_VBLEND_DISABLE = 0,
  540. SVGA3D_VBLEND_1WEIGHT = 1,
  541. SVGA3D_VBLEND_2WEIGHT = 2,
  542. SVGA3D_VBLEND_3WEIGHT = 3,
  543. } SVGA3dVertexBlendFlags;
  544. typedef enum {
  545. SVGA3D_WRAPCOORD_0 = 1 << 0,
  546. SVGA3D_WRAPCOORD_1 = 1 << 1,
  547. SVGA3D_WRAPCOORD_2 = 1 << 2,
  548. SVGA3D_WRAPCOORD_3 = 1 << 3,
  549. SVGA3D_WRAPCOORD_ALL = 0xF,
  550. } SVGA3dWrapFlags;
  551. /*
  552. * SVGA_3D_CMD_TEXTURESTATE Types. All value types
  553. * must fit in a uint32.
  554. */
  555. typedef enum {
  556. SVGA3D_TS_INVALID = 0,
  557. SVGA3D_TS_BIND_TEXTURE = 1, /* SVGA3dSurfaceId */
  558. SVGA3D_TS_COLOROP = 2, /* SVGA3dTextureCombiner */
  559. SVGA3D_TS_COLORARG1 = 3, /* SVGA3dTextureArgData */
  560. SVGA3D_TS_COLORARG2 = 4, /* SVGA3dTextureArgData */
  561. SVGA3D_TS_ALPHAOP = 5, /* SVGA3dTextureCombiner */
  562. SVGA3D_TS_ALPHAARG1 = 6, /* SVGA3dTextureArgData */
  563. SVGA3D_TS_ALPHAARG2 = 7, /* SVGA3dTextureArgData */
  564. SVGA3D_TS_ADDRESSU = 8, /* SVGA3dTextureAddress */
  565. SVGA3D_TS_ADDRESSV = 9, /* SVGA3dTextureAddress */
  566. SVGA3D_TS_MIPFILTER = 10, /* SVGA3dTextureFilter */
  567. SVGA3D_TS_MAGFILTER = 11, /* SVGA3dTextureFilter */
  568. SVGA3D_TS_MINFILTER = 12, /* SVGA3dTextureFilter */
  569. SVGA3D_TS_BORDERCOLOR = 13, /* SVGA3dColor */
  570. SVGA3D_TS_TEXCOORDINDEX = 14, /* uint32 */
  571. SVGA3D_TS_TEXTURETRANSFORMFLAGS = 15, /* SVGA3dTexTransformFlags */
  572. SVGA3D_TS_TEXCOORDGEN = 16, /* SVGA3dTextureCoordGen */
  573. SVGA3D_TS_BUMPENVMAT00 = 17, /* float */
  574. SVGA3D_TS_BUMPENVMAT01 = 18, /* float */
  575. SVGA3D_TS_BUMPENVMAT10 = 19, /* float */
  576. SVGA3D_TS_BUMPENVMAT11 = 20, /* float */
  577. SVGA3D_TS_TEXTURE_MIPMAP_LEVEL = 21, /* uint32 */
  578. SVGA3D_TS_TEXTURE_LOD_BIAS = 22, /* float */
  579. SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL = 23, /* uint32 */
  580. SVGA3D_TS_ADDRESSW = 24, /* SVGA3dTextureAddress */
  581. /*
  582. * Sampler Gamma Level
  583. *
  584. * Sampler gamma effects the color of samples taken from the sampler. A
  585. * value of 1.0 will produce linear samples. If the value is <= 0.0 the
  586. * gamma value is ignored and a linear space is used.
  587. */
  588. SVGA3D_TS_GAMMA = 25, /* float */
  589. SVGA3D_TS_BUMPENVLSCALE = 26, /* float */
  590. SVGA3D_TS_BUMPENVLOFFSET = 27, /* float */
  591. SVGA3D_TS_COLORARG0 = 28, /* SVGA3dTextureArgData */
  592. SVGA3D_TS_ALPHAARG0 = 29, /* SVGA3dTextureArgData */
  593. SVGA3D_TS_MAX
  594. } SVGA3dTextureStateName;
  595. typedef enum {
  596. SVGA3D_TC_INVALID = 0,
  597. SVGA3D_TC_DISABLE = 1,
  598. SVGA3D_TC_SELECTARG1 = 2,
  599. SVGA3D_TC_SELECTARG2 = 3,
  600. SVGA3D_TC_MODULATE = 4,
  601. SVGA3D_TC_ADD = 5,
  602. SVGA3D_TC_ADDSIGNED = 6,
  603. SVGA3D_TC_SUBTRACT = 7,
  604. SVGA3D_TC_BLENDTEXTUREALPHA = 8,
  605. SVGA3D_TC_BLENDDIFFUSEALPHA = 9,
  606. SVGA3D_TC_BLENDCURRENTALPHA = 10,
  607. SVGA3D_TC_BLENDFACTORALPHA = 11,
  608. SVGA3D_TC_MODULATE2X = 12,
  609. SVGA3D_TC_MODULATE4X = 13,
  610. SVGA3D_TC_DSDT = 14,
  611. SVGA3D_TC_DOTPRODUCT3 = 15,
  612. SVGA3D_TC_BLENDTEXTUREALPHAPM = 16,
  613. SVGA3D_TC_ADDSIGNED2X = 17,
  614. SVGA3D_TC_ADDSMOOTH = 18,
  615. SVGA3D_TC_PREMODULATE = 19,
  616. SVGA3D_TC_MODULATEALPHA_ADDCOLOR = 20,
  617. SVGA3D_TC_MODULATECOLOR_ADDALPHA = 21,
  618. SVGA3D_TC_MODULATEINVALPHA_ADDCOLOR = 22,
  619. SVGA3D_TC_MODULATEINVCOLOR_ADDALPHA = 23,
  620. SVGA3D_TC_BUMPENVMAPLUMINANCE = 24,
  621. SVGA3D_TC_MULTIPLYADD = 25,
  622. SVGA3D_TC_LERP = 26,
  623. SVGA3D_TC_MAX
  624. } SVGA3dTextureCombiner;
  625. #define SVGA3D_TC_CAP_BIT(svga3d_tc_op) (svga3d_tc_op ? (1 << (svga3d_tc_op - 1)) : 0)
  626. typedef enum {
  627. SVGA3D_TEX_ADDRESS_INVALID = 0,
  628. SVGA3D_TEX_ADDRESS_WRAP = 1,
  629. SVGA3D_TEX_ADDRESS_MIRROR = 2,
  630. SVGA3D_TEX_ADDRESS_CLAMP = 3,
  631. SVGA3D_TEX_ADDRESS_BORDER = 4,
  632. SVGA3D_TEX_ADDRESS_MIRRORONCE = 5,
  633. SVGA3D_TEX_ADDRESS_EDGE = 6,
  634. SVGA3D_TEX_ADDRESS_MAX
  635. } SVGA3dTextureAddress;
  636. /*
  637. * SVGA3D_TEX_FILTER_NONE as the minification filter means mipmapping is
  638. * disabled, and the rasterizer should use the magnification filter instead.
  639. */
  640. typedef enum {
  641. SVGA3D_TEX_FILTER_NONE = 0,
  642. SVGA3D_TEX_FILTER_NEAREST = 1,
  643. SVGA3D_TEX_FILTER_LINEAR = 2,
  644. SVGA3D_TEX_FILTER_ANISOTROPIC = 3,
  645. SVGA3D_TEX_FILTER_FLATCUBIC = 4, // Deprecated, not implemented
  646. SVGA3D_TEX_FILTER_GAUSSIANCUBIC = 5, // Deprecated, not implemented
  647. SVGA3D_TEX_FILTER_PYRAMIDALQUAD = 6, // Not currently implemented
  648. SVGA3D_TEX_FILTER_GAUSSIANQUAD = 7, // Not currently implemented
  649. SVGA3D_TEX_FILTER_MAX
  650. } SVGA3dTextureFilter;
  651. typedef enum {
  652. SVGA3D_TEX_TRANSFORM_OFF = 0,
  653. SVGA3D_TEX_TRANSFORM_S = (1 << 0),
  654. SVGA3D_TEX_TRANSFORM_T = (1 << 1),
  655. SVGA3D_TEX_TRANSFORM_R = (1 << 2),
  656. SVGA3D_TEX_TRANSFORM_Q = (1 << 3),
  657. SVGA3D_TEX_PROJECTED = (1 << 15),
  658. } SVGA3dTexTransformFlags;
  659. typedef enum {
  660. SVGA3D_TEXCOORD_GEN_OFF = 0,
  661. SVGA3D_TEXCOORD_GEN_EYE_POSITION = 1,
  662. SVGA3D_TEXCOORD_GEN_EYE_NORMAL = 2,
  663. SVGA3D_TEXCOORD_GEN_REFLECTIONVECTOR = 3,
  664. SVGA3D_TEXCOORD_GEN_SPHERE = 4,
  665. SVGA3D_TEXCOORD_GEN_MAX
  666. } SVGA3dTextureCoordGen;
  667. /*
  668. * Texture argument constants for texture combiner
  669. */
  670. typedef enum {
  671. SVGA3D_TA_INVALID = 0,
  672. SVGA3D_TA_CONSTANT = 1,
  673. SVGA3D_TA_PREVIOUS = 2,
  674. SVGA3D_TA_DIFFUSE = 3,
  675. SVGA3D_TA_TEXTURE = 4,
  676. SVGA3D_TA_SPECULAR = 5,
  677. SVGA3D_TA_MAX
  678. } SVGA3dTextureArgData;
  679. #define SVGA3D_TM_MASK_LEN 4
  680. /* Modifiers for texture argument constants defined above. */
  681. typedef enum {
  682. SVGA3D_TM_NONE = 0,
  683. SVGA3D_TM_ALPHA = (1 << SVGA3D_TM_MASK_LEN),
  684. SVGA3D_TM_ONE_MINUS = (2 << SVGA3D_TM_MASK_LEN),
  685. } SVGA3dTextureArgModifier;
  686. #define SVGA3D_INVALID_ID ((uint32)-1)
  687. #define SVGA3D_MAX_CLIP_PLANES 6
  688. /*
  689. * This is the limit to the number of fixed-function texture
  690. * transforms and texture coordinates we can support. It does *not*
  691. * correspond to the number of texture image units (samplers) we
  692. * support!
  693. */
  694. #define SVGA3D_MAX_TEXTURE_COORDS 8
  695. /*
  696. * Vertex declarations
  697. *
  698. * Notes:
  699. *
  700. * SVGA3D_DECLUSAGE_POSITIONT is for pre-transformed vertices. If you
  701. * draw with any POSITIONT vertex arrays, the programmable vertex
  702. * pipeline will be implicitly disabled. Drawing will take place as if
  703. * no vertex shader was bound.
  704. */
  705. typedef enum {
  706. SVGA3D_DECLUSAGE_POSITION = 0,
  707. SVGA3D_DECLUSAGE_BLENDWEIGHT, // 1
  708. SVGA3D_DECLUSAGE_BLENDINDICES, // 2
  709. SVGA3D_DECLUSAGE_NORMAL, // 3
  710. SVGA3D_DECLUSAGE_PSIZE, // 4
  711. SVGA3D_DECLUSAGE_TEXCOORD, // 5
  712. SVGA3D_DECLUSAGE_TANGENT, // 6
  713. SVGA3D_DECLUSAGE_BINORMAL, // 7
  714. SVGA3D_DECLUSAGE_TESSFACTOR, // 8
  715. SVGA3D_DECLUSAGE_POSITIONT, // 9
  716. SVGA3D_DECLUSAGE_COLOR, // 10
  717. SVGA3D_DECLUSAGE_FOG, // 11
  718. SVGA3D_DECLUSAGE_DEPTH, // 12
  719. SVGA3D_DECLUSAGE_SAMPLE, // 13
  720. SVGA3D_DECLUSAGE_MAX
  721. } SVGA3dDeclUsage;
  722. typedef enum {
  723. SVGA3D_DECLMETHOD_DEFAULT = 0,
  724. SVGA3D_DECLMETHOD_PARTIALU,
  725. SVGA3D_DECLMETHOD_PARTIALV,
  726. SVGA3D_DECLMETHOD_CROSSUV, // Normal
  727. SVGA3D_DECLMETHOD_UV,
  728. SVGA3D_DECLMETHOD_LOOKUP, // Lookup a displacement map
  729. SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED, // Lookup a pre-sampled displacement map
  730. } SVGA3dDeclMethod;
  731. typedef enum {
  732. SVGA3D_DECLTYPE_FLOAT1 = 0,
  733. SVGA3D_DECLTYPE_FLOAT2 = 1,
  734. SVGA3D_DECLTYPE_FLOAT3 = 2,
  735. SVGA3D_DECLTYPE_FLOAT4 = 3,
  736. SVGA3D_DECLTYPE_D3DCOLOR = 4,
  737. SVGA3D_DECLTYPE_UBYTE4 = 5,
  738. SVGA3D_DECLTYPE_SHORT2 = 6,
  739. SVGA3D_DECLTYPE_SHORT4 = 7,
  740. SVGA3D_DECLTYPE_UBYTE4N = 8,
  741. SVGA3D_DECLTYPE_SHORT2N = 9,
  742. SVGA3D_DECLTYPE_SHORT4N = 10,
  743. SVGA3D_DECLTYPE_USHORT2N = 11,
  744. SVGA3D_DECLTYPE_USHORT4N = 12,
  745. SVGA3D_DECLTYPE_UDEC3 = 13,
  746. SVGA3D_DECLTYPE_DEC3N = 14,
  747. SVGA3D_DECLTYPE_FLOAT16_2 = 15,
  748. SVGA3D_DECLTYPE_FLOAT16_4 = 16,
  749. SVGA3D_DECLTYPE_MAX,
  750. } SVGA3dDeclType;
  751. /*
  752. * This structure is used for the divisor for geometry instancing;
  753. * it's a direct translation of the Direct3D equivalent.
  754. */
  755. typedef union {
  756. struct {
  757. /*
  758. * For index data, this number represents the number of instances to draw.
  759. * For instance data, this number represents the number of
  760. * instances/vertex in this stream
  761. */
  762. uint32 count : 30;
  763. /*
  764. * This is 1 if this is supposed to be the data that is repeated for
  765. * every instance.
  766. */
  767. uint32 indexedData : 1;
  768. /*
  769. * This is 1 if this is supposed to be the per-instance data.
  770. */
  771. uint32 instanceData : 1;
  772. };
  773. uint32 value;
  774. } SVGA3dVertexDivisor;
  775. typedef enum {
  776. SVGA3D_PRIMITIVE_INVALID = 0,
  777. SVGA3D_PRIMITIVE_TRIANGLELIST = 1,
  778. SVGA3D_PRIMITIVE_POINTLIST = 2,
  779. SVGA3D_PRIMITIVE_LINELIST = 3,
  780. SVGA3D_PRIMITIVE_LINESTRIP = 4,
  781. SVGA3D_PRIMITIVE_TRIANGLESTRIP = 5,
  782. SVGA3D_PRIMITIVE_TRIANGLEFAN = 6,
  783. SVGA3D_PRIMITIVE_MAX
  784. } SVGA3dPrimitiveType;
  785. typedef enum {
  786. SVGA3D_COORDINATE_INVALID = 0,
  787. SVGA3D_COORDINATE_LEFTHANDED = 1,
  788. SVGA3D_COORDINATE_RIGHTHANDED = 2,
  789. SVGA3D_COORDINATE_MAX
  790. } SVGA3dCoordinateType;
  791. typedef enum {
  792. SVGA3D_TRANSFORM_INVALID = 0,
  793. SVGA3D_TRANSFORM_WORLD = 1,
  794. SVGA3D_TRANSFORM_VIEW = 2,
  795. SVGA3D_TRANSFORM_PROJECTION = 3,
  796. SVGA3D_TRANSFORM_TEXTURE0 = 4,
  797. SVGA3D_TRANSFORM_TEXTURE1 = 5,
  798. SVGA3D_TRANSFORM_TEXTURE2 = 6,
  799. SVGA3D_TRANSFORM_TEXTURE3 = 7,
  800. SVGA3D_TRANSFORM_TEXTURE4 = 8,
  801. SVGA3D_TRANSFORM_TEXTURE5 = 9,
  802. SVGA3D_TRANSFORM_TEXTURE6 = 10,
  803. SVGA3D_TRANSFORM_TEXTURE7 = 11,
  804. SVGA3D_TRANSFORM_WORLD1 = 12,
  805. SVGA3D_TRANSFORM_WORLD2 = 13,
  806. SVGA3D_TRANSFORM_WORLD3 = 14,
  807. SVGA3D_TRANSFORM_MAX
  808. } SVGA3dTransformType;
  809. typedef enum {
  810. SVGA3D_LIGHTTYPE_INVALID = 0,
  811. SVGA3D_LIGHTTYPE_POINT = 1,
  812. SVGA3D_LIGHTTYPE_SPOT1 = 2, /* 1-cone, in degrees */
  813. SVGA3D_LIGHTTYPE_SPOT2 = 3, /* 2-cone, in radians */
  814. SVGA3D_LIGHTTYPE_DIRECTIONAL = 4,
  815. SVGA3D_LIGHTTYPE_MAX
  816. } SVGA3dLightType;
  817. typedef enum {
  818. SVGA3D_CUBEFACE_POSX = 0,
  819. SVGA3D_CUBEFACE_NEGX = 1,
  820. SVGA3D_CUBEFACE_POSY = 2,
  821. SVGA3D_CUBEFACE_NEGY = 3,
  822. SVGA3D_CUBEFACE_POSZ = 4,
  823. SVGA3D_CUBEFACE_NEGZ = 5,
  824. } SVGA3dCubeFace;
  825. typedef enum {
  826. SVGA3D_SHADERTYPE_COMPILED_DX8 = 0,
  827. SVGA3D_SHADERTYPE_VS = 1,
  828. SVGA3D_SHADERTYPE_PS = 2,
  829. SVGA3D_SHADERTYPE_MAX
  830. } SVGA3dShaderType;
  831. typedef enum {
  832. SVGA3D_CONST_TYPE_FLOAT = 0,
  833. SVGA3D_CONST_TYPE_INT = 1,
  834. SVGA3D_CONST_TYPE_BOOL = 2,
  835. } SVGA3dShaderConstType;
  836. #define SVGA3D_MAX_SURFACE_FACES 6
  837. typedef enum {
  838. SVGA3D_STRETCH_BLT_POINT = 0,
  839. SVGA3D_STRETCH_BLT_LINEAR = 1,
  840. SVGA3D_STRETCH_BLT_MAX
  841. } SVGA3dStretchBltMode;
  842. typedef enum {
  843. SVGA3D_QUERYTYPE_OCCLUSION = 0,
  844. SVGA3D_QUERYTYPE_MAX
  845. } SVGA3dQueryType;
  846. typedef enum {
  847. SVGA3D_QUERYSTATE_PENDING = 0, /* Waiting on the host (set by guest) */
  848. SVGA3D_QUERYSTATE_SUCCEEDED = 1, /* Completed successfully (set by host) */
  849. SVGA3D_QUERYSTATE_FAILED = 2, /* Completed unsuccessfully (set by host) */
  850. SVGA3D_QUERYSTATE_NEW = 3, /* Never submitted (For guest use only) */
  851. } SVGA3dQueryState;
  852. typedef enum {
  853. SVGA3D_WRITE_HOST_VRAM = 1,
  854. SVGA3D_READ_HOST_VRAM = 2,
  855. } SVGA3dTransferType;
  856. /*
  857. * The maximum number vertex arrays we're guaranteed to support in
  858. * SVGA_3D_CMD_DRAWPRIMITIVES.
  859. */
  860. #define SVGA3D_MAX_VERTEX_ARRAYS 32
  861. /*
  862. * Identifiers for commands in the command FIFO.
  863. *
  864. * IDs between 1000 and 1039 (inclusive) were used by obsolete versions of
  865. * the SVGA3D protocol and remain reserved; they should not be used in the
  866. * future.
  867. *
  868. * IDs between 1040 and 1999 (inclusive) are available for use by the
  869. * current SVGA3D protocol.
  870. *
  871. * FIFO clients other than SVGA3D should stay below 1000, or at 2000
  872. * and up.
  873. */
  874. #define SVGA_3D_CMD_LEGACY_BASE 1000
  875. #define SVGA_3D_CMD_BASE 1040
  876. #define SVGA_3D_CMD_SURFACE_DEFINE SVGA_3D_CMD_BASE + 0
  877. #define SVGA_3D_CMD_SURFACE_DESTROY SVGA_3D_CMD_BASE + 1
  878. #define SVGA_3D_CMD_SURFACE_COPY SVGA_3D_CMD_BASE + 2
  879. #define SVGA_3D_CMD_SURFACE_STRETCHBLT SVGA_3D_CMD_BASE + 3
  880. #define SVGA_3D_CMD_SURFACE_DMA SVGA_3D_CMD_BASE + 4
  881. #define SVGA_3D_CMD_CONTEXT_DEFINE SVGA_3D_CMD_BASE + 5
  882. #define SVGA_3D_CMD_CONTEXT_DESTROY SVGA_3D_CMD_BASE + 6
  883. #define SVGA_3D_CMD_SETTRANSFORM SVGA_3D_CMD_BASE + 7
  884. #define SVGA_3D_CMD_SETZRANGE SVGA_3D_CMD_BASE + 8
  885. #define SVGA_3D_CMD_SETRENDERSTATE SVGA_3D_CMD_BASE + 9
  886. #define SVGA_3D_CMD_SETRENDERTARGET SVGA_3D_CMD_BASE + 10
  887. #define SVGA_3D_CMD_SETTEXTURESTATE SVGA_3D_CMD_BASE + 11
  888. #define SVGA_3D_CMD_SETMATERIAL SVGA_3D_CMD_BASE + 12
  889. #define SVGA_3D_CMD_SETLIGHTDATA SVGA_3D_CMD_BASE + 13
  890. #define SVGA_3D_CMD_SETLIGHTENABLED SVGA_3D_CMD_BASE + 14
  891. #define SVGA_3D_CMD_SETVIEWPORT SVGA_3D_CMD_BASE + 15
  892. #define SVGA_3D_CMD_SETCLIPPLANE SVGA_3D_CMD_BASE + 16
  893. #define SVGA_3D_CMD_CLEAR SVGA_3D_CMD_BASE + 17
  894. #define SVGA_3D_CMD_PRESENT SVGA_3D_CMD_BASE + 18 // Deprecated
  895. #define SVGA_3D_CMD_SHADER_DEFINE SVGA_3D_CMD_BASE + 19
  896. #define SVGA_3D_CMD_SHADER_DESTROY SVGA_3D_CMD_BASE + 20
  897. #define SVGA_3D_CMD_SET_SHADER SVGA_3D_CMD_BASE + 21
  898. #define SVGA_3D_CMD_SET_SHADER_CONST SVGA_3D_CMD_BASE + 22
  899. #define SVGA_3D_CMD_DRAW_PRIMITIVES SVGA_3D_CMD_BASE + 23
  900. #define SVGA_3D_CMD_SETSCISSORRECT SVGA_3D_CMD_BASE + 24
  901. #define SVGA_3D_CMD_BEGIN_QUERY SVGA_3D_CMD_BASE + 25
  902. #define SVGA_3D_CMD_END_QUERY SVGA_3D_CMD_BASE + 26
  903. #define SVGA_3D_CMD_WAIT_FOR_QUERY SVGA_3D_CMD_BASE + 27
  904. #define SVGA_3D_CMD_PRESENT_READBACK SVGA_3D_CMD_BASE + 28 // Deprecated
  905. #define SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN SVGA_3D_CMD_BASE + 29
  906. #define SVGA_3D_CMD_MAX SVGA_3D_CMD_BASE + 30
  907. #define SVGA_3D_CMD_FUTURE_MAX 2000
  908. /*
  909. * Common substructures used in multiple FIFO commands:
  910. */
  911. typedef struct {
  912. union {
  913. struct {
  914. uint16 function; // SVGA3dFogFunction
  915. uint8 type; // SVGA3dFogType
  916. uint8 base; // SVGA3dFogBase
  917. };
  918. uint32 uintValue;
  919. };
  920. } SVGA3dFogMode;
  921. /*
  922. * Uniquely identify one image (a 1D/2D/3D array) from a surface. This
  923. * is a surface ID as well as face/mipmap indices.
  924. */
  925. typedef
  926. struct SVGA3dSurfaceImageId {
  927. uint32 sid;
  928. uint32 face;
  929. uint32 mipmap;
  930. } SVGA3dSurfaceImageId;
  931. typedef
  932. struct SVGA3dGuestImage {
  933. SVGAGuestPtr ptr;
  934. /*
  935. * A note on interpretation of pitch: This value of pitch is the
  936. * number of bytes between vertically adjacent image
  937. * blocks. Normally this is the number of bytes between the first
  938. * pixel of two adjacent scanlines. With compressed textures,
  939. * however, this may represent the number of bytes between
  940. * compression blocks rather than between rows of pixels.
  941. *
  942. * XXX: Compressed textures currently must be tightly packed in guest memory.
  943. *
  944. * If the image is 1-dimensional, pitch is ignored.
  945. *
  946. * If 'pitch' is zero, the SVGA3D device calculates a pitch value
  947. * assuming each row of blocks is tightly packed.
  948. */
  949. uint32 pitch;
  950. } SVGA3dGuestImage;
  951. /*
  952. * FIFO command format definitions:
  953. */
  954. /*
  955. * The data size header following cmdNum for every 3d command
  956. */
  957. typedef
  958. struct {
  959. uint32 id;
  960. uint32 size;
  961. } SVGA3dCmdHeader;
  962. /*
  963. * A surface is a hierarchy of host VRAM surfaces: 1D, 2D, or 3D, with
  964. * optional mipmaps and cube faces.
  965. */
  966. typedef
  967. struct {
  968. uint32 width;
  969. uint32 height;
  970. uint32 depth;
  971. } SVGA3dSize;
  972. typedef enum {
  973. SVGA3D_SURFACE_CUBEMAP = (1 << 0),
  974. SVGA3D_SURFACE_HINT_STATIC = (1 << 1),
  975. SVGA3D_SURFACE_HINT_DYNAMIC = (1 << 2),
  976. SVGA3D_SURFACE_HINT_INDEXBUFFER = (1 << 3),
  977. SVGA3D_SURFACE_HINT_VERTEXBUFFER = (1 << 4),
  978. SVGA3D_SURFACE_HINT_TEXTURE = (1 << 5),
  979. SVGA3D_SURFACE_HINT_RENDERTARGET = (1 << 6),
  980. SVGA3D_SURFACE_HINT_DEPTHSTENCIL = (1 << 7),
  981. SVGA3D_SURFACE_HINT_WRITEONLY = (1 << 8),
  982. } SVGA3dSurfaceFlags;
  983. typedef
  984. struct {
  985. uint32 numMipLevels;
  986. } SVGA3dSurfaceFace;
  987. typedef
  988. struct {
  989. uint32 sid;
  990. SVGA3dSurfaceFlags surfaceFlags;
  991. SVGA3dSurfaceFormat format;
  992. SVGA3dSurfaceFace face[SVGA3D_MAX_SURFACE_FACES];
  993. /*
  994. * Followed by an SVGA3dSize structure for each mip level in each face.
  995. *
  996. * A note on surface sizes: Sizes are always specified in pixels,
  997. * even if the true surface size is not a multiple of the minimum
  998. * block size of the surface's format. For example, a 3x3x1 DXT1
  999. * compressed texture would actually be stored as a 4x4x1 image in
  1000. * memory.
  1001. */
  1002. } SVGA3dCmdDefineSurface; /* SVGA_3D_CMD_SURFACE_DEFINE */
  1003. typedef
  1004. struct {
  1005. uint32 sid;
  1006. } SVGA3dCmdDestroySurface; /* SVGA_3D_CMD_SURFACE_DESTROY */
  1007. typedef
  1008. struct {
  1009. uint32 cid;
  1010. } SVGA3dCmdDefineContext; /* SVGA_3D_CMD_CONTEXT_DEFINE */
  1011. typedef
  1012. struct {
  1013. uint32 cid;
  1014. } SVGA3dCmdDestroyContext; /* SVGA_3D_CMD_CONTEXT_DESTROY */
  1015. typedef
  1016. struct {
  1017. uint32 cid;
  1018. SVGA3dClearFlag clearFlag;
  1019. uint32 color;
  1020. float depth;
  1021. uint32 stencil;
  1022. /* Followed by variable number of SVGA3dRect structures */
  1023. } SVGA3dCmdClear; /* SVGA_3D_CMD_CLEAR */
  1024. typedef
  1025. struct SVGA3dCopyRect {
  1026. uint32 x;
  1027. uint32 y;
  1028. uint32 w;
  1029. uint32 h;
  1030. uint32 srcx;
  1031. uint32 srcy;
  1032. } SVGA3dCopyRect;
  1033. typedef
  1034. struct SVGA3dCopyBox {
  1035. uint32 x;
  1036. uint32 y;
  1037. uint32 z;
  1038. uint32 w;
  1039. uint32 h;
  1040. uint32 d;
  1041. uint32 srcx;
  1042. uint32 srcy;
  1043. uint32 srcz;
  1044. } SVGA3dCopyBox;
  1045. typedef
  1046. struct {
  1047. uint32 x;
  1048. uint32 y;
  1049. uint32 w;
  1050. uint32 h;
  1051. } SVGA3dRect;
  1052. typedef
  1053. struct {
  1054. uint32 x;
  1055. uint32 y;
  1056. uint32 z;
  1057. uint32 w;
  1058. uint32 h;
  1059. uint32 d;
  1060. } SVGA3dBox;
  1061. typedef
  1062. struct {
  1063. uint32 x;
  1064. uint32 y;
  1065. uint32 z;
  1066. } SVGA3dPoint;
  1067. typedef
  1068. struct {
  1069. SVGA3dLightType type;
  1070. SVGA3dBool inWorldSpace;
  1071. float diffuse[4];
  1072. float specular[4];
  1073. float ambient[4];
  1074. float position[4];
  1075. float direction[4];
  1076. float range;
  1077. float falloff;
  1078. float attenuation0;
  1079. float attenuation1;
  1080. float attenuation2;
  1081. float theta;
  1082. float phi;
  1083. } SVGA3dLightData;
  1084. typedef
  1085. struct {
  1086. uint32 sid;
  1087. /* Followed by variable number of SVGA3dCopyRect structures */
  1088. } SVGA3dCmdPresent; /* SVGA_3D_CMD_PRESENT */
  1089. typedef
  1090. struct {
  1091. SVGA3dRenderStateName state;
  1092. union {
  1093. uint32 uintValue;
  1094. float floatValue;
  1095. };
  1096. } SVGA3dRenderState;
  1097. typedef
  1098. struct {
  1099. uint32 cid;
  1100. /* Followed by variable number of SVGA3dRenderState structures */
  1101. } SVGA3dCmdSetRenderState; /* SVGA_3D_CMD_SETRENDERSTATE */
  1102. typedef
  1103. struct {
  1104. uint32 cid;
  1105. SVGA3dRenderTargetType type;
  1106. SVGA3dSurfaceImageId target;
  1107. } SVGA3dCmdSetRenderTarget; /* SVGA_3D_CMD_SETRENDERTARGET */
  1108. typedef
  1109. struct {
  1110. SVGA3dSurfaceImageId src;
  1111. SVGA3dSurfaceImageId dest;
  1112. /* Followed by variable number of SVGA3dCopyBox structures */
  1113. } SVGA3dCmdSurfaceCopy; /* SVGA_3D_CMD_SURFACE_COPY */
  1114. typedef
  1115. struct {
  1116. SVGA3dSurfaceImageId src;
  1117. SVGA3dSurfaceImageId dest;
  1118. SVGA3dBox boxSrc;
  1119. SVGA3dBox boxDest;
  1120. SVGA3dStretchBltMode mode;
  1121. } SVGA3dCmdSurfaceStretchBlt; /* SVGA_3D_CMD_SURFACE_STRETCHBLT */
  1122. typedef
  1123. struct {
  1124. /*
  1125. * If the discard flag is present in a surface DMA operation, the host may
  1126. * discard the contents of the current mipmap level and face of the target
  1127. * surface before applying the surface DMA contents.
  1128. */
  1129. uint32 discard : 1;
  1130. /*
  1131. * If the unsynchronized flag is present, the host may perform this upload
  1132. * without syncing to pending reads on this surface.
  1133. */
  1134. uint32 unsynchronized : 1;
  1135. /*
  1136. * Guests *MUST* set the reserved bits to 0 before submitting the command
  1137. * suffix as future flags may occupy these bits.
  1138. */
  1139. uint32 reserved : 30;
  1140. } SVGA3dSurfaceDMAFlags;
  1141. typedef
  1142. struct {
  1143. SVGA3dGuestImage guest;
  1144. SVGA3dSurfaceImageId host;
  1145. SVGA3dTransferType transfer;
  1146. /*
  1147. * Followed by variable number of SVGA3dCopyBox structures. For consistency
  1148. * in all clipping logic and coordinate translation, we define the
  1149. * "source" in each copyBox as the guest image and the
  1150. * "destination" as the host image, regardless of transfer
  1151. * direction.
  1152. *
  1153. * For efficiency, the SVGA3D device is free to copy more data than
  1154. * specified. For example, it may round copy boxes outwards such
  1155. * that they lie on particular alignment boundaries.
  1156. */
  1157. } SVGA3dCmdSurfaceDMA; /* SVGA_3D_CMD_SURFACE_DMA */
  1158. /*
  1159. * SVGA3dCmdSurfaceDMASuffix --
  1160. *
  1161. * This is a command suffix that will appear after a SurfaceDMA command in
  1162. * the FIFO. It contains some extra information that hosts may use to
  1163. * optimize performance or protect the guest. This suffix exists to preserve
  1164. * backwards compatibility while also allowing for new functionality to be
  1165. * implemented.
  1166. */
  1167. typedef
  1168. struct {
  1169. uint32 suffixSize;
  1170. /*
  1171. * The maximum offset is used to determine the maximum offset from the
  1172. * guestPtr base address that will be accessed or written to during this
  1173. * surfaceDMA. If the suffix is supported, the host will respect this
  1174. * boundary while performing surface DMAs.
  1175. *
  1176. * Defaults to MAX_UINT32
  1177. */
  1178. uint32 maximumOffset;
  1179. /*
  1180. * A set of flags that describes optimizations that the host may perform
  1181. * while performing this surface DMA operation. The guest should never rely
  1182. * on behaviour that is different when these flags are set for correctness.
  1183. *
  1184. * Defaults to 0
  1185. */
  1186. SVGA3dSurfaceDMAFlags flags;
  1187. } SVGA3dCmdSurfaceDMASuffix;
  1188. /*
  1189. * SVGA_3D_CMD_DRAW_PRIMITIVES --
  1190. *
  1191. * This command is the SVGA3D device's generic drawing entry point.
  1192. * It can draw multiple ranges of primitives, optionally using an
  1193. * index buffer, using an arbitrary collection of vertex buffers.
  1194. *
  1195. * Each SVGA3dVertexDecl defines a distinct vertex array to bind
  1196. * during this draw call. The declarations specify which surface
  1197. * the vertex data lives in, what that vertex data is used for,
  1198. * and how to interpret it.
  1199. *
  1200. * Each SVGA3dPrimitiveRange defines a collection of primitives
  1201. * to render using the same vertex arrays. An index buffer is
  1202. * optional.
  1203. */
  1204. typedef
  1205. struct {
  1206. /*
  1207. * A range hint is an optional specification for the range of indices
  1208. * in an SVGA3dArray that will be used. If 'last' is zero, it is assumed
  1209. * that the entire array will be used.
  1210. *
  1211. * These are only hints. The SVGA3D device may use them for
  1212. * performance optimization if possible, but it's also allowed to
  1213. * ignore these values.
  1214. */
  1215. uint32 first;
  1216. uint32 last;
  1217. } SVGA3dArrayRangeHint;
  1218. typedef
  1219. struct {
  1220. /*
  1221. * Define the origin and shape of a vertex or index array. Both
  1222. * 'offset' and 'stride' are in bytes. The provided surface will be
  1223. * reinterpreted as a flat array of bytes in the same format used
  1224. * by surface DMA operations. To avoid unnecessary conversions, the
  1225. * surface should be created with the SVGA3D_BUFFER format.
  1226. *
  1227. * Index 0 in the array starts 'offset' bytes into the surface.
  1228. * Index 1 begins at byte 'offset + stride', etc. Array indices may
  1229. * not be negative.
  1230. */
  1231. uint32 surfaceId;
  1232. uint32 offset;
  1233. uint32 stride;
  1234. } SVGA3dArray;
  1235. typedef
  1236. struct {
  1237. /*
  1238. * Describe a vertex array's data type, and define how it is to be
  1239. * used by the fixed function pipeline or the vertex shader. It
  1240. * isn't useful to have two VertexDecls with the same
  1241. * VertexArrayIdentity in one draw call.
  1242. */
  1243. SVGA3dDeclType type;
  1244. SVGA3dDeclMethod method;
  1245. SVGA3dDeclUsage usage;
  1246. uint32 usageIndex;
  1247. } SVGA3dVertexArrayIdentity;
  1248. typedef
  1249. struct {
  1250. SVGA3dVertexArrayIdentity identity;
  1251. SVGA3dArray array;
  1252. SVGA3dArrayRangeHint rangeHint;
  1253. } SVGA3dVertexDecl;
  1254. typedef
  1255. struct {
  1256. /*
  1257. * Define a group of primitives to render, from sequential indices.
  1258. *
  1259. * The value of 'primitiveType' and 'primitiveCount' imply the
  1260. * total number of vertices that will be rendered.
  1261. */
  1262. SVGA3dPrimitiveType primType;
  1263. uint32 primitiveCount;
  1264. /*
  1265. * Optional index buffer. If indexArray.surfaceId is
  1266. * SVGA3D_INVALID_ID, we render without an index buffer. Rendering
  1267. * without an index buffer is identical to rendering with an index
  1268. * buffer containing the sequence [0, 1, 2, 3, ...].
  1269. *
  1270. * If an index buffer is in use, indexWidth specifies the width in
  1271. * bytes of each index value. It must be less than or equal to
  1272. * indexArray.stride.
  1273. *
  1274. * (Currently, the SVGA3D device requires index buffers to be tightly
  1275. * packed. In other words, indexWidth == indexArray.stride)
  1276. */
  1277. SVGA3dArray indexArray;
  1278. uint32 indexWidth;
  1279. /*
  1280. * Optional index bias. This number is added to all indices from
  1281. * indexArray before they are used as vertex array indices. This
  1282. * can be used in multiple ways:
  1283. *
  1284. * - When not using an indexArray, this bias can be used to
  1285. * specify where in the vertex arrays to begin rendering.
  1286. *
  1287. * - A positive number here is equivalent to increasing the
  1288. * offset in each vertex array.
  1289. *
  1290. * - A negative number can be used to render using a small
  1291. * vertex array and an index buffer that contains large
  1292. * values. This may be used by some applications that
  1293. * crop a vertex buffer without modifying their index
  1294. * buffer.
  1295. *
  1296. * Note that rendering with a negative bias value may be slower and
  1297. * use more memory than rendering with a positive or zero bias.
  1298. */
  1299. int32 indexBias;
  1300. } SVGA3dPrimitiveRange;
  1301. typedef
  1302. struct {
  1303. uint32 cid;
  1304. uint32 numVertexDecls;
  1305. uint32 numRanges;
  1306. /*
  1307. * There are two variable size arrays after the
  1308. * SVGA3dCmdDrawPrimitives structure. In order,
  1309. * they are:
  1310. *
  1311. * 1. SVGA3dVertexDecl, quantity 'numVertexDecls'
  1312. * 2. SVGA3dPrimitiveRange, quantity 'numRanges'
  1313. * 3. Optionally, SVGA3dVertexDivisor, quantity 'numVertexDecls' (contains
  1314. * the frequency divisor for this the corresponding vertex decl)
  1315. */
  1316. } SVGA3dCmdDrawPrimitives; /* SVGA_3D_CMD_DRAWPRIMITIVES */
  1317. typedef
  1318. struct {
  1319. uint32 stage;
  1320. SVGA3dTextureStateName name;
  1321. union {
  1322. uint32 value;
  1323. float floatValue;
  1324. };
  1325. } SVGA3dTextureState;
  1326. typedef
  1327. struct {
  1328. uint32 cid;
  1329. /* Followed by variable number of SVGA3dTextureState structures */
  1330. } SVGA3dCmdSetTextureState; /* SVGA_3D_CMD_SETTEXTURESTATE */
  1331. typedef
  1332. struct {
  1333. uint32 cid;
  1334. SVGA3dTransformType type;
  1335. float matrix[16];
  1336. } SVGA3dCmdSetTransform; /* SVGA_3D_CMD_SETTRANSFORM */
  1337. typedef
  1338. struct {
  1339. float min;
  1340. float max;
  1341. } SVGA3dZRange;
  1342. typedef
  1343. struct {
  1344. uint32 cid;
  1345. SVGA3dZRange zRange;
  1346. } SVGA3dCmdSetZRange; /* SVGA_3D_CMD_SETZRANGE */
  1347. typedef
  1348. struct {
  1349. float diffuse[4];
  1350. float ambient[4];
  1351. float specular[4];
  1352. float emissive[4];
  1353. float shininess;
  1354. } SVGA3dMaterial;
  1355. typedef
  1356. struct {
  1357. uint32 cid;
  1358. SVGA3dFace face;
  1359. SVGA3dMaterial material;
  1360. } SVGA3dCmdSetMaterial; /* SVGA_3D_CMD_SETMATERIAL */
  1361. typedef
  1362. struct {
  1363. uint32 cid;
  1364. uint32 index;
  1365. SVGA3dLightData data;
  1366. } SVGA3dCmdSetLightData; /* SVGA_3D_CMD_SETLIGHTDATA */
  1367. typedef
  1368. struct {
  1369. uint32 cid;
  1370. uint32 index;
  1371. uint32 enabled;
  1372. } SVGA3dCmdSetLightEnabled; /* SVGA_3D_CMD_SETLIGHTENABLED */
  1373. typedef
  1374. struct {
  1375. uint32 cid;
  1376. SVGA3dRect rect;
  1377. } SVGA3dCmdSetViewport; /* SVGA_3D_CMD_SETVIEWPORT */
  1378. typedef
  1379. struct {
  1380. uint32 cid;
  1381. SVGA3dRect rect;
  1382. } SVGA3dCmdSetScissorRect; /* SVGA_3D_CMD_SETSCISSORRECT */
  1383. typedef
  1384. struct {
  1385. uint32 cid;
  1386. uint32 index;
  1387. float plane[4];
  1388. } SVGA3dCmdSetClipPlane; /* SVGA_3D_CMD_SETCLIPPLANE */
  1389. typedef
  1390. struct {
  1391. uint32 cid;
  1392. uint32 shid;
  1393. SVGA3dShaderType type;
  1394. /* Followed by variable number of DWORDs for shader bycode */
  1395. } SVGA3dCmdDefineShader; /* SVGA_3D_CMD_SHADER_DEFINE */
  1396. typedef
  1397. struct {
  1398. uint32 cid;
  1399. uint32 shid;
  1400. SVGA3dShaderType type;
  1401. } SVGA3dCmdDestroyShader; /* SVGA_3D_CMD_SHADER_DESTROY */
  1402. typedef
  1403. struct {
  1404. uint32 cid;
  1405. uint32 reg; /* register number */
  1406. SVGA3dShaderType type;
  1407. SVGA3dShaderConstType ctype;
  1408. uint32 values[4];
  1409. } SVGA3dCmdSetShaderConst; /* SVGA_3D_CMD_SET_SHADER_CONST */
  1410. typedef
  1411. struct {
  1412. uint32 cid;
  1413. SVGA3dShaderType type;
  1414. uint32 shid;
  1415. } SVGA3dCmdSetShader; /* SVGA_3D_CMD_SET_SHADER */
  1416. typedef
  1417. struct {
  1418. uint32 cid;
  1419. SVGA3dQueryType type;
  1420. } SVGA3dCmdBeginQuery; /* SVGA_3D_CMD_BEGIN_QUERY */
  1421. typedef
  1422. struct {
  1423. uint32 cid;
  1424. SVGA3dQueryType type;
  1425. SVGAGuestPtr guestResult; /* Points to an SVGA3dQueryResult structure */
  1426. } SVGA3dCmdEndQuery; /* SVGA_3D_CMD_END_QUERY */
  1427. typedef
  1428. struct {
  1429. uint32 cid; /* Same parameters passed to END_QUERY */
  1430. SVGA3dQueryType type;
  1431. SVGAGuestPtr guestResult;
  1432. } SVGA3dCmdWaitForQuery; /* SVGA_3D_CMD_WAIT_FOR_QUERY */
  1433. typedef
  1434. struct {
  1435. uint32 totalSize; /* Set by guest before query is ended. */
  1436. SVGA3dQueryState state; /* Set by host or guest. See SVGA3dQueryState. */
  1437. union { /* Set by host on exit from PENDING state */
  1438. uint32 result32;
  1439. };
  1440. } SVGA3dQueryResult;
  1441. /*
  1442. * SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN --
  1443. *
  1444. * This is a blit from an SVGA3D surface to a Screen Object. Just
  1445. * like GMR-to-screen blits, this blit may be directed at a
  1446. * specific screen or to the virtual coordinate space.
  1447. *
  1448. * The blit copies from a rectangular region of an SVGA3D surface
  1449. * image to a rectangular region of a screen or screens.
  1450. *
  1451. * This command takes an optional variable-length list of clipping
  1452. * rectangles after the body of the command. If no rectangles are
  1453. * specified, there is no clipping region. The entire destRect is
  1454. * drawn to. If one or more rectangles are included, they describe
  1455. * a clipping region. The clip rectangle coordinates are measured
  1456. * relative to the top-left corner of destRect.
  1457. *
  1458. * This clipping region serves multiple purposes:
  1459. *
  1460. * - It can be used to perform an irregularly shaped blit more
  1461. * efficiently than by issuing many separate blit commands.
  1462. *
  1463. * - It is equivalent to allowing blits with non-integer
  1464. * source coordinates. You could blit just one half-pixel
  1465. * of a source, for example, by specifying a larger
  1466. * destination rectangle than you need, then removing
  1467. * part of it using a clip rectangle.
  1468. *
  1469. * Availability:
  1470. * SVGA_FIFO_CAP_SCREEN_OBJECT
  1471. *
  1472. * Limitations:
  1473. *
  1474. * - Currently, no backend supports blits from a mipmap or face
  1475. * other than the first one.
  1476. */
  1477. typedef
  1478. struct {
  1479. SVGA3dSurfaceImageId srcImage;
  1480. SVGASignedRect srcRect;
  1481. uint32 destScreenId; /* Screen ID or SVGA_ID_INVALID for virt. coords */
  1482. SVGASignedRect destRect; /* Supports scaling if src/rest different size */
  1483. /* Clipping: zero or more SVGASignedRects follow */
  1484. } SVGA3dCmdBlitSurfaceToScreen; /* SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN */
  1485. /*
  1486. * Capability query index.
  1487. *
  1488. * Notes:
  1489. *
  1490. * 1. SVGA3D_DEVCAP_MAX_TEXTURES reflects the maximum number of
  1491. * fixed-function texture units available. Each of these units
  1492. * work in both FFP and Shader modes, and they support texture
  1493. * transforms and texture coordinates. The host may have additional
  1494. * texture image units that are only usable with shaders.
  1495. *
  1496. * 2. The BUFFER_FORMAT capabilities are deprecated, and they always
  1497. * return TRUE. Even on physical hardware that does not support
  1498. * these formats natively, the SVGA3D device will provide an emulation
  1499. * which should be invisible to the guest OS.
  1500. *
  1501. * In general, the SVGA3D device should support any operation on
  1502. * any surface format, it just may perform some of these
  1503. * operations in software depending on the capabilities of the
  1504. * available physical hardware.
  1505. *
  1506. * XXX: In the future, we will add capabilities that describe in
  1507. * detail what formats are supported in hardware for what kinds
  1508. * of operations.
  1509. */
  1510. typedef enum {
  1511. SVGA3D_DEVCAP_3D = 0,
  1512. SVGA3D_DEVCAP_MAX_LIGHTS = 1,
  1513. SVGA3D_DEVCAP_MAX_TEXTURES = 2, /* See note (1) */
  1514. SVGA3D_DEVCAP_MAX_CLIP_PLANES = 3,
  1515. SVGA3D_DEVCAP_VERTEX_SHADER_VERSION = 4,
  1516. SVGA3D_DEVCAP_VERTEX_SHADER = 5,
  1517. SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION = 6,
  1518. SVGA3D_DEVCAP_FRAGMENT_SHADER = 7,
  1519. SVGA3D_DEVCAP_MAX_RENDER_TARGETS = 8,
  1520. SVGA3D_DEVCAP_S23E8_TEXTURES = 9,
  1521. SVGA3D_DEVCAP_S10E5_TEXTURES = 10,
  1522. SVGA3D_DEVCAP_MAX_FIXED_VERTEXBLEND = 11,
  1523. SVGA3D_DEVCAP_D16_BUFFER_FORMAT = 12, /* See note (2) */
  1524. SVGA3D_DEVCAP_D24S8_BUFFER_FORMAT = 13, /* See note (2) */
  1525. SVGA3D_DEVCAP_D24X8_BUFFER_FORMAT = 14, /* See note (2) */
  1526. SVGA3D_DEVCAP_QUERY_TYPES = 15,
  1527. SVGA3D_DEVCAP_TEXTURE_GRADIENT_SAMPLING = 16,
  1528. SVGA3D_DEVCAP_MAX_POINT_SIZE = 17,
  1529. SVGA3D_DEVCAP_MAX_SHADER_TEXTURES = 18,
  1530. SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH = 19,
  1531. SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT = 20,
  1532. SVGA3D_DEVCAP_MAX_VOLUME_EXTENT = 21,
  1533. SVGA3D_DEVCAP_MAX_TEXTURE_REPEAT = 22,
  1534. SVGA3D_DEVCAP_MAX_TEXTURE_ASPECT_RATIO = 23,
  1535. SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY = 24,
  1536. SVGA3D_DEVCAP_MAX_PRIMITIVE_COUNT = 25,
  1537. SVGA3D_DEVCAP_MAX_VERTEX_INDEX = 26,
  1538. SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS = 27,
  1539. SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_INSTRUCTIONS = 28,
  1540. SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS = 29,
  1541. SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS = 30,
  1542. SVGA3D_DEVCAP_TEXTURE_OPS = 31,
  1543. SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8 = 32,
  1544. SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8 = 33,
  1545. SVGA3D_DEVCAP_SURFACEFMT_A2R10G10B10 = 34,
  1546. SVGA3D_DEVCAP_SURFACEFMT_X1R5G5B5 = 35,
  1547. SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5 = 36,
  1548. SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4 = 37,
  1549. SVGA3D_DEVCAP_SURFACEFMT_R5G6B5 = 38,
  1550. SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE16 = 39,
  1551. SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8_ALPHA8 = 40,
  1552. SVGA3D_DEVCAP_SURFACEFMT_ALPHA8 = 41,
  1553. SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8 = 42,
  1554. SVGA3D_DEVCAP_SURFACEFMT_Z_D16 = 43,
  1555. SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8 = 44,
  1556. SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8 = 45,
  1557. SVGA3D_DEVCAP_SURFACEFMT_DXT1 = 46,
  1558. SVGA3D_DEVCAP_SURFACEFMT_DXT2 = 47,
  1559. SVGA3D_DEVCAP_SURFACEFMT_DXT3 = 48,
  1560. SVGA3D_DEVCAP_SURFACEFMT_DXT4 = 49,
  1561. SVGA3D_DEVCAP_SURFACEFMT_DXT5 = 50,
  1562. SVGA3D_DEVCAP_SURFACEFMT_BUMPX8L8V8U8 = 51,
  1563. SVGA3D_DEVCAP_SURFACEFMT_A2W10V10U10 = 52,
  1564. SVGA3D_DEVCAP_SURFACEFMT_BUMPU8V8 = 53,
  1565. SVGA3D_DEVCAP_SURFACEFMT_Q8W8V8U8 = 54,
  1566. SVGA3D_DEVCAP_SURFACEFMT_CxV8U8 = 55,
  1567. SVGA3D_DEVCAP_SURFACEFMT_R_S10E5 = 56,
  1568. SVGA3D_DEVCAP_SURFACEFMT_R_S23E8 = 57,
  1569. SVGA3D_DEVCAP_SURFACEFMT_RG_S10E5 = 58,
  1570. SVGA3D_DEVCAP_SURFACEFMT_RG_S23E8 = 59,
  1571. SVGA3D_DEVCAP_SURFACEFMT_ARGB_S10E5 = 60,
  1572. SVGA3D_DEVCAP_SURFACEFMT_ARGB_S23E8 = 61,
  1573. SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEXTURES = 63,
  1574. /*
  1575. * Note that MAX_SIMULTANEOUS_RENDER_TARGETS is a maximum count of color
  1576. * render targets. This does no include the depth or stencil targets.
  1577. */
  1578. SVGA3D_DEVCAP_MAX_SIMULTANEOUS_RENDER_TARGETS = 64,
  1579. SVGA3D_DEVCAP_SURFACEFMT_V16U16 = 65,
  1580. SVGA3D_DEVCAP_SURFACEFMT_G16R16 = 66,
  1581. SVGA3D_DEVCAP_SURFACEFMT_A16B16G16R16 = 67,
  1582. SVGA3D_DEVCAP_SURFACEFMT_UYVY = 68,
  1583. SVGA3D_DEVCAP_SURFACEFMT_YUY2 = 69,
  1584. /*
  1585. * Don't add new caps into the previous section; the values in this
  1586. * enumeration must not change. You can put new values right before
  1587. * SVGA3D_DEVCAP_MAX.
  1588. */
  1589. SVGA3D_DEVCAP_MAX /* This must be the last index. */
  1590. } SVGA3dDevCapIndex;
  1591. typedef union {
  1592. Bool b;
  1593. uint32 u;
  1594. int32 i;
  1595. float f;
  1596. } SVGA3dDevCapResult;
  1597. #endif /* _SVGA3D_REG_H_ */