Skip to content

Commit 0963d97

Browse files
committed
[ENH] DXGI: dxgidebug.h under Vortice.DXGI.Debug namespace.
[ENH] Direct3D12: Improve Debug MessageID enum values names.
1 parent 94ecf82 commit 0963d97

19 files changed

+526
-74
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Current Stable Release: 1.9.80 (May 2021)
66
Release: 1.9.XX (June 2021)
77
-----------------------------------------------
88
- [ENH] Direct3D11: Rename Usage to ResourceUsage and improve CreateBuffer, improve Create shaders with Blob directly.
9+
- [ENH] DXGI: dxgidebug.h under Vortice.DXGI.Debug namespace.
10+
- [ENH] Direct3D12: Improve Debug MessageID enum values names.
911

1012
-----------------------------------------------
1113
Release: 1.9.80 (May 2021)

src/Vortice.DXGI/IDXGIInfoQueue.cs src/Vortice.DXGI/Debug/IDXGIInfoQueue.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System;
55
using SharpGen.Runtime;
66

7-
namespace Vortice.DXGI
7+
namespace Vortice.DXGI.Debug
88
{
99
public partial class IDXGIInfoQueue
1010
{

src/Vortice.DXGI/InfoQueueFilter.cs src/Vortice.DXGI/Debug/InfoQueueFilter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using System.Runtime.InteropServices;
55

6-
namespace Vortice.DXGI
6+
namespace Vortice.DXGI.Debug
77
{
88
public partial class InfoQueueFilter
99
{

src/Vortice.DXGI/InfoQueueFilterDescription.cs src/Vortice.DXGI/Debug/InfoQueueFilterDescription.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Runtime.InteropServices;
66
using SharpGen.Runtime;
77

8-
namespace Vortice.DXGI
8+
namespace Vortice.DXGI.Debug
99
{
1010
public partial class InfoQueueFilterDescription
1111
{
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) Amer Koleci and contributors.
2+
// Distributed under the MIT license. See the LICENSE file in the project root for more information.
3+
4+
using System.Drawing;
5+
using SharpGen.Runtime;
6+
7+
namespace Vortice.DXGI
8+
{
9+
public partial class IDXGIDecodeSwapChain
10+
{
11+
public Size DestSize
12+
{
13+
get
14+
{
15+
GetDestSize(out int width, out int height);
16+
return new Size(width, height);
17+
}
18+
set
19+
{
20+
SetDestSize(value.Width, value.Height);
21+
}
22+
}
23+
24+
public Result PresentBuffer(int bufferToPresent, int syncInterval)
25+
{
26+
return PresentBuffer(bufferToPresent, syncInterval, PresentFlags.None);
27+
}
28+
}
29+
}

src/Vortice.DXGI/IDXGISurface2.cs

+13-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,23 @@ namespace Vortice.DXGI
88
{
99
public partial class IDXGISurface2
1010
{
11-
public T? GetResource<T>(out int subresourceIndex) where T : ComObject
11+
public T GetResource<T>(out int subresourceIndex) where T : ComObject
1212
{
13-
if (GetResource(typeof(T).GUID, out IntPtr nativePtr, out subresourceIndex).Failure)
13+
GetResource(typeof(T).GUID, out IntPtr nativePtr, out subresourceIndex).CheckError();
14+
return MarshallingHelpers.FromPointer<T>(nativePtr);
15+
}
16+
17+
public Result GetResource<T>(out int subresourceIndex, out T? parentResource) where T : ComObject
18+
{
19+
Result result = GetResource(typeof(T).GUID, out IntPtr nativePtr, out subresourceIndex);
20+
if (result.Failure)
1421
{
15-
return default;
22+
parentResource = default;
23+
return result;
1624
}
1725

18-
return MarshallingHelpers.FromPointer<T>(nativePtr);
26+
parentResource = MarshallingHelpers.FromPointer<T>(nativePtr);
27+
return result;
1928
}
2029
}
2130
}

src/Vortice.DXGI/Mappings.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<sdk name="StdLib" />
99
<include-dir override="true">$(THIS_CONFIG_PATH)/../native/include/directx</include-dir>
1010

11-
<include file="dxgidebug.h" namespace="Vortice.DXGI" attach="true"/>
11+
<include file="dxgidebug.h" namespace="Vortice.DXGI.Debug" attach="true" output="Debug" />
1212

1313
<include file="dxgi.h" namespace="Vortice.DXGI" attach="true"/>
1414
<include file="dxgi1_2.h" namespace="Vortice.DXGI" attach="true"/>
@@ -112,6 +112,7 @@
112112
<map field="DXGI_SWAP_CHAIN_DESC::Windowed" name="IsWindowed" />
113113
<map field="DXGI_SWAP_CHAIN_DESC[12]?::BufferUsage" name="Usage" type="DXGI_USAGE_ENUM"/>
114114
<map field="DXGI_SWAP_CHAIN_DESC[12]?::Flags" type="DXGI_SWAP_CHAIN_FLAG" />
115+
<map field="DXGI_DECODE_SWAP_CHAIN_DESC::Flags" type="DXGI_SWAP_CHAIN_FLAG" />
115116

116117
<map struct="DXGI_PRESENT_PARAMETERS" native="true" marshal="true" marshalto="true"/>
117118
<remove field="DXGI_PRESENT_PARAMETERS::.*"/>
@@ -213,6 +214,7 @@
213214
<map param="IDXGIAdapter3::RegisterVideoMemoryBudgetChangeNotificationEvent::pdwCookie" return="true"/>
214215

215216
<!-- IDXGIDecodeSwapChain -->
217+
<map method="IDXGIDecodeSwapChain::PresentBuffer" hresult="true" check="false"/>
216218
<map param="IDXGIDecodeSwapChain::PresentBuffer::Flags" type="DXGI_PRESENT_FLAGS" />
217219

218220
<!-- IDXGIDevice -->

src/Vortice.DXGI/Vortice.DXGI.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
<ItemGroup>
1414
<ProjectReference Include="..\Vortice.DirectX\Vortice.DirectX.csproj" />
1515
</ItemGroup>
16+
<ItemGroup>
17+
<Folder Include="Debug\" />
18+
</ItemGroup>
1619

1720
</Project>

src/Vortice.Direct3D12/ID3D12Device4.cs

+107-11
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace Vortice.Direct3D12
88
{
99
public partial class ID3D12Device4
1010
{
11+
#region CreateCommandList1
1112
public T CreateCommandList1<T>(CommandListType type, CommandListFlags commandListFlags = CommandListFlags.None) where T : ID3D12GraphicsCommandList1
1213
{
1314
CreateCommandList1(0, type, commandListFlags, typeof(T).GUID, out IntPtr nativePtr).CheckError();
@@ -37,14 +38,58 @@ public Result CreateCommandList1<T>(int nodeMask, CommandListType type, CommandL
3738
commandList = MarshallingHelpers.FromPointer<T>(nativePtr);
3839
return result;
3940
}
41+
#endregion
4042

41-
public T? CreateCommittedResource1<T>(
43+
#region CreateCommittedResource1
44+
public T CreateCommittedResource1<T>(
4245
HeapProperties heapProperties,
4346
HeapFlags heapFlags,
4447
ResourceDescription description,
4548
ResourceStates initialResourceState,
4649
ID3D12ProtectedResourceSession protectedSession,
4750
ClearValue? optimizedClearValue = null) where T : ID3D12Resource1
51+
{
52+
CreateCommittedResource1(ref heapProperties, heapFlags,
53+
ref description,
54+
initialResourceState,
55+
optimizedClearValue,
56+
protectedSession,
57+
typeof(T).GUID, out IntPtr nativePtr).CheckError();
58+
return MarshallingHelpers.FromPointer<T>(nativePtr);
59+
}
60+
61+
public Result CreateCommittedResource1<T>(
62+
HeapProperties heapProperties,
63+
HeapFlags heapFlags,
64+
ResourceDescription description,
65+
ResourceStates initialResourceState,
66+
ID3D12ProtectedResourceSession protectedSession,
67+
out T? resource) where T : ID3D12Resource1
68+
{
69+
Result result = CreateCommittedResource1(ref heapProperties, heapFlags,
70+
ref description,
71+
initialResourceState,
72+
null,
73+
protectedSession,
74+
typeof(T).GUID, out IntPtr nativePtr);
75+
if (result.Failure)
76+
{
77+
resource = default;
78+
return result;
79+
}
80+
81+
resource = MarshallingHelpers.FromPointer<T>(nativePtr);
82+
return result;
83+
}
84+
85+
public Result CreateCommittedResource1<T>(
86+
HeapProperties heapProperties,
87+
HeapFlags heapFlags,
88+
ResourceDescription description,
89+
ResourceStates initialResourceState,
90+
ID3D12ProtectedResourceSession protectedSession,
91+
ClearValue optimizedClearValue,
92+
out T? resource) where T : ID3D12Resource1
4893
{
4994
Result result = CreateCommittedResource1(ref heapProperties, heapFlags,
5095
ref description,
@@ -53,45 +98,96 @@ public Result CreateCommandList1<T>(int nodeMask, CommandListType type, CommandL
5398
protectedSession,
5499
typeof(T).GUID, out IntPtr nativePtr);
55100
if (result.Failure)
56-
return default;
101+
{
102+
resource = default;
103+
return result;
104+
}
105+
106+
resource = MarshallingHelpers.FromPointer<T>(nativePtr);
107+
return result;
108+
}
109+
#endregion
57110

111+
#region CreateHeap1
112+
public T CreateHeap1<T>(HeapDescription description, ID3D12ProtectedResourceSession protectedSession) where T : ID3D12Heap1
113+
{
114+
CreateHeap1(ref description, protectedSession, typeof(T).GUID, out IntPtr nativePtr).CheckError();
58115
return MarshallingHelpers.FromPointer<T>(nativePtr);
59116
}
60117

61-
public T? CreateHeap1<T>(HeapDescription description, ID3D12ProtectedResourceSession protectedSession) where T : ID3D12Heap1
118+
public Result CreateHeap1<T>(HeapDescription description, ID3D12ProtectedResourceSession protectedSession, out T? heap) where T : ID3D12Heap1
62119
{
63120
Result result = CreateHeap1(ref description, protectedSession, typeof(T).GUID, out IntPtr nativePtr);
64121
if (result.Failure)
65-
return default;
122+
{
123+
heap = default;
124+
return result;
125+
}
126+
127+
heap = MarshallingHelpers.FromPointer<T>(nativePtr);
128+
return result;
129+
}
130+
#endregion
66131

132+
#region CreateProtectedResourceSession
133+
public T CreateProtectedResourceSession<T>(ProtectedResourceSessionDescription description) where T : ID3D12ProtectedResourceSession
134+
{
135+
CreateProtectedResourceSession(description, typeof(T).GUID, out IntPtr nativePtr).CheckError();
67136
return MarshallingHelpers.FromPointer<T>(nativePtr);
68137
}
69138

70-
public T? CreateProtectedResourceSession<T>(ProtectedResourceSessionDescription description) where T : ID3D12ProtectedResourceSession
139+
public Result CreateProtectedResourceSession<T>(ProtectedResourceSessionDescription description, out T? resource) where T : ID3D12ProtectedResourceSession
71140
{
72141
Result result = CreateProtectedResourceSession(description, typeof(T).GUID, out IntPtr nativePtr);
73142
if (result.Failure)
74-
return default;
143+
{
144+
resource = default;
145+
return result;
146+
}
75147

148+
resource = MarshallingHelpers.FromPointer<T>(nativePtr);
149+
return result;
150+
}
151+
#endregion
152+
153+
#region CreateReservedResource1
154+
public T CreateReservedResource1<T>(ResourceDescription description, ResourceStates initialState, ClearValue clearValue, ID3D12ProtectedResourceSession protectedResourceSession) where T : ID3D12Resource1
155+
{
156+
CreateReservedResource1(ref description, initialState, clearValue, protectedResourceSession, typeof(T).GUID, out IntPtr nativePtr).CheckError();
76157
return MarshallingHelpers.FromPointer<T>(nativePtr);
77158
}
78159

79-
public T? CreateReservedResource1<T>(ResourceDescription description, ResourceStates initialState, ClearValue clearValue, ID3D12ProtectedResourceSession protectedResourceSession) where T : ID3D12Resource1
160+
public Result CreateReservedResource1<T>(ResourceDescription description, ResourceStates initialState, ClearValue clearValue, ID3D12ProtectedResourceSession protectedResourceSession, out T? resource) where T : ID3D12Resource1
80161
{
81162
Result result = CreateReservedResource1(ref description, initialState, clearValue, protectedResourceSession, typeof(T).GUID, out IntPtr nativePtr);
82163
if (result.Failure)
83-
return default;
164+
{
165+
resource = default;
166+
return result;
167+
}
168+
169+
resource = MarshallingHelpers.FromPointer<T>(nativePtr);
170+
return result;
171+
}
84172

173+
public T CreateReservedResource1<T>(ResourceDescription description, ResourceStates initialState, ID3D12ProtectedResourceSession protectedResourceSession) where T : ID3D12Resource1
174+
{
175+
CreateReservedResource1(ref description, initialState, null, protectedResourceSession, typeof(T).GUID, out IntPtr nativePtr).CheckError();
85176
return MarshallingHelpers.FromPointer<T>(nativePtr);
86177
}
87178

88-
public T? CreateReservedResource1<T>(ResourceDescription description, ResourceStates initialState, ID3D12ProtectedResourceSession protectedResourceSession) where T : ID3D12Resource1
179+
public Result CreateReservedResource1<T>(ResourceDescription description, ResourceStates initialState, ID3D12ProtectedResourceSession protectedResourceSession, out T? resource) where T : ID3D12Resource1
89180
{
90181
Result result = CreateReservedResource1(ref description, initialState, null, protectedResourceSession, typeof(T).GUID, out IntPtr nativePtr);
91182
if (result.Failure)
92-
return default;
183+
{
184+
resource = default;
185+
return result;
186+
}
93187

94-
return MarshallingHelpers.FromPointer<T>(nativePtr);
188+
resource = MarshallingHelpers.FromPointer<T>(nativePtr);
189+
return result;
95190
}
191+
#endregion
96192
}
97193
}

0 commit comments

Comments
 (0)