svga3d_reg.h 86 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628
  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. typedef uint32 PPN;
  34. typedef __le64 PPN64;
  35. /*
  36. * 3D Hardware Version
  37. *
  38. * The hardware version is stored in the SVGA_FIFO_3D_HWVERSION fifo
  39. * register. Is set by the host and read by the guest. This lets
  40. * us make new guest drivers which are backwards-compatible with old
  41. * SVGA hardware revisions. It does not let us support old guest
  42. * drivers. Good enough for now.
  43. *
  44. */
  45. #define SVGA3D_MAKE_HWVERSION(major, minor) (((major) << 16) | ((minor) & 0xFF))
  46. #define SVGA3D_MAJOR_HWVERSION(version) ((version) >> 16)
  47. #define SVGA3D_MINOR_HWVERSION(version) ((version) & 0xFF)
  48. typedef enum {
  49. SVGA3D_HWVERSION_WS5_RC1 = SVGA3D_MAKE_HWVERSION(0, 1),
  50. SVGA3D_HWVERSION_WS5_RC2 = SVGA3D_MAKE_HWVERSION(0, 2),
  51. SVGA3D_HWVERSION_WS51_RC1 = SVGA3D_MAKE_HWVERSION(0, 3),
  52. SVGA3D_HWVERSION_WS6_B1 = SVGA3D_MAKE_HWVERSION(1, 1),
  53. SVGA3D_HWVERSION_FUSION_11 = SVGA3D_MAKE_HWVERSION(1, 4),
  54. SVGA3D_HWVERSION_WS65_B1 = SVGA3D_MAKE_HWVERSION(2, 0),
  55. SVGA3D_HWVERSION_WS8_B1 = SVGA3D_MAKE_HWVERSION(2, 1),
  56. SVGA3D_HWVERSION_CURRENT = SVGA3D_HWVERSION_WS8_B1,
  57. } SVGA3dHardwareVersion;
  58. /*
  59. * Generic Types
  60. */
  61. typedef uint32 SVGA3dBool; /* 32-bit Bool definition */
  62. #define SVGA3D_NUM_CLIPPLANES 6
  63. #define SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS 8
  64. #define SVGA3D_MAX_CONTEXT_IDS 256
  65. #define SVGA3D_MAX_SURFACE_IDS (32 * 1024)
  66. #define SVGA3D_NUM_TEXTURE_UNITS 32
  67. #define SVGA3D_NUM_LIGHTS 8
  68. /*
  69. * Surface formats.
  70. *
  71. * If you modify this list, be sure to keep GLUtil.c in sync. It
  72. * includes the internal format definition of each surface in
  73. * GLUtil_ConvertSurfaceFormat, and it contains a table of
  74. * human-readable names in GLUtil_GetFormatName.
  75. */
  76. typedef enum SVGA3dSurfaceFormat {
  77. SVGA3D_FORMAT_MIN = 0,
  78. SVGA3D_FORMAT_INVALID = 0,
  79. SVGA3D_X8R8G8B8 = 1,
  80. SVGA3D_A8R8G8B8 = 2,
  81. SVGA3D_R5G6B5 = 3,
  82. SVGA3D_X1R5G5B5 = 4,
  83. SVGA3D_A1R5G5B5 = 5,
  84. SVGA3D_A4R4G4B4 = 6,
  85. SVGA3D_Z_D32 = 7,
  86. SVGA3D_Z_D16 = 8,
  87. SVGA3D_Z_D24S8 = 9,
  88. SVGA3D_Z_D15S1 = 10,
  89. SVGA3D_LUMINANCE8 = 11,
  90. SVGA3D_LUMINANCE4_ALPHA4 = 12,
  91. SVGA3D_LUMINANCE16 = 13,
  92. SVGA3D_LUMINANCE8_ALPHA8 = 14,
  93. SVGA3D_DXT1 = 15,
  94. SVGA3D_DXT2 = 16,
  95. SVGA3D_DXT3 = 17,
  96. SVGA3D_DXT4 = 18,
  97. SVGA3D_DXT5 = 19,
  98. SVGA3D_BUMPU8V8 = 20,
  99. SVGA3D_BUMPL6V5U5 = 21,
  100. SVGA3D_BUMPX8L8V8U8 = 22,
  101. SVGA3D_BUMPL8V8U8 = 23,
  102. SVGA3D_ARGB_S10E5 = 24, /* 16-bit floating-point ARGB */
  103. SVGA3D_ARGB_S23E8 = 25, /* 32-bit floating-point ARGB */
  104. SVGA3D_A2R10G10B10 = 26,
  105. /* signed formats */
  106. SVGA3D_V8U8 = 27,
  107. SVGA3D_Q8W8V8U8 = 28,
  108. SVGA3D_CxV8U8 = 29,
  109. /* mixed formats */
  110. SVGA3D_X8L8V8U8 = 30,
  111. SVGA3D_A2W10V10U10 = 31,
  112. SVGA3D_ALPHA8 = 32,
  113. /* Single- and dual-component floating point formats */
  114. SVGA3D_R_S10E5 = 33,
  115. SVGA3D_R_S23E8 = 34,
  116. SVGA3D_RG_S10E5 = 35,
  117. SVGA3D_RG_S23E8 = 36,
  118. SVGA3D_BUFFER = 37,
  119. SVGA3D_Z_D24X8 = 38,
  120. SVGA3D_V16U16 = 39,
  121. SVGA3D_G16R16 = 40,
  122. SVGA3D_A16B16G16R16 = 41,
  123. /* Packed Video formats */
  124. SVGA3D_UYVY = 42,
  125. SVGA3D_YUY2 = 43,
  126. /* Planar video formats */
  127. SVGA3D_NV12 = 44,
  128. /* Video format with alpha */
  129. SVGA3D_AYUV = 45,
  130. SVGA3D_R32G32B32A32_TYPELESS = 46,
  131. SVGA3D_R32G32B32A32_FLOAT = 25,
  132. SVGA3D_R32G32B32A32_UINT = 47,
  133. SVGA3D_R32G32B32A32_SINT = 48,
  134. SVGA3D_R32G32B32_TYPELESS = 49,
  135. SVGA3D_R32G32B32_FLOAT = 50,
  136. SVGA3D_R32G32B32_UINT = 51,
  137. SVGA3D_R32G32B32_SINT = 52,
  138. SVGA3D_R16G16B16A16_TYPELESS = 53,
  139. SVGA3D_R16G16B16A16_FLOAT = 24,
  140. SVGA3D_R16G16B16A16_UNORM = 41,
  141. SVGA3D_R16G16B16A16_UINT = 54,
  142. SVGA3D_R16G16B16A16_SNORM = 55,
  143. SVGA3D_R16G16B16A16_SINT = 56,
  144. SVGA3D_R32G32_TYPELESS = 57,
  145. SVGA3D_R32G32_FLOAT = 36,
  146. SVGA3D_R32G32_UINT = 58,
  147. SVGA3D_R32G32_SINT = 59,
  148. SVGA3D_R32G8X24_TYPELESS = 60,
  149. SVGA3D_D32_FLOAT_S8X24_UINT = 61,
  150. SVGA3D_R32_FLOAT_X8X24_TYPELESS = 62,
  151. SVGA3D_X32_TYPELESS_G8X24_UINT = 63,
  152. SVGA3D_R10G10B10A2_TYPELESS = 64,
  153. SVGA3D_R10G10B10A2_UNORM = 26,
  154. SVGA3D_R10G10B10A2_UINT = 65,
  155. SVGA3D_R11G11B10_FLOAT = 66,
  156. SVGA3D_R8G8B8A8_TYPELESS = 67,
  157. SVGA3D_R8G8B8A8_UNORM = 68,
  158. SVGA3D_R8G8B8A8_UNORM_SRGB = 69,
  159. SVGA3D_R8G8B8A8_UINT = 70,
  160. SVGA3D_R8G8B8A8_SNORM = 28,
  161. SVGA3D_R8G8B8A8_SINT = 71,
  162. SVGA3D_R16G16_TYPELESS = 72,
  163. SVGA3D_R16G16_FLOAT = 35,
  164. SVGA3D_R16G16_UNORM = 40,
  165. SVGA3D_R16G16_UINT = 73,
  166. SVGA3D_R16G16_SNORM = 39,
  167. SVGA3D_R16G16_SINT = 74,
  168. SVGA3D_R32_TYPELESS = 75,
  169. SVGA3D_D32_FLOAT = 76,
  170. SVGA3D_R32_FLOAT = 34,
  171. SVGA3D_R32_UINT = 77,
  172. SVGA3D_R32_SINT = 78,
  173. SVGA3D_R24G8_TYPELESS = 79,
  174. SVGA3D_D24_UNORM_S8_UINT = 80,
  175. SVGA3D_R24_UNORM_X8_TYPELESS = 81,
  176. SVGA3D_X24_TYPELESS_G8_UINT = 82,
  177. SVGA3D_R8G8_TYPELESS = 83,
  178. SVGA3D_R8G8_UNORM = 84,
  179. SVGA3D_R8G8_UINT = 85,
  180. SVGA3D_R8G8_SNORM = 27,
  181. SVGA3D_R8G8_SINT = 86,
  182. SVGA3D_R16_TYPELESS = 87,
  183. SVGA3D_R16_FLOAT = 33,
  184. SVGA3D_D16_UNORM = 8,
  185. SVGA3D_R16_UNORM = 88,
  186. SVGA3D_R16_UINT = 89,
  187. SVGA3D_R16_SNORM = 90,
  188. SVGA3D_R16_SINT = 91,
  189. SVGA3D_R8_TYPELESS = 92,
  190. SVGA3D_R8_UNORM = 93,
  191. SVGA3D_R8_UINT = 94,
  192. SVGA3D_R8_SNORM = 95,
  193. SVGA3D_R8_SINT = 96,
  194. SVGA3D_A8_UNORM = 32,
  195. SVGA3D_R1_UNORM = 97,
  196. SVGA3D_R9G9B9E5_SHAREDEXP = 98,
  197. SVGA3D_R8G8_B8G8_UNORM = 99,
  198. SVGA3D_G8R8_G8B8_UNORM = 100,
  199. SVGA3D_BC1_TYPELESS = 101,
  200. SVGA3D_BC1_UNORM = 15,
  201. SVGA3D_BC1_UNORM_SRGB = 102,
  202. SVGA3D_BC2_TYPELESS = 103,
  203. SVGA3D_BC2_UNORM = 17,
  204. SVGA3D_BC2_UNORM_SRGB = 104,
  205. SVGA3D_BC3_TYPELESS = 105,
  206. SVGA3D_BC3_UNORM = 19,
  207. SVGA3D_BC3_UNORM_SRGB = 106,
  208. SVGA3D_BC4_TYPELESS = 107,
  209. SVGA3D_BC4_UNORM = 108,
  210. SVGA3D_BC4_SNORM = 109,
  211. SVGA3D_BC5_TYPELESS = 110,
  212. SVGA3D_BC5_UNORM = 111,
  213. SVGA3D_BC5_SNORM = 112,
  214. SVGA3D_B5G6R5_UNORM = 3,
  215. SVGA3D_B5G5R5A1_UNORM = 5,
  216. SVGA3D_B8G8R8A8_UNORM = 2,
  217. SVGA3D_B8G8R8X8_UNORM = 1,
  218. SVGA3D_R10G10B10_XR_BIAS_A2_UNORM = 113,
  219. SVGA3D_B8G8R8A8_TYPELESS = 114,
  220. SVGA3D_B8G8R8A8_UNORM_SRGB = 115,
  221. SVGA3D_B8G8R8X8_TYPELESS = 116,
  222. SVGA3D_B8G8R8X8_UNORM_SRGB = 117,
  223. /* Advanced D3D9 depth formats. */
  224. SVGA3D_Z_DF16 = 118,
  225. SVGA3D_Z_DF24 = 119,
  226. SVGA3D_Z_D24S8_INT = 120,
  227. /* Planar video formats. */
  228. SVGA3D_YV12 = 121,
  229. SVGA3D_FORMAT_MAX = 122,
  230. } SVGA3dSurfaceFormat;
  231. typedef uint32 SVGA3dColor; /* a, r, g, b */
  232. /*
  233. * These match the D3DFORMAT_OP definitions used by Direct3D. We need
  234. * them so that we can query the host for what the supported surface
  235. * operations are (when we're using the D3D backend, in particular),
  236. * and so we can send those operations to the guest.
  237. */
  238. typedef enum {
  239. SVGA3DFORMAT_OP_TEXTURE = 0x00000001,
  240. SVGA3DFORMAT_OP_VOLUMETEXTURE = 0x00000002,
  241. SVGA3DFORMAT_OP_CUBETEXTURE = 0x00000004,
  242. SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET = 0x00000008,
  243. SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET = 0x00000010,
  244. SVGA3DFORMAT_OP_ZSTENCIL = 0x00000040,
  245. SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH = 0x00000080,
  246. /*
  247. * This format can be used as a render target if the current display mode
  248. * is the same depth if the alpha channel is ignored. e.g. if the device
  249. * can render to A8R8G8B8 when the display mode is X8R8G8B8, then the
  250. * format op list entry for A8R8G8B8 should have this cap.
  251. */
  252. SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET = 0x00000100,
  253. /*
  254. * This format contains DirectDraw support (including Flip). This flag
  255. * should not to be set on alpha formats.
  256. */
  257. SVGA3DFORMAT_OP_DISPLAYMODE = 0x00000400,
  258. /*
  259. * The rasterizer can support some level of Direct3D support in this format
  260. * and implies that the driver can create a Context in this mode (for some
  261. * render target format). When this flag is set, the SVGA3DFORMAT_OP_DISPLAYMODE
  262. * flag must also be set.
  263. */
  264. SVGA3DFORMAT_OP_3DACCELERATION = 0x00000800,
  265. /*
  266. * This is set for a private format when the driver has put the bpp in
  267. * the structure.
  268. */
  269. SVGA3DFORMAT_OP_PIXELSIZE = 0x00001000,
  270. /*
  271. * Indicates that this format can be converted to any RGB format for which
  272. * SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB is specified
  273. */
  274. SVGA3DFORMAT_OP_CONVERT_TO_ARGB = 0x00002000,
  275. /*
  276. * Indicates that this format can be used to create offscreen plain surfaces.
  277. */
  278. SVGA3DFORMAT_OP_OFFSCREENPLAIN = 0x00004000,
  279. /*
  280. * Indicated that this format can be read as an SRGB texture (meaning that the
  281. * sampler will linearize the looked up data)
  282. */
  283. SVGA3DFORMAT_OP_SRGBREAD = 0x00008000,
  284. /*
  285. * Indicates that this format can be used in the bumpmap instructions
  286. */
  287. SVGA3DFORMAT_OP_BUMPMAP = 0x00010000,
  288. /*
  289. * Indicates that this format can be sampled by the displacement map sampler
  290. */
  291. SVGA3DFORMAT_OP_DMAP = 0x00020000,
  292. /*
  293. * Indicates that this format cannot be used with texture filtering
  294. */
  295. SVGA3DFORMAT_OP_NOFILTER = 0x00040000,
  296. /*
  297. * Indicates that format conversions are supported to this RGB format if
  298. * SVGA3DFORMAT_OP_CONVERT_TO_ARGB is specified in the source format.
  299. */
  300. SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB = 0x00080000,
  301. /*
  302. * Indicated that this format can be written as an SRGB target (meaning that the
  303. * pixel pipe will DE-linearize data on output to format)
  304. */
  305. SVGA3DFORMAT_OP_SRGBWRITE = 0x00100000,
  306. /*
  307. * Indicates that this format cannot be used with alpha blending
  308. */
  309. SVGA3DFORMAT_OP_NOALPHABLEND = 0x00200000,
  310. /*
  311. * Indicates that the device can auto-generated sublevels for resources
  312. * of this format
  313. */
  314. SVGA3DFORMAT_OP_AUTOGENMIPMAP = 0x00400000,
  315. /*
  316. * Indicates that this format can be used by vertex texture sampler
  317. */
  318. SVGA3DFORMAT_OP_VERTEXTEXTURE = 0x00800000,
  319. /*
  320. * Indicates that this format supports neither texture coordinate wrap
  321. * modes, nor mipmapping
  322. */
  323. SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP = 0x01000000
  324. } SVGA3dFormatOp;
  325. /*
  326. * This structure is a conversion of SVGA3DFORMAT_OP_*.
  327. * Entries must be located at the same position.
  328. */
  329. typedef union {
  330. uint32 value;
  331. struct {
  332. uint32 texture : 1;
  333. uint32 volumeTexture : 1;
  334. uint32 cubeTexture : 1;
  335. uint32 offscreenRenderTarget : 1;
  336. uint32 sameFormatRenderTarget : 1;
  337. uint32 unknown1 : 1;
  338. uint32 zStencil : 1;
  339. uint32 zStencilArbitraryDepth : 1;
  340. uint32 sameFormatUpToAlpha : 1;
  341. uint32 unknown2 : 1;
  342. uint32 displayMode : 1;
  343. uint32 acceleration3d : 1;
  344. uint32 pixelSize : 1;
  345. uint32 convertToARGB : 1;
  346. uint32 offscreenPlain : 1;
  347. uint32 sRGBRead : 1;
  348. uint32 bumpMap : 1;
  349. uint32 dmap : 1;
  350. uint32 noFilter : 1;
  351. uint32 memberOfGroupARGB : 1;
  352. uint32 sRGBWrite : 1;
  353. uint32 noAlphaBlend : 1;
  354. uint32 autoGenMipMap : 1;
  355. uint32 vertexTexture : 1;
  356. uint32 noTexCoordWrapNorMip : 1;
  357. };
  358. } SVGA3dSurfaceFormatCaps;
  359. /*
  360. * SVGA_3D_CMD_SETRENDERSTATE Types. All value types
  361. * must fit in a uint32.
  362. */
  363. typedef enum {
  364. SVGA3D_RS_INVALID = 0,
  365. SVGA3D_RS_ZENABLE = 1, /* SVGA3dBool */
  366. SVGA3D_RS_ZWRITEENABLE = 2, /* SVGA3dBool */
  367. SVGA3D_RS_ALPHATESTENABLE = 3, /* SVGA3dBool */
  368. SVGA3D_RS_DITHERENABLE = 4, /* SVGA3dBool */
  369. SVGA3D_RS_BLENDENABLE = 5, /* SVGA3dBool */
  370. SVGA3D_RS_FOGENABLE = 6, /* SVGA3dBool */
  371. SVGA3D_RS_SPECULARENABLE = 7, /* SVGA3dBool */
  372. SVGA3D_RS_STENCILENABLE = 8, /* SVGA3dBool */
  373. SVGA3D_RS_LIGHTINGENABLE = 9, /* SVGA3dBool */
  374. SVGA3D_RS_NORMALIZENORMALS = 10, /* SVGA3dBool */
  375. SVGA3D_RS_POINTSPRITEENABLE = 11, /* SVGA3dBool */
  376. SVGA3D_RS_POINTSCALEENABLE = 12, /* SVGA3dBool */
  377. SVGA3D_RS_STENCILREF = 13, /* uint32 */
  378. SVGA3D_RS_STENCILMASK = 14, /* uint32 */
  379. SVGA3D_RS_STENCILWRITEMASK = 15, /* uint32 */
  380. SVGA3D_RS_FOGSTART = 16, /* float */
  381. SVGA3D_RS_FOGEND = 17, /* float */
  382. SVGA3D_RS_FOGDENSITY = 18, /* float */
  383. SVGA3D_RS_POINTSIZE = 19, /* float */
  384. SVGA3D_RS_POINTSIZEMIN = 20, /* float */
  385. SVGA3D_RS_POINTSIZEMAX = 21, /* float */
  386. SVGA3D_RS_POINTSCALE_A = 22, /* float */
  387. SVGA3D_RS_POINTSCALE_B = 23, /* float */
  388. SVGA3D_RS_POINTSCALE_C = 24, /* float */
  389. SVGA3D_RS_FOGCOLOR = 25, /* SVGA3dColor */
  390. SVGA3D_RS_AMBIENT = 26, /* SVGA3dColor */
  391. SVGA3D_RS_CLIPPLANEENABLE = 27, /* SVGA3dClipPlanes */
  392. SVGA3D_RS_FOGMODE = 28, /* SVGA3dFogMode */
  393. SVGA3D_RS_FILLMODE = 29, /* SVGA3dFillMode */
  394. SVGA3D_RS_SHADEMODE = 30, /* SVGA3dShadeMode */
  395. SVGA3D_RS_LINEPATTERN = 31, /* SVGA3dLinePattern */
  396. SVGA3D_RS_SRCBLEND = 32, /* SVGA3dBlendOp */
  397. SVGA3D_RS_DSTBLEND = 33, /* SVGA3dBlendOp */
  398. SVGA3D_RS_BLENDEQUATION = 34, /* SVGA3dBlendEquation */
  399. SVGA3D_RS_CULLMODE = 35, /* SVGA3dFace */
  400. SVGA3D_RS_ZFUNC = 36, /* SVGA3dCmpFunc */
  401. SVGA3D_RS_ALPHAFUNC = 37, /* SVGA3dCmpFunc */
  402. SVGA3D_RS_STENCILFUNC = 38, /* SVGA3dCmpFunc */
  403. SVGA3D_RS_STENCILFAIL = 39, /* SVGA3dStencilOp */
  404. SVGA3D_RS_STENCILZFAIL = 40, /* SVGA3dStencilOp */
  405. SVGA3D_RS_STENCILPASS = 41, /* SVGA3dStencilOp */
  406. SVGA3D_RS_ALPHAREF = 42, /* float (0.0 .. 1.0) */
  407. SVGA3D_RS_FRONTWINDING = 43, /* SVGA3dFrontWinding */
  408. SVGA3D_RS_COORDINATETYPE = 44, /* SVGA3dCoordinateType */
  409. SVGA3D_RS_ZBIAS = 45, /* float */
  410. SVGA3D_RS_RANGEFOGENABLE = 46, /* SVGA3dBool */
  411. SVGA3D_RS_COLORWRITEENABLE = 47, /* SVGA3dColorMask */
  412. SVGA3D_RS_VERTEXMATERIALENABLE = 48, /* SVGA3dBool */
  413. SVGA3D_RS_DIFFUSEMATERIALSOURCE = 49, /* SVGA3dVertexMaterial */
  414. SVGA3D_RS_SPECULARMATERIALSOURCE = 50, /* SVGA3dVertexMaterial */
  415. SVGA3D_RS_AMBIENTMATERIALSOURCE = 51, /* SVGA3dVertexMaterial */
  416. SVGA3D_RS_EMISSIVEMATERIALSOURCE = 52, /* SVGA3dVertexMaterial */
  417. SVGA3D_RS_TEXTUREFACTOR = 53, /* SVGA3dColor */
  418. SVGA3D_RS_LOCALVIEWER = 54, /* SVGA3dBool */
  419. SVGA3D_RS_SCISSORTESTENABLE = 55, /* SVGA3dBool */
  420. SVGA3D_RS_BLENDCOLOR = 56, /* SVGA3dColor */
  421. SVGA3D_RS_STENCILENABLE2SIDED = 57, /* SVGA3dBool */
  422. SVGA3D_RS_CCWSTENCILFUNC = 58, /* SVGA3dCmpFunc */
  423. SVGA3D_RS_CCWSTENCILFAIL = 59, /* SVGA3dStencilOp */
  424. SVGA3D_RS_CCWSTENCILZFAIL = 60, /* SVGA3dStencilOp */
  425. SVGA3D_RS_CCWSTENCILPASS = 61, /* SVGA3dStencilOp */
  426. SVGA3D_RS_VERTEXBLEND = 62, /* SVGA3dVertexBlendFlags */
  427. SVGA3D_RS_SLOPESCALEDEPTHBIAS = 63, /* float */
  428. SVGA3D_RS_DEPTHBIAS = 64, /* float */
  429. /*
  430. * Output Gamma Level
  431. *
  432. * Output gamma effects the gamma curve of colors that are output from the
  433. * rendering pipeline. A value of 1.0 specifies a linear color space. If the
  434. * value is <= 0.0, gamma correction is ignored and linear color space is
  435. * used.
  436. */
  437. SVGA3D_RS_OUTPUTGAMMA = 65, /* float */
  438. SVGA3D_RS_ZVISIBLE = 66, /* SVGA3dBool */
  439. SVGA3D_RS_LASTPIXEL = 67, /* SVGA3dBool */
  440. SVGA3D_RS_CLIPPING = 68, /* SVGA3dBool */
  441. SVGA3D_RS_WRAP0 = 69, /* SVGA3dWrapFlags */
  442. SVGA3D_RS_WRAP1 = 70, /* SVGA3dWrapFlags */
  443. SVGA3D_RS_WRAP2 = 71, /* SVGA3dWrapFlags */
  444. SVGA3D_RS_WRAP3 = 72, /* SVGA3dWrapFlags */
  445. SVGA3D_RS_WRAP4 = 73, /* SVGA3dWrapFlags */
  446. SVGA3D_RS_WRAP5 = 74, /* SVGA3dWrapFlags */
  447. SVGA3D_RS_WRAP6 = 75, /* SVGA3dWrapFlags */
  448. SVGA3D_RS_WRAP7 = 76, /* SVGA3dWrapFlags */
  449. SVGA3D_RS_WRAP8 = 77, /* SVGA3dWrapFlags */
  450. SVGA3D_RS_WRAP9 = 78, /* SVGA3dWrapFlags */
  451. SVGA3D_RS_WRAP10 = 79, /* SVGA3dWrapFlags */
  452. SVGA3D_RS_WRAP11 = 80, /* SVGA3dWrapFlags */
  453. SVGA3D_RS_WRAP12 = 81, /* SVGA3dWrapFlags */
  454. SVGA3D_RS_WRAP13 = 82, /* SVGA3dWrapFlags */
  455. SVGA3D_RS_WRAP14 = 83, /* SVGA3dWrapFlags */
  456. SVGA3D_RS_WRAP15 = 84, /* SVGA3dWrapFlags */
  457. SVGA3D_RS_MULTISAMPLEANTIALIAS = 85, /* SVGA3dBool */
  458. SVGA3D_RS_MULTISAMPLEMASK = 86, /* uint32 */
  459. SVGA3D_RS_INDEXEDVERTEXBLENDENABLE = 87, /* SVGA3dBool */
  460. SVGA3D_RS_TWEENFACTOR = 88, /* float */
  461. SVGA3D_RS_ANTIALIASEDLINEENABLE = 89, /* SVGA3dBool */
  462. SVGA3D_RS_COLORWRITEENABLE1 = 90, /* SVGA3dColorMask */
  463. SVGA3D_RS_COLORWRITEENABLE2 = 91, /* SVGA3dColorMask */
  464. SVGA3D_RS_COLORWRITEENABLE3 = 92, /* SVGA3dColorMask */
  465. SVGA3D_RS_SEPARATEALPHABLENDENABLE = 93, /* SVGA3dBool */
  466. SVGA3D_RS_SRCBLENDALPHA = 94, /* SVGA3dBlendOp */
  467. SVGA3D_RS_DSTBLENDALPHA = 95, /* SVGA3dBlendOp */
  468. SVGA3D_RS_BLENDEQUATIONALPHA = 96, /* SVGA3dBlendEquation */
  469. SVGA3D_RS_TRANSPARENCYANTIALIAS = 97, /* SVGA3dTransparencyAntialiasType */
  470. SVGA3D_RS_LINEAA = 98, /* SVGA3dBool */
  471. SVGA3D_RS_LINEWIDTH = 99, /* float */
  472. SVGA3D_RS_MAX
  473. } SVGA3dRenderStateName;
  474. typedef enum {
  475. SVGA3D_TRANSPARENCYANTIALIAS_NORMAL = 0,
  476. SVGA3D_TRANSPARENCYANTIALIAS_ALPHATOCOVERAGE = 1,
  477. SVGA3D_TRANSPARENCYANTIALIAS_SUPERSAMPLE = 2,
  478. SVGA3D_TRANSPARENCYANTIALIAS_MAX
  479. } SVGA3dTransparencyAntialiasType;
  480. typedef enum {
  481. SVGA3D_VERTEXMATERIAL_NONE = 0, /* Use the value in the current material */
  482. SVGA3D_VERTEXMATERIAL_DIFFUSE = 1, /* Use the value in the diffuse component */
  483. SVGA3D_VERTEXMATERIAL_SPECULAR = 2, /* Use the value in the specular component */
  484. } SVGA3dVertexMaterial;
  485. typedef enum {
  486. SVGA3D_FILLMODE_INVALID = 0,
  487. SVGA3D_FILLMODE_POINT = 1,
  488. SVGA3D_FILLMODE_LINE = 2,
  489. SVGA3D_FILLMODE_FILL = 3,
  490. SVGA3D_FILLMODE_MAX
  491. } SVGA3dFillModeType;
  492. typedef
  493. union {
  494. struct {
  495. uint16 mode; /* SVGA3dFillModeType */
  496. uint16 face; /* SVGA3dFace */
  497. };
  498. uint32 uintValue;
  499. } SVGA3dFillMode;
  500. typedef enum {
  501. SVGA3D_SHADEMODE_INVALID = 0,
  502. SVGA3D_SHADEMODE_FLAT = 1,
  503. SVGA3D_SHADEMODE_SMOOTH = 2,
  504. SVGA3D_SHADEMODE_PHONG = 3, /* Not supported */
  505. SVGA3D_SHADEMODE_MAX
  506. } SVGA3dShadeMode;
  507. typedef
  508. union {
  509. struct {
  510. uint16 repeat;
  511. uint16 pattern;
  512. };
  513. uint32 uintValue;
  514. } SVGA3dLinePattern;
  515. typedef enum {
  516. SVGA3D_BLENDOP_INVALID = 0,
  517. SVGA3D_BLENDOP_ZERO = 1,
  518. SVGA3D_BLENDOP_ONE = 2,
  519. SVGA3D_BLENDOP_SRCCOLOR = 3,
  520. SVGA3D_BLENDOP_INVSRCCOLOR = 4,
  521. SVGA3D_BLENDOP_SRCALPHA = 5,
  522. SVGA3D_BLENDOP_INVSRCALPHA = 6,
  523. SVGA3D_BLENDOP_DESTALPHA = 7,
  524. SVGA3D_BLENDOP_INVDESTALPHA = 8,
  525. SVGA3D_BLENDOP_DESTCOLOR = 9,
  526. SVGA3D_BLENDOP_INVDESTCOLOR = 10,
  527. SVGA3D_BLENDOP_SRCALPHASAT = 11,
  528. SVGA3D_BLENDOP_BLENDFACTOR = 12,
  529. SVGA3D_BLENDOP_INVBLENDFACTOR = 13,
  530. SVGA3D_BLENDOP_MAX
  531. } SVGA3dBlendOp;
  532. typedef enum {
  533. SVGA3D_BLENDEQ_INVALID = 0,
  534. SVGA3D_BLENDEQ_ADD = 1,
  535. SVGA3D_BLENDEQ_SUBTRACT = 2,
  536. SVGA3D_BLENDEQ_REVSUBTRACT = 3,
  537. SVGA3D_BLENDEQ_MINIMUM = 4,
  538. SVGA3D_BLENDEQ_MAXIMUM = 5,
  539. SVGA3D_BLENDEQ_MAX
  540. } SVGA3dBlendEquation;
  541. typedef enum {
  542. SVGA3D_FRONTWINDING_INVALID = 0,
  543. SVGA3D_FRONTWINDING_CW = 1,
  544. SVGA3D_FRONTWINDING_CCW = 2,
  545. SVGA3D_FRONTWINDING_MAX
  546. } SVGA3dFrontWinding;
  547. typedef enum {
  548. SVGA3D_FACE_INVALID = 0,
  549. SVGA3D_FACE_NONE = 1,
  550. SVGA3D_FACE_FRONT = 2,
  551. SVGA3D_FACE_BACK = 3,
  552. SVGA3D_FACE_FRONT_BACK = 4,
  553. SVGA3D_FACE_MAX
  554. } SVGA3dFace;
  555. /*
  556. * The order and the values should not be changed
  557. */
  558. typedef enum {
  559. SVGA3D_CMP_INVALID = 0,
  560. SVGA3D_CMP_NEVER = 1,
  561. SVGA3D_CMP_LESS = 2,
  562. SVGA3D_CMP_EQUAL = 3,
  563. SVGA3D_CMP_LESSEQUAL = 4,
  564. SVGA3D_CMP_GREATER = 5,
  565. SVGA3D_CMP_NOTEQUAL = 6,
  566. SVGA3D_CMP_GREATEREQUAL = 7,
  567. SVGA3D_CMP_ALWAYS = 8,
  568. SVGA3D_CMP_MAX
  569. } SVGA3dCmpFunc;
  570. /*
  571. * SVGA3D_FOGFUNC_* specifies the fog equation, or PER_VERTEX which allows
  572. * the fog factor to be specified in the alpha component of the specular
  573. * (a.k.a. secondary) vertex color.
  574. */
  575. typedef enum {
  576. SVGA3D_FOGFUNC_INVALID = 0,
  577. SVGA3D_FOGFUNC_EXP = 1,
  578. SVGA3D_FOGFUNC_EXP2 = 2,
  579. SVGA3D_FOGFUNC_LINEAR = 3,
  580. SVGA3D_FOGFUNC_PER_VERTEX = 4
  581. } SVGA3dFogFunction;
  582. /*
  583. * SVGA3D_FOGTYPE_* specifies if fog factors are computed on a per-vertex
  584. * or per-pixel basis.
  585. */
  586. typedef enum {
  587. SVGA3D_FOGTYPE_INVALID = 0,
  588. SVGA3D_FOGTYPE_VERTEX = 1,
  589. SVGA3D_FOGTYPE_PIXEL = 2,
  590. SVGA3D_FOGTYPE_MAX = 3
  591. } SVGA3dFogType;
  592. /*
  593. * SVGA3D_FOGBASE_* selects depth or range-based fog. Depth-based fog is
  594. * computed using the eye Z value of each pixel (or vertex), whereas range-
  595. * based fog is computed using the actual distance (range) to the eye.
  596. */
  597. typedef enum {
  598. SVGA3D_FOGBASE_INVALID = 0,
  599. SVGA3D_FOGBASE_DEPTHBASED = 1,
  600. SVGA3D_FOGBASE_RANGEBASED = 2,
  601. SVGA3D_FOGBASE_MAX = 3
  602. } SVGA3dFogBase;
  603. typedef enum {
  604. SVGA3D_STENCILOP_INVALID = 0,
  605. SVGA3D_STENCILOP_KEEP = 1,
  606. SVGA3D_STENCILOP_ZERO = 2,
  607. SVGA3D_STENCILOP_REPLACE = 3,
  608. SVGA3D_STENCILOP_INCRSAT = 4,
  609. SVGA3D_STENCILOP_DECRSAT = 5,
  610. SVGA3D_STENCILOP_INVERT = 6,
  611. SVGA3D_STENCILOP_INCR = 7,
  612. SVGA3D_STENCILOP_DECR = 8,
  613. SVGA3D_STENCILOP_MAX
  614. } SVGA3dStencilOp;
  615. typedef enum {
  616. SVGA3D_CLIPPLANE_0 = (1 << 0),
  617. SVGA3D_CLIPPLANE_1 = (1 << 1),
  618. SVGA3D_CLIPPLANE_2 = (1 << 2),
  619. SVGA3D_CLIPPLANE_3 = (1 << 3),
  620. SVGA3D_CLIPPLANE_4 = (1 << 4),
  621. SVGA3D_CLIPPLANE_5 = (1 << 5),
  622. } SVGA3dClipPlanes;
  623. typedef enum {
  624. SVGA3D_CLEAR_COLOR = 0x1,
  625. SVGA3D_CLEAR_DEPTH = 0x2,
  626. SVGA3D_CLEAR_STENCIL = 0x4
  627. } SVGA3dClearFlag;
  628. typedef enum {
  629. SVGA3D_RT_DEPTH = 0,
  630. SVGA3D_RT_STENCIL = 1,
  631. SVGA3D_RT_COLOR0 = 2,
  632. SVGA3D_RT_COLOR1 = 3,
  633. SVGA3D_RT_COLOR2 = 4,
  634. SVGA3D_RT_COLOR3 = 5,
  635. SVGA3D_RT_COLOR4 = 6,
  636. SVGA3D_RT_COLOR5 = 7,
  637. SVGA3D_RT_COLOR6 = 8,
  638. SVGA3D_RT_COLOR7 = 9,
  639. SVGA3D_RT_MAX,
  640. SVGA3D_RT_INVALID = ((uint32)-1),
  641. } SVGA3dRenderTargetType;
  642. #define SVGA3D_MAX_RT_COLOR (SVGA3D_RT_COLOR7 - SVGA3D_RT_COLOR0 + 1)
  643. typedef
  644. union {
  645. struct {
  646. uint32 red : 1;
  647. uint32 green : 1;
  648. uint32 blue : 1;
  649. uint32 alpha : 1;
  650. };
  651. uint32 uintValue;
  652. } SVGA3dColorMask;
  653. typedef enum {
  654. SVGA3D_VBLEND_DISABLE = 0,
  655. SVGA3D_VBLEND_1WEIGHT = 1,
  656. SVGA3D_VBLEND_2WEIGHT = 2,
  657. SVGA3D_VBLEND_3WEIGHT = 3,
  658. } SVGA3dVertexBlendFlags;
  659. typedef enum {
  660. SVGA3D_WRAPCOORD_0 = 1 << 0,
  661. SVGA3D_WRAPCOORD_1 = 1 << 1,
  662. SVGA3D_WRAPCOORD_2 = 1 << 2,
  663. SVGA3D_WRAPCOORD_3 = 1 << 3,
  664. SVGA3D_WRAPCOORD_ALL = 0xF,
  665. } SVGA3dWrapFlags;
  666. /*
  667. * SVGA_3D_CMD_TEXTURESTATE Types. All value types
  668. * must fit in a uint32.
  669. */
  670. typedef enum {
  671. SVGA3D_TS_INVALID = 0,
  672. SVGA3D_TS_BIND_TEXTURE = 1, /* SVGA3dSurfaceId */
  673. SVGA3D_TS_COLOROP = 2, /* SVGA3dTextureCombiner */
  674. SVGA3D_TS_COLORARG1 = 3, /* SVGA3dTextureArgData */
  675. SVGA3D_TS_COLORARG2 = 4, /* SVGA3dTextureArgData */
  676. SVGA3D_TS_ALPHAOP = 5, /* SVGA3dTextureCombiner */
  677. SVGA3D_TS_ALPHAARG1 = 6, /* SVGA3dTextureArgData */
  678. SVGA3D_TS_ALPHAARG2 = 7, /* SVGA3dTextureArgData */
  679. SVGA3D_TS_ADDRESSU = 8, /* SVGA3dTextureAddress */
  680. SVGA3D_TS_ADDRESSV = 9, /* SVGA3dTextureAddress */
  681. SVGA3D_TS_MIPFILTER = 10, /* SVGA3dTextureFilter */
  682. SVGA3D_TS_MAGFILTER = 11, /* SVGA3dTextureFilter */
  683. SVGA3D_TS_MINFILTER = 12, /* SVGA3dTextureFilter */
  684. SVGA3D_TS_BORDERCOLOR = 13, /* SVGA3dColor */
  685. SVGA3D_TS_TEXCOORDINDEX = 14, /* uint32 */
  686. SVGA3D_TS_TEXTURETRANSFORMFLAGS = 15, /* SVGA3dTexTransformFlags */
  687. SVGA3D_TS_TEXCOORDGEN = 16, /* SVGA3dTextureCoordGen */
  688. SVGA3D_TS_BUMPENVMAT00 = 17, /* float */
  689. SVGA3D_TS_BUMPENVMAT01 = 18, /* float */
  690. SVGA3D_TS_BUMPENVMAT10 = 19, /* float */
  691. SVGA3D_TS_BUMPENVMAT11 = 20, /* float */
  692. SVGA3D_TS_TEXTURE_MIPMAP_LEVEL = 21, /* uint32 */
  693. SVGA3D_TS_TEXTURE_LOD_BIAS = 22, /* float */
  694. SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL = 23, /* uint32 */
  695. SVGA3D_TS_ADDRESSW = 24, /* SVGA3dTextureAddress */
  696. /*
  697. * Sampler Gamma Level
  698. *
  699. * Sampler gamma effects the color of samples taken from the sampler. A
  700. * value of 1.0 will produce linear samples. If the value is <= 0.0 the
  701. * gamma value is ignored and a linear space is used.
  702. */
  703. SVGA3D_TS_GAMMA = 25, /* float */
  704. SVGA3D_TS_BUMPENVLSCALE = 26, /* float */
  705. SVGA3D_TS_BUMPENVLOFFSET = 27, /* float */
  706. SVGA3D_TS_COLORARG0 = 28, /* SVGA3dTextureArgData */
  707. SVGA3D_TS_ALPHAARG0 = 29, /* SVGA3dTextureArgData */
  708. SVGA3D_TS_MAX
  709. } SVGA3dTextureStateName;
  710. typedef enum {
  711. SVGA3D_TC_INVALID = 0,
  712. SVGA3D_TC_DISABLE = 1,
  713. SVGA3D_TC_SELECTARG1 = 2,
  714. SVGA3D_TC_SELECTARG2 = 3,
  715. SVGA3D_TC_MODULATE = 4,
  716. SVGA3D_TC_ADD = 5,
  717. SVGA3D_TC_ADDSIGNED = 6,
  718. SVGA3D_TC_SUBTRACT = 7,
  719. SVGA3D_TC_BLENDTEXTUREALPHA = 8,
  720. SVGA3D_TC_BLENDDIFFUSEALPHA = 9,
  721. SVGA3D_TC_BLENDCURRENTALPHA = 10,
  722. SVGA3D_TC_BLENDFACTORALPHA = 11,
  723. SVGA3D_TC_MODULATE2X = 12,
  724. SVGA3D_TC_MODULATE4X = 13,
  725. SVGA3D_TC_DSDT = 14,
  726. SVGA3D_TC_DOTPRODUCT3 = 15,
  727. SVGA3D_TC_BLENDTEXTUREALPHAPM = 16,
  728. SVGA3D_TC_ADDSIGNED2X = 17,
  729. SVGA3D_TC_ADDSMOOTH = 18,
  730. SVGA3D_TC_PREMODULATE = 19,
  731. SVGA3D_TC_MODULATEALPHA_ADDCOLOR = 20,
  732. SVGA3D_TC_MODULATECOLOR_ADDALPHA = 21,
  733. SVGA3D_TC_MODULATEINVALPHA_ADDCOLOR = 22,
  734. SVGA3D_TC_MODULATEINVCOLOR_ADDALPHA = 23,
  735. SVGA3D_TC_BUMPENVMAPLUMINANCE = 24,
  736. SVGA3D_TC_MULTIPLYADD = 25,
  737. SVGA3D_TC_LERP = 26,
  738. SVGA3D_TC_MAX
  739. } SVGA3dTextureCombiner;
  740. #define SVGA3D_TC_CAP_BIT(svga3d_tc_op) (svga3d_tc_op ? (1 << (svga3d_tc_op - 1)) : 0)
  741. typedef enum {
  742. SVGA3D_TEX_ADDRESS_INVALID = 0,
  743. SVGA3D_TEX_ADDRESS_WRAP = 1,
  744. SVGA3D_TEX_ADDRESS_MIRROR = 2,
  745. SVGA3D_TEX_ADDRESS_CLAMP = 3,
  746. SVGA3D_TEX_ADDRESS_BORDER = 4,
  747. SVGA3D_TEX_ADDRESS_MIRRORONCE = 5,
  748. SVGA3D_TEX_ADDRESS_EDGE = 6,
  749. SVGA3D_TEX_ADDRESS_MAX
  750. } SVGA3dTextureAddress;
  751. /*
  752. * SVGA3D_TEX_FILTER_NONE as the minification filter means mipmapping is
  753. * disabled, and the rasterizer should use the magnification filter instead.
  754. */
  755. typedef enum {
  756. SVGA3D_TEX_FILTER_NONE = 0,
  757. SVGA3D_TEX_FILTER_NEAREST = 1,
  758. SVGA3D_TEX_FILTER_LINEAR = 2,
  759. SVGA3D_TEX_FILTER_ANISOTROPIC = 3,
  760. SVGA3D_TEX_FILTER_FLATCUBIC = 4, /* Deprecated, not implemented */
  761. SVGA3D_TEX_FILTER_GAUSSIANCUBIC = 5, /* Deprecated, not implemented */
  762. SVGA3D_TEX_FILTER_PYRAMIDALQUAD = 6, /* Not currently implemented */
  763. SVGA3D_TEX_FILTER_GAUSSIANQUAD = 7, /* Not currently implemented */
  764. SVGA3D_TEX_FILTER_MAX
  765. } SVGA3dTextureFilter;
  766. typedef enum {
  767. SVGA3D_TEX_TRANSFORM_OFF = 0,
  768. SVGA3D_TEX_TRANSFORM_S = (1 << 0),
  769. SVGA3D_TEX_TRANSFORM_T = (1 << 1),
  770. SVGA3D_TEX_TRANSFORM_R = (1 << 2),
  771. SVGA3D_TEX_TRANSFORM_Q = (1 << 3),
  772. SVGA3D_TEX_PROJECTED = (1 << 15),
  773. } SVGA3dTexTransformFlags;
  774. typedef enum {
  775. SVGA3D_TEXCOORD_GEN_OFF = 0,
  776. SVGA3D_TEXCOORD_GEN_EYE_POSITION = 1,
  777. SVGA3D_TEXCOORD_GEN_EYE_NORMAL = 2,
  778. SVGA3D_TEXCOORD_GEN_REFLECTIONVECTOR = 3,
  779. SVGA3D_TEXCOORD_GEN_SPHERE = 4,
  780. SVGA3D_TEXCOORD_GEN_MAX
  781. } SVGA3dTextureCoordGen;
  782. /*
  783. * Texture argument constants for texture combiner
  784. */
  785. typedef enum {
  786. SVGA3D_TA_INVALID = 0,
  787. SVGA3D_TA_CONSTANT = 1,
  788. SVGA3D_TA_PREVIOUS = 2,
  789. SVGA3D_TA_DIFFUSE = 3,
  790. SVGA3D_TA_TEXTURE = 4,
  791. SVGA3D_TA_SPECULAR = 5,
  792. SVGA3D_TA_MAX
  793. } SVGA3dTextureArgData;
  794. #define SVGA3D_TM_MASK_LEN 4
  795. /* Modifiers for texture argument constants defined above. */
  796. typedef enum {
  797. SVGA3D_TM_NONE = 0,
  798. SVGA3D_TM_ALPHA = (1 << SVGA3D_TM_MASK_LEN),
  799. SVGA3D_TM_ONE_MINUS = (2 << SVGA3D_TM_MASK_LEN),
  800. } SVGA3dTextureArgModifier;
  801. #define SVGA3D_INVALID_ID ((uint32)-1)
  802. #define SVGA3D_MAX_CLIP_PLANES 6
  803. /*
  804. * This is the limit to the number of fixed-function texture
  805. * transforms and texture coordinates we can support. It does *not*
  806. * correspond to the number of texture image units (samplers) we
  807. * support!
  808. */
  809. #define SVGA3D_MAX_TEXTURE_COORDS 8
  810. /*
  811. * Vertex declarations
  812. *
  813. * Notes:
  814. *
  815. * SVGA3D_DECLUSAGE_POSITIONT is for pre-transformed vertices. If you
  816. * draw with any POSITIONT vertex arrays, the programmable vertex
  817. * pipeline will be implicitly disabled. Drawing will take place as if
  818. * no vertex shader was bound.
  819. */
  820. typedef enum {
  821. SVGA3D_DECLUSAGE_POSITION = 0,
  822. SVGA3D_DECLUSAGE_BLENDWEIGHT, /* 1 */
  823. SVGA3D_DECLUSAGE_BLENDINDICES, /* 2 */
  824. SVGA3D_DECLUSAGE_NORMAL, /* 3 */
  825. SVGA3D_DECLUSAGE_PSIZE, /* 4 */
  826. SVGA3D_DECLUSAGE_TEXCOORD, /* 5 */
  827. SVGA3D_DECLUSAGE_TANGENT, /* 6 */
  828. SVGA3D_DECLUSAGE_BINORMAL, /* 7 */
  829. SVGA3D_DECLUSAGE_TESSFACTOR, /* 8 */
  830. SVGA3D_DECLUSAGE_POSITIONT, /* 9 */
  831. SVGA3D_DECLUSAGE_COLOR, /* 10 */
  832. SVGA3D_DECLUSAGE_FOG, /* 11 */
  833. SVGA3D_DECLUSAGE_DEPTH, /* 12 */
  834. SVGA3D_DECLUSAGE_SAMPLE, /* 13 */
  835. SVGA3D_DECLUSAGE_MAX
  836. } SVGA3dDeclUsage;
  837. typedef enum {
  838. SVGA3D_DECLMETHOD_DEFAULT = 0,
  839. SVGA3D_DECLMETHOD_PARTIALU,
  840. SVGA3D_DECLMETHOD_PARTIALV,
  841. SVGA3D_DECLMETHOD_CROSSUV, /* Normal */
  842. SVGA3D_DECLMETHOD_UV,
  843. SVGA3D_DECLMETHOD_LOOKUP, /* Lookup a displacement map */
  844. SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED, /* Lookup a pre-sampled displacement map */
  845. } SVGA3dDeclMethod;
  846. typedef enum {
  847. SVGA3D_DECLTYPE_FLOAT1 = 0,
  848. SVGA3D_DECLTYPE_FLOAT2 = 1,
  849. SVGA3D_DECLTYPE_FLOAT3 = 2,
  850. SVGA3D_DECLTYPE_FLOAT4 = 3,
  851. SVGA3D_DECLTYPE_D3DCOLOR = 4,
  852. SVGA3D_DECLTYPE_UBYTE4 = 5,
  853. SVGA3D_DECLTYPE_SHORT2 = 6,
  854. SVGA3D_DECLTYPE_SHORT4 = 7,
  855. SVGA3D_DECLTYPE_UBYTE4N = 8,
  856. SVGA3D_DECLTYPE_SHORT2N = 9,
  857. SVGA3D_DECLTYPE_SHORT4N = 10,
  858. SVGA3D_DECLTYPE_USHORT2N = 11,
  859. SVGA3D_DECLTYPE_USHORT4N = 12,
  860. SVGA3D_DECLTYPE_UDEC3 = 13,
  861. SVGA3D_DECLTYPE_DEC3N = 14,
  862. SVGA3D_DECLTYPE_FLOAT16_2 = 15,
  863. SVGA3D_DECLTYPE_FLOAT16_4 = 16,
  864. SVGA3D_DECLTYPE_MAX,
  865. } SVGA3dDeclType;
  866. /*
  867. * This structure is used for the divisor for geometry instancing;
  868. * it's a direct translation of the Direct3D equivalent.
  869. */
  870. typedef union {
  871. struct {
  872. /*
  873. * For index data, this number represents the number of instances to draw.
  874. * For instance data, this number represents the number of
  875. * instances/vertex in this stream
  876. */
  877. uint32 count : 30;
  878. /*
  879. * This is 1 if this is supposed to be the data that is repeated for
  880. * every instance.
  881. */
  882. uint32 indexedData : 1;
  883. /*
  884. * This is 1 if this is supposed to be the per-instance data.
  885. */
  886. uint32 instanceData : 1;
  887. };
  888. uint32 value;
  889. } SVGA3dVertexDivisor;
  890. typedef enum {
  891. SVGA3D_PRIMITIVE_INVALID = 0,
  892. SVGA3D_PRIMITIVE_TRIANGLELIST = 1,
  893. SVGA3D_PRIMITIVE_POINTLIST = 2,
  894. SVGA3D_PRIMITIVE_LINELIST = 3,
  895. SVGA3D_PRIMITIVE_LINESTRIP = 4,
  896. SVGA3D_PRIMITIVE_TRIANGLESTRIP = 5,
  897. SVGA3D_PRIMITIVE_TRIANGLEFAN = 6,
  898. SVGA3D_PRIMITIVE_MAX
  899. } SVGA3dPrimitiveType;
  900. typedef enum {
  901. SVGA3D_COORDINATE_INVALID = 0,
  902. SVGA3D_COORDINATE_LEFTHANDED = 1,
  903. SVGA3D_COORDINATE_RIGHTHANDED = 2,
  904. SVGA3D_COORDINATE_MAX
  905. } SVGA3dCoordinateType;
  906. typedef enum {
  907. SVGA3D_TRANSFORM_INVALID = 0,
  908. SVGA3D_TRANSFORM_WORLD = 1,
  909. SVGA3D_TRANSFORM_VIEW = 2,
  910. SVGA3D_TRANSFORM_PROJECTION = 3,
  911. SVGA3D_TRANSFORM_TEXTURE0 = 4,
  912. SVGA3D_TRANSFORM_TEXTURE1 = 5,
  913. SVGA3D_TRANSFORM_TEXTURE2 = 6,
  914. SVGA3D_TRANSFORM_TEXTURE3 = 7,
  915. SVGA3D_TRANSFORM_TEXTURE4 = 8,
  916. SVGA3D_TRANSFORM_TEXTURE5 = 9,
  917. SVGA3D_TRANSFORM_TEXTURE6 = 10,
  918. SVGA3D_TRANSFORM_TEXTURE7 = 11,
  919. SVGA3D_TRANSFORM_WORLD1 = 12,
  920. SVGA3D_TRANSFORM_WORLD2 = 13,
  921. SVGA3D_TRANSFORM_WORLD3 = 14,
  922. SVGA3D_TRANSFORM_MAX
  923. } SVGA3dTransformType;
  924. typedef enum {
  925. SVGA3D_LIGHTTYPE_INVALID = 0,
  926. SVGA3D_LIGHTTYPE_POINT = 1,
  927. SVGA3D_LIGHTTYPE_SPOT1 = 2, /* 1-cone, in degrees */
  928. SVGA3D_LIGHTTYPE_SPOT2 = 3, /* 2-cone, in radians */
  929. SVGA3D_LIGHTTYPE_DIRECTIONAL = 4,
  930. SVGA3D_LIGHTTYPE_MAX
  931. } SVGA3dLightType;
  932. typedef enum {
  933. SVGA3D_CUBEFACE_POSX = 0,
  934. SVGA3D_CUBEFACE_NEGX = 1,
  935. SVGA3D_CUBEFACE_POSY = 2,
  936. SVGA3D_CUBEFACE_NEGY = 3,
  937. SVGA3D_CUBEFACE_POSZ = 4,
  938. SVGA3D_CUBEFACE_NEGZ = 5,
  939. } SVGA3dCubeFace;
  940. typedef enum {
  941. SVGA3D_SHADERTYPE_INVALID = 0,
  942. SVGA3D_SHADERTYPE_MIN = 1,
  943. SVGA3D_SHADERTYPE_VS = 1,
  944. SVGA3D_SHADERTYPE_PS = 2,
  945. SVGA3D_SHADERTYPE_MAX = 3,
  946. SVGA3D_SHADERTYPE_GS = 3,
  947. } SVGA3dShaderType;
  948. #define SVGA3D_NUM_SHADERTYPE (SVGA3D_SHADERTYPE_MAX - SVGA3D_SHADERTYPE_MIN)
  949. typedef enum {
  950. SVGA3D_CONST_TYPE_FLOAT = 0,
  951. SVGA3D_CONST_TYPE_INT = 1,
  952. SVGA3D_CONST_TYPE_BOOL = 2,
  953. SVGA3D_CONST_TYPE_MAX
  954. } SVGA3dShaderConstType;
  955. #define SVGA3D_MAX_SURFACE_FACES 6
  956. typedef enum {
  957. SVGA3D_STRETCH_BLT_POINT = 0,
  958. SVGA3D_STRETCH_BLT_LINEAR = 1,
  959. SVGA3D_STRETCH_BLT_MAX
  960. } SVGA3dStretchBltMode;
  961. typedef enum {
  962. SVGA3D_QUERYTYPE_OCCLUSION = 0,
  963. SVGA3D_QUERYTYPE_MAX
  964. } SVGA3dQueryType;
  965. typedef enum {
  966. SVGA3D_QUERYSTATE_PENDING = 0, /* Waiting on the host (set by guest) */
  967. SVGA3D_QUERYSTATE_SUCCEEDED = 1, /* Completed successfully (set by host) */
  968. SVGA3D_QUERYSTATE_FAILED = 2, /* Completed unsuccessfully (set by host) */
  969. SVGA3D_QUERYSTATE_NEW = 3, /* Never submitted (For guest use only) */
  970. } SVGA3dQueryState;
  971. typedef enum {
  972. SVGA3D_WRITE_HOST_VRAM = 1,
  973. SVGA3D_READ_HOST_VRAM = 2,
  974. } SVGA3dTransferType;
  975. /*
  976. * The maximum number of vertex arrays we're guaranteed to support in
  977. * SVGA_3D_CMD_DRAWPRIMITIVES.
  978. */
  979. #define SVGA3D_MAX_VERTEX_ARRAYS 32
  980. /*
  981. * The maximum number of primitive ranges we're guaranteed to support
  982. * in SVGA_3D_CMD_DRAWPRIMITIVES.
  983. */
  984. #define SVGA3D_MAX_DRAW_PRIMITIVE_RANGES 32
  985. /*
  986. * Identifiers for commands in the command FIFO.
  987. *
  988. * IDs between 1000 and 1039 (inclusive) were used by obsolete versions of
  989. * the SVGA3D protocol and remain reserved; they should not be used in the
  990. * future.
  991. *
  992. * IDs between 1040 and 1999 (inclusive) are available for use by the
  993. * current SVGA3D protocol.
  994. *
  995. * FIFO clients other than SVGA3D should stay below 1000, or at 2000
  996. * and up.
  997. */
  998. #define SVGA_3D_CMD_LEGACY_BASE 1000
  999. #define SVGA_3D_CMD_BASE 1040
  1000. #define SVGA_3D_CMD_SURFACE_DEFINE SVGA_3D_CMD_BASE + 0 /* Deprecated */
  1001. #define SVGA_3D_CMD_SURFACE_DESTROY SVGA_3D_CMD_BASE + 1
  1002. #define SVGA_3D_CMD_SURFACE_COPY SVGA_3D_CMD_BASE + 2
  1003. #define SVGA_3D_CMD_SURFACE_STRETCHBLT SVGA_3D_CMD_BASE + 3
  1004. #define SVGA_3D_CMD_SURFACE_DMA SVGA_3D_CMD_BASE + 4
  1005. #define SVGA_3D_CMD_CONTEXT_DEFINE SVGA_3D_CMD_BASE + 5
  1006. #define SVGA_3D_CMD_CONTEXT_DESTROY SVGA_3D_CMD_BASE + 6
  1007. #define SVGA_3D_CMD_SETTRANSFORM SVGA_3D_CMD_BASE + 7
  1008. #define SVGA_3D_CMD_SETZRANGE SVGA_3D_CMD_BASE + 8
  1009. #define SVGA_3D_CMD_SETRENDERSTATE SVGA_3D_CMD_BASE + 9
  1010. #define SVGA_3D_CMD_SETRENDERTARGET SVGA_3D_CMD_BASE + 10
  1011. #define SVGA_3D_CMD_SETTEXTURESTATE SVGA_3D_CMD_BASE + 11
  1012. #define SVGA_3D_CMD_SETMATERIAL SVGA_3D_CMD_BASE + 12
  1013. #define SVGA_3D_CMD_SETLIGHTDATA SVGA_3D_CMD_BASE + 13
  1014. #define SVGA_3D_CMD_SETLIGHTENABLED SVGA_3D_CMD_BASE + 14
  1015. #define SVGA_3D_CMD_SETVIEWPORT SVGA_3D_CMD_BASE + 15
  1016. #define SVGA_3D_CMD_SETCLIPPLANE SVGA_3D_CMD_BASE + 16
  1017. #define SVGA_3D_CMD_CLEAR SVGA_3D_CMD_BASE + 17
  1018. #define SVGA_3D_CMD_PRESENT SVGA_3D_CMD_BASE + 18 /* Deprecated */
  1019. #define SVGA_3D_CMD_SHADER_DEFINE SVGA_3D_CMD_BASE + 19
  1020. #define SVGA_3D_CMD_SHADER_DESTROY SVGA_3D_CMD_BASE + 20
  1021. #define SVGA_3D_CMD_SET_SHADER SVGA_3D_CMD_BASE + 21
  1022. #define SVGA_3D_CMD_SET_SHADER_CONST SVGA_3D_CMD_BASE + 22
  1023. #define SVGA_3D_CMD_DRAW_PRIMITIVES SVGA_3D_CMD_BASE + 23
  1024. #define SVGA_3D_CMD_SETSCISSORRECT SVGA_3D_CMD_BASE + 24
  1025. #define SVGA_3D_CMD_BEGIN_QUERY SVGA_3D_CMD_BASE + 25
  1026. #define SVGA_3D_CMD_END_QUERY SVGA_3D_CMD_BASE + 26
  1027. #define SVGA_3D_CMD_WAIT_FOR_QUERY SVGA_3D_CMD_BASE + 27
  1028. #define SVGA_3D_CMD_PRESENT_READBACK SVGA_3D_CMD_BASE + 28 /* Deprecated */
  1029. #define SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN SVGA_3D_CMD_BASE + 29
  1030. #define SVGA_3D_CMD_SURFACE_DEFINE_V2 SVGA_3D_CMD_BASE + 30
  1031. #define SVGA_3D_CMD_GENERATE_MIPMAPS SVGA_3D_CMD_BASE + 31
  1032. #define SVGA_3D_CMD_ACTIVATE_SURFACE SVGA_3D_CMD_BASE + 40
  1033. #define SVGA_3D_CMD_DEACTIVATE_SURFACE SVGA_3D_CMD_BASE + 41
  1034. #define SVGA_3D_CMD_SCREEN_DMA 1082
  1035. #define SVGA_3D_CMD_SET_UNITY_SURFACE_COOKIE 1083
  1036. #define SVGA_3D_CMD_OPEN_CONTEXT_SURFACE 1084
  1037. #define SVGA_3D_CMD_LOGICOPS_BITBLT 1085
  1038. #define SVGA_3D_CMD_LOGICOPS_TRANSBLT 1086
  1039. #define SVGA_3D_CMD_LOGICOPS_STRETCHBLT 1087
  1040. #define SVGA_3D_CMD_LOGICOPS_COLORFILL 1088
  1041. #define SVGA_3D_CMD_LOGICOPS_ALPHABLEND 1089
  1042. #define SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND 1090
  1043. #define SVGA_3D_CMD_SET_OTABLE_BASE 1091
  1044. #define SVGA_3D_CMD_READBACK_OTABLE 1092
  1045. #define SVGA_3D_CMD_DEFINE_GB_MOB 1093
  1046. #define SVGA_3D_CMD_DESTROY_GB_MOB 1094
  1047. #define SVGA_3D_CMD_REDEFINE_GB_MOB 1095
  1048. #define SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING 1096
  1049. #define SVGA_3D_CMD_DEFINE_GB_SURFACE 1097
  1050. #define SVGA_3D_CMD_DESTROY_GB_SURFACE 1098
  1051. #define SVGA_3D_CMD_BIND_GB_SURFACE 1099
  1052. #define SVGA_3D_CMD_COND_BIND_GB_SURFACE 1100
  1053. #define SVGA_3D_CMD_UPDATE_GB_IMAGE 1101
  1054. #define SVGA_3D_CMD_UPDATE_GB_SURFACE 1102
  1055. #define SVGA_3D_CMD_READBACK_GB_IMAGE 1103
  1056. #define SVGA_3D_CMD_READBACK_GB_SURFACE 1104
  1057. #define SVGA_3D_CMD_INVALIDATE_GB_IMAGE 1105
  1058. #define SVGA_3D_CMD_INVALIDATE_GB_SURFACE 1106
  1059. #define SVGA_3D_CMD_DEFINE_GB_CONTEXT 1107
  1060. #define SVGA_3D_CMD_DESTROY_GB_CONTEXT 1108
  1061. #define SVGA_3D_CMD_BIND_GB_CONTEXT 1109
  1062. #define SVGA_3D_CMD_READBACK_GB_CONTEXT 1110
  1063. #define SVGA_3D_CMD_INVALIDATE_GB_CONTEXT 1111
  1064. #define SVGA_3D_CMD_DEFINE_GB_SHADER 1112
  1065. #define SVGA_3D_CMD_DESTROY_GB_SHADER 1113
  1066. #define SVGA_3D_CMD_BIND_GB_SHADER 1114
  1067. #define SVGA_3D_CMD_SET_OTABLE_BASE64 1115
  1068. #define SVGA_3D_CMD_BEGIN_GB_QUERY 1116
  1069. #define SVGA_3D_CMD_END_GB_QUERY 1117
  1070. #define SVGA_3D_CMD_WAIT_FOR_GB_QUERY 1118
  1071. #define SVGA_3D_CMD_NOP 1119
  1072. #define SVGA_3D_CMD_ENABLE_GART 1120
  1073. #define SVGA_3D_CMD_DISABLE_GART 1121
  1074. #define SVGA_3D_CMD_MAP_MOB_INTO_GART 1122
  1075. #define SVGA_3D_CMD_UNMAP_GART_RANGE 1123
  1076. #define SVGA_3D_CMD_DEFINE_GB_SCREENTARGET 1124
  1077. #define SVGA_3D_CMD_DESTROY_GB_SCREENTARGET 1125
  1078. #define SVGA_3D_CMD_BIND_GB_SCREENTARGET 1126
  1079. #define SVGA_3D_CMD_UPDATE_GB_SCREENTARGET 1127
  1080. #define SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL 1128
  1081. #define SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL 1129
  1082. #define SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE 1130
  1083. #define SVGA_3D_CMD_GB_SCREEN_DMA 1131
  1084. #define SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH 1132
  1085. #define SVGA_3D_CMD_GB_MOB_FENCE 1133
  1086. #define SVGA_3D_CMD_DEFINE_GB_SURFACE_V2 1134
  1087. #define SVGA_3D_CMD_DEFINE_GB_MOB64 1135
  1088. #define SVGA_3D_CMD_REDEFINE_GB_MOB64 1136
  1089. #define SVGA_3D_CMD_NOP_ERROR 1137
  1090. #define SVGA_3D_CMD_RESERVED1 1138
  1091. #define SVGA_3D_CMD_RESERVED2 1139
  1092. #define SVGA_3D_CMD_RESERVED3 1140
  1093. #define SVGA_3D_CMD_RESERVED4 1141
  1094. #define SVGA_3D_CMD_RESERVED5 1142
  1095. #define SVGA_3D_CMD_MAX 1142
  1096. #define SVGA_3D_CMD_FUTURE_MAX 3000
  1097. /*
  1098. * Common substructures used in multiple FIFO commands:
  1099. */
  1100. typedef struct {
  1101. union {
  1102. struct {
  1103. uint16 function; /* SVGA3dFogFunction */
  1104. uint8 type; /* SVGA3dFogType */
  1105. uint8 base; /* SVGA3dFogBase */
  1106. };
  1107. uint32 uintValue;
  1108. };
  1109. } SVGA3dFogMode;
  1110. /*
  1111. * Uniquely identify one image (a 1D/2D/3D array) from a surface. This
  1112. * is a surface ID as well as face/mipmap indices.
  1113. */
  1114. typedef
  1115. struct SVGA3dSurfaceImageId {
  1116. uint32 sid;
  1117. uint32 face;
  1118. uint32 mipmap;
  1119. } SVGA3dSurfaceImageId;
  1120. typedef
  1121. struct SVGA3dGuestImage {
  1122. SVGAGuestPtr ptr;
  1123. /*
  1124. * A note on interpretation of pitch: This value of pitch is the
  1125. * number of bytes between vertically adjacent image
  1126. * blocks. Normally this is the number of bytes between the first
  1127. * pixel of two adjacent scanlines. With compressed textures,
  1128. * however, this may represent the number of bytes between
  1129. * compression blocks rather than between rows of pixels.
  1130. *
  1131. * XXX: Compressed textures currently must be tightly packed in guest memory.
  1132. *
  1133. * If the image is 1-dimensional, pitch is ignored.
  1134. *
  1135. * If 'pitch' is zero, the SVGA3D device calculates a pitch value
  1136. * assuming each row of blocks is tightly packed.
  1137. */
  1138. uint32 pitch;
  1139. } SVGA3dGuestImage;
  1140. /*
  1141. * FIFO command format definitions:
  1142. */
  1143. /*
  1144. * The data size header following cmdNum for every 3d command
  1145. */
  1146. typedef
  1147. struct {
  1148. uint32 id;
  1149. uint32 size;
  1150. } SVGA3dCmdHeader;
  1151. /*
  1152. * A surface is a hierarchy of host VRAM surfaces: 1D, 2D, or 3D, with
  1153. * optional mipmaps and cube faces.
  1154. */
  1155. typedef
  1156. struct {
  1157. uint32 width;
  1158. uint32 height;
  1159. uint32 depth;
  1160. } SVGA3dSize;
  1161. typedef enum {
  1162. SVGA3D_SURFACE_CUBEMAP = (1 << 0),
  1163. SVGA3D_SURFACE_HINT_STATIC = (1 << 1),
  1164. SVGA3D_SURFACE_HINT_DYNAMIC = (1 << 2),
  1165. SVGA3D_SURFACE_HINT_INDEXBUFFER = (1 << 3),
  1166. SVGA3D_SURFACE_HINT_VERTEXBUFFER = (1 << 4),
  1167. SVGA3D_SURFACE_HINT_TEXTURE = (1 << 5),
  1168. SVGA3D_SURFACE_HINT_RENDERTARGET = (1 << 6),
  1169. SVGA3D_SURFACE_HINT_DEPTHSTENCIL = (1 << 7),
  1170. SVGA3D_SURFACE_HINT_WRITEONLY = (1 << 8),
  1171. SVGA3D_SURFACE_MASKABLE_ANTIALIAS = (1 << 9),
  1172. SVGA3D_SURFACE_AUTOGENMIPMAPS = (1 << 10),
  1173. } SVGA3dSurfaceFlags;
  1174. typedef
  1175. struct {
  1176. uint32 numMipLevels;
  1177. } SVGA3dSurfaceFace;
  1178. typedef
  1179. struct {
  1180. uint32 sid;
  1181. SVGA3dSurfaceFlags surfaceFlags;
  1182. SVGA3dSurfaceFormat format;
  1183. /*
  1184. * If surfaceFlags has SVGA3D_SURFACE_CUBEMAP bit set, all SVGA3dSurfaceFace
  1185. * structures must have the same value of numMipLevels field.
  1186. * Otherwise, all but the first SVGA3dSurfaceFace structures must have the
  1187. * numMipLevels set to 0.
  1188. */
  1189. SVGA3dSurfaceFace face[SVGA3D_MAX_SURFACE_FACES];
  1190. /*
  1191. * Followed by an SVGA3dSize structure for each mip level in each face.
  1192. *
  1193. * A note on surface sizes: Sizes are always specified in pixels,
  1194. * even if the true surface size is not a multiple of the minimum
  1195. * block size of the surface's format. For example, a 3x3x1 DXT1
  1196. * compressed texture would actually be stored as a 4x4x1 image in
  1197. * memory.
  1198. */
  1199. } SVGA3dCmdDefineSurface; /* SVGA_3D_CMD_SURFACE_DEFINE */
  1200. typedef
  1201. struct {
  1202. uint32 sid;
  1203. SVGA3dSurfaceFlags surfaceFlags;
  1204. SVGA3dSurfaceFormat format;
  1205. /*
  1206. * If surfaceFlags has SVGA3D_SURFACE_CUBEMAP bit set, all SVGA3dSurfaceFace
  1207. * structures must have the same value of numMipLevels field.
  1208. * Otherwise, all but the first SVGA3dSurfaceFace structures must have the
  1209. * numMipLevels set to 0.
  1210. */
  1211. SVGA3dSurfaceFace face[SVGA3D_MAX_SURFACE_FACES];
  1212. uint32 multisampleCount;
  1213. SVGA3dTextureFilter autogenFilter;
  1214. /*
  1215. * Followed by an SVGA3dSize structure for each mip level in each face.
  1216. *
  1217. * A note on surface sizes: Sizes are always specified in pixels,
  1218. * even if the true surface size is not a multiple of the minimum
  1219. * block size of the surface's format. For example, a 3x3x1 DXT1
  1220. * compressed texture would actually be stored as a 4x4x1 image in
  1221. * memory.
  1222. */
  1223. } SVGA3dCmdDefineSurface_v2; /* SVGA_3D_CMD_SURFACE_DEFINE_V2 */
  1224. typedef
  1225. struct {
  1226. uint32 sid;
  1227. } SVGA3dCmdDestroySurface; /* SVGA_3D_CMD_SURFACE_DESTROY */
  1228. typedef
  1229. struct {
  1230. uint32 cid;
  1231. } SVGA3dCmdDefineContext; /* SVGA_3D_CMD_CONTEXT_DEFINE */
  1232. typedef
  1233. struct {
  1234. uint32 cid;
  1235. } SVGA3dCmdDestroyContext; /* SVGA_3D_CMD_CONTEXT_DESTROY */
  1236. typedef
  1237. struct {
  1238. uint32 cid;
  1239. SVGA3dClearFlag clearFlag;
  1240. uint32 color;
  1241. float depth;
  1242. uint32 stencil;
  1243. /* Followed by variable number of SVGA3dRect structures */
  1244. } SVGA3dCmdClear; /* SVGA_3D_CMD_CLEAR */
  1245. typedef
  1246. struct SVGA3dCopyRect {
  1247. uint32 x;
  1248. uint32 y;
  1249. uint32 w;
  1250. uint32 h;
  1251. uint32 srcx;
  1252. uint32 srcy;
  1253. } SVGA3dCopyRect;
  1254. typedef
  1255. struct SVGA3dCopyBox {
  1256. uint32 x;
  1257. uint32 y;
  1258. uint32 z;
  1259. uint32 w;
  1260. uint32 h;
  1261. uint32 d;
  1262. uint32 srcx;
  1263. uint32 srcy;
  1264. uint32 srcz;
  1265. } SVGA3dCopyBox;
  1266. typedef
  1267. struct {
  1268. uint32 x;
  1269. uint32 y;
  1270. uint32 w;
  1271. uint32 h;
  1272. } SVGA3dRect;
  1273. typedef
  1274. struct {
  1275. uint32 x;
  1276. uint32 y;
  1277. uint32 z;
  1278. uint32 w;
  1279. uint32 h;
  1280. uint32 d;
  1281. } SVGA3dBox;
  1282. typedef
  1283. struct {
  1284. uint32 x;
  1285. uint32 y;
  1286. uint32 z;
  1287. } SVGA3dPoint;
  1288. typedef
  1289. struct {
  1290. SVGA3dLightType type;
  1291. SVGA3dBool inWorldSpace;
  1292. float diffuse[4];
  1293. float specular[4];
  1294. float ambient[4];
  1295. float position[4];
  1296. float direction[4];
  1297. float range;
  1298. float falloff;
  1299. float attenuation0;
  1300. float attenuation1;
  1301. float attenuation2;
  1302. float theta;
  1303. float phi;
  1304. } SVGA3dLightData;
  1305. typedef
  1306. struct {
  1307. uint32 sid;
  1308. /* Followed by variable number of SVGA3dCopyRect structures */
  1309. } SVGA3dCmdPresent; /* SVGA_3D_CMD_PRESENT */
  1310. typedef
  1311. struct {
  1312. SVGA3dRenderStateName state;
  1313. union {
  1314. uint32 uintValue;
  1315. float floatValue;
  1316. };
  1317. } SVGA3dRenderState;
  1318. typedef
  1319. struct {
  1320. uint32 cid;
  1321. /* Followed by variable number of SVGA3dRenderState structures */
  1322. } SVGA3dCmdSetRenderState; /* SVGA_3D_CMD_SETRENDERSTATE */
  1323. typedef
  1324. struct {
  1325. uint32 cid;
  1326. SVGA3dRenderTargetType type;
  1327. SVGA3dSurfaceImageId target;
  1328. } SVGA3dCmdSetRenderTarget; /* SVGA_3D_CMD_SETRENDERTARGET */
  1329. typedef
  1330. struct {
  1331. SVGA3dSurfaceImageId src;
  1332. SVGA3dSurfaceImageId dest;
  1333. /* Followed by variable number of SVGA3dCopyBox structures */
  1334. } SVGA3dCmdSurfaceCopy; /* SVGA_3D_CMD_SURFACE_COPY */
  1335. typedef
  1336. struct {
  1337. SVGA3dSurfaceImageId src;
  1338. SVGA3dSurfaceImageId dest;
  1339. SVGA3dBox boxSrc;
  1340. SVGA3dBox boxDest;
  1341. SVGA3dStretchBltMode mode;
  1342. } SVGA3dCmdSurfaceStretchBlt; /* SVGA_3D_CMD_SURFACE_STRETCHBLT */
  1343. typedef
  1344. struct {
  1345. /*
  1346. * If the discard flag is present in a surface DMA operation, the host may
  1347. * discard the contents of the current mipmap level and face of the target
  1348. * surface before applying the surface DMA contents.
  1349. */
  1350. uint32 discard : 1;
  1351. /*
  1352. * If the unsynchronized flag is present, the host may perform this upload
  1353. * without syncing to pending reads on this surface.
  1354. */
  1355. uint32 unsynchronized : 1;
  1356. /*
  1357. * Guests *MUST* set the reserved bits to 0 before submitting the command
  1358. * suffix as future flags may occupy these bits.
  1359. */
  1360. uint32 reserved : 30;
  1361. } SVGA3dSurfaceDMAFlags;
  1362. typedef
  1363. struct {
  1364. SVGA3dGuestImage guest;
  1365. SVGA3dSurfaceImageId host;
  1366. SVGA3dTransferType transfer;
  1367. /*
  1368. * Followed by variable number of SVGA3dCopyBox structures. For consistency
  1369. * in all clipping logic and coordinate translation, we define the
  1370. * "source" in each copyBox as the guest image and the
  1371. * "destination" as the host image, regardless of transfer
  1372. * direction.
  1373. *
  1374. * For efficiency, the SVGA3D device is free to copy more data than
  1375. * specified. For example, it may round copy boxes outwards such
  1376. * that they lie on particular alignment boundaries.
  1377. */
  1378. } SVGA3dCmdSurfaceDMA; /* SVGA_3D_CMD_SURFACE_DMA */
  1379. /*
  1380. * SVGA3dCmdSurfaceDMASuffix --
  1381. *
  1382. * This is a command suffix that will appear after a SurfaceDMA command in
  1383. * the FIFO. It contains some extra information that hosts may use to
  1384. * optimize performance or protect the guest. This suffix exists to preserve
  1385. * backwards compatibility while also allowing for new functionality to be
  1386. * implemented.
  1387. */
  1388. typedef
  1389. struct {
  1390. uint32 suffixSize;
  1391. /*
  1392. * The maximum offset is used to determine the maximum offset from the
  1393. * guestPtr base address that will be accessed or written to during this
  1394. * surfaceDMA. If the suffix is supported, the host will respect this
  1395. * boundary while performing surface DMAs.
  1396. *
  1397. * Defaults to MAX_UINT32
  1398. */
  1399. uint32 maximumOffset;
  1400. /*
  1401. * A set of flags that describes optimizations that the host may perform
  1402. * while performing this surface DMA operation. The guest should never rely
  1403. * on behaviour that is different when these flags are set for correctness.
  1404. *
  1405. * Defaults to 0
  1406. */
  1407. SVGA3dSurfaceDMAFlags flags;
  1408. } SVGA3dCmdSurfaceDMASuffix;
  1409. /*
  1410. * SVGA_3D_CMD_DRAW_PRIMITIVES --
  1411. *
  1412. * This command is the SVGA3D device's generic drawing entry point.
  1413. * It can draw multiple ranges of primitives, optionally using an
  1414. * index buffer, using an arbitrary collection of vertex buffers.
  1415. *
  1416. * Each SVGA3dVertexDecl defines a distinct vertex array to bind
  1417. * during this draw call. The declarations specify which surface
  1418. * the vertex data lives in, what that vertex data is used for,
  1419. * and how to interpret it.
  1420. *
  1421. * Each SVGA3dPrimitiveRange defines a collection of primitives
  1422. * to render using the same vertex arrays. An index buffer is
  1423. * optional.
  1424. */
  1425. typedef
  1426. struct {
  1427. /*
  1428. * A range hint is an optional specification for the range of indices
  1429. * in an SVGA3dArray that will be used. If 'last' is zero, it is assumed
  1430. * that the entire array will be used.
  1431. *
  1432. * These are only hints. The SVGA3D device may use them for
  1433. * performance optimization if possible, but it's also allowed to
  1434. * ignore these values.
  1435. */
  1436. uint32 first;
  1437. uint32 last;
  1438. } SVGA3dArrayRangeHint;
  1439. typedef
  1440. struct {
  1441. /*
  1442. * Define the origin and shape of a vertex or index array. Both
  1443. * 'offset' and 'stride' are in bytes. The provided surface will be
  1444. * reinterpreted as a flat array of bytes in the same format used
  1445. * by surface DMA operations. To avoid unnecessary conversions, the
  1446. * surface should be created with the SVGA3D_BUFFER format.
  1447. *
  1448. * Index 0 in the array starts 'offset' bytes into the surface.
  1449. * Index 1 begins at byte 'offset + stride', etc. Array indices may
  1450. * not be negative.
  1451. */
  1452. uint32 surfaceId;
  1453. uint32 offset;
  1454. uint32 stride;
  1455. } SVGA3dArray;
  1456. typedef
  1457. struct {
  1458. /*
  1459. * Describe a vertex array's data type, and define how it is to be
  1460. * used by the fixed function pipeline or the vertex shader. It
  1461. * isn't useful to have two VertexDecls with the same
  1462. * VertexArrayIdentity in one draw call.
  1463. */
  1464. SVGA3dDeclType type;
  1465. SVGA3dDeclMethod method;
  1466. SVGA3dDeclUsage usage;
  1467. uint32 usageIndex;
  1468. } SVGA3dVertexArrayIdentity;
  1469. typedef
  1470. struct {
  1471. SVGA3dVertexArrayIdentity identity;
  1472. SVGA3dArray array;
  1473. SVGA3dArrayRangeHint rangeHint;
  1474. } SVGA3dVertexDecl;
  1475. typedef
  1476. struct {
  1477. /*
  1478. * Define a group of primitives to render, from sequential indices.
  1479. *
  1480. * The value of 'primitiveType' and 'primitiveCount' imply the
  1481. * total number of vertices that will be rendered.
  1482. */
  1483. SVGA3dPrimitiveType primType;
  1484. uint32 primitiveCount;
  1485. /*
  1486. * Optional index buffer. If indexArray.surfaceId is
  1487. * SVGA3D_INVALID_ID, we render without an index buffer. Rendering
  1488. * without an index buffer is identical to rendering with an index
  1489. * buffer containing the sequence [0, 1, 2, 3, ...].
  1490. *
  1491. * If an index buffer is in use, indexWidth specifies the width in
  1492. * bytes of each index value. It must be less than or equal to
  1493. * indexArray.stride.
  1494. *
  1495. * (Currently, the SVGA3D device requires index buffers to be tightly
  1496. * packed. In other words, indexWidth == indexArray.stride)
  1497. */
  1498. SVGA3dArray indexArray;
  1499. uint32 indexWidth;
  1500. /*
  1501. * Optional index bias. This number is added to all indices from
  1502. * indexArray before they are used as vertex array indices. This
  1503. * can be used in multiple ways:
  1504. *
  1505. * - When not using an indexArray, this bias can be used to
  1506. * specify where in the vertex arrays to begin rendering.
  1507. *
  1508. * - A positive number here is equivalent to increasing the
  1509. * offset in each vertex array.
  1510. *
  1511. * - A negative number can be used to render using a small
  1512. * vertex array and an index buffer that contains large
  1513. * values. This may be used by some applications that
  1514. * crop a vertex buffer without modifying their index
  1515. * buffer.
  1516. *
  1517. * Note that rendering with a negative bias value may be slower and
  1518. * use more memory than rendering with a positive or zero bias.
  1519. */
  1520. int32 indexBias;
  1521. } SVGA3dPrimitiveRange;
  1522. typedef
  1523. struct {
  1524. uint32 cid;
  1525. uint32 numVertexDecls;
  1526. uint32 numRanges;
  1527. /*
  1528. * There are two variable size arrays after the
  1529. * SVGA3dCmdDrawPrimitives structure. In order,
  1530. * they are:
  1531. *
  1532. * 1. SVGA3dVertexDecl, quantity 'numVertexDecls', but no more than
  1533. * SVGA3D_MAX_VERTEX_ARRAYS;
  1534. * 2. SVGA3dPrimitiveRange, quantity 'numRanges', but no more than
  1535. * SVGA3D_MAX_DRAW_PRIMITIVE_RANGES;
  1536. * 3. Optionally, SVGA3dVertexDivisor, quantity 'numVertexDecls' (contains
  1537. * the frequency divisor for the corresponding vertex decl).
  1538. */
  1539. } SVGA3dCmdDrawPrimitives; /* SVGA_3D_CMD_DRAWPRIMITIVES */
  1540. typedef
  1541. struct {
  1542. uint32 stage;
  1543. SVGA3dTextureStateName name;
  1544. union {
  1545. uint32 value;
  1546. float floatValue;
  1547. };
  1548. } SVGA3dTextureState;
  1549. typedef
  1550. struct {
  1551. uint32 cid;
  1552. /* Followed by variable number of SVGA3dTextureState structures */
  1553. } SVGA3dCmdSetTextureState; /* SVGA_3D_CMD_SETTEXTURESTATE */
  1554. typedef
  1555. struct {
  1556. uint32 cid;
  1557. SVGA3dTransformType type;
  1558. float matrix[16];
  1559. } SVGA3dCmdSetTransform; /* SVGA_3D_CMD_SETTRANSFORM */
  1560. typedef
  1561. struct {
  1562. float min;
  1563. float max;
  1564. } SVGA3dZRange;
  1565. typedef
  1566. struct {
  1567. uint32 cid;
  1568. SVGA3dZRange zRange;
  1569. } SVGA3dCmdSetZRange; /* SVGA_3D_CMD_SETZRANGE */
  1570. typedef
  1571. struct {
  1572. float diffuse[4];
  1573. float ambient[4];
  1574. float specular[4];
  1575. float emissive[4];
  1576. float shininess;
  1577. } SVGA3dMaterial;
  1578. typedef
  1579. struct {
  1580. uint32 cid;
  1581. SVGA3dFace face;
  1582. SVGA3dMaterial material;
  1583. } SVGA3dCmdSetMaterial; /* SVGA_3D_CMD_SETMATERIAL */
  1584. typedef
  1585. struct {
  1586. uint32 cid;
  1587. uint32 index;
  1588. SVGA3dLightData data;
  1589. } SVGA3dCmdSetLightData; /* SVGA_3D_CMD_SETLIGHTDATA */
  1590. typedef
  1591. struct {
  1592. uint32 cid;
  1593. uint32 index;
  1594. uint32 enabled;
  1595. } SVGA3dCmdSetLightEnabled; /* SVGA_3D_CMD_SETLIGHTENABLED */
  1596. typedef
  1597. struct {
  1598. uint32 cid;
  1599. SVGA3dRect rect;
  1600. } SVGA3dCmdSetViewport; /* SVGA_3D_CMD_SETVIEWPORT */
  1601. typedef
  1602. struct {
  1603. uint32 cid;
  1604. SVGA3dRect rect;
  1605. } SVGA3dCmdSetScissorRect; /* SVGA_3D_CMD_SETSCISSORRECT */
  1606. typedef
  1607. struct {
  1608. uint32 cid;
  1609. uint32 index;
  1610. float plane[4];
  1611. } SVGA3dCmdSetClipPlane; /* SVGA_3D_CMD_SETCLIPPLANE */
  1612. typedef
  1613. struct {
  1614. uint32 cid;
  1615. uint32 shid;
  1616. SVGA3dShaderType type;
  1617. /* Followed by variable number of DWORDs for shader bycode */
  1618. } SVGA3dCmdDefineShader; /* SVGA_3D_CMD_SHADER_DEFINE */
  1619. typedef
  1620. struct {
  1621. uint32 cid;
  1622. uint32 shid;
  1623. SVGA3dShaderType type;
  1624. } SVGA3dCmdDestroyShader; /* SVGA_3D_CMD_SHADER_DESTROY */
  1625. typedef
  1626. struct {
  1627. uint32 cid;
  1628. uint32 reg; /* register number */
  1629. SVGA3dShaderType type;
  1630. SVGA3dShaderConstType ctype;
  1631. uint32 values[4];
  1632. } SVGA3dCmdSetShaderConst; /* SVGA_3D_CMD_SET_SHADER_CONST */
  1633. typedef
  1634. struct {
  1635. uint32 cid;
  1636. SVGA3dShaderType type;
  1637. uint32 shid;
  1638. } SVGA3dCmdSetShader; /* SVGA_3D_CMD_SET_SHADER */
  1639. typedef
  1640. struct {
  1641. uint32 cid;
  1642. SVGA3dQueryType type;
  1643. } SVGA3dCmdBeginQuery; /* SVGA_3D_CMD_BEGIN_QUERY */
  1644. typedef
  1645. struct {
  1646. uint32 cid;
  1647. SVGA3dQueryType type;
  1648. SVGAGuestPtr guestResult; /* Points to an SVGA3dQueryResult structure */
  1649. } SVGA3dCmdEndQuery; /* SVGA_3D_CMD_END_QUERY */
  1650. typedef
  1651. struct {
  1652. uint32 cid; /* Same parameters passed to END_QUERY */
  1653. SVGA3dQueryType type;
  1654. SVGAGuestPtr guestResult;
  1655. } SVGA3dCmdWaitForQuery; /* SVGA_3D_CMD_WAIT_FOR_QUERY */
  1656. typedef
  1657. struct {
  1658. uint32 totalSize; /* Set by guest before query is ended. */
  1659. SVGA3dQueryState state; /* Set by host or guest. See SVGA3dQueryState. */
  1660. union { /* Set by host on exit from PENDING state */
  1661. uint32 result32;
  1662. };
  1663. } SVGA3dQueryResult;
  1664. /*
  1665. * SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN --
  1666. *
  1667. * This is a blit from an SVGA3D surface to a Screen Object. Just
  1668. * like GMR-to-screen blits, this blit may be directed at a
  1669. * specific screen or to the virtual coordinate space.
  1670. *
  1671. * The blit copies from a rectangular region of an SVGA3D surface
  1672. * image to a rectangular region of a screen or screens.
  1673. *
  1674. * This command takes an optional variable-length list of clipping
  1675. * rectangles after the body of the command. If no rectangles are
  1676. * specified, there is no clipping region. The entire destRect is
  1677. * drawn to. If one or more rectangles are included, they describe
  1678. * a clipping region. The clip rectangle coordinates are measured
  1679. * relative to the top-left corner of destRect.
  1680. *
  1681. * This clipping region serves multiple purposes:
  1682. *
  1683. * - It can be used to perform an irregularly shaped blit more
  1684. * efficiently than by issuing many separate blit commands.
  1685. *
  1686. * - It is equivalent to allowing blits with non-integer
  1687. * source coordinates. You could blit just one half-pixel
  1688. * of a source, for example, by specifying a larger
  1689. * destination rectangle than you need, then removing
  1690. * part of it using a clip rectangle.
  1691. *
  1692. * Availability:
  1693. * SVGA_FIFO_CAP_SCREEN_OBJECT
  1694. *
  1695. * Limitations:
  1696. *
  1697. * - Currently, no backend supports blits from a mipmap or face
  1698. * other than the first one.
  1699. */
  1700. typedef
  1701. struct {
  1702. SVGA3dSurfaceImageId srcImage;
  1703. SVGASignedRect srcRect;
  1704. uint32 destScreenId; /* Screen ID or SVGA_ID_INVALID for virt. coords */
  1705. SVGASignedRect destRect; /* Supports scaling if src/rest different size */
  1706. /* Clipping: zero or more SVGASignedRects follow */
  1707. } SVGA3dCmdBlitSurfaceToScreen; /* SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN */
  1708. typedef
  1709. struct {
  1710. uint32 sid;
  1711. SVGA3dTextureFilter filter;
  1712. } SVGA3dCmdGenerateMipmaps; /* SVGA_3D_CMD_GENERATE_MIPMAPS */
  1713. /*
  1714. * Guest-backed surface definitions.
  1715. */
  1716. typedef uint32 SVGAMobId;
  1717. typedef enum SVGAMobFormat {
  1718. SVGA3D_MOBFMT_INVALID = SVGA3D_INVALID_ID,
  1719. SVGA3D_MOBFMT_PTDEPTH_0 = 0,
  1720. SVGA3D_MOBFMT_PTDEPTH_1 = 1,
  1721. SVGA3D_MOBFMT_PTDEPTH_2 = 2,
  1722. SVGA3D_MOBFMT_RANGE = 3,
  1723. SVGA3D_MOBFMT_PTDEPTH64_0 = 4,
  1724. SVGA3D_MOBFMT_PTDEPTH64_1 = 5,
  1725. SVGA3D_MOBFMT_PTDEPTH64_2 = 6,
  1726. SVGA3D_MOBFMT_MAX,
  1727. } SVGAMobFormat;
  1728. /*
  1729. * Sizes of opaque types.
  1730. */
  1731. #define SVGA3D_OTABLE_MOB_ENTRY_SIZE 16
  1732. #define SVGA3D_OTABLE_CONTEXT_ENTRY_SIZE 8
  1733. #define SVGA3D_OTABLE_SURFACE_ENTRY_SIZE 64
  1734. #define SVGA3D_OTABLE_SHADER_ENTRY_SIZE 16
  1735. #define SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE 64
  1736. #define SVGA3D_CONTEXT_DATA_SIZE 16384
  1737. /*
  1738. * SVGA3dCmdSetOTableBase --
  1739. *
  1740. * This command allows the guest to specify the base PPN of the
  1741. * specified object table.
  1742. */
  1743. typedef enum {
  1744. SVGA_OTABLE_MOB = 0,
  1745. SVGA_OTABLE_MIN = 0,
  1746. SVGA_OTABLE_SURFACE = 1,
  1747. SVGA_OTABLE_CONTEXT = 2,
  1748. SVGA_OTABLE_SHADER = 3,
  1749. SVGA_OTABLE_SCREEN_TARGET = 4,
  1750. SVGA_OTABLE_DX9_MAX = 5,
  1751. SVGA_OTABLE_MAX = 8
  1752. } SVGAOTableType;
  1753. typedef
  1754. struct {
  1755. SVGAOTableType type;
  1756. PPN baseAddress;
  1757. uint32 sizeInBytes;
  1758. uint32 validSizeInBytes;
  1759. SVGAMobFormat ptDepth;
  1760. } __packed
  1761. SVGA3dCmdSetOTableBase; /* SVGA_3D_CMD_SET_OTABLE_BASE */
  1762. typedef
  1763. struct {
  1764. SVGAOTableType type;
  1765. PPN64 baseAddress;
  1766. uint32 sizeInBytes;
  1767. uint32 validSizeInBytes;
  1768. SVGAMobFormat ptDepth;
  1769. } __packed
  1770. SVGA3dCmdSetOTableBase64; /* SVGA_3D_CMD_SET_OTABLE_BASE64 */
  1771. typedef
  1772. struct {
  1773. SVGAOTableType type;
  1774. } __packed
  1775. SVGA3dCmdReadbackOTable; /* SVGA_3D_CMD_READBACK_OTABLE */
  1776. /*
  1777. * Define a memory object (Mob) in the OTable.
  1778. */
  1779. typedef
  1780. struct SVGA3dCmdDefineGBMob {
  1781. SVGAMobId mobid;
  1782. SVGAMobFormat ptDepth;
  1783. PPN base;
  1784. uint32 sizeInBytes;
  1785. } __packed
  1786. SVGA3dCmdDefineGBMob; /* SVGA_3D_CMD_DEFINE_GB_MOB */
  1787. /*
  1788. * Destroys an object in the OTable.
  1789. */
  1790. typedef
  1791. struct SVGA3dCmdDestroyGBMob {
  1792. SVGAMobId mobid;
  1793. } __packed
  1794. SVGA3dCmdDestroyGBMob; /* SVGA_3D_CMD_DESTROY_GB_MOB */
  1795. /*
  1796. * Redefine an object in the OTable.
  1797. */
  1798. typedef
  1799. struct SVGA3dCmdRedefineGBMob {
  1800. SVGAMobId mobid;
  1801. SVGAMobFormat ptDepth;
  1802. PPN base;
  1803. uint32 sizeInBytes;
  1804. } __packed
  1805. SVGA3dCmdRedefineGBMob; /* SVGA_3D_CMD_REDEFINE_GB_MOB */
  1806. /*
  1807. * Define a memory object (Mob) in the OTable with a PPN64 base.
  1808. */
  1809. typedef
  1810. struct SVGA3dCmdDefineGBMob64 {
  1811. SVGAMobId mobid;
  1812. SVGAMobFormat ptDepth;
  1813. PPN64 base;
  1814. uint32 sizeInBytes;
  1815. } __packed
  1816. SVGA3dCmdDefineGBMob64; /* SVGA_3D_CMD_DEFINE_GB_MOB64 */
  1817. /*
  1818. * Redefine an object in the OTable with PPN64 base.
  1819. */
  1820. typedef
  1821. struct SVGA3dCmdRedefineGBMob64 {
  1822. SVGAMobId mobid;
  1823. SVGAMobFormat ptDepth;
  1824. PPN64 base;
  1825. uint32 sizeInBytes;
  1826. } __packed
  1827. SVGA3dCmdRedefineGBMob64; /* SVGA_3D_CMD_REDEFINE_GB_MOB64 */
  1828. /*
  1829. * Notification that the page tables have been modified.
  1830. */
  1831. typedef
  1832. struct SVGA3dCmdUpdateGBMobMapping {
  1833. SVGAMobId mobid;
  1834. } __packed
  1835. SVGA3dCmdUpdateGBMobMapping; /* SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING */
  1836. /*
  1837. * Define a guest-backed surface.
  1838. */
  1839. typedef
  1840. struct SVGA3dCmdDefineGBSurface {
  1841. uint32 sid;
  1842. SVGA3dSurfaceFlags surfaceFlags;
  1843. SVGA3dSurfaceFormat format;
  1844. uint32 numMipLevels;
  1845. uint32 multisampleCount;
  1846. SVGA3dTextureFilter autogenFilter;
  1847. SVGA3dSize size;
  1848. } __packed
  1849. SVGA3dCmdDefineGBSurface; /* SVGA_3D_CMD_DEFINE_GB_SURFACE */
  1850. /*
  1851. * Destroy a guest-backed surface.
  1852. */
  1853. typedef
  1854. struct SVGA3dCmdDestroyGBSurface {
  1855. uint32 sid;
  1856. } __packed
  1857. SVGA3dCmdDestroyGBSurface; /* SVGA_3D_CMD_DESTROY_GB_SURFACE */
  1858. /*
  1859. * Bind a guest-backed surface to an object.
  1860. */
  1861. typedef
  1862. struct SVGA3dCmdBindGBSurface {
  1863. uint32 sid;
  1864. SVGAMobId mobid;
  1865. } __packed
  1866. SVGA3dCmdBindGBSurface; /* SVGA_3D_CMD_BIND_GB_SURFACE */
  1867. /*
  1868. * Conditionally bind a mob to a guest backed surface if testMobid
  1869. * matches the currently bound mob. Optionally issue a readback on
  1870. * the surface while it is still bound to the old mobid if the mobid
  1871. * is changed by this command.
  1872. */
  1873. #define SVGA3D_COND_BIND_GB_SURFACE_FLAG_READBACK (1 << 0)
  1874. typedef
  1875. struct{
  1876. uint32 sid;
  1877. SVGAMobId testMobid;
  1878. SVGAMobId mobid;
  1879. uint32 flags;
  1880. } __packed
  1881. SVGA3dCmdCondBindGBSurface; /* SVGA_3D_CMD_COND_BIND_GB_SURFACE */
  1882. /*
  1883. * Update an image in a guest-backed surface.
  1884. * (Inform the device that the guest-contents have been updated.)
  1885. */
  1886. typedef
  1887. struct SVGA3dCmdUpdateGBImage {
  1888. SVGA3dSurfaceImageId image;
  1889. SVGA3dBox box;
  1890. } __packed
  1891. SVGA3dCmdUpdateGBImage; /* SVGA_3D_CMD_UPDATE_GB_IMAGE */
  1892. /*
  1893. * Update an entire guest-backed surface.
  1894. * (Inform the device that the guest-contents have been updated.)
  1895. */
  1896. typedef
  1897. struct SVGA3dCmdUpdateGBSurface {
  1898. uint32 sid;
  1899. } __packed
  1900. SVGA3dCmdUpdateGBSurface; /* SVGA_3D_CMD_UPDATE_GB_SURFACE */
  1901. /*
  1902. * Readback an image in a guest-backed surface.
  1903. * (Request the device to flush the dirty contents into the guest.)
  1904. */
  1905. typedef
  1906. struct SVGA3dCmdReadbackGBImage {
  1907. SVGA3dSurfaceImageId image;
  1908. } __packed
  1909. SVGA3dCmdReadbackGBImage; /* SVGA_3D_CMD_READBACK_GB_IMAGE*/
  1910. /*
  1911. * Readback an entire guest-backed surface.
  1912. * (Request the device to flush the dirty contents into the guest.)
  1913. */
  1914. typedef
  1915. struct SVGA3dCmdReadbackGBSurface {
  1916. uint32 sid;
  1917. } __packed
  1918. SVGA3dCmdReadbackGBSurface; /* SVGA_3D_CMD_READBACK_GB_SURFACE */
  1919. /*
  1920. * Readback a sub rect of an image in a guest-backed surface. After
  1921. * issuing this command the driver is required to issue an update call
  1922. * of the same region before issuing any other commands that reference
  1923. * this surface or rendering is not guaranteed.
  1924. */
  1925. typedef
  1926. struct SVGA3dCmdReadbackGBImagePartial {
  1927. SVGA3dSurfaceImageId image;
  1928. SVGA3dBox box;
  1929. uint32 invertBox;
  1930. } __packed
  1931. SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */
  1932. /*
  1933. * Invalidate an image in a guest-backed surface.
  1934. * (Notify the device that the contents can be lost.)
  1935. */
  1936. typedef
  1937. struct SVGA3dCmdInvalidateGBImage {
  1938. SVGA3dSurfaceImageId image;
  1939. } __packed
  1940. SVGA3dCmdInvalidateGBImage; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE */
  1941. /*
  1942. * Invalidate an entire guest-backed surface.
  1943. * (Notify the device that the contents if all images can be lost.)
  1944. */
  1945. typedef
  1946. struct SVGA3dCmdInvalidateGBSurface {
  1947. uint32 sid;
  1948. } __packed
  1949. SVGA3dCmdInvalidateGBSurface; /* SVGA_3D_CMD_INVALIDATE_GB_SURFACE */
  1950. /*
  1951. * Invalidate a sub rect of an image in a guest-backed surface. After
  1952. * issuing this command the driver is required to issue an update call
  1953. * of the same region before issuing any other commands that reference
  1954. * this surface or rendering is not guaranteed.
  1955. */
  1956. typedef
  1957. struct SVGA3dCmdInvalidateGBImagePartial {
  1958. SVGA3dSurfaceImageId image;
  1959. SVGA3dBox box;
  1960. uint32 invertBox;
  1961. } __packed
  1962. SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */
  1963. /*
  1964. * Define a guest-backed context.
  1965. */
  1966. typedef
  1967. struct SVGA3dCmdDefineGBContext {
  1968. uint32 cid;
  1969. } __packed
  1970. SVGA3dCmdDefineGBContext; /* SVGA_3D_CMD_DEFINE_GB_CONTEXT */
  1971. /*
  1972. * Destroy a guest-backed context.
  1973. */
  1974. typedef
  1975. struct SVGA3dCmdDestroyGBContext {
  1976. uint32 cid;
  1977. } __packed
  1978. SVGA3dCmdDestroyGBContext; /* SVGA_3D_CMD_DESTROY_GB_CONTEXT */
  1979. /*
  1980. * Bind a guest-backed context.
  1981. *
  1982. * validContents should be set to 0 for new contexts,
  1983. * and 1 if this is an old context which is getting paged
  1984. * back on to the device.
  1985. *
  1986. * For new contexts, it is recommended that the driver
  1987. * issue commands to initialize all interesting state
  1988. * prior to rendering.
  1989. */
  1990. typedef
  1991. struct SVGA3dCmdBindGBContext {
  1992. uint32 cid;
  1993. SVGAMobId mobid;
  1994. uint32 validContents;
  1995. } __packed
  1996. SVGA3dCmdBindGBContext; /* SVGA_3D_CMD_BIND_GB_CONTEXT */
  1997. /*
  1998. * Readback a guest-backed context.
  1999. * (Request that the device flush the contents back into guest memory.)
  2000. */
  2001. typedef
  2002. struct SVGA3dCmdReadbackGBContext {
  2003. uint32 cid;
  2004. } __packed
  2005. SVGA3dCmdReadbackGBContext; /* SVGA_3D_CMD_READBACK_GB_CONTEXT */
  2006. /*
  2007. * Invalidate a guest-backed context.
  2008. */
  2009. typedef
  2010. struct SVGA3dCmdInvalidateGBContext {
  2011. uint32 cid;
  2012. } __packed
  2013. SVGA3dCmdInvalidateGBContext; /* SVGA_3D_CMD_INVALIDATE_GB_CONTEXT */
  2014. /*
  2015. * Define a guest-backed shader.
  2016. */
  2017. typedef
  2018. struct SVGA3dCmdDefineGBShader {
  2019. uint32 shid;
  2020. SVGA3dShaderType type;
  2021. uint32 sizeInBytes;
  2022. } __packed
  2023. SVGA3dCmdDefineGBShader; /* SVGA_3D_CMD_DEFINE_GB_SHADER */
  2024. /*
  2025. * Bind a guest-backed shader.
  2026. */
  2027. typedef struct SVGA3dCmdBindGBShader {
  2028. uint32 shid;
  2029. SVGAMobId mobid;
  2030. uint32 offsetInBytes;
  2031. } __packed
  2032. SVGA3dCmdBindGBShader; /* SVGA_3D_CMD_BIND_GB_SHADER */
  2033. /*
  2034. * Destroy a guest-backed shader.
  2035. */
  2036. typedef struct SVGA3dCmdDestroyGBShader {
  2037. uint32 shid;
  2038. } __packed
  2039. SVGA3dCmdDestroyGBShader; /* SVGA_3D_CMD_DESTROY_GB_SHADER */
  2040. typedef
  2041. struct {
  2042. uint32 cid;
  2043. uint32 regStart;
  2044. SVGA3dShaderType shaderType;
  2045. SVGA3dShaderConstType constType;
  2046. /*
  2047. * Followed by a variable number of shader constants.
  2048. *
  2049. * Note that FLOAT and INT constants are 4-dwords in length, while
  2050. * BOOL constants are 1-dword in length.
  2051. */
  2052. } __packed
  2053. SVGA3dCmdSetGBShaderConstInline;
  2054. /* SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE */
  2055. typedef
  2056. struct {
  2057. uint32 cid;
  2058. SVGA3dQueryType type;
  2059. } __packed
  2060. SVGA3dCmdBeginGBQuery; /* SVGA_3D_CMD_BEGIN_GB_QUERY */
  2061. typedef
  2062. struct {
  2063. uint32 cid;
  2064. SVGA3dQueryType type;
  2065. SVGAMobId mobid;
  2066. uint32 offset;
  2067. } __packed
  2068. SVGA3dCmdEndGBQuery; /* SVGA_3D_CMD_END_GB_QUERY */
  2069. /*
  2070. * SVGA_3D_CMD_WAIT_FOR_GB_QUERY --
  2071. *
  2072. * The semantics of this command are identical to the
  2073. * SVGA_3D_CMD_WAIT_FOR_QUERY except that the results are written
  2074. * to a Mob instead of a GMR.
  2075. */
  2076. typedef
  2077. struct {
  2078. uint32 cid;
  2079. SVGA3dQueryType type;
  2080. SVGAMobId mobid;
  2081. uint32 offset;
  2082. } __packed
  2083. SVGA3dCmdWaitForGBQuery; /* SVGA_3D_CMD_WAIT_FOR_GB_QUERY */
  2084. typedef
  2085. struct {
  2086. SVGAMobId mobid;
  2087. uint32 fbOffset;
  2088. uint32 initalized;
  2089. } __packed
  2090. SVGA3dCmdEnableGart; /* SVGA_3D_CMD_ENABLE_GART */
  2091. typedef
  2092. struct {
  2093. SVGAMobId mobid;
  2094. uint32 gartOffset;
  2095. } __packed
  2096. SVGA3dCmdMapMobIntoGart; /* SVGA_3D_CMD_MAP_MOB_INTO_GART */
  2097. typedef
  2098. struct {
  2099. uint32 gartOffset;
  2100. uint32 numPages;
  2101. } __packed
  2102. SVGA3dCmdUnmapGartRange; /* SVGA_3D_CMD_UNMAP_GART_RANGE */
  2103. /*
  2104. * Screen Targets
  2105. */
  2106. #define SVGA_STFLAG_PRIMARY (1 << 0)
  2107. typedef
  2108. struct {
  2109. uint32 stid;
  2110. uint32 width;
  2111. uint32 height;
  2112. int32 xRoot;
  2113. int32 yRoot;
  2114. uint32 flags;
  2115. } __packed
  2116. SVGA3dCmdDefineGBScreenTarget; /* SVGA_3D_CMD_DEFINE_GB_SCREENTARGET */
  2117. typedef
  2118. struct {
  2119. uint32 stid;
  2120. } __packed
  2121. SVGA3dCmdDestroyGBScreenTarget; /* SVGA_3D_CMD_DESTROY_GB_SCREENTARGET */
  2122. typedef
  2123. struct {
  2124. uint32 stid;
  2125. SVGA3dSurfaceImageId image;
  2126. } __packed
  2127. SVGA3dCmdBindGBScreenTarget; /* SVGA_3D_CMD_BIND_GB_SCREENTARGET */
  2128. typedef
  2129. struct {
  2130. uint32 stid;
  2131. SVGA3dBox box;
  2132. } __packed
  2133. SVGA3dCmdUpdateGBScreenTarget; /* SVGA_3D_CMD_UPDATE_GB_SCREENTARGET */
  2134. /*
  2135. * Capability query index.
  2136. *
  2137. * Notes:
  2138. *
  2139. * 1. SVGA3D_DEVCAP_MAX_TEXTURES reflects the maximum number of
  2140. * fixed-function texture units available. Each of these units
  2141. * work in both FFP and Shader modes, and they support texture
  2142. * transforms and texture coordinates. The host may have additional
  2143. * texture image units that are only usable with shaders.
  2144. *
  2145. * 2. The BUFFER_FORMAT capabilities are deprecated, and they always
  2146. * return TRUE. Even on physical hardware that does not support
  2147. * these formats natively, the SVGA3D device will provide an emulation
  2148. * which should be invisible to the guest OS.
  2149. *
  2150. * In general, the SVGA3D device should support any operation on
  2151. * any surface format, it just may perform some of these
  2152. * operations in software depending on the capabilities of the
  2153. * available physical hardware.
  2154. *
  2155. * XXX: In the future, we will add capabilities that describe in
  2156. * detail what formats are supported in hardware for what kinds
  2157. * of operations.
  2158. */
  2159. typedef enum {
  2160. SVGA3D_DEVCAP_3D = 0,
  2161. SVGA3D_DEVCAP_MAX_LIGHTS = 1,
  2162. SVGA3D_DEVCAP_MAX_TEXTURES = 2, /* See note (1) */
  2163. SVGA3D_DEVCAP_MAX_CLIP_PLANES = 3,
  2164. SVGA3D_DEVCAP_VERTEX_SHADER_VERSION = 4,
  2165. SVGA3D_DEVCAP_VERTEX_SHADER = 5,
  2166. SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION = 6,
  2167. SVGA3D_DEVCAP_FRAGMENT_SHADER = 7,
  2168. SVGA3D_DEVCAP_MAX_RENDER_TARGETS = 8,
  2169. SVGA3D_DEVCAP_S23E8_TEXTURES = 9,
  2170. SVGA3D_DEVCAP_S10E5_TEXTURES = 10,
  2171. SVGA3D_DEVCAP_MAX_FIXED_VERTEXBLEND = 11,
  2172. SVGA3D_DEVCAP_D16_BUFFER_FORMAT = 12, /* See note (2) */
  2173. SVGA3D_DEVCAP_D24S8_BUFFER_FORMAT = 13, /* See note (2) */
  2174. SVGA3D_DEVCAP_D24X8_BUFFER_FORMAT = 14, /* See note (2) */
  2175. SVGA3D_DEVCAP_QUERY_TYPES = 15,
  2176. SVGA3D_DEVCAP_TEXTURE_GRADIENT_SAMPLING = 16,
  2177. SVGA3D_DEVCAP_MAX_POINT_SIZE = 17,
  2178. SVGA3D_DEVCAP_MAX_SHADER_TEXTURES = 18,
  2179. SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH = 19,
  2180. SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT = 20,
  2181. SVGA3D_DEVCAP_MAX_VOLUME_EXTENT = 21,
  2182. SVGA3D_DEVCAP_MAX_TEXTURE_REPEAT = 22,
  2183. SVGA3D_DEVCAP_MAX_TEXTURE_ASPECT_RATIO = 23,
  2184. SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY = 24,
  2185. SVGA3D_DEVCAP_MAX_PRIMITIVE_COUNT = 25,
  2186. SVGA3D_DEVCAP_MAX_VERTEX_INDEX = 26,
  2187. SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS = 27,
  2188. SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_INSTRUCTIONS = 28,
  2189. SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS = 29,
  2190. SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS = 30,
  2191. SVGA3D_DEVCAP_TEXTURE_OPS = 31,
  2192. SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8 = 32,
  2193. SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8 = 33,
  2194. SVGA3D_DEVCAP_SURFACEFMT_A2R10G10B10 = 34,
  2195. SVGA3D_DEVCAP_SURFACEFMT_X1R5G5B5 = 35,
  2196. SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5 = 36,
  2197. SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4 = 37,
  2198. SVGA3D_DEVCAP_SURFACEFMT_R5G6B5 = 38,
  2199. SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE16 = 39,
  2200. SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8_ALPHA8 = 40,
  2201. SVGA3D_DEVCAP_SURFACEFMT_ALPHA8 = 41,
  2202. SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8 = 42,
  2203. SVGA3D_DEVCAP_SURFACEFMT_Z_D16 = 43,
  2204. SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8 = 44,
  2205. SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8 = 45,
  2206. SVGA3D_DEVCAP_SURFACEFMT_DXT1 = 46,
  2207. SVGA3D_DEVCAP_SURFACEFMT_DXT2 = 47,
  2208. SVGA3D_DEVCAP_SURFACEFMT_DXT3 = 48,
  2209. SVGA3D_DEVCAP_SURFACEFMT_DXT4 = 49,
  2210. SVGA3D_DEVCAP_SURFACEFMT_DXT5 = 50,
  2211. SVGA3D_DEVCAP_SURFACEFMT_BUMPX8L8V8U8 = 51,
  2212. SVGA3D_DEVCAP_SURFACEFMT_A2W10V10U10 = 52,
  2213. SVGA3D_DEVCAP_SURFACEFMT_BUMPU8V8 = 53,
  2214. SVGA3D_DEVCAP_SURFACEFMT_Q8W8V8U8 = 54,
  2215. SVGA3D_DEVCAP_SURFACEFMT_CxV8U8 = 55,
  2216. SVGA3D_DEVCAP_SURFACEFMT_R_S10E5 = 56,
  2217. SVGA3D_DEVCAP_SURFACEFMT_R_S23E8 = 57,
  2218. SVGA3D_DEVCAP_SURFACEFMT_RG_S10E5 = 58,
  2219. SVGA3D_DEVCAP_SURFACEFMT_RG_S23E8 = 59,
  2220. SVGA3D_DEVCAP_SURFACEFMT_ARGB_S10E5 = 60,
  2221. SVGA3D_DEVCAP_SURFACEFMT_ARGB_S23E8 = 61,
  2222. SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEXTURES = 63,
  2223. /*
  2224. * Note that MAX_SIMULTANEOUS_RENDER_TARGETS is a maximum count of color
  2225. * render targets. This does no include the depth or stencil targets.
  2226. */
  2227. SVGA3D_DEVCAP_MAX_SIMULTANEOUS_RENDER_TARGETS = 64,
  2228. SVGA3D_DEVCAP_SURFACEFMT_V16U16 = 65,
  2229. SVGA3D_DEVCAP_SURFACEFMT_G16R16 = 66,
  2230. SVGA3D_DEVCAP_SURFACEFMT_A16B16G16R16 = 67,
  2231. SVGA3D_DEVCAP_SURFACEFMT_UYVY = 68,
  2232. SVGA3D_DEVCAP_SURFACEFMT_YUY2 = 69,
  2233. SVGA3D_DEVCAP_MULTISAMPLE_NONMASKABLESAMPLES = 70,
  2234. SVGA3D_DEVCAP_MULTISAMPLE_MASKABLESAMPLES = 71,
  2235. SVGA3D_DEVCAP_ALPHATOCOVERAGE = 72,
  2236. SVGA3D_DEVCAP_SUPERSAMPLE = 73,
  2237. SVGA3D_DEVCAP_AUTOGENMIPMAPS = 74,
  2238. SVGA3D_DEVCAP_SURFACEFMT_NV12 = 75,
  2239. SVGA3D_DEVCAP_SURFACEFMT_AYUV = 76,
  2240. /*
  2241. * This is the maximum number of SVGA context IDs that the guest
  2242. * can define using SVGA_3D_CMD_CONTEXT_DEFINE.
  2243. */
  2244. SVGA3D_DEVCAP_MAX_CONTEXT_IDS = 77,
  2245. /*
  2246. * This is the maximum number of SVGA surface IDs that the guest
  2247. * can define using SVGA_3D_CMD_SURFACE_DEFINE*.
  2248. */
  2249. SVGA3D_DEVCAP_MAX_SURFACE_IDS = 78,
  2250. SVGA3D_DEVCAP_SURFACEFMT_Z_DF16 = 79,
  2251. SVGA3D_DEVCAP_SURFACEFMT_Z_DF24 = 80,
  2252. SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8_INT = 81,
  2253. SVGA3D_DEVCAP_SURFACEFMT_BC4_UNORM = 82,
  2254. SVGA3D_DEVCAP_SURFACEFMT_BC5_UNORM = 83,
  2255. /*
  2256. * Deprecated.
  2257. */
  2258. SVGA3D_DEVCAP_VGPU10 = 84,
  2259. /*
  2260. * This contains several SVGA_3D_CAPS_VIDEO_DECODE elements
  2261. * ored together, one for every type of video decoding supported.
  2262. */
  2263. SVGA3D_DEVCAP_VIDEO_DECODE = 85,
  2264. /*
  2265. * This contains several SVGA_3D_CAPS_VIDEO_PROCESS elements
  2266. * ored together, one for every type of video processing supported.
  2267. */
  2268. SVGA3D_DEVCAP_VIDEO_PROCESS = 86,
  2269. SVGA3D_DEVCAP_LINE_AA = 87, /* boolean */
  2270. SVGA3D_DEVCAP_LINE_STIPPLE = 88, /* boolean */
  2271. SVGA3D_DEVCAP_MAX_LINE_WIDTH = 89, /* float */
  2272. SVGA3D_DEVCAP_MAX_AA_LINE_WIDTH = 90, /* float */
  2273. SVGA3D_DEVCAP_SURFACEFMT_YV12 = 91,
  2274. /*
  2275. * Does the host support the SVGA logic ops commands?
  2276. */
  2277. SVGA3D_DEVCAP_LOGICOPS = 92,
  2278. /*
  2279. * What support does the host have for screen targets?
  2280. *
  2281. * See the SVGA3D_SCREENTARGET_CAP bits below.
  2282. */
  2283. SVGA3D_DEVCAP_SCREENTARGETS = 93,
  2284. SVGA3D_DEVCAP_MAX /* This must be the last index. */
  2285. } SVGA3dDevCapIndex;
  2286. typedef union {
  2287. Bool b;
  2288. uint32 u;
  2289. int32 i;
  2290. float f;
  2291. } SVGA3dDevCapResult;
  2292. typedef enum {
  2293. SVGA3DCAPS_RECORD_UNKNOWN = 0,
  2294. SVGA3DCAPS_RECORD_DEVCAPS_MIN = 0x100,
  2295. SVGA3DCAPS_RECORD_DEVCAPS = 0x100,
  2296. SVGA3DCAPS_RECORD_DEVCAPS_MAX = 0x1ff,
  2297. } SVGA3dCapsRecordType;
  2298. typedef
  2299. struct SVGA3dCapsRecordHeader {
  2300. uint32 length;
  2301. SVGA3dCapsRecordType type;
  2302. }
  2303. SVGA3dCapsRecordHeader;
  2304. typedef
  2305. struct SVGA3dCapsRecord {
  2306. SVGA3dCapsRecordHeader header;
  2307. uint32 data[1];
  2308. }
  2309. SVGA3dCapsRecord;
  2310. typedef uint32 SVGA3dCapPair[2];
  2311. #endif /* _SVGA3D_REG_H_ */