ThreedClassState.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981
  1. using Ryujinx.Common.Memory;
  2. using Ryujinx.Graphics.GAL;
  3. using Ryujinx.Graphics.Gpu.Engine.InlineToMemory;
  4. using Ryujinx.Graphics.Gpu.Engine.Types;
  5. using Ryujinx.Graphics.Gpu.Image;
  6. using Ryujinx.Graphics.Shader;
  7. using System;
  8. namespace Ryujinx.Graphics.Gpu.Engine.Threed
  9. {
  10. /// <summary>
  11. /// Shader stage name.
  12. /// </summary>
  13. enum ShaderType
  14. {
  15. Vertex,
  16. TessellationControl,
  17. TessellationEvaluation,
  18. Geometry,
  19. Fragment
  20. }
  21. /// <summary>
  22. /// Tessellation mode.
  23. /// </summary>
  24. struct TessMode
  25. {
  26. #pragma warning disable CS0649
  27. public uint Packed;
  28. #pragma warning restore CS0649
  29. /// <summary>
  30. /// Unpacks the tessellation abstract patch type.
  31. /// </summary>
  32. /// <returns>Abtract patch type</returns>
  33. public TessPatchType UnpackPatchType()
  34. {
  35. return (TessPatchType)(Packed & 3);
  36. }
  37. /// <summary>
  38. /// Unpacks the spacing between tessellated vertices of the patch.
  39. /// </summary>
  40. /// <returns>Spacing between tessellated vertices</returns>
  41. public TessSpacing UnpackSpacing()
  42. {
  43. return (TessSpacing)((Packed >> 4) & 3);
  44. }
  45. /// <summary>
  46. /// Unpacks the primitive winding order.
  47. /// </summary>
  48. /// <returns>True if clockwise, false if counter-clockwise</returns>
  49. public bool UnpackCw()
  50. {
  51. return (Packed & (1 << 8)) != 0;
  52. }
  53. }
  54. /// <summary>
  55. /// Transform feedback buffer state.
  56. /// </summary>
  57. struct TfBufferState
  58. {
  59. #pragma warning disable CS0649
  60. public Boolean32 Enable;
  61. public GpuVa Address;
  62. public int Size;
  63. public int Offset;
  64. public uint Padding0;
  65. public uint Padding1;
  66. public uint Padding2;
  67. #pragma warning restore CS0649
  68. }
  69. /// <summary>
  70. /// Transform feedback state.
  71. /// </summary>
  72. struct TfState
  73. {
  74. #pragma warning disable CS0649
  75. public int BufferIndex;
  76. public int VaryingsCount;
  77. public int Stride;
  78. public uint Padding;
  79. #pragma warning restore CS0649
  80. }
  81. /// <summary>
  82. /// Render target color buffer state.
  83. /// </summary>
  84. struct RtColorState
  85. {
  86. #pragma warning disable CS0649
  87. public GpuVa Address;
  88. public int WidthOrStride;
  89. public int Height;
  90. public ColorFormat Format;
  91. public MemoryLayout MemoryLayout;
  92. public int Depth;
  93. public int LayerSize;
  94. public int BaseLayer;
  95. public int Unknown0x24;
  96. public int Padding0;
  97. public int Padding1;
  98. public int Padding2;
  99. public int Padding3;
  100. public int Padding4;
  101. public int Padding5;
  102. #pragma warning restore CS0649
  103. }
  104. /// <summary>
  105. /// Viewport transform parameters, for viewport transformation.
  106. /// </summary>
  107. struct ViewportTransform
  108. {
  109. #pragma warning disable CS0649
  110. public float ScaleX;
  111. public float ScaleY;
  112. public float ScaleZ;
  113. public float TranslateX;
  114. public float TranslateY;
  115. public float TranslateZ;
  116. public uint Swizzle;
  117. public uint SubpixelPrecisionBias;
  118. #pragma warning restore CS0649
  119. /// <summary>
  120. /// Unpacks viewport swizzle of the position X component.
  121. /// </summary>
  122. /// <returns>Swizzle enum value</returns>
  123. public ViewportSwizzle UnpackSwizzleX()
  124. {
  125. return (ViewportSwizzle)(Swizzle & 7);
  126. }
  127. /// <summary>
  128. /// Unpacks viewport swizzle of the position Y component.
  129. /// </summary>
  130. /// <returns>Swizzle enum value</returns>
  131. public ViewportSwizzle UnpackSwizzleY()
  132. {
  133. return (ViewportSwizzle)((Swizzle >> 4) & 7);
  134. }
  135. /// <summary>
  136. /// Unpacks viewport swizzle of the position Z component.
  137. /// </summary>
  138. /// <returns>Swizzle enum value</returns>
  139. public ViewportSwizzle UnpackSwizzleZ()
  140. {
  141. return (ViewportSwizzle)((Swizzle >> 8) & 7);
  142. }
  143. /// <summary>
  144. /// Unpacks viewport swizzle of the position W component.
  145. /// </summary>
  146. /// <returns>Swizzle enum value</returns>
  147. public ViewportSwizzle UnpackSwizzleW()
  148. {
  149. return (ViewportSwizzle)((Swizzle >> 12) & 7);
  150. }
  151. }
  152. /// <summary>
  153. /// Viewport extents for viewport clipping, also includes depth range.
  154. /// </summary>
  155. struct ViewportExtents
  156. {
  157. #pragma warning disable CS0649
  158. public ushort X;
  159. public ushort Width;
  160. public ushort Y;
  161. public ushort Height;
  162. public float DepthNear;
  163. public float DepthFar;
  164. #pragma warning restore CS0649
  165. }
  166. /// <summary>
  167. /// Draw state for non-indexed draws.
  168. /// </summary>
  169. struct VertexBufferDrawState
  170. {
  171. #pragma warning disable CS0649
  172. public int First;
  173. public int Count;
  174. #pragma warning restore CS0649
  175. }
  176. /// <summary>
  177. /// Color buffer clear color.
  178. /// </summary>
  179. struct ClearColors
  180. {
  181. #pragma warning disable CS0649
  182. public float Red;
  183. public float Green;
  184. public float Blue;
  185. public float Alpha;
  186. #pragma warning restore CS0649
  187. }
  188. /// <summary>
  189. /// Depth bias (also called polygon offset) parameters.
  190. /// </summary>
  191. struct DepthBiasState
  192. {
  193. #pragma warning disable CS0649
  194. public Boolean32 PointEnable;
  195. public Boolean32 LineEnable;
  196. public Boolean32 FillEnable;
  197. #pragma warning restore CS0649
  198. }
  199. /// <summary>
  200. /// Scissor state.
  201. /// </summary>
  202. struct ScissorState
  203. {
  204. #pragma warning disable CS0649
  205. public Boolean32 Enable;
  206. public ushort X1;
  207. public ushort X2;
  208. public ushort Y1;
  209. public ushort Y2;
  210. public uint Padding;
  211. #pragma warning restore CS0649
  212. }
  213. /// <summary>
  214. /// Stencil test masks for back tests.
  215. /// </summary>
  216. struct StencilBackMasks
  217. {
  218. #pragma warning disable CS0649
  219. public int FuncRef;
  220. public int Mask;
  221. public int FuncMask;
  222. #pragma warning restore CS0649
  223. }
  224. /// <summary>
  225. /// Render target depth-stencil buffer state.
  226. /// </summary>
  227. struct RtDepthStencilState
  228. {
  229. #pragma warning disable CS0649
  230. public GpuVa Address;
  231. public ZetaFormat Format;
  232. public MemoryLayout MemoryLayout;
  233. public int LayerSize;
  234. #pragma warning restore CS0649
  235. }
  236. /// <summary>
  237. /// Screen scissor state.
  238. /// </summary>
  239. struct ScreenScissorState
  240. {
  241. #pragma warning disable CS0649
  242. public ushort X;
  243. public ushort Width;
  244. public ushort Y;
  245. public ushort Height;
  246. #pragma warning restore CS0649
  247. }
  248. /// <summary>
  249. /// Vertex attribute vector and component size.
  250. /// </summary>
  251. enum VertexAttribSize
  252. {
  253. Size32x4 = 1,
  254. Size32x3 = 2,
  255. Size16x4 = 3,
  256. Size32x2 = 4,
  257. Size16x3 = 5,
  258. Size8x4 = 0xa,
  259. Size16x2 = 0xf,
  260. Size32 = 0x12,
  261. Size8x3 = 0x13,
  262. Size8x2 = 0x18,
  263. Size16 = 0x1b,
  264. Size8 = 0x1d,
  265. Rgb10A2 = 0x30,
  266. Rg11B10 = 0x31
  267. }
  268. /// <summary>
  269. /// Vertex attribute component type.
  270. /// </summary>
  271. enum VertexAttribType
  272. {
  273. Snorm = 1,
  274. Unorm = 2,
  275. Sint = 3,
  276. Uint = 4,
  277. Uscaled = 5,
  278. Sscaled = 6,
  279. Float = 7
  280. }
  281. /// <summary>
  282. /// Vertex buffer attribute state.
  283. /// </summary>
  284. struct VertexAttribState
  285. {
  286. #pragma warning disable CS0649
  287. public uint Attribute;
  288. #pragma warning restore CS0649
  289. /// <summary>
  290. /// Unpacks the index of the vertex buffer this attribute belongs to.
  291. /// </summary>
  292. /// <returns>Vertex buffer index</returns>
  293. public int UnpackBufferIndex()
  294. {
  295. return (int)(Attribute & 0x1f);
  296. }
  297. /// <summary>
  298. /// Unpacks the attribute constant flag.
  299. /// </summary>
  300. /// <returns>True if the attribute is constant, false otherwise</returns>
  301. public bool UnpackIsConstant()
  302. {
  303. return (Attribute & 0x40) != 0;
  304. }
  305. /// <summary>
  306. /// Unpacks the offset, in bytes, of the attribute on the vertex buffer.
  307. /// </summary>
  308. /// <returns>Attribute offset in bytes</returns>
  309. public int UnpackOffset()
  310. {
  311. return (int)((Attribute >> 7) & 0x3fff);
  312. }
  313. /// <summary>
  314. /// Unpacks the Maxwell attribute format integer.
  315. /// </summary>
  316. /// <returns>Attribute format integer</returns>
  317. public uint UnpackFormat()
  318. {
  319. return Attribute & 0x3fe00000;
  320. }
  321. /// <summary>
  322. /// Unpacks the Maxwell attribute size.
  323. /// </summary>
  324. /// <returns>Attribute size</returns>
  325. public VertexAttribSize UnpackSize()
  326. {
  327. return (VertexAttribSize)((Attribute >> 21) & 0x3f);
  328. }
  329. /// <summary>
  330. /// Unpacks the Maxwell attribute component type.
  331. /// </summary>
  332. /// <returns>Attribute component type</returns>
  333. public VertexAttribType UnpackType()
  334. {
  335. return (VertexAttribType)((Attribute >> 27) & 7);
  336. }
  337. }
  338. /// <summary>
  339. /// Render target draw buffers control.
  340. /// </summary>
  341. struct RtControl
  342. {
  343. #pragma warning disable CS0649
  344. public uint Packed;
  345. #pragma warning restore CS0649
  346. /// <summary>
  347. /// Unpacks the number of active draw buffers.
  348. /// </summary>
  349. /// <returns>Number of active draw buffers</returns>
  350. public int UnpackCount()
  351. {
  352. return (int)(Packed & 0xf);
  353. }
  354. /// <summary>
  355. /// Unpacks the color attachment index for a given draw buffer.
  356. /// </summary>
  357. /// <param name="index">Index of the draw buffer</param>
  358. /// <returns>Attachment index</returns>
  359. public int UnpackPermutationIndex(int index)
  360. {
  361. return (int)((Packed >> (4 + index * 3)) & 7);
  362. }
  363. }
  364. /// <summary>
  365. /// 3D, 2D or 1D texture size.
  366. /// </summary>
  367. struct Size3D
  368. {
  369. #pragma warning disable CS0649
  370. public int Width;
  371. public int Height;
  372. public int Depth;
  373. #pragma warning restore CS0649
  374. }
  375. /// <summary>
  376. /// Stencil front test state and masks.
  377. /// </summary>
  378. struct StencilTestState
  379. {
  380. #pragma warning disable CS0649
  381. public Boolean32 Enable;
  382. public StencilOp FrontSFail;
  383. public StencilOp FrontDpFail;
  384. public StencilOp FrontDpPass;
  385. public CompareOp FrontFunc;
  386. public int FrontFuncRef;
  387. public int FrontFuncMask;
  388. public int FrontMask;
  389. #pragma warning restore CS0649
  390. }
  391. /// <summary>
  392. /// Screen Y control register.
  393. /// </summary>
  394. [Flags]
  395. enum YControl
  396. {
  397. NegateY = 1 << 0,
  398. TriangleRastFlip = 1 << 4
  399. }
  400. /// <summary>
  401. /// Condition for conditional rendering.
  402. /// </summary>
  403. enum Condition
  404. {
  405. Never,
  406. Always,
  407. ResultNonZero,
  408. Equal,
  409. NotEqual
  410. }
  411. /// <summary>
  412. /// Texture or sampler pool state.
  413. /// </summary>
  414. struct PoolState
  415. {
  416. #pragma warning disable CS0649
  417. public GpuVa Address;
  418. public int MaximumId;
  419. #pragma warning restore CS0649
  420. }
  421. /// <summary>
  422. /// Stencil back test state.
  423. /// </summary>
  424. struct StencilBackTestState
  425. {
  426. #pragma warning disable CS0649
  427. public Boolean32 TwoSided;
  428. public StencilOp BackSFail;
  429. public StencilOp BackDpFail;
  430. public StencilOp BackDpPass;
  431. public CompareOp BackFunc;
  432. #pragma warning restore CS0649
  433. }
  434. /// <summary>
  435. /// Primitive restart state.
  436. /// </summary>
  437. struct PrimitiveRestartState
  438. {
  439. #pragma warning disable CS0649
  440. public Boolean32 Enable;
  441. public int Index;
  442. #pragma warning restore CS0649
  443. }
  444. /// <summary>
  445. /// GPU index buffer state.
  446. /// This is used on indexed draws.
  447. /// </summary>
  448. struct IndexBufferState
  449. {
  450. #pragma warning disable CS0649
  451. public GpuVa Address;
  452. public GpuVa EndAddress;
  453. public IndexType Type;
  454. public int First;
  455. #pragma warning restore CS0649
  456. }
  457. /// <summary>
  458. /// Face culling and orientation parameters.
  459. /// </summary>
  460. struct FaceState
  461. {
  462. #pragma warning disable CS0649
  463. public Boolean32 CullEnable;
  464. public FrontFace FrontFace;
  465. public Face CullFace;
  466. #pragma warning restore CS0649
  467. }
  468. /// <summary>
  469. /// View volume clip control.
  470. /// </summary>
  471. [Flags]
  472. enum ViewVolumeClipControl
  473. {
  474. ForceDepthRangeZeroToOne = 1 << 0,
  475. DepthClampDisabled = 1 << 11
  476. }
  477. /// <summary>
  478. /// Logical operation state.
  479. /// </summary>
  480. struct LogicalOpState
  481. {
  482. #pragma warning disable CS0649
  483. public Boolean32 Enable;
  484. public LogicalOp LogicalOp;
  485. #pragma warning restore CS0649
  486. }
  487. /// <summary>
  488. /// Render target color buffer mask.
  489. /// This defines which color channels are written to the color buffer.
  490. /// </summary>
  491. struct RtColorMask
  492. {
  493. #pragma warning disable CS0649
  494. public uint Packed;
  495. #pragma warning restore CS0649
  496. /// <summary>
  497. /// Unpacks red channel enable.
  498. /// </summary>
  499. /// <returns>True to write the new red channel color, false to keep the old value</returns>
  500. public bool UnpackRed()
  501. {
  502. return (Packed & 0x1) != 0;
  503. }
  504. /// <summary>
  505. /// Unpacks green channel enable.
  506. /// </summary>
  507. /// <returns>True to write the new green channel color, false to keep the old value</returns>
  508. public bool UnpackGreen()
  509. {
  510. return (Packed & 0x10) != 0;
  511. }
  512. /// <summary>
  513. /// Unpacks blue channel enable.
  514. /// </summary>
  515. /// <returns>True to write the new blue channel color, false to keep the old value</returns>
  516. public bool UnpackBlue()
  517. {
  518. return (Packed & 0x100) != 0;
  519. }
  520. /// <summary>
  521. /// Unpacks alpha channel enable.
  522. /// </summary>
  523. /// <returns>True to write the new alpha channel color, false to keep the old value</returns>
  524. public bool UnpackAlpha()
  525. {
  526. return (Packed & 0x1000) != 0;
  527. }
  528. }
  529. /// <summary>
  530. /// Vertex buffer state.
  531. /// </summary>
  532. struct VertexBufferState
  533. {
  534. #pragma warning disable CS0649
  535. public uint Control;
  536. public GpuVa Address;
  537. public int Divisor;
  538. #pragma warning restore CS0649
  539. /// <summary>
  540. /// Vertex buffer stride, defined as the number of bytes occupied by each vertex in memory.
  541. /// </summary>
  542. /// <returns>Vertex buffer stride</returns>
  543. public int UnpackStride()
  544. {
  545. return (int)(Control & 0xfff);
  546. }
  547. /// <summary>
  548. /// Vertex buffer enable.
  549. /// </summary>
  550. /// <returns>True if the vertex buffer is enabled, false otherwise</returns>
  551. public bool UnpackEnable()
  552. {
  553. return (Control & (1 << 12)) != 0;
  554. }
  555. }
  556. /// <summary>
  557. /// Color buffer blending parameters, shared by all color buffers.
  558. /// </summary>
  559. struct BlendStateCommon
  560. {
  561. #pragma warning disable CS0649
  562. public Boolean32 SeparateAlpha;
  563. public BlendOp ColorOp;
  564. public BlendFactor ColorSrcFactor;
  565. public BlendFactor ColorDstFactor;
  566. public BlendOp AlphaOp;
  567. public BlendFactor AlphaSrcFactor;
  568. public uint Unknown0x1354;
  569. public BlendFactor AlphaDstFactor;
  570. #pragma warning restore CS0649
  571. }
  572. /// <summary>
  573. /// Color buffer blending parameters.
  574. /// </summary>
  575. struct BlendState
  576. {
  577. #pragma warning disable CS0649
  578. public Boolean32 SeparateAlpha;
  579. public BlendOp ColorOp;
  580. public BlendFactor ColorSrcFactor;
  581. public BlendFactor ColorDstFactor;
  582. public BlendOp AlphaOp;
  583. public BlendFactor AlphaSrcFactor;
  584. public BlendFactor AlphaDstFactor;
  585. public uint Padding;
  586. #pragma warning restore CS0649
  587. }
  588. /// <summary>
  589. /// Graphics shader stage state.
  590. /// </summary>
  591. struct ShaderState
  592. {
  593. #pragma warning disable CS0649
  594. public uint Control;
  595. public uint Offset;
  596. public uint Unknown0x8;
  597. public int MaxRegisters;
  598. public ShaderType Type;
  599. public uint Unknown0x14;
  600. public uint Unknown0x18;
  601. public uint Unknown0x1c;
  602. public uint Unknown0x20;
  603. public uint Unknown0x24;
  604. public uint Unknown0x28;
  605. public uint Unknown0x2c;
  606. public uint Unknown0x30;
  607. public uint Unknown0x34;
  608. public uint Unknown0x38;
  609. public uint Unknown0x3c;
  610. #pragma warning restore CS0649
  611. /// <summary>
  612. /// Unpacks shader enable information.
  613. /// Must be ignored for vertex shaders, those are always enabled.
  614. /// </summary>
  615. /// <returns>True if the stage is enabled, false otherwise</returns>
  616. public bool UnpackEnable()
  617. {
  618. return (Control & 1) != 0;
  619. }
  620. }
  621. /// <summary>
  622. /// Uniform buffer state for the uniform buffer currently being modified.
  623. /// </summary>
  624. struct UniformBufferState
  625. {
  626. #pragma warning disable CS0649
  627. public int Size;
  628. public GpuVa Address;
  629. public int Offset;
  630. #pragma warning restore CS0649
  631. }
  632. unsafe struct ThreedClassState : IShadowState
  633. {
  634. #pragma warning disable CS0649
  635. public uint SetObject;
  636. public int SetObjectClassId => (int)((SetObject >> 0) & 0xFFFF);
  637. public int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
  638. public fixed uint Reserved04[63];
  639. public uint NoOperation;
  640. public uint SetNotifyA;
  641. public int SetNotifyAAddressUpper => (int)((SetNotifyA >> 0) & 0xFF);
  642. public uint SetNotifyB;
  643. public uint Notify;
  644. public NotifyType NotifyType => (NotifyType)(Notify);
  645. public uint WaitForIdle;
  646. public uint LoadMmeInstructionRamPointer;
  647. public uint LoadMmeInstructionRam;
  648. public uint LoadMmeStartAddressRamPointer;
  649. public uint LoadMmeStartAddressRam;
  650. public uint SetMmeShadowRamControl;
  651. public SetMmeShadowRamControlMode SetMmeShadowRamControlMode => (SetMmeShadowRamControlMode)((SetMmeShadowRamControl >> 0) & 0x3);
  652. public fixed uint Reserved128[2];
  653. public uint SetGlobalRenderEnableA;
  654. public int SetGlobalRenderEnableAOffsetUpper => (int)((SetGlobalRenderEnableA >> 0) & 0xFF);
  655. public uint SetGlobalRenderEnableB;
  656. public uint SetGlobalRenderEnableC;
  657. public int SetGlobalRenderEnableCMode => (int)((SetGlobalRenderEnableC >> 0) & 0x7);
  658. public uint SendGoIdle;
  659. public uint PmTrigger;
  660. public uint PmTriggerWfi;
  661. public fixed uint Reserved148[2];
  662. public uint SetInstrumentationMethodHeader;
  663. public uint SetInstrumentationMethodData;
  664. public fixed uint Reserved158[10];
  665. public uint LineLengthIn;
  666. public uint LineCount;
  667. public uint OffsetOutUpper;
  668. public int OffsetOutUpperValue => (int)((OffsetOutUpper >> 0) & 0xFF);
  669. public uint OffsetOut;
  670. public uint PitchOut;
  671. public uint SetDstBlockSize;
  672. public SetDstBlockSizeWidth SetDstBlockSizeWidth => (SetDstBlockSizeWidth)((SetDstBlockSize >> 0) & 0xF);
  673. public SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
  674. public SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
  675. public uint SetDstWidth;
  676. public uint SetDstHeight;
  677. public uint SetDstDepth;
  678. public uint SetDstLayer;
  679. public uint SetDstOriginBytesX;
  680. public int SetDstOriginBytesXV => (int)((SetDstOriginBytesX >> 0) & 0xFFFFF);
  681. public uint SetDstOriginSamplesY;
  682. public int SetDstOriginSamplesYV => (int)((SetDstOriginSamplesY >> 0) & 0xFFFF);
  683. public uint LaunchDma;
  684. public LaunchDmaDstMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaDstMemoryLayout)((LaunchDma >> 0) & 0x1);
  685. public LaunchDmaCompletionType LaunchDmaCompletionType => (LaunchDmaCompletionType)((LaunchDma >> 4) & 0x3);
  686. public LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 8) & 0x3);
  687. public LaunchDmaSemaphoreStructSize LaunchDmaSemaphoreStructSize => (LaunchDmaSemaphoreStructSize)((LaunchDma >> 12) & 0x1);
  688. public bool LaunchDmaReductionEnable => (LaunchDma & 0x2) != 0;
  689. public LaunchDmaReductionOp LaunchDmaReductionOp => (LaunchDmaReductionOp)((LaunchDma >> 13) & 0x7);
  690. public LaunchDmaReductionFormat LaunchDmaReductionFormat => (LaunchDmaReductionFormat)((LaunchDma >> 2) & 0x3);
  691. public bool LaunchDmaSysmembarDisable => (LaunchDma & 0x40) != 0;
  692. public uint LoadInlineData;
  693. public fixed uint Reserved1B8[22];
  694. public Boolean32 EarlyZForce;
  695. public fixed uint Reserved214[45];
  696. public uint SyncpointAction;
  697. public fixed uint Reserved2CC[21];
  698. public TessMode TessMode;
  699. public Array4<float> TessOuterLevel;
  700. public Array2<float> TessInnerLevel;
  701. public fixed uint Reserved33C[16];
  702. public Boolean32 RasterizeEnable;
  703. public Array4<TfBufferState> TfBufferState;
  704. public fixed uint Reserved400[192];
  705. public Array4<TfState> TfState;
  706. public fixed uint Reserved740[1];
  707. public Boolean32 TfEnable;
  708. public fixed uint Reserved748[46];
  709. public Array8<RtColorState> RtColorState;
  710. public Array16<ViewportTransform> ViewportTransform;
  711. public Array16<ViewportExtents> ViewportExtents;
  712. public fixed uint ReservedD00[29];
  713. public VertexBufferDrawState VertexBufferDrawState;
  714. public uint DepthMode;
  715. public ClearColors ClearColors;
  716. public float ClearDepthValue;
  717. public fixed uint ReservedD94[3];
  718. public uint ClearStencilValue;
  719. public fixed uint ReservedDA4[2];
  720. public PolygonMode PolygonModeFront;
  721. public PolygonMode PolygonModeBack;
  722. public Boolean32 PolygonSmoothEnable;
  723. public fixed uint ReservedDB8[2];
  724. public DepthBiasState DepthBiasState;
  725. public int PatchVertices;
  726. public fixed uint ReservedDD0[4];
  727. public uint TextureBarrier;
  728. public uint WatchdogTimer;
  729. public Boolean32 PrimitiveRestartDrawArrays;
  730. public fixed uint ReservedDEC[5];
  731. public Array16<ScissorState> ScissorState;
  732. public fixed uint ReservedF00[21];
  733. public StencilBackMasks StencilBackMasks;
  734. public fixed uint ReservedF60[5];
  735. public uint InvalidateTextures;
  736. public fixed uint ReservedF78[1];
  737. public uint TextureBarrierTiled;
  738. public fixed uint ReservedF80[4];
  739. public Boolean32 RtColorMaskShared;
  740. public fixed uint ReservedF94[19];
  741. public RtDepthStencilState RtDepthStencilState;
  742. public ScreenScissorState ScreenScissorState;
  743. public fixed uint ReservedFFC[33];
  744. public int DrawTextureDstX;
  745. public int DrawTextureDstY;
  746. public int DrawTextureDstWidth;
  747. public int DrawTextureDstHeight;
  748. public long DrawTextureDuDx;
  749. public long DrawTextureDvDy;
  750. public int DrawTextureSamplerId;
  751. public int DrawTextureTextureId;
  752. public int DrawTextureSrcX;
  753. public int DrawTextureSrcY;
  754. public fixed uint Reserved10B0[18];
  755. public uint ClearFlags;
  756. public fixed uint Reserved10FC[25];
  757. public Array32<VertexAttribState> VertexAttribState;
  758. public fixed uint Reserved11E0[15];
  759. public RtControl RtControl;
  760. public fixed uint Reserved1220[2];
  761. public Size3D RtDepthStencilSize;
  762. public SamplerIndex SamplerIndex;
  763. public fixed uint Reserved1238[37];
  764. public Boolean32 DepthTestEnable;
  765. public fixed uint Reserved12D0[4];
  766. public Boolean32 AlphaToCoverageDitherEnable;
  767. public Boolean32 BlendIndependent;
  768. public Boolean32 DepthWriteEnable;
  769. public Boolean32 AlphaTestEnable;
  770. public fixed uint Reserved12F0[5];
  771. public uint VbElementU8;
  772. public uint Reserved1308;
  773. public CompareOp DepthTestFunc;
  774. public float AlphaTestRef;
  775. public CompareOp AlphaTestFunc;
  776. public uint Reserved1318;
  777. public ColorF BlendConstant;
  778. public fixed uint Reserved132C[4];
  779. public BlendStateCommon BlendStateCommon;
  780. public Boolean32 BlendEnableCommon;
  781. public Array8<Boolean32> BlendEnable;
  782. public StencilTestState StencilTestState;
  783. public fixed uint Reserved13A0[3];
  784. public YControl YControl;
  785. public float LineWidthSmooth;
  786. public float LineWidthAliased;
  787. public fixed uint Reserved13B8[27];
  788. public uint InvalidateSamplerCacheNoWfi;
  789. public uint InvalidateTextureHeaderCacheNoWfi;
  790. public fixed uint Reserved142C[2];
  791. public uint FirstVertex;
  792. public uint FirstInstance;
  793. public fixed uint Reserved143C[53];
  794. public uint ClipDistanceEnable;
  795. public uint Reserved1514;
  796. public float PointSize;
  797. public uint Reserved151C;
  798. public Boolean32 PointSpriteEnable;
  799. public fixed uint Reserved1524[3];
  800. public uint ResetCounter;
  801. public Boolean32 MultisampleEnable;
  802. public Boolean32 RtDepthStencilEnable;
  803. public uint MultisampleControl;
  804. public fixed uint Reserved1540[4];
  805. public GpuVa RenderEnableAddress;
  806. public Condition RenderEnableCondition;
  807. public PoolState SamplerPoolState;
  808. public uint Reserved1568;
  809. public float DepthBiasFactor;
  810. public Boolean32 LineSmoothEnable;
  811. public PoolState TexturePoolState;
  812. public fixed uint Reserved1580[5];
  813. public StencilBackTestState StencilBackTestState;
  814. public fixed uint Reserved15A8[5];
  815. public float DepthBiasUnits;
  816. public fixed uint Reserved15C0[4];
  817. public TextureMsaaMode RtMsaaMode;
  818. public fixed uint Reserved15D4[5];
  819. public uint VbElementU32;
  820. public uint Reserved15EC;
  821. public uint VbElementU16;
  822. public fixed uint Reserved15F4[4];
  823. public uint PointCoordReplace;
  824. public GpuVa ShaderBaseAddress;
  825. public uint Reserved1610;
  826. public uint DrawEnd;
  827. public uint DrawBegin;
  828. public fixed uint Reserved161C[10];
  829. public PrimitiveRestartState PrimitiveRestartState;
  830. public fixed uint Reserved164C[95];
  831. public IndexBufferState IndexBufferState;
  832. public uint IndexBufferCount;
  833. public uint DrawIndexedSmall;
  834. public uint DrawIndexedSmall2;
  835. public uint Reserved17EC;
  836. public uint DrawIndexedSmallIncInstance;
  837. public uint DrawIndexedSmallIncInstance2;
  838. public fixed uint Reserved17F8[33];
  839. public float DepthBiasClamp;
  840. public Array16<Boolean32> VertexBufferInstanced;
  841. public fixed uint Reserved18C0[20];
  842. public Boolean32 VertexProgramPointSize;
  843. public uint Reserved1914;
  844. public FaceState FaceState;
  845. public fixed uint Reserved1924[2];
  846. public uint ViewportTransformEnable;
  847. public fixed uint Reserved1930[3];
  848. public ViewVolumeClipControl ViewVolumeClipControl;
  849. public fixed uint Reserved1940[2];
  850. public Boolean32 PrimitiveTypeOverrideEnable;
  851. public fixed uint Reserved194C[9];
  852. public PrimitiveTypeOverride PrimitiveTypeOverride;
  853. public fixed uint Reserved1974[20];
  854. public LogicalOpState LogicOpState;
  855. public uint Reserved19CC;
  856. public uint Clear;
  857. public fixed uint Reserved19D4[11];
  858. public Array8<RtColorMask> RtColorMask;
  859. public fixed uint Reserved1A20[56];
  860. public GpuVa SemaphoreAddress;
  861. public int SemaphorePayload;
  862. public uint SemaphoreControl;
  863. public fixed uint Reserved1B10[60];
  864. public Array16<VertexBufferState> VertexBufferState;
  865. public fixed uint Reserved1D00[64];
  866. public Array8<BlendState> BlendState;
  867. public Array16<GpuVa> VertexBufferEndAddress;
  868. public fixed uint Reserved1F80[32];
  869. public Array6<ShaderState> ShaderState;
  870. public fixed uint Reserved2180[96];
  871. public uint SetFalcon00;
  872. public uint SetFalcon01;
  873. public uint SetFalcon02;
  874. public uint SetFalcon03;
  875. public uint SetFalcon04;
  876. public uint SetFalcon05;
  877. public uint SetFalcon06;
  878. public uint SetFalcon07;
  879. public uint SetFalcon08;
  880. public uint SetFalcon09;
  881. public uint SetFalcon10;
  882. public uint SetFalcon11;
  883. public uint SetFalcon12;
  884. public uint SetFalcon13;
  885. public uint SetFalcon14;
  886. public uint SetFalcon15;
  887. public uint SetFalcon16;
  888. public uint SetFalcon17;
  889. public uint SetFalcon18;
  890. public uint SetFalcon19;
  891. public uint SetFalcon20;
  892. public uint SetFalcon21;
  893. public uint SetFalcon22;
  894. public uint SetFalcon23;
  895. public uint SetFalcon24;
  896. public uint SetFalcon25;
  897. public uint SetFalcon26;
  898. public uint SetFalcon27;
  899. public uint SetFalcon28;
  900. public uint SetFalcon29;
  901. public uint SetFalcon30;
  902. public uint SetFalcon31;
  903. public UniformBufferState UniformBufferState;
  904. public Array16<uint> UniformBufferUpdateData;
  905. public fixed uint Reserved23D0[16];
  906. public uint UniformBufferBindVertex;
  907. public fixed uint Reserved2414[7];
  908. public uint UniformBufferBindTessControl;
  909. public fixed uint Reserved2434[7];
  910. public uint UniformBufferBindTessEvaluation;
  911. public fixed uint Reserved2454[7];
  912. public uint UniformBufferBindGeometry;
  913. public fixed uint Reserved2474[7];
  914. public uint UniformBufferBindFragment;
  915. public fixed uint Reserved2494[93];
  916. public uint TextureBufferIndex;
  917. public fixed uint Reserved260C[125];
  918. public Array4<Array32<uint>> TfVaryingLocations;
  919. public fixed uint Reserved2A00[640];
  920. public MmeShadowScratch SetMmeShadowScratch;
  921. #pragma warning restore CS0649
  922. }
  923. }