1
1
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
2
2
// Ported from d3dcommon.h in microsoft/DirectX-Headers tag v1.614.0
3
3
// Original source is Copyright © Microsoft. Licensed under the MIT license
4
+ using System . Runtime . CompilerServices ;
4
5
using Silk . NET . Win32 ;
5
6
using System ;
6
- using System . Runtime . CompilerServices ;
7
7
using System . Runtime . InteropServices ;
8
8
using static Silk . NET . Win32 . IID ;
9
9
@@ -18,30 +18,6 @@ public unsafe partial struct ID3DBlob : ID3DBlob.Native.Interface, IComInterface
18
18
public Native * lpVtbl ;
19
19
static Guid * INativeGuid . NativeGuid => ( Guid * ) Unsafe . AsPointer ( ref Unsafe . AsRef ( in IID_ID3D10Blob ) ) ;
20
20
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 ( ) ;
45
21
/// <include file='ID3DBlob.xml' path='doc/member[@name="ID3DBlob"]/*'/>
46
22
[ Guid ( "8BA5FB08-5195-40E2-AC58-0D989C3A0102" ) ]
47
23
[ NativeTypeName ( "struct ID3D10Blob : IUnknown" ) ]
@@ -51,12 +27,29 @@ public unsafe partial struct Native : ID3DBlob.Native.Interface, INativeGuid
51
27
static Guid * INativeGuid . NativeGuid => ( Guid * ) Unsafe . AsPointer ( ref Unsafe . AsRef ( in IID_ID3D10Blob ) ) ;
52
28
53
29
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
58
31
{
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 ;
60
53
}
61
54
62
55
/// <inheritdoc cref = "IUnknown.AddRef"/>
@@ -68,20 +61,16 @@ public uint AddRef()
68
61
return ( ( delegate * unmanaged< ID3DBlob . Native * , uint > ) ( lpVtbl [ 1 ] ) ) ( ( ID3DBlob . Native * ) Unsafe . AsPointer ( ref this ) ) ;
69
62
}
70
63
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 ( ) ;
80
69
/// <include file='ID3DBlob.xml' path='doc/member[@name="ID3DBlob.GetBufferPointer"]/*'/>
81
70
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
82
71
[ VtblIndex ( 3 ) ]
83
72
[ return : NativeTypeName ( "LPVOID" ) ]
84
- public void * GetBufferPointer ( )
73
+ public void * GetBufferPointerRaw ( )
85
74
{
86
75
return ( ( delegate * unmanaged< ID3DBlob . Native * , void * > ) ( lpVtbl [ 3 ] ) ) ( ( ID3DBlob . Native * ) Unsafe . AsPointer ( ref this ) ) ;
87
76
}
@@ -95,29 +84,24 @@ public nuint GetBufferSize()
95
84
return ( ( delegate * unmanaged< ID3DBlob . Native * , nuint > ) ( lpVtbl [ 4 ] ) ) ( ( ID3DBlob . Native * ) Unsafe . AsPointer ( ref this ) ) ;
96
85
}
97
86
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 )
99
91
{
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 ) ;
106
93
}
107
94
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 )
110
99
{
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
+ }
121
105
}
122
106
123
107
/// <inheritdoc cref = "IUnknown.QueryInterface"/>
@@ -129,6 +113,15 @@ public HRESULT QueryInterface<TCom>(out TCom ppvObject)
129
113
ppvObject = default ( TCom ) ;
130
114
return QueryInterface ( TCom . NativeGuid , ppvObject . GetAddressOf ( ) ) ;
131
115
}
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
+ }
132
125
}
133
126
134
127
/// <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)
137
130
/// <summary>Initializes a new instance of the <see cref = "ID3DBlob"/> struct with the specified virtual table pointer.</summary>
138
131
/// <param name = "vtbl">The pointer to virtual table.</param>
139
132
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 ) ) ;
145
133
/// <summary>casts <see cref = "ID3DBlob.Native"/> to <see cref = "ID3DBlob"/>.</summary>
146
134
/// <param name = "value">The <see cref = "ID3DBlob.Native"/> instance to be converted </param>
147
135
public static implicit operator ID3DBlob ( ID3DBlob . Native * value ) => new ID3DBlob ( value ) ;
@@ -166,6 +154,63 @@ public HRESULT QueryInterface<TCom>(out TCom ppvObject)
166
154
/// <summary>casts <see cref = "ID3DBlob"/> to nuint</summary>
167
155
/// <param name = "value">The <see cref = "ID3DBlob"/> instance to be converted </param>
168
156
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
+
169
214
/// <inheritdoc cref = "IUnknown.QueryInterface"/>
170
215
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
171
216
[ VtblIndex ( 0 ) ]
@@ -176,11 +221,9 @@ public HRESULT QueryInterface<TCom>(out TCom ppvObject)
176
221
return QueryInterface ( TCom . NativeGuid , ppvObject . GetAddressOf ( ) ) ;
177
222
}
178
223
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 ( ) ;
186
229
}
0 commit comments