2022-10-18 14:52:16 +11:00
|
|
|
# librashader
|
|
|
|
|
2022-11-21 18:38:23 +11:00
|
|
|
![image](https://user-images.githubusercontent.com/1000503/202991618-e3e38e05-f0de-429d-a3ee-4cd0b077f88f.png)
|
|
|
|
|
|
|
|
<small>*crt-royale-fake-bloom*</small>
|
2022-11-19 18:35:02 +11:00
|
|
|
|
2022-11-14 17:49:51 +11:00
|
|
|
A preprocessor, compiler, and runtime for RetroArch 'slang' shaders, rewritten in pure Rust.
|
2022-10-18 14:52:16 +11:00
|
|
|
|
2022-11-14 17:49:51 +11:00
|
|
|
Heavily WIP.
|
|
|
|
|
2022-11-22 10:49:51 +11:00
|
|
|
## Supported Render APIs
|
|
|
|
librashader supports OpenGL 3, Vulkan, DirectX 11, and DirectX 12. Support is WIP for all runtimes except OpenGL 3. Older versions
|
|
|
|
of DirectX and OpenGL, as well as Metal, are not supported (but pull-requests are welcome).
|
|
|
|
|
|
|
|
| **API** | **Status** | **`librashader` feature** |
|
|
|
|
|------------|------------|---------------------------|
|
|
|
|
| OpenGL 3 | ✔ | `gl` |
|
|
|
|
| Vulkan | 🚧 | `vk` |
|
|
|
|
| DirectX 11 | 🚧 | `dx11` |
|
|
|
|
| DirectX 12 | 🚧 | `dx12` |
|
|
|
|
| OpenGL 2 | ❌ | |
|
|
|
|
| DirectX 9 | ❌ | |
|
|
|
|
| Metal | ❌ | |
|
|
|
|
|
2022-11-24 17:37:16 +11:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
🚧 *`librashader_ld` is WIP* 🚧
|
|
|
|
|
|
|
|
librashader provides both a Rust API under the `librashader` crate, and a C API. Both APIs are first-class, fully supported.
|
|
|
|
|
|
|
|
The librashader C API is best used by linking statically with `librashader_ld`, which implements a loader that dynamically
|
|
|
|
loads the librashader (`librashader.so` or `rashader.dll`) implementation in the search path.
|
2022-11-22 10:49:51 +11:00
|
|
|
|
2022-11-14 17:49:51 +11:00
|
|
|
## License
|
2022-11-22 12:45:57 +11:00
|
|
|
The core parts of librashader such as the preprocessor, the preset parser,
|
|
|
|
the reflection library, and the runtimes, are all licensed under the Mozilla Public License version 2.0.
|
2022-11-14 17:49:51 +11:00
|
|
|
|
|
|
|
The librashader C API, i.e. its headers and definitions, *not its implementation in `librashader_capi`*,
|
2022-11-24 17:37:16 +11:00
|
|
|
are more permissively licensed, and may allow you to use librashader in your permissively
|
2022-11-14 17:49:51 +11:00
|
|
|
licensed or proprietary project.
|
|
|
|
|
2022-11-24 17:37:16 +11:00
|
|
|
To facilitate easier use of librashader in projects incompatible with MPL-2.0, `librashader_ld`
|
|
|
|
implements a loader which thunks its calls to any `librashader.so` or `rashader.dll`
|
|
|
|
library found in the load path. A non-MPL-2.0 compatible project may link against
|
|
|
|
`librashader_ld` to use the librashader runtime, *provided that `librashader.so` or `rashader.dll`
|
|
|
|
are distributed under the restrictions of MPLv2*.
|
2022-11-14 17:49:51 +11:00
|
|
|
|
2022-11-24 17:37:16 +11:00
|
|
|
Note that this means that if your project is not compatible with MPL-2.0, you **can not distribute `librashader.so` or `rashader.dll`**
|
|
|
|
alongside your project. The end user must obtain the implementation of librashader themselves.
|
2022-11-22 12:45:57 +11:00
|
|
|
|
2022-11-24 17:37:16 +11:00
|
|
|
At your discretion, you may instead choose to distribute `librashader` under the terms of GPLv3 rather than MPL-2.0
|