diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs
index 1dfe3a03..4fb83784 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs
@@ -67,6 +67,10 @@ public static class D2D1ReflectionServices
d3D11ShaderReflection.Get()->GetDesc(&d3D11ShaderDescription).Assert();
+ D3D_FEATURE_LEVEL d3DFeatureLevel = default;
+
+ d3D11ShaderReflection.Get()->GetMinFeatureLevel(&d3DFeatureLevel).Assert();
+
return new(
CompilerVersion: new string(d3D11ShaderDescription.Creator),
HlslSource: hlslSource,
@@ -92,6 +96,7 @@ public static class D2D1ReflectionServices
MovcInstructionCount: d3D11ShaderReflection.Get()->GetMovcInstructionCount(),
MovInstructionCount: d3D11ShaderReflection.Get()->GetMovInstructionCount(),
InterfaceSlotCount: d3D11ShaderReflection.Get()->GetNumInterfaceSlots(),
- RequiresDoublePrecisionSupport: (d3D11ShaderReflection.Get()->GetRequiresFlags() & (D3D.D3D_SHADER_REQUIRES_DOUBLES | D3D.D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS)) != 0);
+ RequiresDoublePrecisionSupport: (d3D11ShaderReflection.Get()->GetRequiresFlags() & (D3D.D3D_SHADER_REQUIRES_DOUBLES | D3D.D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS)) != 0,
+ FeatureLevel: (D3DFeatureLevel)d3DFeatureLevel);
}
}
\ No newline at end of file
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderInfo.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderInfo.cs
index b723db4b..0c0f0d0c 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderInfo.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderInfo.cs
@@ -28,6 +28,7 @@ namespace ComputeSharp.D2D1.Interop;
/// The number of mov instructions used.
/// The number of interface slots used.
/// Indicates whether support for double precision floating point numbers is required.
+/// The feature level for the shader.
public sealed record D2D1ShaderInfo(
string CompilerVersion,
string HlslSource,
@@ -53,4 +54,5 @@ public sealed record D2D1ShaderInfo(
uint MovcInstructionCount,
uint MovInstructionCount,
uint InterfaceSlotCount,
- bool RequiresDoublePrecisionSupport);
\ No newline at end of file
+ bool RequiresDoublePrecisionSupport,
+ D3DFeatureLevel FeatureLevel);
\ No newline at end of file
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D3DFeatureLevel.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D3DFeatureLevel.cs
new file mode 100644
index 00000000..c045e133
--- /dev/null
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D3DFeatureLevel.cs
@@ -0,0 +1,69 @@
+using static TerraFX.Interop.DirectX.D3D_FEATURE_LEVEL;
+
+namespace ComputeSharp.D2D1.Interop;
+
+///
+/// Describes the set of features targeted by a Direct3D device.
+///
+public enum D3DFeatureLevel
+{
+ ///
+ /// Allows Microsoft Compute Driver Model (MCDM) devices to be used, or more feature-rich devices (such as
+ /// traditional GPUs) that support a superset of the functionality. MCDM is the overall driver model for
+ /// compute-only; it's a scaled-down peer of the larger scoped Windows Device Driver Model (WDDM).
+ ///
+ FeatureLevel1_0Core = D3D_FEATURE_LEVEL_1_0_CORE,
+
+ ///
+ /// Targets features supported by feature level 9.1, including shader model 2.
+ ///
+ FeatureLevel9_1 = D3D_FEATURE_LEVEL_9_1,
+
+ ///
+ /// Targets features supported by feature level 9.2, including shader model 2.
+ ///
+ FeatureLevel9_2 = D3D_FEATURE_LEVEL_9_2,
+
+ ///
+ /// Targets features supported by feature level 9.3, including shader model 2.
+ ///
+ FeatureLevel9_3 = D3D_FEATURE_LEVEL_9_3,
+
+ ///
+ /// Targets features supported by Direct3D 10.0, including shader model 4.
+ ///
+ FeatureLevel10 = D3D_FEATURE_LEVEL_10_0,
+
+ ///
+ /// Targets features supported by Direct3D 10.1, including shader model 4.
+ ///
+ FeatureLevel10_1 = D3D_FEATURE_LEVEL_10_1,
+
+ ///
+ /// Targets features supported by Direct3D 11.0, including shader model 5.
+ ///
+ FeatureLevel11_0 = D3D_FEATURE_LEVEL_11_0,
+
+ ///
+ /// Targets features supported by Direct3D 11.1, including shader model 5 and logical blend operations. This
+ /// feature level requires a display driver that is at least implemented to WDDM for Windows 8 (WDDM 1.2).
+ ///
+ FeatureLevel11_1 = D3D_FEATURE_LEVEL_11_1,
+
+ ///
+ /// Targets features supported by Direct3D 12.0, including shader model 5.
+ ///
+ FeatureLevel12 = D3D_FEATURE_LEVEL_12_0,
+
+ ///
+ /// Targets features supported by Direct3D 12.1, including shader model 5.
+ ///
+ FeatureLevel12_1 = D3D_FEATURE_LEVEL_12_1,
+
+ ///
+ /// Targets features supported by Direct3D 12.2, including shader model 6.5. For more information about feature
+ /// level 12_2, see its specification page.
+ /// Feature level 12_2 is available in Windows SDK builds 20170 and later.
+ ///
+ FeatureLevel12_2 = D3D_FEATURE_LEVEL_12_2
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/headers/d3dcommon/D3D_FEATURE_LEVEL.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/headers/d3dcommon/D3D_FEATURE_LEVEL.cs
new file mode 100644
index 00000000..3ef2ffc0
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/headers/d3dcommon/D3D_FEATURE_LEVEL.cs
@@ -0,0 +1,21 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from d3dcommon.h in microsoft/DirectX-Headers tag v1.606.4
+// Original source is Copyright © Microsoft. Licensed under the MIT license
+
+namespace TerraFX.Interop.DirectX;
+
+internal enum D3D_FEATURE_LEVEL
+{
+ D3D_FEATURE_LEVEL_1_0_CORE = 0x1000,
+ D3D_FEATURE_LEVEL_9_1 = 0x9100,
+ D3D_FEATURE_LEVEL_9_2 = 0x9200,
+ D3D_FEATURE_LEVEL_9_3 = 0x9300,
+ D3D_FEATURE_LEVEL_10_0 = 0xa000,
+ D3D_FEATURE_LEVEL_10_1 = 0xa100,
+ D3D_FEATURE_LEVEL_11_0 = 0xb000,
+ D3D_FEATURE_LEVEL_11_1 = 0xb100,
+ D3D_FEATURE_LEVEL_12_0 = 0xc000,
+ D3D_FEATURE_LEVEL_12_1 = 0xc100,
+ D3D_FEATURE_LEVEL_12_2 = 0xc200
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3d11shader/ID3D11ShaderReflection.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3d11shader/ID3D11ShaderReflection.cs
index 76a3893f..d9c47d03 100644
--- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3d11shader/ID3D11ShaderReflection.cs
+++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3d11shader/ID3D11ShaderReflection.cs
@@ -94,6 +94,13 @@ namespace TerraFX.Interop.DirectX
return ((delegate* unmanaged[Stdcall])(lpVtbl[18]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(19)]
+ public HRESULT GetMinFeatureLevel([NativeTypeName("enum D3D_FEATURE_LEVEL *")] D3D_FEATURE_LEVEL* pLevel)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[19]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this), pLevel);
+ }
+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(20)]
public uint GetThreadGroupSize(uint* pSizeX, uint* pSizeY, uint* pSizeZ)
diff --git a/src/TerraFX.Interop.Windows.D2D1/TerraFX.Interop.Windows.D2D1.projitems b/src/TerraFX.Interop.Windows.D2D1/TerraFX.Interop.Windows.D2D1.projitems
index f607566b..d9f59f77 100644
--- a/src/TerraFX.Interop.Windows.D2D1/TerraFX.Interop.Windows.D2D1.projitems
+++ b/src/TerraFX.Interop.Windows.D2D1/TerraFX.Interop.Windows.D2D1.projitems
@@ -10,6 +10,7 @@
+