diff --git a/src/Generator/Program.cs b/src/Generator/Program.cs
index 5cbce5f..e3c24ac 100644
--- a/src/Generator/Program.cs
+++ b/src/Generator/Program.cs
@@ -963,6 +963,11 @@ public static class Program
// D3D11
{ "ID3D11DeviceContext::Map::MapFlags", "D3D11_MAP_FLAG" },
+ { "ID3D11DeviceContext::ClearDepthStencilView::ClearFlags", "D3D11_CLEAR_FLAG" },
+ { "ID3D11DeviceContext1::ClearDepthStencilView::ClearFlags", "D3D11_CLEAR_FLAG" },
+ { "ID3D11DeviceContext2::ClearDepthStencilView::ClearFlags", "D3D11_CLEAR_FLAG" },
+ { "ID3D11DeviceContext3::ClearDepthStencilView::ClearFlags", "D3D11_CLEAR_FLAG" },
+ { "ID3D11DeviceContext4::ClearDepthStencilView::ClearFlags", "D3D11_CLEAR_FLAG" },
// D3D12
diff --git a/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext.cs b/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext.cs
index 07b1259..90f6c38 100644
--- a/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext.cs
+++ b/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext.cs
@@ -473,9 +473,9 @@ public unsafe partial struct ID3D11DeviceContext
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(53)]
- public void ClearDepthStencilView(ID3D11DepthStencilView* pDepthStencilView, uint ClearFlags, float Depth, byte Stencil)
+ public void ClearDepthStencilView(ID3D11DepthStencilView* pDepthStencilView, ClearFlags ClearFlags, float Depth, byte Stencil)
{
- ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID3D11DeviceContext*)Unsafe.AsPointer(ref this), pDepthStencilView, ClearFlags, Depth, Stencil);
+ ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID3D11DeviceContext*)Unsafe.AsPointer(ref this), pDepthStencilView, ClearFlags, Depth, Stencil);
}
///
diff --git a/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext1.cs b/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext1.cs
index 8ca17d1..d85915b 100644
--- a/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext1.cs
+++ b/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext1.cs
@@ -473,9 +473,9 @@ public unsafe partial struct ID3D11DeviceContext1
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(53)]
- public void ClearDepthStencilView(ID3D11DepthStencilView* pDepthStencilView, uint ClearFlags, float Depth, byte Stencil)
+ public void ClearDepthStencilView(ID3D11DepthStencilView* pDepthStencilView, ClearFlags ClearFlags, float Depth, byte Stencil)
{
- ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID3D11DeviceContext1*)Unsafe.AsPointer(ref this), pDepthStencilView, ClearFlags, Depth, Stencil);
+ ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID3D11DeviceContext1*)Unsafe.AsPointer(ref this), pDepthStencilView, ClearFlags, Depth, Stencil);
}
///
diff --git a/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext2.cs b/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext2.cs
index a2272c4..a055206 100644
--- a/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext2.cs
+++ b/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext2.cs
@@ -473,9 +473,9 @@ public unsafe partial struct ID3D11DeviceContext2
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(53)]
- public void ClearDepthStencilView(ID3D11DepthStencilView* pDepthStencilView, uint ClearFlags, float Depth, byte Stencil)
+ public void ClearDepthStencilView(ID3D11DepthStencilView* pDepthStencilView, ClearFlags ClearFlags, float Depth, byte Stencil)
{
- ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID3D11DeviceContext2*)Unsafe.AsPointer(ref this), pDepthStencilView, ClearFlags, Depth, Stencil);
+ ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID3D11DeviceContext2*)Unsafe.AsPointer(ref this), pDepthStencilView, ClearFlags, Depth, Stencil);
}
///
diff --git a/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext3.cs b/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext3.cs
index 164298b..7425126 100644
--- a/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext3.cs
+++ b/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext3.cs
@@ -473,9 +473,9 @@ public unsafe partial struct ID3D11DeviceContext3
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(53)]
- public void ClearDepthStencilView(ID3D11DepthStencilView* pDepthStencilView, uint ClearFlags, float Depth, byte Stencil)
+ public void ClearDepthStencilView(ID3D11DepthStencilView* pDepthStencilView, ClearFlags ClearFlags, float Depth, byte Stencil)
{
- ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID3D11DeviceContext3*)Unsafe.AsPointer(ref this), pDepthStencilView, ClearFlags, Depth, Stencil);
+ ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID3D11DeviceContext3*)Unsafe.AsPointer(ref this), pDepthStencilView, ClearFlags, Depth, Stencil);
}
///
diff --git a/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext4.cs b/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext4.cs
index cd12cca..5a08e64 100644
--- a/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext4.cs
+++ b/src/Vortice.Win32/Generated/Graphics/Direct3D11/ID3D11DeviceContext4.cs
@@ -473,9 +473,9 @@ public unsafe partial struct ID3D11DeviceContext4
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(53)]
- public void ClearDepthStencilView(ID3D11DepthStencilView* pDepthStencilView, uint ClearFlags, float Depth, byte Stencil)
+ public void ClearDepthStencilView(ID3D11DepthStencilView* pDepthStencilView, ClearFlags ClearFlags, float Depth, byte Stencil)
{
- ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID3D11DeviceContext4*)Unsafe.AsPointer(ref this), pDepthStencilView, ClearFlags, Depth, Stencil);
+ ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID3D11DeviceContext4*)Unsafe.AsPointer(ref this), pDepthStencilView, ClearFlags, Depth, Stencil);
}
///
diff --git a/src/Vortice.Win32/Graphics/Direct3D11/ID3D11Device.cs b/src/Vortice.Win32/Graphics/Direct3D11/ID3D11Device.cs
index ff839f2..b51dd68 100644
--- a/src/Vortice.Win32/Graphics/Direct3D11/ID3D11Device.cs
+++ b/src/Vortice.Win32/Graphics/Direct3D11/ID3D11Device.cs
@@ -5,6 +5,13 @@ namespace Win32.Graphics.Direct3D11;
public unsafe partial struct ID3D11Device
{
+ public ComPtr CreateBuffe(BufferDescription* description, SubresourceData* initialData = default)
+ {
+ using ComPtr buffer = default;
+ CreateBuffer(description, initialData, buffer.GetAddressOf()).ThrowIfFailed();
+ return buffer.Move();
+ }
+
public ComPtr CreateBuffer(
in T data,
BufferDescription description) where T : unmanaged
@@ -47,7 +54,6 @@ public unsafe partial struct ID3D11Device
/// Creates a new instance of the class.
///
/// Type of the data to upload
- /// The instance.
/// Flags specifying how the buffer will be bound to the pipeline.
/// Initial data used to initialize the buffer.
/// The size, in bytes, of the buffer. If 0 is specified, sizeof(T) * data.Length is used.
@@ -87,4 +93,156 @@ public unsafe partial struct ID3D11Device
return buffer.Move();
}
}
+
+ public ComPtr CreateRenderTargetView(
+ ID3D11Resource* resource,
+ RenderTargetViewDescription* description)
+ {
+ using ComPtr view = default;
+ CreateRenderTargetView(resource, description, view.GetAddressOf()).ThrowIfFailed();
+
+ return view.Move();
+ }
+
+ public ComPtr CreateDepthStencilView(
+ ID3D11Resource* resource,
+ DepthStencilViewDescription* description)
+ {
+ using ComPtr view = default;
+ CreateDepthStencilView(resource, description, view.GetAddressOf()).ThrowIfFailed();
+
+ return view.Move();
+ }
+
+ public ComPtr CreateShaderResourceView(
+ ID3D11Resource* resource,
+ ShaderResourceViewDescription* description)
+ {
+ using ComPtr view = default;
+ CreateShaderResourceView(resource, description, view.GetAddressOf()).ThrowIfFailed();
+
+ return view.Move();
+ }
+
+ public ComPtr CreateUnorderedAccessView(
+ ID3D11Resource* resource,
+ UnorderedAccessViewDescription* description)
+ {
+ using ComPtr view = default;
+ CreateUnorderedAccessView(resource, description, view.GetAddressOf()).ThrowIfFailed();
+
+ return view.Move();
+ }
+
+ public ComPtr CreateBlendState(BlendDescription* description)
+ {
+ using ComPtr state = default;
+ CreateBlendState(description, state.GetAddressOf()).ThrowIfFailed();
+
+ return state.Move();
+ }
+
+ public ComPtr CreateBlendState(BlendDescription description)
+ {
+ using ComPtr state = default;
+ CreateBlendState(&description, state.GetAddressOf()).ThrowIfFailed();
+
+ return state.Move();
+ }
+
+ public ComPtr CreateDepthStencilState(DepthStencilDescription* description)
+ {
+ using ComPtr state = default;
+ CreateDepthStencilState(description, state.GetAddressOf()).ThrowIfFailed();
+
+ return state.Move();
+ }
+
+ public ComPtr CreateDepthStencilState(DepthStencilDescription description)
+ {
+ using ComPtr state = default;
+ CreateDepthStencilState(&description, state.GetAddressOf()).ThrowIfFailed();
+
+ return state.Move();
+ }
+
+ public ComPtr CreateRasterizerState(RasterizerDescription* description)
+ {
+ using ComPtr state = default;
+ CreateRasterizerState(description, state.GetAddressOf()).ThrowIfFailed();
+
+ return state.Move();
+ }
+
+ public ComPtr CreateRasterizerState(RasterizerDescription description)
+ {
+ using ComPtr state = default;
+ CreateRasterizerState(&description, state.GetAddressOf()).ThrowIfFailed();
+
+ return state.Move();
+ }
+
+ public ComPtr CreateSamplerState(SamplerDescription* description)
+ {
+ using ComPtr state = default;
+ CreateSamplerState(description, state.GetAddressOf()).ThrowIfFailed();
+
+ return state.Move();
+ }
+
+ public ComPtr CreateSamplerState(SamplerDescription description)
+ {
+ using ComPtr state = default;
+ CreateSamplerState(&description, state.GetAddressOf()).ThrowIfFailed();
+
+ return state.Move();
+ }
+
+ public ComPtr CreateTexture1D(Texture1DDescription* description, SubresourceData* initialData = default)
+ {
+ using ComPtr texture = default;
+ CreateTexture1D(description, initialData, texture.GetAddressOf()).ThrowIfFailed();
+
+ return texture.Move();
+ }
+
+ public ComPtr CreateTexture1D(Texture1DDescription description, SubresourceData* initialData = default)
+ {
+ using ComPtr texture = default;
+ CreateTexture1D(&description, initialData, texture.GetAddressOf()).ThrowIfFailed();
+
+ return texture.Move();
+ }
+
+ public ComPtr CreateTexture2D(Texture2DDescription* description, SubresourceData* initialData = default)
+ {
+ using ComPtr texture = default;
+ CreateTexture2D(description, initialData, texture.GetAddressOf()).ThrowIfFailed();
+
+ return texture.Move();
+ }
+
+ public ComPtr CreateTexture2D(Texture2DDescription description, SubresourceData* initialData = default)
+ {
+ using ComPtr texture = default;
+ CreateTexture2D(&description, initialData, texture.GetAddressOf()).ThrowIfFailed();
+
+ return texture.Move();
+ }
+
+ public ComPtr CreateTexture3D(Texture3DDescription* description, SubresourceData* initialData = default)
+ {
+ using ComPtr texture = default;
+ CreateTexture3D(description, initialData, texture.GetAddressOf()).ThrowIfFailed();
+
+ return texture.Move();
+ }
+
+ public ComPtr CreateTexture3D(Texture3DDescription description, SubresourceData* initialData = default)
+ {
+ using ComPtr texture = default;
+ CreateTexture3D(&description, initialData, texture.GetAddressOf()).ThrowIfFailed();
+
+ return texture.Move();
+ }
}
diff --git a/src/Vortice.Win32/Graphics/Direct3D11/ID3D11DeviceChild.cs b/src/Vortice.Win32/Graphics/Direct3D11/ID3D11DeviceChild.cs
new file mode 100644
index 0000000..6437a48
--- /dev/null
+++ b/src/Vortice.Win32/Graphics/Direct3D11/ID3D11DeviceChild.cs
@@ -0,0 +1,45 @@
+// Copyright © Amer Koleci and Contributors.
+// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
+
+using static Win32.Graphics.Direct3D.Apis;
+using static Win32.StringUtilities;
+
+namespace Win32.Graphics.Direct3D11;
+
+public unsafe partial struct ID3D11DeviceChild
+{
+ public static Guid* D3DDebugObjectNameGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in WKPDID_D3DDebugObjectName));
+
+ ///
+ /// Gets or sets the debug-name for this object.
+ ///
+ public string? DebugName
+ {
+ get
+ {
+ sbyte* pname = stackalloc sbyte[1024];
+ uint size = 1024 - 1;
+ if (GetPrivateData(D3DDebugObjectNameGuid, &size, pname).Failure)
+ {
+ return string.Empty;
+ }
+
+ pname[size] = 0;
+ return GetString(pname);
+ }
+ set
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ SetPrivateData(D3DDebugObjectNameGuid, 0, null);
+ }
+ else
+ {
+ fixed (sbyte* valuePtr = value.GetUtf8Span())
+ {
+ SetPrivateData(D3DDebugObjectNameGuid, (uint)value.Length, valuePtr);
+ }
+ }
+ }
+ }
+}
diff --git a/src/Vortice.Win32/Graphics/Direct3D11/ID3D11DeviceContext.cs b/src/Vortice.Win32/Graphics/Direct3D11/ID3D11DeviceContext.cs
new file mode 100644
index 0000000..e46ccda
--- /dev/null
+++ b/src/Vortice.Win32/Graphics/Direct3D11/ID3D11DeviceContext.cs
@@ -0,0 +1,38 @@
+// Copyright © Amer Koleci and Contributors.
+// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
+
+namespace Win32.Graphics.Direct3D11;
+
+public unsafe partial struct ID3D11DeviceContext
+{
+ public void RSSetViewport(float x, float y, float width, float height, float minDepth = 0.0f, float maxDepth = 1.0f)
+ {
+ var viewport = new Viewport(x, y, width, height, minDepth, maxDepth);
+ RSSetViewports(1, &viewport);
+ }
+
+ public void RSSetViewport(Viewport viewport)
+ {
+ RSSetViewports(1, &viewport);
+ }
+
+ public void RSSetScissorRect(int x, int y, int width, int height)
+ {
+ RawRect rawRect = new(x, y, x + width, y + height);
+ RSSetScissorRects(1, &rawRect);
+ }
+
+ public void RSSetScissorRect(RawRect rect)
+ {
+ RSSetScissorRects(1, &rect);
+ }
+
+
+ public ComPtr FinishCommandList(bool RestoreDeferredContextState = false)
+ {
+ using ComPtr commandList = default;
+ FinishCommandList(RestoreDeferredContextState, commandList.GetAddressOf()).ThrowIfFailed();
+
+ return commandList.Move();
+ }
+}
diff --git a/src/Vortice.Win32/StringUtilities.cs b/src/Vortice.Win32/StringUtilities.cs
index f30434b..d846a80 100644
--- a/src/Vortice.Win32/StringUtilities.cs
+++ b/src/Vortice.Win32/StringUtilities.cs
@@ -2,7 +2,6 @@
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
-using System.Runtime.CompilerServices;
using System.Text;
using static Win32.UnsafeUtilities;
diff --git a/src/Vortice.Win32/Vortice.Win32.csproj b/src/Vortice.Win32/Vortice.Win32.csproj
index 24bfed0..64b4261 100644
--- a/src/Vortice.Win32/Vortice.Win32.csproj
+++ b/src/Vortice.Win32/Vortice.Win32.csproj
@@ -3,7 +3,7 @@
netstandard2.0;net6.0;net7.0
Windows API low level bindings.
- 1.6.3
+ 1.6.4
true
True
diff --git a/src/samples/01-ClearScreen/Program.cs b/src/samples/01-ClearScreen/Program.cs
index 40cf412..7564d9c 100644
--- a/src/samples/01-ClearScreen/Program.cs
+++ b/src/samples/01-ClearScreen/Program.cs
@@ -253,6 +253,7 @@ public static unsafe class Program
Texture2DDescription texture2DDesc = new(Format.D32Float, 256, 256, 1, 1, BindFlags.DepthStencil);
tempDevice.Get()->CreateTexture2D(&texture2DDesc, null, depthStencilTexture.GetAddressOf()).ThrowIfFailed();
depthStencilTexture.Get()->GetDesc(&texture2DDesc);
+ ((ID3D11DeviceChild*)depthStencilTexture.Get())->DebugName = "CIAO";
tempDevice.Get()->CreateDepthStencilView((ID3D11Resource*)depthStencilTexture.Get(), null, depthStencilTextureView.GetAddressOf()).ThrowIfFailed();
}