mirror of
https://github.com/amerkoleci/Vortice.Win32.git
synced 2026-01-14 16:16:04 +08:00
Various improvements.
This commit is contained in:
@@ -373,6 +373,23 @@ public static unsafe class ID3D11DeviceExtension
|
||||
}
|
||||
}
|
||||
|
||||
public static HResult CreateInputLayout<TD3D11Device>(ref this TD3D11Device self,
|
||||
ReadOnlySpan<InputElementDescription> inputElements,
|
||||
uint inputElementsCount,
|
||||
ReadOnlySpan<byte> shaderBytecode,
|
||||
ID3D11InputLayout** ppInputLayout)
|
||||
where TD3D11Device : unmanaged, ID3D11Device.Interface
|
||||
{
|
||||
fixed (InputElementDescription* pInputElements = inputElements)
|
||||
fixed (byte* pShaderBytecode = shaderBytecode)
|
||||
{
|
||||
return self.CreateInputLayout(
|
||||
pInputElements, inputElementsCount,
|
||||
pShaderBytecode, (nuint)shaderBytecode.Length,
|
||||
ppInputLayout);
|
||||
}
|
||||
}
|
||||
|
||||
public static ComPtr<ID3D11InputLayout> CreateInputLayout<TD3D11Device>(ref this TD3D11Device self,
|
||||
ReadOnlySpan<InputElementDescription> inputElements,
|
||||
ReadOnlySpan<byte> shaderBytecode)
|
||||
@@ -392,4 +409,25 @@ public static unsafe class ID3D11DeviceExtension
|
||||
|
||||
return inputLayout.Move();
|
||||
}
|
||||
|
||||
public static ComPtr<ID3D11InputLayout> CreateInputLayout<TD3D11Device>(ref this TD3D11Device self,
|
||||
ReadOnlySpan<InputElementDescription> inputElements,
|
||||
uint inputElementsCount,
|
||||
ReadOnlySpan<byte> shaderBytecode)
|
||||
where TD3D11Device : unmanaged, ID3D11Device.Interface
|
||||
{
|
||||
using ComPtr<ID3D11InputLayout> inputLayout = default;
|
||||
|
||||
fixed (InputElementDescription* pInputElements = inputElements)
|
||||
fixed (byte* pShaderBytecode = shaderBytecode)
|
||||
{
|
||||
ThrowIfFailed(self.CreateInputLayout(
|
||||
pInputElements, inputElementsCount,
|
||||
pShaderBytecode, (nuint)shaderBytecode.Length,
|
||||
inputLayout.GetAddressOf())
|
||||
);
|
||||
}
|
||||
|
||||
return inputLayout.Move();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// Copyright © Amer Koleci and Contributors.
|
||||
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
|
||||
|
||||
namespace Win32.Graphics.Direct3D11;
|
||||
|
||||
unsafe partial struct ID3DUserDefinedAnnotation
|
||||
{
|
||||
public int BeginEvent(string name)
|
||||
{
|
||||
fixed (char* namePtr = name)
|
||||
{
|
||||
return BeginEvent((ushort*)namePtr);
|
||||
}
|
||||
}
|
||||
|
||||
public int BeginEvent(ReadOnlySpan<char> name)
|
||||
{
|
||||
fixed (char* namePtr = name)
|
||||
{
|
||||
return BeginEvent((ushort*)namePtr);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMarker(string name)
|
||||
{
|
||||
fixed (char* namePtr = name)
|
||||
{
|
||||
SetMarker((ushort*)namePtr);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMarker(ReadOnlySpan<char> name)
|
||||
{
|
||||
fixed (char* namePtr = name)
|
||||
{
|
||||
SetMarker((ushort*)namePtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,21 +3,23 @@
|
||||
|
||||
namespace Win32.Graphics.Direct3D12;
|
||||
|
||||
public partial struct ID3D12Object
|
||||
public static unsafe class ID3D12ObjectExtensions
|
||||
{
|
||||
public unsafe HResult SetName(ReadOnlySpan<char> name)
|
||||
public static void SetName<TID3D12Object>(ref this TID3D12Object self, ReadOnlySpan<char> name)
|
||||
where TID3D12Object : unmanaged, ID3D12Object.Interface
|
||||
{
|
||||
fixed (char* namePtr = name)
|
||||
{
|
||||
return SetName((ushort*)namePtr);
|
||||
_ = self.SetName((ushort*)namePtr);
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe HResult SetName(string name)
|
||||
public static void SetName<TID3D12Object>(ref this TID3D12Object self, string name)
|
||||
where TID3D12Object : unmanaged, ID3D12Object.Interface
|
||||
{
|
||||
fixed (char* namePtr = name)
|
||||
{
|
||||
return SetName((ushort*)namePtr);
|
||||
_ = self.SetName((ushort*)namePtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user