1+ using FFXIVClientStructs . FFXIV . Common . Math ;
2+
13namespace FFXIVClientStructs . FFXIV . Client . Graphics . Kernel ;
24
35// Client::Graphics::Kernel::Device
@@ -10,7 +12,7 @@ public unsafe partial struct Device {
1012 [ StaticAddress ( "48 8B 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 80 7B 08 00" , 3 , isPointer : true ) ]
1113 public static partial Device * Instance ( ) ;
1214
13- [ FieldOffset ( 0x8 ) ] public void * ContextArray ; // Client::Graphics::Kernel::Context array
15+ [ FieldOffset ( 0x8 ) ] public void * ContextArray ; // TODO: We have a struct for this now (breaking change)
1416 [ FieldOffset ( 0x10 ) ] public void * RenderThread ; // Client::Graphics::Kernel::RenderThread
1517 [ FieldOffset ( 0x28 ) ] private CallbackManager * Unk28 ;
1618 [ FieldOffset ( 0x30 ) ] private CallbackManager * Unk30 ;
@@ -71,7 +73,7 @@ public unsafe partial struct Device {
7173 // Client::Graphics::Kernel::Device::CallbackManager
7274 [ GenerateInterop ]
7375 [ StructLayout ( LayoutKind . Explicit , Size = 0x40 ) ]
74- public unsafe partial struct CallbackManager {
76+ public partial struct CallbackManager {
7577 [ FieldOffset ( 0x8 ) ] public void * Lock ; // CRITICAL_SECTION
7678
7779 [ FieldOffset ( 0x30 ) ] public Entry * Entries ;
@@ -89,7 +91,7 @@ public unsafe partial struct CallbackManager {
8991
9092 // Unsure about the names of things inside CallbackManager though
9193 [ StructLayout ( LayoutKind . Explicit , Size = 0x10 ) ]
92- public unsafe partial struct Entry {
94+ public struct Entry {
9395 [ FieldOffset ( 0x0 ) ] public void * Function ;
9496 [ FieldOffset ( 0x8 ) ] public void * Context ;
9597 }
@@ -103,44 +105,68 @@ public unsafe struct RenderCommandBufferGroup {
103105 [ FieldOffset ( 0x8 ) , CExporterUnion ( "RenderCommand" ) ] public RenderCommandSetTarget * SetTargetCommand ;
104106 [ FieldOffset ( 0x8 ) , CExporterUnion ( "RenderCommand" ) ] public RenderCommandViewport * ViewportCommand ;
105107 [ FieldOffset ( 0x8 ) , CExporterUnion ( "RenderCommand" ) ] public RenderCommandScissorsRect * ScissorsRectCommand ;
106- [ FieldOffset ( 0x8 ) , CExporterUnion ( "RenderCommand" ) ] public RenderCommandClearDepth * ClearDepthCommand ;
108+ [ FieldOffset ( 0x8 ) , CExporterUnion ( "RenderCommand" ) , Obsolete ( "Use ClearCommand." ) ] public RenderCommandClearDepth * ClearDepthCommand ;
109+ [ FieldOffset ( 0x8 ) , CExporterUnion ( "RenderCommand" ) ] public RenderCommandClear * ClearCommand ;
110+ }
111+
112+ public enum RenderCommandType : int {
113+ SetTarget = 0 ,
114+ Viewport = 1 ,
115+ MultiViewport = 2 ,
116+ ScissorRect = 3 ,
117+ Clear = 4 ,
107118}
108119
109120[ GenerateInterop ]
110121[ StructLayout ( LayoutKind . Explicit , Size = 0x40 ) ]
111122public unsafe partial struct RenderCommandSetTarget {
112- [ FieldOffset ( 0x0 ) ] public int SwitchType ;
123+ [ FieldOffset ( 0x0 ) ] public RenderCommandType Type ;
113124 [ FieldOffset ( 0x4 ) ] public int RenderTargetCount ;
114- [ FieldOffset ( 0x8 ) , FixedSizeArray ] internal FixedSizeArray4 < Pointer < Texture > > _renderTargets ;
115- [ FieldOffset ( 0x28 ) ] public Texture * DepthBuffer ;
125+ [ FieldOffset ( 0x8 ) , FixedSizeArray ] internal FixedSizeArray5 < Pointer < Texture > > _renderTargets ;
126+ [ FieldOffset ( 0x30 ) ] public Texture * DepthBuffer ;
116127 [ FieldOffset ( 0x38 ) ] private float Unk0 ;
117128 [ FieldOffset ( 0x3C ) ] private float Unk1 ;
129+
130+ [ FieldOffset ( 0x0 ) , Obsolete ( "Use Type instead." ) ] public int SwitchType ;
118131}
119132
120- [ GenerateInterop ]
121133[ StructLayout ( LayoutKind . Explicit , Size = 0x20 ) ]
122- public unsafe partial struct RenderCommandViewport {
123- [ FieldOffset ( 0x0 ) ] public int SwitchType ;
124- [ FieldOffset ( 0x04 ) ] public int TopLeftY ;
125- [ FieldOffset ( 0x08 ) ] public int TopLeftX ;
126- [ FieldOffset ( 0x0C ) ] public int BottomRightY ;
127- [ FieldOffset ( 0x10 ) ] public int BottomRightX ;
134+ public struct RenderCommandViewport {
135+ [ FieldOffset ( 0x0 ) ] public RenderCommandType Type ;
136+ [ FieldOffset ( 0x4 ) ] public IntRectangle ViewportRect ;
128137 [ FieldOffset ( 0x14 ) ] public float MinDepth ;
129138 [ FieldOffset ( 0x18 ) ] public float MaxDepth ;
139+
140+ [ FieldOffset ( 0x0 ) , Obsolete ( "Use Type instead." ) ] public int SwitchType ;
141+ [ FieldOffset ( 0x04 ) , Obsolete ( "Use ViewportRect.Left." ) ] public int TopLeftY ;
142+ [ FieldOffset ( 0x08 ) , Obsolete ( "Use ViewportRect.Top." ) ] public int TopLeftX ;
143+ [ FieldOffset ( 0x0C ) , Obsolete ( "Use ViewportRect.Right." ) ] public int BottomRightY ;
144+ [ FieldOffset ( 0x10 ) , Obsolete ( "Use ViewportRect.Bottom." ) ] public int BottomRightX ;
130145}
131146
132147[ GenerateInterop ]
133- [ StructLayout ( LayoutKind . Explicit , Size = 0x20 ) ]
134- public unsafe partial struct RenderCommandScissorsRect {
148+ [ StructLayout ( LayoutKind . Explicit , Size = 0x80 ) ]
149+ public partial struct RenderCommandMultiViewport {
135150 [ FieldOffset ( 0x0 ) ] public int SwitchType ;
136- [ FieldOffset ( 0x4 ) ] public int Left ;
137- [ FieldOffset ( 0x8 ) ] public int Top ;
138- [ FieldOffset ( 0xC ) ] public int Right ;
139- [ FieldOffset ( 0x10 ) ] public int Bottom ;
151+ [ FieldOffset ( 0x4 ) , FixedSizeArray ] internal FixedSizeArray5 < IntRectangle > _viewportRects ;
152+ [ FieldOffset ( 0x54 ) , FixedSizeArray ] internal FixedSizeArray5 < float > _minDepths ;
153+ [ FieldOffset ( 0x68 ) , FixedSizeArray ] internal FixedSizeArray5 < float > _maxDepths ;
154+ [ FieldOffset ( 0x7C ) ] public uint ViewportCount ;
140155}
141156
142- [ GenerateInterop ]
143- [ StructLayout ( LayoutKind . Explicit , Size = 0x40 ) ]
157+ [ StructLayout ( LayoutKind . Explicit , Size = 0x20 ) ]
158+ public struct RenderCommandScissorsRect {
159+ [ FieldOffset ( 0x0 ) ] public RenderCommandType Type ;
160+ [ FieldOffset ( 0x4 ) ] public IntRectangle ScissorRect ;
161+
162+ [ FieldOffset ( 0x0 ) , Obsolete ( "Use Type instead." ) ] public int SwitchType ;
163+ [ FieldOffset ( 0x4 ) , Obsolete ( "Use ScissorRect.Left." ) ] public int Left ;
164+ [ FieldOffset ( 0x8 ) , Obsolete ( "Use ScissorRect.Top." ) ] public int Top ;
165+ [ FieldOffset ( 0xC ) , Obsolete ( "Use ScissorRect.Right." ) ] public int Right ;
166+ [ FieldOffset ( 0x10 ) , Obsolete ( "Use ScissorRect.Bottom." ) ] public int Bottom ;
167+ }
168+
169+ [ StructLayout ( LayoutKind . Explicit , Size = 0x40 ) , Obsolete ( "Use RenderCommandClear." ) ]
144170public unsafe partial struct RenderCommandClearDepth {
145171 [ FieldOffset ( 0x0 ) ] public int SwitchType ;
146172 [ FieldOffset ( 0x4 ) ] public float ClearType ;
@@ -158,3 +184,25 @@ public unsafe partial struct RenderCommandClearDepth {
158184 [ FieldOffset ( 0x34 ) ] public float MinZ ;
159185 [ FieldOffset ( 0x38 ) ] public float MaxZ ;
160186}
187+
188+ public enum ClearFlags : uint {
189+ None = 0 ,
190+ Color = 1 << 0 ,
191+ Depth = 1 << 1 ,
192+ Stencil = 1 << 2 ,
193+ }
194+
195+ [ StructLayout ( LayoutKind . Explicit , Size = 0x38 ) ]
196+ public unsafe struct RenderCommandClear {
197+ [ FieldOffset ( 0x0 ) ] public RenderCommandType Type ;
198+ [ FieldOffset ( 0x4 ) ] public ClearFlags ClearFlags ;
199+ [ FieldOffset ( 0x8 ) ] public float ColorR ;
200+ [ FieldOffset ( 0xC ) ] public float ColorG ;
201+ [ FieldOffset ( 0x10 ) ] public float ColorB ;
202+ [ FieldOffset ( 0x14 ) ] public float ColorA ;
203+ [ FieldOffset ( 0x18 ) ] public float ClearDepth ;
204+ [ FieldOffset ( 0x1C ) ] public byte ClearStencil ;
205+ [ FieldOffset ( 0x1D ) ] public byte StencilReference ;
206+ [ FieldOffset ( 0x20 ) ] public IntRectangle * ClearRectanglePtr ; // optional, generally points at ClearRectangle if set
207+ [ FieldOffset ( 0x28 ) ] public IntRectangle ClearRectangle ;
208+ }
0 commit comments