yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Tim FoleyOrganize landing page (#1769)f30c6e3b0

master
1.0 KiB13 linesraw

Slang Examples

This directory contains small example programs showing how to use the Slang language, compiler, and API.

  • The hello-world example shows a minimal example of using Slang shader code more or less like HLSL.

  • The shader-object example shows how Slang's support for interface types can be used to implement shader specialization with simpler logic than preprocessor-based techniques.

  • The gpu-printing example shows how Slang's support for string literals can be used to implement a cross-API "GPU printf" solution

Most of the examples presented here use a software layer called gfx (exposed via slang-gfx.h) to abstract over the differences between various target APIs/platforms (D3D11, D3D12, OpenGL, Vulkan, CUDA, and CPU). Using gfx is not a requirement for using Slang, but it provides a concrete example of how tight integration of Slang's features into a GPU abstraction layer can provide for a clean and usable application programming model.

1Slang Examples
2==============
3
4This directory contains small example programs showing how to use the Slang language, compiler, and API.
5
6* The [`hello-world`](hello-world/) example shows a minimal example of using Slang shader code more or less like HLSL.
7
8* The [`shader-object`](shader-object/) example shows how Slang's support for interface types can be used to implement shader specialization with simpler logic than preprocessor-based techniques.
9
10* The [`gpu-printing`](gpu-printing/) example shows how Slang's support for string literals can be used to implement a cross-API "GPU `printf`" solution
11
12Most of the examples presented here use a software layer called `gfx` (exposed via `slang-gfx.h`) to abstract over the differences between various target APIs/platforms (D3D11, D3D12, OpenGL, Vulkan, CUDA, and CPU).
13Using `gfx` is not a requirement for using Slang, but it provides a concrete example of how tight integration of Slang's features into a GPU abstraction layer can provide for a clean and usable application programming model.