• Stars
    star
    2,690
  • Rank 16,975 (Top 0.4 %)
  • Language
    C#
  • License
    MIT License
  • Created over 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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! πŸš€


.NET 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!

ComputeSharpWinUI3.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!

Get it from Microsoft

Available packages πŸ“¦

Name Description Latest version
ComputeSharp The main library, with compiled shaders support NuGet
ComputeSharp.Dynamic An extension for ComputeSharp, enabling dynamic shader compilation at runtime and shader metaprogramming NuGet
ComputeSharp.Pix An extension library for ComputeSharp, enabling PIX support to produce debugging information NuGet
ComputeSharp.Uwp A UWP library (targeting .NET Standard 2.0) with controls to render DX12 shaders powered by ComputeSharp NuGet
ComputeSharp.WinUI A WinUI 3 library (targeting .NET 6) with controls to render DX12 shaders powered by ComputeSharp NuGet
ComputeSharp.D2D1 A library to write D2D1 pixel shaders entirely with C# code, and to easily register and create ID2D1Effect-s from them NuGet

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!

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:

More Repositories

1

PolySharp

PolySharp provides generated, source-only polyfills for C# language features, to easily use all runtime-agnostic features downlevel. Add a reference, set your C# version to latest and have fun! πŸš€
C#
1,731
star
2

NeuralNetwork.NET

A TensorFlow-inspired neural network library built from scratch in C# 7.3 for .NET Standard 2.0, with GPU support through cuDNN
C#
540
star
3

BinaryPack

The fastest and most memory efficient binary serialization library for .NET Standard 2.1, powered by dynamic IL generation
C#
331
star
4

UICompositionAnimations

A powerful and easy to use library to work with Composition and XAML animations and Win2D effects
C#
91
star
5

Brainf_ckSharp

A complete and full-featured Brainf_ck IDE/console for Windows 10 (UWP), with a high-performance REPL interpreter
C#
56
star
6

ReflectionToIL

A demonstration and benchmark of different approaches to load closure fields using reflection and dynamic code generation
C#
30
star
7

privatelike

An attribute, generator and analyzer to declare "private-like" types in C# (internal but producing errors if not used as if they were declared as private)
C#
10
star
8

BigWatson

A complete, ligthweight and self-contained .NET Standard 2.0 offline exception logging library, powered by Realm
C#
9
star
9

quickup

A .NET Core 2.1 CLI tool to quickly create one-way backups from one folder to another
C#
5
star
10

Win2DSample

A simple and minimal Win2D sample in an unpackaged Win32 app
C#
4
star
11

GarbageCollectorC

A simple, multi-thread implementation of a GC in C
C
3
star
12

List_T

A parametric list in C with supports with LINQ-style functions and lambda expressions
C
3
star
13

clup

A no-nonsense .NET Core 2.1 CLI duplicate files remover
C#
2
star
14

FizzBuzz

The "Fizz-Buzz test" is an interview question designed to help filter out the 99.5% of programming job candidates who can't seem to program their way out of a wet paper bag. The text of the programming assignment is as follows: "Write a program that prints the numbers from 1 to 100. But for multiples of three print β€œFizz” instead of the number and for the multiples of five print β€œBuzz”. For numbers which are multiples of both three and five print β€œFizzBuzz”."
PowerShell
1
star
15

Snake

The classic arcade game Snake written in C
C
1
star
16

sepconv-gan

A TensorFlow-based network to perform video frame interpolation
Python
1
star