Skip to content
This repository was archived by the owner on Mar 30, 2019. It is now read-only.

Commit f889cba

Browse files
committed
Merge pull request #713 from curin/master
[Direct3D11/Direct3D12] Adding Direct3D11On12 Support in Direct3D11
2 parents d5a8cdf + db8ff96 commit f889cba

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

Source/SharpDX.Direct3D11/Device.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,5 +666,14 @@ private void CreateDevice(Adapter adapter, DriverType driverType, DeviceCreation
666666
ImmediateContext__.Device__ = this;
667667
}
668668
}
669+
670+
public static Device CreateFromDirect3D12(ComObject d3d12Device, Direct3D11.DeviceCreationFlags flags, Direct3D.FeatureLevel[] featureLevels, DXGI.Adapter adapter, params ComObject[] commandQueues)
671+
{
672+
Device devOut;
673+
DeviceContext contextOut;
674+
Direct3D.FeatureLevel featurelevelOut;
675+
D3D11.On12CreateDevice(d3d12Device, flags, featureLevels, featureLevels == null ? 0 : featureLevels.Length, commandQueues, commandQueues.Length, 0, out devOut, out contextOut, out featurelevelOut);
676+
return devOut;
677+
}
669678
}
670679
}

Source/SharpDX.Direct3D11/Mapping.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@
4242
<include file="d3d11_2.h" attach="true" />
4343
<include file="d3d11_3.h" attach="true" />
4444
<include file="d3d11sdklayers.h" attach="true" />
45+
<include file="d3d11on12.h" attach="true" />
4546

4647
<naming />
4748

4849
<context-set id="d3d11-all">
4950
<context>sharpdx-direct3d11</context>
5051
<context>sharpdx-direct3d11-ext</context>
5152
<context>d3d11</context>
53+
<context>d3d11on12</context>
5254
<context>d3d11sdklayers</context>
5355
<context>d3d11_1</context>
5456
<context>d3d11_2</context>
@@ -280,6 +282,10 @@
280282

281283
<map param="ID3D11DeviceContext2::.*Tile.*::Flags" type="D3D11_TILE_MAPPING_FLAG" />
282284
<map param="ID3D11DeviceContext2::UpdateTileMappings::pRangeFlags" type="D3D11_TILE_RANGE_FLAG" />
285+
286+
<map param="ID3D11On12Device::CreateWrappedResource::InState" type="int" />
287+
<map param="ID3D11On12Device::CreateWrappedResource::OutState" type="int" />
288+
<map param="ID3D11On12Device::CreateWrappedResource::ppResource11" type="ID3D11Resource" />
283289

284290
<!--
285291
// *****************************************************************
@@ -292,6 +298,9 @@
292298
<map function="D3D11.*" dll='"d3d11.dll"' group="SharpDX.Direct3D11.D3D11" />
293299
<map param="D3D11CreateDevice::ppDevice" attribute="out fast" />
294300
<map function="D3D11CreateDevice" check="false"/>
301+
<map function="D3D11On12CreateDevice" dll='"d3d11.dll"' group="SharpDX.Direct3D11.D3D11"/>
302+
<map param="D3D11On12CreateDevice::Flags" type ="D3D11_CREATE_DEVICE_FLAG"/>
303+
<map param="D3D11On12CreateDevice::ppDevice" type="ID3D11Device" attribute="out" />
295304

296305
<remove function="ID3D11DeviceContext1_.*"/>
297306

Source/SharpDX.Direct3D12/Mapping.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@
316316
<remove function=".*_Proxy"/>
317317
<map function="D3D12(.+)" name-tmp="$1" />
318318
<map function="D3D12.*" dll='"d3d12.dll"' group="SharpDX.Direct3D12.D3D12" />
319-
<map function="D3D11CreateDeviceForD3D12" dll='"d3d12.dll"' group="SharpDX.Direct3D12.D3D12" />
320319
<map param="D3D12CreateDevice::ppDevice" type="ID3D12Device" attribute="out fast" />
321320
<map function="D3D12CreateDevice" check="false"/>
322321
<map param="D3D12CreateDevice.*?::Flags" type="D3D12_CREATE_DEVICE_FLAG" />
@@ -328,9 +327,6 @@
328327
<map param="D3D12CreateDeviceAndSwapChain::ppDevice" type="ID3D12Device"/>
329328

330329

331-
<!-- Temporary remove d3d11 types -->
332-
<remove function="D3D11CreateDeviceForD3D12"/>
333-
334330
<!--
335331
// *****************************************************************
336332
// D3D12 Constants

0 commit comments

Comments
 (0)