mirror of
https://github.com/amerkoleci/Vortice.Win32.git
synced 2026-01-14 16:16:04 +08:00
Improve in CheckFeatureSupport support across library.
This commit is contained in:
@@ -5,9 +5,30 @@ using static Win32.Apis;
|
||||
|
||||
namespace Win32.Graphics.Direct3D11;
|
||||
|
||||
public static unsafe class ID3D11DeviceExtension
|
||||
public static unsafe class ID3D11DeviceExtensions
|
||||
{
|
||||
public static ComPtr<ID3D11Buffer> CheckFeatureSupport<TD3D11Device>(ref this TD3D11Device self, BufferDescription* description, SubresourceData* initialData = default)
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static TFeature CheckFeatureSupport<TD3D11Device, TFeature>(ref this TD3D11Device self, Feature feature)
|
||||
where TD3D11Device : unmanaged, ID3D11Device.Interface
|
||||
where TFeature : unmanaged
|
||||
{
|
||||
TFeature featureData = default;
|
||||
ThrowIfFailed(self.CheckFeatureSupport(feature, &featureData, sizeof(TFeature)));
|
||||
return featureData;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static HResult CheckFeatureSupport<TD3D11Device, TFeature>(ref this TD3D11Device self, Feature feature, ref TFeature featureData)
|
||||
where TD3D11Device : unmanaged, ID3D11Device.Interface
|
||||
where TFeature : unmanaged
|
||||
{
|
||||
fixed (TFeature* featureDataPtr = &featureData)
|
||||
{
|
||||
return self.CheckFeatureSupport(feature, featureDataPtr, sizeof(TFeature));
|
||||
}
|
||||
}
|
||||
|
||||
public static ComPtr<ID3D11Buffer> CreateBuffer<TD3D11Device>(ref this TD3D11Device self, BufferDescription* description, SubresourceData* initialData = default)
|
||||
where TD3D11Device : unmanaged, ID3D11Device.Interface
|
||||
{
|
||||
using ComPtr<ID3D11Buffer> buffer = default;
|
||||
|
||||
30
src/Vortice.Win32.Graphics.Direct3D11/ID3D11VideoDevice2.cs
Normal file
30
src/Vortice.Win32.Graphics.Direct3D11/ID3D11VideoDevice2.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright © Amer Koleci and Contributors.
|
||||
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
|
||||
|
||||
using static Win32.Apis;
|
||||
|
||||
namespace Win32.Graphics.Direct3D11;
|
||||
|
||||
public static unsafe class ID3D11VideoDevice2Extensions
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static TFeature CheckFeatureSupport<TD3D11VideoDevice2, TFeature>(ref this TD3D11VideoDevice2 self, FeatureVideo feature)
|
||||
where TD3D11VideoDevice2 : unmanaged, ID3D11VideoDevice2.Interface
|
||||
where TFeature : unmanaged
|
||||
{
|
||||
TFeature featureData = default;
|
||||
ThrowIfFailed(self.CheckFeatureSupport(feature, &featureData, sizeof(TFeature)));
|
||||
return featureData;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static HResult CheckFeatureSupport<TD3D11VideoDevice2, TFeature>(ref this TD3D11VideoDevice2 self, FeatureVideo feature, ref TFeature featureData)
|
||||
where TD3D11VideoDevice2 : unmanaged, ID3D11VideoDevice2.Interface
|
||||
where TFeature : unmanaged
|
||||
{
|
||||
fixed (TFeature* featureDataPtr = &featureData)
|
||||
{
|
||||
return self.CheckFeatureSupport(feature, featureDataPtr, sizeof(TFeature));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user