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

Commit 4a066d7

Browse files
author
AndrewSt
committed
[Direct3D11] Improve support Direct3D 11.3
1 parent 7f61b6b commit 4a066d7

File tree

8 files changed

+385
-0
lines changed

8 files changed

+385
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and associated documentation files (the "Software"), to deal
5+
// in the Software without restriction, including without limitation the rights
6+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
// copies of the Software, and to permit persons to whom the Software is
8+
// furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in
11+
// all copies or substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
// THE SOFTWARE.
20+
using System;
21+
22+
namespace SharpDX.Direct3D11
23+
{
24+
public partial class DeviceContext3
25+
{
26+
/// <summary>
27+
/// Initializes a new deferred context instance of <see cref="SharpDX.Direct3D11.DeviceContext3"/> class.
28+
/// </summary>
29+
/// <param name="device"></param>
30+
public DeviceContext3(Device3 device)
31+
: base(IntPtr.Zero)
32+
{
33+
device.CreateDeferredContext3(0, this);
34+
}
35+
}
36+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and associated documentation files (the "Software"), to deal
5+
// in the Software without restriction, including without limitation the rights
6+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
// copies of the Software, and to permit persons to whom the Software is
8+
// furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in
11+
// all copies or substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
// THE SOFTWARE.
20+
using System;
21+
22+
namespace SharpDX.Direct3D11
23+
{
24+
public partial class Query1
25+
{
26+
/// <summary>
27+
/// Constructs a new <see cref = "T:SharpDX.Direct3D11.Query1" /> based on the specified description.
28+
/// </summary>
29+
/// <param name = "device">The device with which to associate the state object.</param>
30+
/// <param name = "description">The query description.</param>
31+
/// <returns>The newly created object.</returns>
32+
public Query1(Device3 device, QueryDescription1 description)
33+
: base(IntPtr.Zero)
34+
{
35+
device.CreateQuery1(description, this);
36+
}
37+
}
38+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and associated documentation files (the "Software"), to deal
5+
// in the Software without restriction, including without limitation the rights
6+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
// copies of the Software, and to permit persons to whom the Software is
8+
// furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in
11+
// all copies or substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
// THE SOFTWARE.
20+
using System;
21+
22+
namespace SharpDX.Direct3D11
23+
{
24+
public partial class RenderTargetView1
25+
{
26+
/// <summary>
27+
/// Creates a <see cref = "T:SharpDX.Direct3D11.RenderTargetView1" /> for accessing resource data.
28+
/// </summary>
29+
/// <param name = "device">The device to use when creating this <see cref = "T:SharpDX.Direct3D11.RenderTargetView1" />.</param>
30+
/// <param name = "resource">The resource that represents the render-target surface. This surface must have been created with the <see cref = "T:SharpDX.Direct3D11.BindFlags">RenderTarget</see> flag.</param>
31+
/// <unmanaged>ID3D11Device3::CreateRenderTargetView1</unmanaged>
32+
public RenderTargetView1(Device3 device, Resource resource)
33+
: base(IntPtr.Zero)
34+
{
35+
device.CreateRenderTargetView1(resource, null, this);
36+
}
37+
38+
/// <summary>
39+
/// Creates a <see cref = "T:SharpDX.Direct3D11.RenderTargetView" /> for accessing resource data.
40+
/// </summary>
41+
/// <param name = "device">The device to use when creating this <see cref = "T:SharpDX.Direct3D11.RenderTargetView1" />.</param>
42+
/// <param name = "resource">The resource that represents the render-target surface. This surface must have been created with the <see cref = "T:SharpDX.Direct3D11.BindFlags">RenderTarget</see> flag.</param>
43+
/// <param name = "description">A structure describing the <see cref = "T:SharpDX.Direct3D11.RenderTargetView1" /> to be created.</param>
44+
/// <unmanaged>ID3D11Device3::CreateRenderTargetView1</unmanaged>
45+
public RenderTargetView1(Device3 device, Resource resource, RenderTargetViewDescription1 description)
46+
: base(IntPtr.Zero)
47+
{
48+
device.CreateRenderTargetView1(resource, description, this);
49+
}
50+
}
51+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and associated documentation files (the "Software"), to deal
5+
// in the Software without restriction, including without limitation the rights
6+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
// copies of the Software, and to permit persons to whom the Software is
8+
// furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in
11+
// all copies or substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
// THE SOFTWARE.
20+
using System;
21+
using System.IO;
22+
23+
namespace SharpDX.Direct3D11
24+
{
25+
public partial class ShaderResourceView1
26+
{
27+
/// <summary>
28+
/// Creates a <see cref = "T:SharpDX.Direct3D11.ShaderResourceView1" /> for accessing resource data.
29+
/// </summary>
30+
/// <param name = "device">The device to use when creating this <see cref = "T:SharpDX.Direct3D11.ShaderResourceView1" />.</param>
31+
/// <param name = "resource">The resource that represents the render-target surface. This surface must have been created with the <see cref = "T:SharpDX.Direct3D11.BindFlags">ShaderResource</see> flag.</param>
32+
/// <msdn-id>ff476519</msdn-id>
33+
/// <unmanaged>HRESULT ID3D11Device3::CreateShaderResourceView1([In] ID3D11Resource* pResource,[In, Optional] const D3D11_SHADER_RESOURCE_VIEW_DESC1* pDesc,[Out, Fast] ID3D11ShaderResourceView1** ppSRView)</unmanaged>
34+
/// <unmanaged-short>ID3D11Device3::CreateShaderResourceView1</unmanaged-short>
35+
public ShaderResourceView1(Device3 device, Resource resource)
36+
: base(IntPtr.Zero)
37+
{
38+
device.CreateShaderResourceView1(resource, null, this);
39+
}
40+
41+
/// <summary>
42+
/// Creates a <see cref = "T:SharpDX.Direct3D11.ShaderResourceView" /> for accessing resource data.
43+
/// </summary>
44+
/// <param name = "device">The device to use when creating this <see cref = "T:SharpDX.Direct3D11.ShaderResourceView" />.</param>
45+
/// <param name = "resource">The resource that represents the render-target surface. This surface must have been created with the <see cref = "T:SharpDX.Direct3D11.BindFlags">ShaderResource</see> flag.</param>
46+
/// <param name = "description">A structure describing the <see cref = "T:SharpDX.Direct3D11.ShaderResourceView" /> to be created.</param>
47+
/// <msdn-id>ff476519</msdn-id>
48+
/// <unmanaged>HRESULT ID3D11Device3::CreateShaderResourceView1([In] ID3D11Resource* pResource,[In, Optional] const D3D11_SHADER_RESOURCE_VIEW_DESC1* pDesc,[Out, Fast] ID3D11ShaderResourceView1** ppSRView)</unmanaged>
49+
/// <unmanaged-short>ID3D11Device3::CreateShaderResourceView1</unmanaged-short>
50+
public ShaderResourceView1(Device3 device, Resource resource, ShaderResourceViewDescription1 description)
51+
: base(IntPtr.Zero)
52+
{
53+
device.CreateShaderResourceView1(resource, description, this);
54+
}
55+
}
56+
}

Source/SharpDX.Direct3D11/SharpDX.Direct3D11.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
<Compile Include="BlendStateDescription1.cs" />
2525
<Compile Include="Device2.cs" />
2626
<Compile Include="Device3.cs" />
27+
<Compile Include="DeviceContext3.cs" />
2728
<Compile Include="DeviceContext2.cs" />
29+
<Compile Include="Query1.cs" />
2830
<Compile Include="RasterizerState2.cs" />
2931
<Compile Include="RasterizerStateDescription1.cs" />
3032
<Compile Include="DepthStencilStateDescription.cs" />
@@ -67,18 +69,23 @@
6769
<Compile Include="Query.cs" />
6870
<Compile Include="RasterizerState.cs" />
6971
<Compile Include="RenderTargetBlendDescription.cs" />
72+
<Compile Include="RenderTargetView1.cs" />
7073
<Compile Include="RenderTargetView.cs" />
7174
<Compile Include="Resource.cs" />
7275
<Compile Include="ResourceRegion.cs" />
7376
<Compile Include="ResourceView.cs" />
7477
<Compile Include="SamplerState.cs" />
7578
<Compile Include="SamplerStateDescription.cs" />
79+
<Compile Include="ShaderResourceView1.cs" />
7680
<Compile Include="ShaderResourceView.cs" />
7781
<Compile Include="StreamOutputBufferBinding.cs" />
7882
<Compile Include="StreamOutputElement.cs" />
7983
<Compile Include="Texture1D.cs" />
84+
<Compile Include="Texture2D1.cs" />
8085
<Compile Include="Texture2D.cs" />
86+
<Compile Include="Texture3D1.cs" />
8187
<Compile Include="Texture3D.cs" />
88+
<Compile Include="UnorderedAccessView1.cs" />
8289
<Compile Include="UnorderedAccessView.cs" />
8390
<Compile Include="VertexBufferBinding.cs" />
8491
<Compile Include="VertexShader.cs" />
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and associated documentation files (the "Software"), to deal
5+
// in the Software without restriction, including without limitation the rights
6+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
// copies of the Software, and to permit persons to whom the Software is
8+
// furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in
11+
// all copies or substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
// THE SOFTWARE.
20+
using System;
21+
22+
namespace SharpDX.Direct3D11
23+
{
24+
public partial class Texture2D1
25+
{
26+
/// <summary>
27+
/// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D11.Texture2D1" /> class.
28+
/// </summary>
29+
/// <param name = "device">The device with which to associate the texture.</param>
30+
/// <param name = "description">The description of the texture.</param>
31+
/// <msdn-id>ff476521</msdn-id>
32+
/// <unmanaged>HRESULT ID3D11Device3::CreateTexture2D1([In] const D3D11_TEXTURE2D_DESC1* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D1** ppTexture2D)</unmanaged>
33+
/// <unmanaged-short>ID3D11Device3::CreateTexture2D1</unmanaged-short>
34+
public Texture2D1(Device3 device, Texture2DDescription1 description)
35+
: base(IntPtr.Zero)
36+
{
37+
device.CreateTexture2D1(ref description, null, this);
38+
}
39+
40+
/// <summary>
41+
/// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D11.Texture2D1" /> class.
42+
/// </summary>
43+
/// <param name = "device">The device with which to associate the texture.</param>
44+
/// <param name = "description">The description of the texture.</param>
45+
/// <param name = "data">An array of initial texture data for each subresource.</param>
46+
/// <msdn-id>ff476521</msdn-id>
47+
/// <unmanaged>HRESULT ID3D11Device3::CreateTexture2D1([In] const D3D11_TEXTURE2D_DESC1* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D1** ppTexture2D)</unmanaged>
48+
/// <unmanaged-short>ID3D11Device3::CreateTexture2D1</unmanaged-short>
49+
public Texture2D1(Device3 device, Texture2DDescription1 description, params DataRectangle[] data)
50+
: base(IntPtr.Zero)
51+
{
52+
DataBox[] subResourceDatas = null;
53+
54+
if (data != null && data.Length > 0)
55+
{
56+
subResourceDatas = new DataBox[data.Length];
57+
for (int i = 0; i < subResourceDatas.Length; i++)
58+
{
59+
subResourceDatas[i].DataPointer = data[i].DataPointer;
60+
subResourceDatas[i].RowPitch = data[i].Pitch;
61+
}
62+
}
63+
64+
device.CreateTexture2D1(ref description, subResourceDatas, this);
65+
}
66+
67+
/// <summary>
68+
/// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D11.Texture2D1" /> class.
69+
/// </summary>
70+
/// <param name = "device">The device with which to associate the texture.</param>
71+
/// <param name = "description">The description of the texture.</param>
72+
/// <param name = "data">An array of initial texture data for each subresource.</param>
73+
/// <msdn-id>ff476521</msdn-id>
74+
/// <unmanaged>HRESULT ID3D11Device3::CreateTexture2D1([In] const D3D11_TEXTURE2D_DESC1* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D** ppTexture2D)</unmanaged>
75+
/// <unmanaged-short>ID3D11Device3::CreateTexture2D1</unmanaged-short>
76+
public Texture2D1(Device3 device, Texture2DDescription1 description, DataBox[] data)
77+
: base(IntPtr.Zero)
78+
{
79+
device.CreateTexture2D1(ref description, data, this);
80+
}
81+
82+
/// <inheritdoc/>
83+
public override int CalculateSubResourceIndex(int mipSlice, int arraySlice, out int mipSize)
84+
{
85+
var desc = Description;
86+
mipSize = CalculateMipSize(mipSlice, desc.Height);
87+
return CalculateSubResourceIndex(mipSlice, arraySlice, desc.MipLevels);
88+
}
89+
}
90+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and associated documentation files (the "Software"), to deal
5+
// in the Software without restriction, including without limitation the rights
6+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
// copies of the Software, and to permit persons to whom the Software is
8+
// furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in
11+
// all copies or substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
// THE SOFTWARE.
20+
using System;
21+
22+
namespace SharpDX.Direct3D11
23+
{
24+
public partial class Texture3D1
25+
{
26+
/// <summary>
27+
/// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D11.Texture3D1" /> class.
28+
/// </summary>
29+
/// <param name = "device">The device with which to associate the texture.</param>
30+
/// <param name = "description">The description of the texture.</param>
31+
public Texture3D1(Device3 device, Texture3DDescription1 description)
32+
: base(IntPtr.Zero)
33+
{
34+
device.CreateTexture3D1(ref description, null, this);
35+
}
36+
37+
/// <summary>
38+
/// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D11.Texture3D1" /> class.
39+
/// </summary>
40+
/// <param name = "device">The device with which to associate the texture.</param>
41+
/// <param name = "description">The description of the texture.</param>
42+
/// <param name = "data">An array of initial texture data for each subresource.</param>
43+
public Texture3D1(Device3 device, Texture3DDescription1 description, DataBox[] data) : base(IntPtr.Zero)
44+
{
45+
device.CreateTexture3D1(ref description, data, this);
46+
}
47+
48+
/// <inheritdoc/>
49+
public override int CalculateSubResourceIndex(int mipSlice, int arraySlice, out int mipSize)
50+
{
51+
var desc = Description;
52+
mipSize = CalculateMipSize(mipSlice, desc.Depth);
53+
return CalculateSubResourceIndex(mipSlice, arraySlice, desc.MipLevels);
54+
}
55+
}
56+
}

0 commit comments

Comments
 (0)