This repository has been archived by the owner on Mar 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 639
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Direct3D11] Improve support Direct3D 11.3
- Loading branch information
AndrewSt
committed
Jun 2, 2016
1 parent
7f61b6b
commit 4a066d7
Showing
8 changed files
with
385 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
using System; | ||
|
||
namespace SharpDX.Direct3D11 | ||
{ | ||
public partial class DeviceContext3 | ||
{ | ||
/// <summary> | ||
/// Initializes a new deferred context instance of <see cref="SharpDX.Direct3D11.DeviceContext3"/> class. | ||
/// </summary> | ||
/// <param name="device"></param> | ||
public DeviceContext3(Device3 device) | ||
: base(IntPtr.Zero) | ||
{ | ||
device.CreateDeferredContext3(0, this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
using System; | ||
|
||
namespace SharpDX.Direct3D11 | ||
{ | ||
public partial class Query1 | ||
{ | ||
/// <summary> | ||
/// Constructs a new <see cref = "T:SharpDX.Direct3D11.Query1" /> based on the specified description. | ||
/// </summary> | ||
/// <param name = "device">The device with which to associate the state object.</param> | ||
/// <param name = "description">The query description.</param> | ||
/// <returns>The newly created object.</returns> | ||
public Query1(Device3 device, QueryDescription1 description) | ||
: base(IntPtr.Zero) | ||
{ | ||
device.CreateQuery1(description, this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
using System; | ||
|
||
namespace SharpDX.Direct3D11 | ||
{ | ||
public partial class RenderTargetView1 | ||
{ | ||
/// <summary> | ||
/// Creates a <see cref = "T:SharpDX.Direct3D11.RenderTargetView1" /> for accessing resource data. | ||
/// </summary> | ||
/// <param name = "device">The device to use when creating this <see cref = "T:SharpDX.Direct3D11.RenderTargetView1" />.</param> | ||
/// <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> | ||
/// <unmanaged>ID3D11Device3::CreateRenderTargetView1</unmanaged> | ||
public RenderTargetView1(Device3 device, Resource resource) | ||
: base(IntPtr.Zero) | ||
{ | ||
device.CreateRenderTargetView1(resource, null, this); | ||
} | ||
|
||
/// <summary> | ||
/// Creates a <see cref = "T:SharpDX.Direct3D11.RenderTargetView" /> for accessing resource data. | ||
/// </summary> | ||
/// <param name = "device">The device to use when creating this <see cref = "T:SharpDX.Direct3D11.RenderTargetView1" />.</param> | ||
/// <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> | ||
/// <param name = "description">A structure describing the <see cref = "T:SharpDX.Direct3D11.RenderTargetView1" /> to be created.</param> | ||
/// <unmanaged>ID3D11Device3::CreateRenderTargetView1</unmanaged> | ||
public RenderTargetView1(Device3 device, Resource resource, RenderTargetViewDescription1 description) | ||
: base(IntPtr.Zero) | ||
{ | ||
device.CreateRenderTargetView1(resource, description, this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
using System; | ||
using System.IO; | ||
|
||
namespace SharpDX.Direct3D11 | ||
{ | ||
public partial class ShaderResourceView1 | ||
{ | ||
/// <summary> | ||
/// Creates a <see cref = "T:SharpDX.Direct3D11.ShaderResourceView1" /> for accessing resource data. | ||
/// </summary> | ||
/// <param name = "device">The device to use when creating this <see cref = "T:SharpDX.Direct3D11.ShaderResourceView1" />.</param> | ||
/// <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> | ||
/// <msdn-id>ff476519</msdn-id> | ||
/// <unmanaged>HRESULT ID3D11Device3::CreateShaderResourceView1([In] ID3D11Resource* pResource,[In, Optional] const D3D11_SHADER_RESOURCE_VIEW_DESC1* pDesc,[Out, Fast] ID3D11ShaderResourceView1** ppSRView)</unmanaged> | ||
/// <unmanaged-short>ID3D11Device3::CreateShaderResourceView1</unmanaged-short> | ||
public ShaderResourceView1(Device3 device, Resource resource) | ||
: base(IntPtr.Zero) | ||
{ | ||
device.CreateShaderResourceView1(resource, null, this); | ||
} | ||
|
||
/// <summary> | ||
/// Creates a <see cref = "T:SharpDX.Direct3D11.ShaderResourceView" /> for accessing resource data. | ||
/// </summary> | ||
/// <param name = "device">The device to use when creating this <see cref = "T:SharpDX.Direct3D11.ShaderResourceView" />.</param> | ||
/// <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> | ||
/// <param name = "description">A structure describing the <see cref = "T:SharpDX.Direct3D11.ShaderResourceView" /> to be created.</param> | ||
/// <msdn-id>ff476519</msdn-id> | ||
/// <unmanaged>HRESULT ID3D11Device3::CreateShaderResourceView1([In] ID3D11Resource* pResource,[In, Optional] const D3D11_SHADER_RESOURCE_VIEW_DESC1* pDesc,[Out, Fast] ID3D11ShaderResourceView1** ppSRView)</unmanaged> | ||
/// <unmanaged-short>ID3D11Device3::CreateShaderResourceView1</unmanaged-short> | ||
public ShaderResourceView1(Device3 device, Resource resource, ShaderResourceViewDescription1 description) | ||
: base(IntPtr.Zero) | ||
{ | ||
device.CreateShaderResourceView1(resource, description, this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
using System; | ||
|
||
namespace SharpDX.Direct3D11 | ||
{ | ||
public partial class Texture2D1 | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D11.Texture2D1" /> class. | ||
/// </summary> | ||
/// <param name = "device">The device with which to associate the texture.</param> | ||
/// <param name = "description">The description of the texture.</param> | ||
/// <msdn-id>ff476521</msdn-id> | ||
/// <unmanaged>HRESULT ID3D11Device3::CreateTexture2D1([In] const D3D11_TEXTURE2D_DESC1* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D1** ppTexture2D)</unmanaged> | ||
/// <unmanaged-short>ID3D11Device3::CreateTexture2D1</unmanaged-short> | ||
public Texture2D1(Device3 device, Texture2DDescription1 description) | ||
: base(IntPtr.Zero) | ||
{ | ||
device.CreateTexture2D1(ref description, null, this); | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D11.Texture2D1" /> class. | ||
/// </summary> | ||
/// <param name = "device">The device with which to associate the texture.</param> | ||
/// <param name = "description">The description of the texture.</param> | ||
/// <param name = "data">An array of initial texture data for each subresource.</param> | ||
/// <msdn-id>ff476521</msdn-id> | ||
/// <unmanaged>HRESULT ID3D11Device3::CreateTexture2D1([In] const D3D11_TEXTURE2D_DESC1* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D1** ppTexture2D)</unmanaged> | ||
/// <unmanaged-short>ID3D11Device3::CreateTexture2D1</unmanaged-short> | ||
public Texture2D1(Device3 device, Texture2DDescription1 description, params DataRectangle[] data) | ||
: base(IntPtr.Zero) | ||
{ | ||
DataBox[] subResourceDatas = null; | ||
|
||
if (data != null && data.Length > 0) | ||
{ | ||
subResourceDatas = new DataBox[data.Length]; | ||
for (int i = 0; i < subResourceDatas.Length; i++) | ||
{ | ||
subResourceDatas[i].DataPointer = data[i].DataPointer; | ||
subResourceDatas[i].RowPitch = data[i].Pitch; | ||
} | ||
} | ||
|
||
device.CreateTexture2D1(ref description, subResourceDatas, this); | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D11.Texture2D1" /> class. | ||
/// </summary> | ||
/// <param name = "device">The device with which to associate the texture.</param> | ||
/// <param name = "description">The description of the texture.</param> | ||
/// <param name = "data">An array of initial texture data for each subresource.</param> | ||
/// <msdn-id>ff476521</msdn-id> | ||
/// <unmanaged>HRESULT ID3D11Device3::CreateTexture2D1([In] const D3D11_TEXTURE2D_DESC1* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D** ppTexture2D)</unmanaged> | ||
/// <unmanaged-short>ID3D11Device3::CreateTexture2D1</unmanaged-short> | ||
public Texture2D1(Device3 device, Texture2DDescription1 description, DataBox[] data) | ||
: base(IntPtr.Zero) | ||
{ | ||
device.CreateTexture2D1(ref description, data, this); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override int CalculateSubResourceIndex(int mipSlice, int arraySlice, out int mipSize) | ||
{ | ||
var desc = Description; | ||
mipSize = CalculateMipSize(mipSlice, desc.Height); | ||
return CalculateSubResourceIndex(mipSlice, arraySlice, desc.MipLevels); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
using System; | ||
|
||
namespace SharpDX.Direct3D11 | ||
{ | ||
public partial class Texture3D1 | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D11.Texture3D1" /> class. | ||
/// </summary> | ||
/// <param name = "device">The device with which to associate the texture.</param> | ||
/// <param name = "description">The description of the texture.</param> | ||
public Texture3D1(Device3 device, Texture3DDescription1 description) | ||
: base(IntPtr.Zero) | ||
{ | ||
device.CreateTexture3D1(ref description, null, this); | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D11.Texture3D1" /> class. | ||
/// </summary> | ||
/// <param name = "device">The device with which to associate the texture.</param> | ||
/// <param name = "description">The description of the texture.</param> | ||
/// <param name = "data">An array of initial texture data for each subresource.</param> | ||
public Texture3D1(Device3 device, Texture3DDescription1 description, DataBox[] data) : base(IntPtr.Zero) | ||
{ | ||
device.CreateTexture3D1(ref description, data, this); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override int CalculateSubResourceIndex(int mipSlice, int arraySlice, out int mipSize) | ||
{ | ||
var desc = Description; | ||
mipSize = CalculateMipSize(mipSlice, desc.Depth); | ||
return CalculateSubResourceIndex(mipSlice, arraySlice, desc.MipLevels); | ||
} | ||
} | ||
} |
Oops, something went wrong.