ComputeWeave.D2D1 2.6.0

dotnet add package ComputeWeave.D2D1 --version 2.6.0
                    
NuGet\Install-Package ComputeWeave.D2D1 -Version 2.6.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ComputeWeave.D2D1" Version="2.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ComputeWeave.D2D1" Version="2.6.0" />
                    
Directory.Packages.props
<PackageReference Include="ComputeWeave.D2D1" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ComputeWeave.D2D1 --version 2.6.0
                    
#r "nuget: ComputeWeave.D2D1, 2.6.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ComputeWeave.D2D1@2.6.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ComputeWeave.D2D1&version=2.6.0
                    
Install as a Cake Addin
#tool nuget:?package=ComputeWeave.D2D1&version=2.6.0
                    
Install as a Cake Tool

ComputeWeave.D2D1

English | 日本語

A companion package to ComputeWeave. It writes Direct2D pixel shaders entirely in C# and registers them as ID2D1Effect.

This is not an extension of the ComputeWeave package and does not reference it. What the two share is the base layer in ComputeWeave.Core: the primitive types and the Hlsl intrinsics. The shaders here are executed by Direct2D rather than on the Direct3D 12 compute queue, so nothing in this package creates or uses a GraphicsDevice, and the declarative layer the fork adds does not apply to them.

A pixel shader is a partial struct implementing ID2D1PixelShader.

[D2DInputCount(1)]
[D2DInputSimple(0)]
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
[D2DGeneratedPixelShaderDescriptor]
public readonly partial struct DifferenceEffect(float amount) : ID2D1PixelShader
{
    public float4 Execute()
    {
        float4 color = D2D.GetInput(0);
        float3 rgb = Hlsl.Saturate(this.amount - color.RGB);

        return new(rgb, 1);
    }
}

The bytecode and the constant buffer are then available without a device.

ReadOnlyMemory<byte> bytecode = D2D1PixelShader.LoadBytecode<DifferenceEffect>();
ReadOnlyMemory<byte> buffer = D2D1PixelShader.GetConstantBuffer(new DifferenceEffect(1));

D2D1PixelShaderEffect registers a shader as a Direct2D effect and creates ID2D1Effect instances from it, with a custom draw transform when one is needed. D2D1ReflectionServices reports the generated HLSL source and the shader statistics.

Shaders are compiled to DXBC with FXC, which is what Direct2D accepts. d3dcompiler_47.dll ships with Windows, so this package bundles no compiler of its own.

More

The complete API reference is in the repository.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.6.0 76 9/13/2026
2.5.0 109 9/7/2026
2.4.0 100 9/5/2026
2.3.0 110 8/31/2026