랭킹으로 돌아가기

Sergio0694/ComputeSharp

C#

A .NET library to run C# code in parallel on the GPU through DX12, D2D1, and dynamically generated HLSL compute and pixel shaders, with the goal of making GPU computing easy to use for all .NET developers! 🚀

csharpnetstandarddirectxgpuhlslhlsl-shadervisual-studiolibraryperformancegpgpucomputingshader
스타 성장
스타
3.1k
포크
149
주간 성장
이슈
35
1k2k3k
2019년 8월2021년 11월2024년 3월2026년 7월
README


.NET NuGet NuGet

What is it? 🚀

ComputeSharp is a .NET library to run C# code in parallel on the GPU through DX12, D2D1, and dynamically generated HLSL compute and pixel shaders. The available APIs let you access GPU devices, allocate GPU buffers and textures, move data between them and the RAM, write compute shaders entirely in C# and have them run on the GPU. The goal of this project is to make GPU computing easy to use for all .NET developers!

What can it actually do? ✨

Since a video is worth a thousand words, here's a showcase of some pixel shaders (originally from shadertoy.com), ported from GLSL to C# and running with ComputeSharp in a WinUI 3 sample app. You can use this library to create all sorts of things from scientific simulations, to animated backgrounds, audio visualizers and more!

https://user-images.githubusercontent.com/10199417/126792509-c11feb11-a609-4fab-86b3-426d43df6d90.mp4

Where is it being used? ✈️

ComputeSharp is production ready, and it's being used by several projects running on millions of devices!

Here's a showcase of some of them:

Screenshot Project
image The Microsoft Store is a first party application that ships with Windows and allows users to discover, search and download digital content such as apps, games, movies and more. Starting from the January 2023 release, it is using ComputeSharp.D2D1.Uwp to leverage custom effects and pixel shaders to power several graphics elements in the application, such as the new app cards.
image Paint.NET is an image and photo editing application for Windows. Starting from its 5.0 release, it is using ComputeSharp.D2D1 as a core component of its architecture (in fact, ComputeSharp.D2D1 was initially developed specifically to support Paint.NET!). The library is used both internally to accelerate dozens of built-in effects using custom D2D1 pixel shaders, as well as for external plugins.

Try out the sample app! 💻

The sample app is available in the Microsoft Store, showcasing several pixel shaders all powered by ComputeSharp!

Download from the Microsoft Store

Available packages 📦

Name Description
ComputeSharp The main library, with compiled shaders support
ComputeSharp.D3D12MemoryAllocator An extension library for ComputeSharp, adding D3D12MA as the memory allocator for graphics resources.
ComputeSharp.Dxc An extension library for ComputeSharp, bundling the DXC compiler and enabling shader reflection
ComputeSharp.Pix An extension library for ComputeSharp, enabling PIX support to produce debugging information
ComputeSharp.Uwp A UWP library with controls to render DX12 shaders powered by ComputeSharp
ComputeSharp.WinUI A WinUI 3 library with controls to render DX12 shaders powered by ComputeSharp
ComputeSharp.D2D1 A library to write D2D1 pixel shaders entirely with C# code, and to easily register and create ID2D1Effect-s from them
ComputeSharp.D2D1.Uwp A UWP library with custom effects for Win2D powered by ComputeSharp.D2D1
ComputeSharp.D2D1.WinUI A WinUI 3 library with custom effects for Win2D powered by ComputeSharp.D2D1

Preview builds are available at https://pkgs.computesharp.dev/index.json (as well as GitHub Packages).

Documentation 📖

All the documentation for ComputeSharp is available in the wiki pages. That includes a recap of everything in this readme, as well as info and detailed samples on all features and APIs from the available packages. Make sure to go through it to get familiar with this library!

Where can I learn more? 📑

I've written about ComputeSharp in my master's thesis in Engineering in Computer Engineering, which you can find in this repo! There, I cover everything there is to know about this project: the basics of COM, WinRT, UWP XAML, and Win2D, the underlying infrastructure for ComputeSharp both in terms of DirectX interop and its source generators (including an extensive breakdown of all generated code and what it does), how HLSL intrinsics are transpiled, how I extended Win2D to add support for custom effects, how ComputeSharp leverages this in its PixelShaderEffect<T> type to seamlessly integrate with Win2D, and more! I also included a detailed case study on how we implemented several pixel shaders in the Microsoft Store, with an overview of their effect graphs, and some code snippets as well.

If you're curious, you can read the thesis here!

Sponsors 🎁

Huge thanks to these sponsors for directly supporting my work on ComputeSharp, it means a lot! 🙌

Special thanks

ComputeSharp was originally based on some of the code from the DX12GameEngine project by Amin Delavar.

Additionally, ComputeSharp uses NuGet packages from the following repositories:

관련 저장소
jellyfin/jellyfin

The Free Software Media System - Server Backend & API

C#GNU General Public License v2.0jellyfincsharp
jellyfin.org
54.5k5.1k
files-community/Files

A modern file manager that helps users organize their files and folders.

C#MIT Licensefluent-designxaml
files.community
44.4k2.8k
ShareX/ShareX

ShareX is a free and open-source application that enables users to capture or record any area of their screen with a single keystroke. It also supports uploading images, text, and various file types to a wide range of destinations.

C#GNU General Public License v3.0screen-capturescreen-recorder
getsharex.com
38.7k3.9k
doocs/leetcode

🔥LeetCode solutions in any programming language | 多种编程语言实现 LeetCode、《剑指 Offer(第 2 版)》、《程序员面试金典(第 6 版)》题解

JavaMavenCreative Commons Attribution Share Alike 4.0 Internationalalgorithmscpp
leetcode.doocs.org
36.3k9.4k
DevToys-app/DevToys

A Swiss Army knife for developers.

C#MIT Licensesyntax-highlightingdeveloper-tools
devtoys.app
31.8k1.8k
AvaloniaUI/Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The future of .NET UI

C#MIT Licensec-sharpxaml
avaloniaui.net
31.2k2.8k
microsoft/calculator

Windows Calculator: A simple yet powerful calculator that ships with Windows

C++MIT Licenseuwpwindows
31k5.8k
BeyondDimension/SteamTools

🛠「Watt Toolkit」是一个开源跨平台的多功能 Steam 工具箱。

C#GNU General Public License v3.0steamcsharp
steampp.net
26.2k1.7k
pulumi/pulumi

Pulumi - Infrastructure as Code in any programming language 🚀

GoGo ModulesApache License 2.0infrastructure-as-codeserverless
pulumi.com
25.5k1.4k
mxgmn/WaveFunctionCollapse

Bitmap & tilemap generation from a single example with the help of ideas from quantum mechanics

C#Otherprocedural-generationmachine-learning
25.2k1.3k
quozd/awesome-dotnet

A collection of awesome .NET libraries, tools, frameworks and software

Creative Commons Zero v1.0 Universaldotnetawesome
21.5k2.9k
thangchung/awesome-dotnet-core

:honeybee: A collection of awesome .NET core libraries, tools, frameworks and software

C#dotnet-coreawesome-list
21.3k3k