11// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
22// Ported from d3dcommon.h in microsoft/DirectX-Headers tag v1.614.0
33// Original source is Copyright © Microsoft. Licensed under the MIT license
4+ using System . Runtime . CompilerServices ;
45using Silk . NET . Win32 ;
56using System ;
6- using System . Runtime . CompilerServices ;
77using System . Runtime . InteropServices ;
88using static Silk . NET . Win32 . IID ;
99
@@ -18,30 +18,6 @@ public unsafe partial struct ID3DBlob : ID3DBlob.Native.Interface, IComInterface
1818 public Native * lpVtbl ;
1919 static Guid * INativeGuid . NativeGuid => ( Guid * ) Unsafe . AsPointer ( ref Unsafe . AsRef ( in IID_ID3D10Blob ) ) ;
2020
21- /// <inheritdoc cref = "IUnknown.QueryInterface"/>
22- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
23- [ VtblIndex ( 0 ) ]
24- public HRESULT QueryInterface ( [ NativeTypeName ( "const IID &" ) ] Guid * riid , void * * ppvObject ) => lpVtbl ->QueryInterface ( riid , ppvObject ) ;
25- /// <inheritdoc cref = "IUnknown.AddRef"/>
26- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
27- [ VtblIndex ( 1 ) ]
28- [ return : NativeTypeName ( "ULONG" ) ]
29- public uint AddRef ( ) => lpVtbl ->AddRef ( ) ;
30- /// <inheritdoc cref = "IUnknown.Release"/>
31- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
32- [ VtblIndex ( 2 ) ]
33- [ return : NativeTypeName ( "ULONG" ) ]
34- public uint Release ( ) => lpVtbl ->Release ( ) ;
35- /// <include file='ID3DBlob.xml' path='doc/member[@name="ID3DBlob.GetBufferPointer"]/*'/>
36- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
37- [ VtblIndex ( 3 ) ]
38- [ return : NativeTypeName ( "LPVOID" ) ]
39- public void * GetBufferPointer ( ) => lpVtbl ->GetBufferPointer ( ) ;
40- /// <include file='ID3DBlob.xml' path='doc/member[@name="ID3DBlob.GetBufferSize"]/*'/>
41- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
42- [ VtblIndex ( 4 ) ]
43- [ return : NativeTypeName ( "SIZE_T" ) ]
44- public nuint GetBufferSize ( ) => lpVtbl ->GetBufferSize ( ) ;
4521 /// <include file='ID3DBlob.xml' path='doc/member[@name="ID3DBlob"]/*'/>
4622 [ Guid ( "8BA5FB08-5195-40E2-AC58-0D989C3A0102" ) ]
4723 [ NativeTypeName ( "struct ID3D10Blob : IUnknown" ) ]
@@ -51,12 +27,29 @@ public unsafe partial struct Native : ID3DBlob.Native.Interface, INativeGuid
5127 static Guid * INativeGuid . NativeGuid => ( Guid * ) Unsafe . AsPointer ( ref Unsafe . AsRef ( in IID_ID3D10Blob ) ) ;
5228
5329 public void * * lpVtbl ;
54- /// <inheritdoc cref = "IUnknown.QueryInterface"/>
55- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
56- [ VtblIndex ( 0 ) ]
57- public HRESULT QueryInterface ( [ NativeTypeName ( "const IID &" ) ] Guid * riid , void * * ppvObject )
30+ public interface Interface : IUnknown . Native . Interface
5831 {
59- return ( ( delegate * unmanaged< ID3DBlob . Native * , Guid * , void * * , int > ) ( lpVtbl [ 0 ] ) ) ( ( ID3DBlob . Native * ) Unsafe . AsPointer ( ref this ) , riid , ppvObject ) ;
32+ [ VtblIndex ( 3 ) ]
33+ [ return : NativeTypeName ( "LPVOID" ) ]
34+ void * GetBufferPointer ( ) ;
35+ [ VtblIndex ( 4 ) ]
36+ [ return : NativeTypeName ( "SIZE_T" ) ]
37+ nuint GetBufferSize ( ) ;
38+ }
39+
40+ public partial struct Vtbl < TSelf >
41+ where TSelf : unmanaged, Interface
42+ {
43+ [ NativeTypeName ( "HRESULT (const IID &, void **) __attribute__((stdcall))" ) ]
44+ public delegate * unmanaged< TSelf * , Guid * , void * * , int > QueryInterface ;
45+ [ NativeTypeName ( "ULONG () __attribute__((stdcall))" ) ]
46+ public delegate * unmanaged< TSelf * , uint > AddRef ;
47+ [ NativeTypeName ( "ULONG () __attribute__((stdcall))" ) ]
48+ public delegate * unmanaged< TSelf * , uint > Release ;
49+ [ NativeTypeName ( "LPVOID () __attribute__((stdcall))" ) ]
50+ public delegate * unmanaged< TSelf * , void * > GetBufferPointer ;
51+ [ NativeTypeName ( "SIZE_T () __attribute__((stdcall))" ) ]
52+ public delegate * unmanaged< TSelf * , nuint > GetBufferSize ;
6053 }
6154
6255 /// <inheritdoc cref = "IUnknown.AddRef"/>
@@ -68,20 +61,16 @@ public uint AddRef()
6861 return ( ( delegate * unmanaged< ID3DBlob . Native * , uint > ) ( lpVtbl [ 1 ] ) ) ( ( ID3DBlob . Native * ) Unsafe . AsPointer ( ref this ) ) ;
6962 }
7063
71- /// <inheritdoc cref = "IUnknown.Release"/>
72- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
73- [ VtblIndex ( 2 ) ]
74- [ return : NativeTypeName ( "ULONG" ) ]
75- public uint Release ( )
76- {
77- return ( ( delegate * unmanaged< ID3DBlob . Native * , uint > ) ( lpVtbl [ 2 ] ) ) ( ( ID3DBlob . Native * ) Unsafe . AsPointer ( ref this ) ) ;
78- }
79-
64+ [ VtblIndex ( 3 ) ]
65+ [ return : NativeTypeName ( "LPVOID" ) ]
66+ [ Transformed ]
67+ [ MethodImpl ( MethodImplOptions . AggressiveInlining | MethodImplOptions . AggressiveOptimization ) ]
68+ public Ptr GetBufferPointer ( ) => ( void * ) GetBufferPointerRaw ( ) ;
8069 /// <include file='ID3DBlob.xml' path='doc/member[@name="ID3DBlob.GetBufferPointer"]/*'/>
8170 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
8271 [ VtblIndex ( 3 ) ]
8372 [ return : NativeTypeName ( "LPVOID" ) ]
84- public void * GetBufferPointer ( )
73+ public void * GetBufferPointerRaw ( )
8574 {
8675 return ( ( delegate * unmanaged< ID3DBlob . Native * , void * > ) ( lpVtbl [ 3 ] ) ) ( ( ID3DBlob . Native * ) Unsafe . AsPointer ( ref this ) ) ;
8776 }
@@ -95,29 +84,24 @@ public nuint GetBufferSize()
9584 return ( ( delegate * unmanaged< ID3DBlob . Native * , nuint > ) ( lpVtbl [ 4 ] ) ) ( ( ID3DBlob . Native * ) Unsafe . AsPointer ( ref this ) ) ;
9685 }
9786
98- public interface Interface : IUnknown . Native . Interface
87+ /// <inheritdoc cref = "IUnknown.QueryInterface"/>
88+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
89+ [ VtblIndex ( 0 ) ]
90+ public HRESULT QueryInterface ( [ NativeTypeName ( "const IID &" ) ] Guid * riid , void * * ppvObject )
9991 {
100- [ VtblIndex ( 3 ) ]
101- [ return : NativeTypeName ( "LPVOID" ) ]
102- void * GetBufferPointer ( ) ;
103- [ VtblIndex ( 4 ) ]
104- [ return : NativeTypeName ( "SIZE_T" ) ]
105- nuint GetBufferSize ( ) ;
92+ return ( ( delegate * unmanaged< ID3DBlob . Native * , Guid * , void * * , int > ) ( lpVtbl [ 0 ] ) ) ( ( ID3DBlob . Native * ) Unsafe . AsPointer ( ref this ) , riid , ppvObject ) ;
10693 }
10794
108- public partial struct Vtbl < TSelf >
109- where TSelf : unmanaged, Interface
95+ [ VtblIndex ( 0 ) ]
96+ [ Transformed ]
97+ [ MethodImpl ( MethodImplOptions . AggressiveInlining | MethodImplOptions . AggressiveOptimization ) ]
98+ public HRESULT QueryInterface ( [ NativeTypeName ( "const IID &" ) ] Ref < Guid > riid , Ref2D ppvObject )
11099 {
111- [ NativeTypeName ( "HRESULT (const IID &, void **) __attribute__((stdcall))" ) ]
112- public delegate * unmanaged< TSelf * , Guid * , void * * , int > QueryInterface ;
113- [ NativeTypeName ( "ULONG () __attribute__((stdcall))" ) ]
114- public delegate * unmanaged< TSelf * , uint > AddRef ;
115- [ NativeTypeName ( "ULONG () __attribute__((stdcall))" ) ]
116- public delegate * unmanaged< TSelf * , uint > Release ;
117- [ NativeTypeName ( "LPVOID () __attribute__((stdcall))" ) ]
118- public delegate * unmanaged< TSelf * , void * > GetBufferPointer ;
119- [ NativeTypeName ( "SIZE_T () __attribute__((stdcall))" ) ]
120- public delegate * unmanaged< TSelf * , nuint > GetBufferSize ;
100+ fixed ( void * * __dsl_ppvObject = ppvObject )
101+ fixed ( Guid * __dsl_riid = riid )
102+ {
103+ return ( HRESULT ) QueryInterface ( __dsl_riid , __dsl_ppvObject ) ;
104+ }
121105 }
122106
123107 /// <inheritdoc cref = "IUnknown.QueryInterface"/>
@@ -129,6 +113,15 @@ public HRESULT QueryInterface<TCom>(out TCom ppvObject)
129113 ppvObject = default ( TCom ) ;
130114 return QueryInterface ( TCom . NativeGuid , ppvObject . GetAddressOf ( ) ) ;
131115 }
116+
117+ /// <inheritdoc cref = "IUnknown.Release"/>
118+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
119+ [ VtblIndex ( 2 ) ]
120+ [ return : NativeTypeName ( "ULONG" ) ]
121+ public uint Release ( )
122+ {
123+ return ( ( delegate * unmanaged< ID3DBlob . Native * , uint > ) ( lpVtbl [ 2 ] ) ) ( ( ID3DBlob . Native * ) Unsafe . AsPointer ( ref this ) ) ;
124+ }
132125 }
133126
134127 /// <summary>Initializes a new instance of the <see cref = "ID3DBlob"/> struct with the specified virtual table pointer.</summary>
@@ -137,11 +130,6 @@ public HRESULT QueryInterface<TCom>(out TCom ppvObject)
137130 /// <summary>Initializes a new instance of the <see cref = "ID3DBlob"/> struct with the specified virtual table pointer.</summary>
138131 /// <param name = "vtbl">The pointer to virtual table.</param>
139132 public ID3DBlob ( ID3DBlob . Native * vtbl ) => lpVtbl = vtbl ;
140- /// <inheritdoc cref = "INativeInterface.GetAddressOf{TNativeInterface}()"></inheritdoc>
141- public readonly TNativeInterface * * GetAddressOf < TNativeInterface > ( )
142- where TNativeInterface : unmanaged => ( TNativeInterface * * ) Unsafe . AsPointer ( ref Unsafe . AsRef ( in this ) ) ;
143- /// <inheritdoc cref = "INativeInterface.GetAddressOf()"></inheritdoc>
144- public readonly void * * GetAddressOf ( ) => ( void * * ) Unsafe . AsPointer ( ref Unsafe . AsRef ( in this ) ) ;
145133 /// <summary>casts <see cref = "ID3DBlob.Native"/> to <see cref = "ID3DBlob"/>.</summary>
146134 /// <param name = "value">The <see cref = "ID3DBlob.Native"/> instance to be converted </param>
147135 public static implicit operator ID3DBlob ( ID3DBlob . Native * value ) => new ID3DBlob ( value ) ;
@@ -166,6 +154,63 @@ public HRESULT QueryInterface<TCom>(out TCom ppvObject)
166154 /// <summary>casts <see cref = "ID3DBlob"/> to nuint</summary>
167155 /// <param name = "value">The <see cref = "ID3DBlob"/> instance to be converted </param>
168156 public static implicit operator nuint ( ID3DBlob value ) => ( nuint ) value . lpVtbl ;
157+ /// <summary>Downcasts <see cref = "Silk.NET.Win32.IUnknown"/> to <see cref = "ID3DBlob"/>.</summary>
158+ /// <param name = "value">The <see cref = "Silk.NET.Win32.IUnknown"/> instance to be converted </param>
159+ public static explicit operator ID3DBlob ( Silk . NET . Win32 . IUnknown value ) => new ID3DBlob ( ( ID3DBlob . Native * ) value . lpVtbl ) ;
160+ /// <summary>Upcasts <see cref = "ID3DBlob"/> to <see cref = "Silk.NET.Win32.IUnknown"/>.</summary>
161+ /// <param name = "value">The <see cref = "ID3DBlob"/> instance to be converted </param>
162+ public static implicit operator Silk . NET . Win32 . IUnknown ( ID3DBlob value ) => new Silk . NET . Win32 . IUnknown ( ( Silk . NET . Win32 . IUnknown . Native * ) value . lpVtbl ) ;
163+ /// <inheritdoc cref = "IUnknown.AddRef"/>
164+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
165+ [ VtblIndex ( 1 ) ]
166+ [ return : NativeTypeName ( "ULONG" ) ]
167+ public uint AddRef ( ) => lpVtbl ->AddRef ( ) ;
168+ public void Dispose ( ) => Release ( ) ;
169+ [ Transformed ]
170+ [ MethodImpl ( MethodImplOptions . AggressiveInlining | MethodImplOptions . AggressiveOptimization ) ]
171+ /// <inheritdoc cref = "INativeInterface.GetAddressOf{TNativeInterface}()"></inheritdoc>
172+ public readonly Ptr2D < TNativeInterface > GetAddressOf < TNativeInterface > ( )
173+ where TNativeInterface : unmanaged => ( TNativeInterface * * ) GetAddressOfRaw ( ) ;
174+ [ Transformed ]
175+ [ MethodImpl ( MethodImplOptions . AggressiveInlining | MethodImplOptions . AggressiveOptimization ) ]
176+ /// <inheritdoc cref = "INativeInterface.GetAddressOf()"></inheritdoc>
177+ public readonly Ptr2D GetAddressOf ( ) => ( void * * ) GetAddressOfRaw ( ) ;
178+ /// <inheritdoc cref = "INativeInterface.GetAddressOf{TNativeInterface}()"></inheritdoc>
179+ public readonly TNativeInterface * * GetAddressOfRaw < TNativeInterface > ( )
180+ where TNativeInterface : unmanaged => ( TNativeInterface * * ) Unsafe . AsPointer ( ref Unsafe . AsRef ( in this ) ) ;
181+ /// <inheritdoc cref = "INativeInterface.GetAddressOf()"></inheritdoc>
182+ public readonly void * * GetAddressOfRaw ( ) => ( void * * ) Unsafe . AsPointer ( ref Unsafe . AsRef ( in this ) ) ;
183+ [ VtblIndex ( 3 ) ]
184+ [ return : NativeTypeName ( "LPVOID" ) ]
185+ [ Transformed ]
186+ [ MethodImpl ( MethodImplOptions . AggressiveInlining | MethodImplOptions . AggressiveOptimization ) ]
187+ public Ptr GetBufferPointer ( ) => ( void * ) GetBufferPointerRaw ( ) ;
188+ /// <include file='ID3DBlob.xml' path='doc/member[@name="ID3DBlob.GetBufferPointer"]/*'/>
189+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
190+ [ VtblIndex ( 3 ) ]
191+ [ return : NativeTypeName ( "LPVOID" ) ]
192+ public void * GetBufferPointerRaw ( ) => lpVtbl ->GetBufferPointer ( ) ;
193+ /// <include file='ID3DBlob.xml' path='doc/member[@name="ID3DBlob.GetBufferSize"]/*'/>
194+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
195+ [ VtblIndex ( 4 ) ]
196+ [ return : NativeTypeName ( "SIZE_T" ) ]
197+ public nuint GetBufferSize ( ) => lpVtbl ->GetBufferSize ( ) ;
198+ /// <inheritdoc cref = "IUnknown.QueryInterface"/>
199+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
200+ [ VtblIndex ( 0 ) ]
201+ public HRESULT QueryInterface ( [ NativeTypeName ( "const IID &" ) ] Guid * riid , void * * ppvObject ) => lpVtbl ->QueryInterface ( riid , ppvObject ) ;
202+ [ VtblIndex ( 0 ) ]
203+ [ Transformed ]
204+ [ MethodImpl ( MethodImplOptions . AggressiveInlining | MethodImplOptions . AggressiveOptimization ) ]
205+ public HRESULT QueryInterface ( [ NativeTypeName ( "const IID &" ) ] Ref < Guid > riid , Ref2D ppvObject )
206+ {
207+ fixed ( void * * __dsl_ppvObject = ppvObject )
208+ fixed ( Guid * __dsl_riid = riid )
209+ {
210+ return ( HRESULT ) QueryInterface ( __dsl_riid , __dsl_ppvObject ) ;
211+ }
212+ }
213+
169214 /// <inheritdoc cref = "IUnknown.QueryInterface"/>
170215 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
171216 [ VtblIndex ( 0 ) ]
@@ -176,11 +221,9 @@ public HRESULT QueryInterface<TCom>(out TCom ppvObject)
176221 return QueryInterface ( TCom . NativeGuid , ppvObject . GetAddressOf ( ) ) ;
177222 }
178223
179- public void Dispose ( ) => Release ( ) ;
180- /// <summary>Downcasts <see cref = "Silk.NET.Win32.IUnknown"/> to <see cref = "ID3DBlob"/>.</summary>
181- /// <param name = "value">The <see cref = "Silk.NET.Win32.IUnknown"/> instance to be converted </param>
182- public static explicit operator ID3DBlob ( Silk . NET . Win32 . IUnknown value ) => new ID3DBlob ( ( ID3DBlob . Native * ) value . lpVtbl ) ;
183- /// <summary>Upcasts <see cref = "ID3DBlob"/> to <see cref = "Silk.NET.Win32.IUnknown"/>.</summary>
184- /// <param name = "value">The <see cref = "ID3DBlob"/> instance to be converted </param>
185- public static implicit operator Silk . NET . Win32 . IUnknown ( ID3DBlob value ) => new Silk . NET . Win32 . IUnknown ( ( Silk . NET . Win32 . IUnknown . Native * ) value . lpVtbl ) ;
224+ /// <inheritdoc cref = "IUnknown.Release"/>
225+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
226+ [ VtblIndex ( 2 ) ]
227+ [ return : NativeTypeName ( "ULONG" ) ]
228+ public uint Release ( ) => lpVtbl ->Release ( ) ;
186229}
0 commit comments