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