diff --git a/Directory.Build.props b/Directory.Build.props
index 5451ee0..4fa9c8c 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -14,7 +14,7 @@
true
$(MSBuildThisFileDirectory)NuGet.config
- 1.9.12
+ 1.9.13
true
diff --git a/src/Vortice.Win32.Graphics.Direct2D/ID2D1DeviceContext.cs b/src/Vortice.Win32.Graphics.Direct2D/ID2D1DeviceContext.cs
index 084d492..74548b9 100644
--- a/src/Vortice.Win32.Graphics.Direct2D/ID2D1DeviceContext.cs
+++ b/src/Vortice.Win32.Graphics.Direct2D/ID2D1DeviceContext.cs
@@ -9,180 +9,241 @@ using static Win32.Graphics.Direct2D.Apis;
namespace Win32.Graphics.Direct2D;
-public unsafe partial struct ID2D1DeviceContext
+public static unsafe class ID2D1DeviceContextExtensions
{
- public HResult CreateBitmap(Size size, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap)
+ public static HResult CreateBitmapt(
+ ref this TD2D1DeviceContext self, Size size, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateBitmap(size, null, 0, bitmapProperties, bitmap);
+ return self.CreateBitmap(size, null, 0, bitmapProperties, bitmap);
}
- public HResult CreateBitmapFromWicBitmap(IWICBitmapSource* wicBitmapSource, ID2D1Bitmap** bitmap)
+ public static HResult CreateBitmapFromWicBitmapt(
+ ref this TD2D1DeviceContext self, IWICBitmapSource* wicBitmapSource, ID2D1Bitmap** bitmap)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateBitmapFromWicBitmap(wicBitmapSource, null, bitmap);
+ return self.CreateBitmapFromWicBitmap(wicBitmapSource, null, bitmap);
}
- public HResult CreateBitmapBrush(ID2D1Bitmap* bitmap, ID2D1BitmapBrush** bitmapBrush)
+ public static HResult CreateBitmapBrusht(
+ ref this TD2D1DeviceContext self, ID2D1Bitmap* bitmap, ID2D1BitmapBrush** bitmapBrush)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateBitmapBrush(bitmap, null, null, bitmapBrush);
+ return self.CreateBitmapBrush(bitmap, null, null, bitmapBrush);
}
- public HResult CreateBitmapBrush(ID2D1Bitmap* bitmap, BitmapBrushProperties* bitmapBrushProperties, ID2D1BitmapBrush** bitmapBrush)
+ public static HResult CreateBitmapBrush(
+ ref this TD2D1DeviceContext self, ID2D1Bitmap* bitmap, BitmapBrushProperties* bitmapBrushProperties, ID2D1BitmapBrush** bitmapBrush)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateBitmapBrush(bitmap, bitmapBrushProperties, null, bitmapBrush);
+ return self.CreateBitmapBrush(bitmap, bitmapBrushProperties, null, bitmapBrush);
}
- public HResult CreateSolidColorBrush(Color4* color, ID2D1SolidColorBrush** solidColorBrush)
+ public static HResult CreateSolidColorBrush(
+ ref this TD2D1DeviceContext self, Color4* color, ID2D1SolidColorBrush** solidColorBrush)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateSolidColorBrush(color, null, solidColorBrush);
+ return self.CreateSolidColorBrush(color, null, solidColorBrush);
}
- public HResult CreateGradientStopCollection(GradientStop* gradientStops, uint gradientStopsCount, ID2D1GradientStopCollection** gradientStopCollection)
+ public static HResult CreateSolidColorBrush(
+ ref this TD2D1DeviceContext self, Color4 color, ID2D1SolidColorBrush** solidColorBrush)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateGradientStopCollection(gradientStops, gradientStopsCount, Gamma.Gamma_2_2, ExtendMode.Clamp, gradientStopCollection);
+ return self.CreateSolidColorBrush(&color, null, solidColorBrush);
}
- public HResult CreateLinearGradientBrush(LinearGradientBrushProperties* linearGradientBrushProperties, ID2D1GradientStopCollection* gradientStopCollection, ID2D1LinearGradientBrush** linearGradientBrush)
+ public static HResult CreateGradientStopCollection(
+ ref this TD2D1DeviceContext self, GradientStop* gradientStops, int gradientStopsCount, ID2D1GradientStopCollection** gradientStopCollection)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateLinearGradientBrush(linearGradientBrushProperties, null, gradientStopCollection, linearGradientBrush);
+ return self.CreateGradientStopCollection(gradientStops, (uint)gradientStopsCount, Gamma.Gamma_2_2, ExtendMode.Clamp, gradientStopCollection);
}
- public HResult CreateRadialGradientBrush(RadialGradientBrushProperties* radialGradientBrushProperties, ID2D1GradientStopCollection* gradientStopCollection, ID2D1RadialGradientBrush** radialGradientBrush)
+ public static HResult CreateLinearGradientBrush(
+ ref this TD2D1DeviceContext self, LinearGradientBrushProperties* linearGradientBrushProperties, ID2D1GradientStopCollection* gradientStopCollection, ID2D1LinearGradientBrush** linearGradientBrush)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateRadialGradientBrush(radialGradientBrushProperties, null, gradientStopCollection, radialGradientBrush);
+ return self.CreateLinearGradientBrush(linearGradientBrushProperties, null, gradientStopCollection, linearGradientBrush);
}
- public HResult CreateCompatibleRenderTarget(ID2D1BitmapRenderTarget** bitmapRenderTarget)
+ public static HResult CreateRadialGradientBrush(
+ ref this TD2D1DeviceContext self, RadialGradientBrushProperties* radialGradientBrushProperties, ID2D1GradientStopCollection* gradientStopCollection, ID2D1RadialGradientBrush** radialGradientBrush)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateCompatibleRenderTarget(null, null, null, CompatibleRenderTargetOptions.None, bitmapRenderTarget);
+ return self.CreateRadialGradientBrush(radialGradientBrushProperties, null, gradientStopCollection, radialGradientBrush);
}
- public HResult CreateCompatibleRenderTarget(SizeF desiredSize, ID2D1BitmapRenderTarget** bitmapRenderTarget)
+ public static HResult CreateCompatibleRenderTarget(
+ ref this TD2D1DeviceContext self, ID2D1BitmapRenderTarget** bitmapRenderTarget)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateCompatibleRenderTarget(&desiredSize, null, null, CompatibleRenderTargetOptions.None, bitmapRenderTarget);
+ return self.CreateCompatibleRenderTarget(null, null, null, CompatibleRenderTargetOptions.None, bitmapRenderTarget);
}
- public HResult CreateCompatibleRenderTarget(SizeF desiredSize, Size desiredPixelSize, ID2D1BitmapRenderTarget** bitmapRenderTarget)
+ public static HResult CreateCompatibleRenderTarget(
+ ref this TD2D1DeviceContext self, SizeF desiredSize, ID2D1BitmapRenderTarget** bitmapRenderTarget)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, null, CompatibleRenderTargetOptions.None, bitmapRenderTarget);
+ return self.CreateCompatibleRenderTarget(&desiredSize, null, null, CompatibleRenderTargetOptions.None, bitmapRenderTarget);
}
- public HResult CreateCompatibleRenderTarget(SizeF desiredSize, Size desiredPixelSize, PixelFormat desiredFormat, ID2D1BitmapRenderTarget** bitmapRenderTarget)
+ public static HResult CreateCompatibleRenderTarget(
+ ref this TD2D1DeviceContext self, SizeF desiredSize, Size desiredPixelSize, ID2D1BitmapRenderTarget** bitmapRenderTarget)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, &desiredFormat, CompatibleRenderTargetOptions.None, bitmapRenderTarget);
+ return self.CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, null, CompatibleRenderTargetOptions.None, bitmapRenderTarget);
}
- public HResult CreateCompatibleRenderTarget(SizeF desiredSize, Size desiredPixelSize, PixelFormat desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget)
+ public static HResult CreateCompatibleRenderTarget(
+ ref this TD2D1DeviceContext self, SizeF desiredSize, Size desiredPixelSize, PixelFormat desiredFormat, ID2D1BitmapRenderTarget** bitmapRenderTarget)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, &desiredFormat, options, bitmapRenderTarget);
+ return self.CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, &desiredFormat, CompatibleRenderTargetOptions.None, bitmapRenderTarget);
}
- public HResult CreateLayer(SizeF size, ID2D1Layer** layer)
+ public static HResult CreateCompatibleRenderTarget(
+ ref this TD2D1DeviceContext self, SizeF desiredSize, Size desiredPixelSize, PixelFormat desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateLayer(&size, layer);
+ return self.CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, &desiredFormat, options, bitmapRenderTarget);
}
- public HResult CreateLayer(ID2D1Layer** layer)
+ public static HResult CreateLayer(
+ ref this TD2D1DeviceContext self, SizeF size, ID2D1Layer** layer)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateLayer(null, layer);
- }
- public HResult CreateBitmapFromWicBitmap(IWICBitmapSource* wicBitmapSource, ID2D1Bitmap1** bitmap)
- {
- return CreateBitmapFromWicBitmap(wicBitmapSource, null, bitmap);
+ return self.CreateLayer(&size, layer);
}
- public HResult CreateImageBrush(ID2D1Image* image, ImageBrushProperties* imageBrushProperties, ID2D1ImageBrush** imageBrush)
+ public static HResult CreateLayer(
+ ref this TD2D1DeviceContext self, ID2D1Layer** layer)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateImageBrush(image, imageBrushProperties, null, imageBrush);
+ return self.CreateLayer(null, layer);
+ }
+ public static HResult CreateBitmapFromWicBitmap(
+ ref this TD2D1DeviceContext self, IWICBitmapSource* wicBitmapSource, ID2D1Bitmap1** bitmap)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
+ {
+ return self.CreateBitmapFromWicBitmap(wicBitmapSource, null, bitmap);
}
- public HResult CreateBitmapBrush(ID2D1Bitmap* bitmap, ID2D1BitmapBrush1** bitmapBrush)
+ public static HResult CreateImageBrush(
+ ref this TD2D1DeviceContext self, ID2D1Image* image, ImageBrushProperties* imageBrushProperties, ID2D1ImageBrush** imageBrush)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateBitmapBrush(bitmap, null, null, bitmapBrush);
+ return self.CreateImageBrush(image, imageBrushProperties, null, imageBrush);
}
- public HResult CreateEffect(in Guid effectId, ID2D1Effect** effect)
+ public static HResult CreateBitmapBrush(
+ ref this TD2D1DeviceContext self, ID2D1Bitmap* bitmap, ID2D1BitmapBrush1** bitmapBrush)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- return CreateEffect((Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in effectId)), effect);
+ return self.CreateBitmapBrush(bitmap, null, null, bitmapBrush);
}
- public ComPtr CreateEffect(in Guid effectId)
+ public static HResult CreateEffect(
+ ref this TD2D1DeviceContext self, in Guid effectId, ID2D1Effect** effect)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
+ {
+ return self.CreateEffect((Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in effectId)), effect);
+ }
+
+ public static ComPtr CreateEffect(
+ ref this TD2D1DeviceContext self, in Guid effectId)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
using ComPtr effect = default;
- ThrowIfFailed(CreateEffect((Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in effectId)), effect.GetAddressOf()));
+ ThrowIfFailed(self.CreateEffect((Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in effectId)), effect.GetAddressOf()));
return effect.Move();
}
- public void DrawImage(
+ public static void DrawImage(
+ ref this TD2D1DeviceContext self,
ID2D1Effect* effect,
Vector2* targetOffset = null,
RectF* imageRectangle = null,
InterpolationMode interpolationMode = InterpolationMode.Linear,
CompositeMode compositeMode = CompositeMode.SourceOver)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
ID2D1Image* output = null;
effect->GetOutput(&output);
- DrawImage(output, targetOffset, imageRectangle, interpolationMode, compositeMode);
+ self.DrawImage(output, targetOffset, imageRectangle, interpolationMode, compositeMode);
_ = output->Release();
}
- public void DrawImage(
+ public static void DrawImage(
+ ref this TD2D1DeviceContext self,
ID2D1Image* image,
InterpolationMode interpolationMode,
CompositeMode compositeMode = CompositeMode.SourceOver)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- DrawImage(image, null, null, interpolationMode, compositeMode);
+ self.DrawImage(image, null, null, interpolationMode, compositeMode);
}
- public void DrawImage(ID2D1Effect* effect,
+ public static void DrawImage(
+ ref this TD2D1DeviceContext self,
+ ID2D1Effect* effect,
InterpolationMode interpolationMode,
CompositeMode compositeMode = CompositeMode.SourceOver)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- DrawImage(effect, null, null, interpolationMode, compositeMode);
+ self.DrawImage(effect, null, null, interpolationMode, compositeMode);
}
- public void DrawImage(ID2D1Image* image,
+ public static void DrawImage(
+ ref this TD2D1DeviceContext self, ID2D1Image* image,
Vector2 targetOffset,
InterpolationMode interpolationMode = InterpolationMode.Linear,
CompositeMode compositeMode = CompositeMode.SourceOver)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- DrawImage(image, &targetOffset, null, interpolationMode, compositeMode);
+ self.DrawImage(image, &targetOffset, null, interpolationMode, compositeMode);
}
- public void DrawImage(ID2D1Effect* effect,
+ public static void DrawImage(
+ ref this TD2D1DeviceContext self, ID2D1Effect* effect,
Vector2 targetOffset,
InterpolationMode interpolationMode = InterpolationMode.Linear,
CompositeMode compositeMode = CompositeMode.SourceOver)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- DrawImage(effect, &targetOffset, null, interpolationMode, compositeMode);
+ self.DrawImage(effect, &targetOffset, null, interpolationMode, compositeMode);
}
- public void DrawImage(ID2D1Image* image,
+ public static void DrawImage(
+ ref this TD2D1DeviceContext self, ID2D1Image* image,
Vector2 targetOffset,
RectF* imageRectangle,
InterpolationMode interpolationMode = InterpolationMode.Linear,
CompositeMode compositeMode = CompositeMode.SourceOver)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- DrawImage(image, &targetOffset, imageRectangle, interpolationMode, compositeMode);
+ self.DrawImage(image, &targetOffset, imageRectangle, interpolationMode, compositeMode);
}
- public void DrawImage(ID2D1Effect* effect,
+ public static void DrawImage(
+ ref this TD2D1DeviceContext self, ID2D1Effect* effect,
Vector2 targetOffset,
RectF* imageRectangle,
InterpolationMode interpolationMode = InterpolationMode.Linear,
CompositeMode compositeMode = CompositeMode.SourceOver)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- DrawImage(effect, &targetOffset, imageRectangle, interpolationMode, compositeMode);
+ self.DrawImage(effect, &targetOffset, imageRectangle, interpolationMode, compositeMode);
}
- public void DrawGdiMetafile(ID2D1GdiMetafile* gdiMetafile, Vector2 targetOffset)
+ public static void DrawGdiMetafile(
+ ref this TD2D1DeviceContext self, ID2D1GdiMetafile* gdiMetafile, Vector2 targetOffset)
+ where TD2D1DeviceContext : unmanaged, ID2D1DeviceContext.Interface
{
- DrawGdiMetafile(gdiMetafile, &targetOffset);
+ self.DrawGdiMetafile(gdiMetafile, &targetOffset);
}
-}
-public static unsafe partial class ID2D1DeviceContextExtensions
-{
public static HResult SetDpiCompensatedEffectInput(
ref this TD2D1DeviceContext self,
ID2D1Effect* effect,
diff --git a/src/Vortice.Win32.Graphics.Direct2D/ID2D1EffectContext.cs b/src/Vortice.Win32.Graphics.Direct2D/ID2D1EffectContext.cs
index d936aca..7957291 100644
--- a/src/Vortice.Win32.Graphics.Direct2D/ID2D1EffectContext.cs
+++ b/src/Vortice.Win32.Graphics.Direct2D/ID2D1EffectContext.cs
@@ -5,17 +5,42 @@ using static Win32.Apis;
namespace Win32.Graphics.Direct2D;
-public unsafe partial struct ID2D1EffectContext
+public static unsafe class ID2D1EffectContextExtensions
{
- public HResult CreateEffect(in Guid effectId, ID2D1Effect** effect)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static TFeature CheckFeatureSupport(ref this TID2D1EffectContext self, Feature feature)
+ where TID2D1EffectContext : unmanaged, ID2D1EffectContext.Interface
+ where TFeature : unmanaged
{
- return CreateEffect((Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in effectId)), effect);
+ TFeature featureData = default;
+ ThrowIfFailed(self.CheckFeatureSupport(feature, &featureData, (uint)sizeof(TFeature)));
+ return featureData;
}
- public ComPtr CreateEffect(in Guid effectId)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static HResult CheckFeatureSupport(ref this TID2D1EffectContext self, Feature feature, ref TFeature featureData)
+ where TID2D1EffectContext : unmanaged, ID2D1EffectContext.Interface
+ where TFeature : unmanaged
+ {
+ fixed (TFeature* featureDataPtr = &featureData)
+ {
+ return self.CheckFeatureSupport(feature, featureDataPtr, (uint)sizeof(TFeature));
+ }
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static HResult CreateEffect(ref this TID2D1EffectContext self, in Guid effectId, ID2D1Effect** effect)
+ where TID2D1EffectContext : unmanaged, ID2D1EffectContext.Interface
+ {
+ return self.CreateEffect((Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in effectId)), effect);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static ComPtr CreateEffect(ref this TID2D1EffectContext self, in Guid effectId)
+ where TID2D1EffectContext : unmanaged, ID2D1EffectContext.Interface
{
using ComPtr effect = default;
- ThrowIfFailed(CreateEffect((Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in effectId)), effect.GetAddressOf()));
+ ThrowIfFailed(self.CreateEffect((Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in effectId)), effect.GetAddressOf()));
return effect.Move();
}
}
diff --git a/src/Vortice.Win32.Graphics.Direct3D11/ID3D11Device.cs b/src/Vortice.Win32.Graphics.Direct3D11/ID3D11Device.cs
index b06b749..d12d619 100644
--- a/src/Vortice.Win32.Graphics.Direct3D11/ID3D11Device.cs
+++ b/src/Vortice.Win32.Graphics.Direct3D11/ID3D11Device.cs
@@ -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 CheckFeatureSupport(ref this TD3D11Device self, BufferDescription* description, SubresourceData* initialData = default)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static TFeature CheckFeatureSupport(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(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 CreateBuffer(ref this TD3D11Device self, BufferDescription* description, SubresourceData* initialData = default)
where TD3D11Device : unmanaged, ID3D11Device.Interface
{
using ComPtr buffer = default;
diff --git a/src/Vortice.Win32.Graphics.Direct3D11/ID3D11VideoDevice2.cs b/src/Vortice.Win32.Graphics.Direct3D11/ID3D11VideoDevice2.cs
new file mode 100644
index 0000000..6db98a4
--- /dev/null
+++ b/src/Vortice.Win32.Graphics.Direct3D11/ID3D11VideoDevice2.cs
@@ -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(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(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));
+ }
+ }
+}