ComputeSharp.D2D1
3.0.0-preview1
Prefix Reserved
See the version list below for details.
dotnet add package ComputeSharp.D2D1 --version 3.0.0-preview1
NuGet\Install-Package ComputeSharp.D2D1 -Version 3.0.0-preview1
<PackageReference Include="ComputeSharp.D2D1" Version="3.0.0-preview1" />
paket add ComputeSharp.D2D1 --version 3.0.0-preview1
#r "nuget: ComputeSharp.D2D1, 3.0.0-preview1"
// Install ComputeSharp.D2D1 as a Cake Addin #addin nuget:?package=ComputeSharp.D2D1&version=3.0.0-preview1&prerelease // Install ComputeSharp.D2D1 as a Cake Tool #tool nuget:?package=ComputeSharp.D2D1&version=3.0.0-preview1&prerelease
Overview 📖
ComputeSharp.D2D1 is a library to write D2D1 pixel shaders entirely with C# code, and to easily register and create ID2D1Effect
-s from them. This shares the same base APIs (primitives, intrinsics, etc.) as ComputeSharp, but then adds D2D1 specific support, instead of using DX12 compute shaders like the main package. This means it offers the ability to implement D2D1 pixel shaders, and to then either load them manually, or to register a D2D1 effect using them, optionally with a custom draw transform as well.
Quick start 🚀
Here's a simple D2D1 pixel shader written using ComputeSharp.D2D1:
[D2DInputCount(1)]
[D2DInputSimple(0)]
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
[D2DGeneratedPixelShaderDescriptor]
public readonly partial struct DifferenceEffect(float amount) : ID2D1PixelShader
{
/// <inheritdoc/>
public float4 Execute()
{
float4 color = D2D.GetInput(0);
float3 rgb = Hlsl.Saturate(this.amount - color.RGB);
return new(rgb, 1);
}
}
This can then be used directly to get the shader bytecode and the buffer, like so:
ReadOnlyMemory<byte> bytecode = D2D1PixelShader.LoadBytecode<DifferenceEffect>();
ReadOnlyMemory<byte> buffer = D2D1PixelShader.GetConstantBuffer(new DifferenceEffect(1));
There are also several other APIs to easily register a pixel shader effect from a shader written using ComputeSharp.D2D1, and to then create an ID2D1Effect
instance from it (from the D2D1PixelShaderEffect
type), as well as for reflecting into a shader and extract information about it, such as its HLSL source code (from the D2D1ReflectionServices
type).
There's more!
For a complete list of all features available in ComputeSharp, check the documentation in the GitHub repo.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- ComputeSharp.Core (>= 3.0.0-preview1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on ComputeSharp.D2D1:
Package | Downloads |
---|---|
ComputeSharp.D2D1.Uwp
A UWP library with APIs to leverage D2D1 functionality with D2D1 pixel shaders powered by ComputeSharp.D2D1. |
|
ComputeSharp.D2D1.WinUI
A WinUI 3 library with APIs to leverage D2D1 functionality with D2D1 pixel shaders powered by ComputeSharp.D2D1. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.1.0-preview2 | 30 | 10/22/2024 |
3.1.0-preview1 | 73 | 9/19/2024 |
3.0.1 | 158 | 6/18/2024 |
3.0.0 | 63 | 6/10/2024 |
3.0.0-preview2 | 205 | 12/17/2023 |
3.0.0-preview1 | 109 | 11/24/2023 |
2.2.0-preview2 | 33 | 10/14/2024 |
2.2.0-preview1 | 160 | 10/10/2023 |
2.1.0 | 363 | 9/27/2023 |
2.1.0-preview3 | 118 | 7/9/2023 |
2.1.0-preview2 | 578 | 5/1/2023 |
2.1.0-preview1 | 89 | 4/27/2023 |
2.0.3 | 449 | 12/24/2022 |
2.0.2 | 98 | 12/9/2022 |
2.0.0 | 142 | 11/29/2022 |
2.0.0-preview2 | 117 | 10/22/2022 |
2.0.0-preview1 | 129 | 10/8/2022 |
2.0.0-alpha.29 | 109 | 9/19/2022 |
2.0.0-alpha.28 | 119 | 9/6/2022 |
2.0.0-alpha.27 | 148 | 8/22/2022 |
2.0.0-alpha.26 | 121 | 8/1/2022 |
2.0.0-alpha.25 | 133 | 6/6/2022 |
2.0.0-alpha.24 | 130 | 5/24/2022 |
2.0.0-alpha.23 | 127 | 5/12/2022 |
2.0.0-alpha.22 | 137 | 4/24/2022 |
2.0.0-alpha.21 | 135 | 4/21/2022 |