Compare commits

...

8 commits

Author SHA1 Message Date
Alex Janka 71584cd9af fix double free 2024-02-09 10:14:23 +11:00
Alex Janka 5d59f70649 shaders can be either a path or a string 2024-02-09 10:14:23 +11:00
chyyran b7f62dc378 chore: Release 2024-02-07 23:56:09 -05:00
chyyran b796494cc6 build: remove libvulkan buildtime dependency 2024-02-07 23:55:33 -05:00
chyyran 91794dd353 build: remove cmake and python dependency 2024-02-07 23:55:33 -05:00
chyyran 2b208f1848 dep: remove shaderc dependency 2024-02-07 23:55:33 -05:00
chyyran 47f6e0f10e chore: Release 2024-02-07 00:00:18 -05:00
chyyran 665570342c doc(lib): add wgpu-types to librashader deps 2024-02-06 23:59:55 -05:00
35 changed files with 261 additions and 384 deletions

View file

@ -26,10 +26,6 @@ jobs:
toolchain: nightly
override: true
target: aarch64-unknown-linux-gnu
- uses: actions/setup-python@v1
name: Setup Python 3.11
with:
python-version: '3.11'
- name: Install ARM64 cross-compilation dependencies
continue-on-error: true
run: |
@ -38,7 +34,7 @@ jobs:
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy main restricted" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted" | sudo tee -a /etc/apt/sources.list
sudo apt-get update || true
sudo apt-get -y install libvulkan-dev:arm64 g++-aarch64-linux-gnu gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
sudo apt-get -y install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
- name: Build dynamic library
run: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc cargo run -p librashader-build-script -- --profile ${{ matrix.profile }} --target aarch64-unknown-linux-gnu
- name: Upload build artifacts

View file

@ -26,15 +26,6 @@ jobs:
with:
toolchain: nightly
override: true
- uses: actions/setup-python@v1
name: Setup Python 3.11
with:
python-version: '3.11'
- name: Install Vulkan SDK
uses: humbletim/install-vulkan-sdk@v1.1.1
with:
version: latest
cache: true
- name: Build dynamic library
run: cargo run -p librashader-build-script -- --profile ${{ matrix.profile }}
- name: Upload build artifacts

152
Cargo.lock generated
View file

@ -404,9 +404,9 @@ checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205"
[[package]]
name = "bytemuck"
version = "1.14.1"
version = "1.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed2490600f404f2b94c167e31d3ed1d5f3c225a0f3b80230053b3e0b7b962bd9"
checksum = "ea31d69bda4949c1c1562c1e6f042a1caefac98cdc8a298260a2ff41c1e2d42b"
dependencies = [
"bytemuck_derive",
]
@ -1341,6 +1341,28 @@ dependencies = [
"web-sys",
]
[[package]]
name = "glslang"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffa3b9c49e9b4270061e25e7e3946d979a9394a21ac51edcb72e7c17874d3a54"
dependencies = [
"glslang-sys",
"once_cell",
"rustc-hash",
"thiserror",
]
[[package]]
name = "glslang-sys"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3c81cefc876b4fd65354162037a464768bc5bada8b02d93b64e18186ae5cb7e"
dependencies = [
"cc",
"glob",
]
[[package]]
name = "glutin_wgl_sys"
version = "0.5.0"
@ -1701,13 +1723,13 @@ dependencies = [
[[package]]
name = "librashader"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
dependencies = [
"ash",
"librashader-cache",
"librashader-common 0.2.0-beta.5",
"librashader-common 0.2.0-beta.7",
"librashader-preprocess",
"librashader-presets 0.2.0-beta.5",
"librashader-presets 0.2.0-beta.7",
"librashader-reflect",
"librashader-runtime",
"librashader-runtime-d3d11",
@ -1716,6 +1738,7 @@ dependencies = [
"librashader-runtime-vk",
"librashader-runtime-wgpu",
"wgpu",
"wgpu-types",
"windows 0.48.0",
]
@ -1729,7 +1752,7 @@ dependencies = [
[[package]]
name = "librashader-cache"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
dependencies = [
"bincode",
"blake3",
@ -1745,7 +1768,7 @@ dependencies = [
[[package]]
name = "librashader-capi"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
dependencies = [
"ash",
"gl",
@ -1768,7 +1791,7 @@ dependencies = [
[[package]]
name = "librashader-common"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
dependencies = [
"ash",
"gl",
@ -1779,11 +1802,11 @@ dependencies = [
[[package]]
name = "librashader-preprocess"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
dependencies = [
"encoding_rs",
"glob",
"librashader-common 0.2.0-beta.5",
"librashader-common 0.2.0-beta.7",
"librashader-presets 0.1.4",
"nom",
"rayon",
@ -1806,10 +1829,10 @@ dependencies = [
[[package]]
name = "librashader-presets"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
dependencies = [
"glob",
"librashader-common 0.2.0-beta.5",
"librashader-common 0.2.0-beta.7",
"nom",
"nom_locate",
"num-traits",
@ -1818,21 +1841,21 @@ dependencies = [
[[package]]
name = "librashader-reflect"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
dependencies = [
"bitflags 1.3.2",
"bytemuck",
"glslang",
"indexmap 2.2.2",
"librashader-common 0.2.0-beta.5",
"librashader-common 0.2.0-beta.7",
"librashader-preprocess",
"librashader-presets 0.2.0-beta.5",
"librashader-presets 0.2.0-beta.7",
"librashader-spirv-cross",
"matches",
"naga",
"rspirv",
"rustc-hash",
"serde",
"shaderc",
"spirv",
"spirv-to-dxil",
"thiserror",
@ -1840,13 +1863,13 @@ dependencies = [
[[package]]
name = "librashader-runtime"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
dependencies = [
"bytemuck",
"image",
"librashader-common 0.2.0-beta.5",
"librashader-common 0.2.0-beta.7",
"librashader-preprocess",
"librashader-presets 0.2.0-beta.5",
"librashader-presets 0.2.0-beta.7",
"librashader-reflect",
"num-traits",
"rustc-hash",
@ -1854,15 +1877,15 @@ dependencies = [
[[package]]
name = "librashader-runtime-d3d11"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
dependencies = [
"array-concat",
"bytemuck",
"gfx-maths",
"librashader-cache",
"librashader-common 0.2.0-beta.5",
"librashader-common 0.2.0-beta.7",
"librashader-preprocess",
"librashader-presets 0.2.0-beta.5",
"librashader-presets 0.2.0-beta.7",
"librashader-reflect",
"librashader-runtime",
"librashader-spirv-cross",
@ -1874,7 +1897,7 @@ dependencies = [
[[package]]
name = "librashader-runtime-d3d12"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
dependencies = [
"array-concat",
"array-init",
@ -1882,9 +1905,9 @@ dependencies = [
"bytemuck",
"gfx-maths",
"librashader-cache",
"librashader-common 0.2.0-beta.5",
"librashader-common 0.2.0-beta.7",
"librashader-preprocess",
"librashader-presets 0.2.0-beta.5",
"librashader-presets 0.2.0-beta.7",
"librashader-reflect",
"librashader-runtime",
"librashader-spirv-cross",
@ -1898,15 +1921,15 @@ dependencies = [
[[package]]
name = "librashader-runtime-gl"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
dependencies = [
"bytemuck",
"gl",
"glfw 0.47.0",
"librashader-cache",
"librashader-common 0.2.0-beta.5",
"librashader-common 0.2.0-beta.7",
"librashader-preprocess",
"librashader-presets 0.2.0-beta.5",
"librashader-presets 0.2.0-beta.7",
"librashader-reflect",
"librashader-runtime",
"librashader-spirv-cross",
@ -1918,7 +1941,7 @@ dependencies = [
[[package]]
name = "librashader-runtime-vk"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
dependencies = [
"ash",
"ash-window",
@ -1926,9 +1949,9 @@ dependencies = [
"glfw 0.49.1",
"gpu-allocator 0.22.0",
"librashader-cache",
"librashader-common 0.2.0-beta.5",
"librashader-common 0.2.0-beta.7",
"librashader-preprocess",
"librashader-presets 0.2.0-beta.5",
"librashader-presets 0.2.0-beta.7",
"librashader-reflect",
"librashader-runtime",
"librashader-spirv-cross",
@ -1943,16 +1966,16 @@ dependencies = [
[[package]]
name = "librashader-runtime-wgpu"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
dependencies = [
"array-concat",
"bytemuck",
"config",
"env_logger",
"image",
"librashader-common 0.2.0-beta.5",
"librashader-common 0.2.0-beta.7",
"librashader-preprocess",
"librashader-presets 0.2.0-beta.5",
"librashader-presets 0.2.0-beta.7",
"librashader-reflect",
"librashader-runtime",
"log",
@ -2313,19 +2336,18 @@ dependencies = [
[[package]]
name = "num-integer"
version = "0.1.45"
version = "0.1.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
dependencies = [
"autocfg",
"num-traits",
]
[[package]]
name = "num-iter"
version = "0.1.43"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9"
dependencies = [
"autocfg",
"num-integer",
@ -2346,9 +2368,9 @@ dependencies = [
[[package]]
name = "num-traits"
version = "0.2.17"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
dependencies = [
"autocfg",
]
@ -2842,15 +2864,6 @@ dependencies = [
"serde",
]
[[package]]
name = "roxmltree"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "921904a62e410e37e215c40381b7117f830d9d89ba60ab5236170541dd25646b"
dependencies = [
"xmlparser",
]
[[package]]
name = "rspirv"
version = "0.12.0+sdk-1.3.268.0"
@ -3034,27 +3047,6 @@ dependencies = [
"digest",
]
[[package]]
name = "shaderc"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27e07913ada18607bb60d12431cbe3358d3bbebbe95948e1618851dc01e63b7b"
dependencies = [
"libc",
"shaderc-sys",
]
[[package]]
name = "shaderc-sys"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73120d240fe22196300f39ca8547ca2d014960f27b19b47b21288b396272f7f7"
dependencies = [
"cmake",
"libc",
"roxmltree",
]
[[package]]
name = "simd-adler32"
version = "0.3.7"
@ -3158,9 +3150,9 @@ dependencies = [
[[package]]
name = "spirv-to-dxil"
version = "0.4.1"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ce8b35efd4e676abda599d43a3ddf8771bd77364631745a7254079021d55895"
checksum = "9aa1b4b592a3c01a5a443b0d80200f1ae0cf4706928e3d61e03ae570e4085d06"
dependencies = [
"bytemuck",
"spirv-to-dxil-sys",
@ -3169,9 +3161,9 @@ dependencies = [
[[package]]
name = "spirv-to-dxil-sys"
version = "0.4.5"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "159f154ac0277748c193b397a72d27ee664446547dfa9a2589cf7a7bd9a01e5e"
checksum = "84697ae60e0a247c15d86651fca5b1af43bf7bceeed3746532255fa2f7416ee5"
dependencies = [
"build-target",
"bytemuck",
@ -3417,9 +3409,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-segmentation"
version = "1.10.1"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
[[package]]
name = "unicode-width"
@ -4336,12 +4328,6 @@ version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a"
[[package]]
name = "xmlparser"
version = "0.13.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4"
[[package]]
name = "yaml-rust"
version = "0.4.5"

View file

@ -19,14 +19,14 @@ are not currently supported (but pull-requests are welcome). librashader does no
APIs such as older versions of OpenGL, or legacy versions of Direct3D.
| **API** | **Status** | **`librashader` feature** |
|-------------|------------|--------------------------|
|-------------|------------|---------------------------|
| OpenGL 3.3+ | ✔ | `gl` |
| OpenGL 4.6 | ✔ | `gl` |
| Vulkan | ✔ | `vk` |
| Direct3D 11 | ✔ | `d3d11` |
| Direct3D 12 | ✔ | `d3d12` |
| wgpu | ✔ | `wgpu` |
| Metal | ❌ | |
| WebGPU | ❌ | |
✔ = Render API is supported — ❌ Render API is not supported
@ -91,18 +91,7 @@ static GL_DEFAULT_MVP: &[f32; 16] = &[
### Building
librashader requires the following build time dependencies
* The [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/)
* [CMake 3.8 or later](https://cmake.org/)
For DXIL support on Windows, the following is also needed
* [Meson](https://mesonbuild.com/)
* [Python 3.6 or later](https://www.python.org/)
---
For Rust projects, simply add the crate tofil your `Cargo.toml`.
For Rust projects, simply add the crate to your `Cargo.toml`.
```
cargo add librashader
@ -117,6 +106,9 @@ cargo run -p librashader-build-script -- --profile optimized
This will output a `librashader.dll` or `librashader.so` in the target folder. Profile can be `debug`, `release`, or
`optimized` for full LTO.
While librashader has no build-time dependencies, using `librashader_ld.h` may require headers from
the relevant runtime graphics API.
### Writing a librashader Runtime
If you wish to contribute a runtime implementation not already available, see the [librashader-runtime](https://docs.rs/librashader-runtime/latest/librashader_runtime/)

View file

@ -2,7 +2,7 @@
name = "librashader-cache"
edition = "2021"
license = "MPL-2.0 OR GPL-3.0-only"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
repository = "https://github.com/SnowflakePowered/librashader"
readme = "../README.md"
@ -12,8 +12,8 @@ description = "RetroArch shaders for all."
[dependencies]
serde = { version = "1.0" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.5", features = ["serialize"] }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.5" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.7", features = ["serialize"] }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.7" }
platform-dirs = "0.3.0"
blake3 = { version = "1.3.3" }
thiserror = "1.0.38"

View file

@ -3,7 +3,7 @@ name = "librashader-capi"
edition = "2021"
license = "MPL-2.0 OR GPL-3.0-only"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
repository = "https://github.com/SnowflakePowered/librashader"
readme = "../README.md"
@ -23,7 +23,7 @@ runtime-d3d12 = ["windows", "librashader/runtime-d3d12", "windows/Win32_Graphics
runtime-vulkan = ["ash", "librashader/runtime-vk"]
[dependencies]
librashader = { path = "../librashader", version = "0.2.0-beta.5", features = ["internal"] }
librashader = { path = "../librashader", version = "0.2.0-beta.7", features = ["internal"] }
thiserror = "1.0.37"
paste = "1.0.9"
gl = { version = "0.14.0", optional = true }

View file

@ -3,7 +3,7 @@ name = "librashader-common"
edition = "2021"
license = "MPL-2.0 OR GPL-3.0-only"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
repository = "https://github.com/SnowflakePowered/librashader"
readme = "../README.md"

View file

@ -32,6 +32,12 @@ use num_traits::AsPrimitive;
use std::convert::Infallible;
use std::str::FromStr;
#[derive(Debug, Clone)]
pub enum ShaderStorage {
Path(std::path::PathBuf),
String(String),
}
#[repr(u32)]
#[derive(Default, Copy, Clone, Debug, Eq, PartialEq, Hash)]
/// Supported image formats for textures.

View file

@ -3,7 +3,7 @@ name = "librashader-preprocess"
edition = "2021"
license = "MPL-2.0 OR GPL-3.0-only"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
repository = "https://github.com/SnowflakePowered/librashader"
readme = "../README.md"
@ -14,7 +14,7 @@ description = "RetroArch shaders for all."
[dependencies]
thiserror = "1.0.37"
nom = "7.1.1"
librashader-common = { path = "../librashader-common", version = "0.2.0-beta.5" }
librashader-common = { path = "../librashader-common", version = "0.2.0-beta.7" }
rustc-hash = "1.1.0"
encoding_rs = "0.8.31"

View file

@ -17,7 +17,6 @@ use crate::include::read_source;
pub use error::*;
use librashader_common::ImageFormat;
use rustc_hash::FxHashMap;
use std::path::Path;
/// The source file for a single shader pass.
#[derive(Debug, Clone, PartialEq)]
@ -58,8 +57,8 @@ pub struct ShaderParameter {
impl ShaderSource {
/// Load the source file at the given path, resolving includes relative to the location of the
/// source file.
pub fn load(path: impl AsRef<Path>) -> Result<ShaderSource, PreprocessError> {
load_shader_source(path)
pub fn load(file: &librashader_common::ShaderStorage) -> Result<ShaderSource, PreprocessError> {
load_shader_source(file)
}
}
@ -78,8 +77,14 @@ impl SourceOutput for String {
}
}
pub(crate) fn load_shader_source(path: impl AsRef<Path>) -> Result<ShaderSource, PreprocessError> {
let source = read_source(path)?;
pub(crate) fn load_shader_source(
file: &librashader_common::ShaderStorage,
) -> Result<ShaderSource, PreprocessError> {
let source = match file {
librashader_common::ShaderStorage::Path(path) => read_source(path)?,
librashader_common::ShaderStorage::String(s) => s.to_string(),
};
let meta = pragma::parse_pragma_meta(&source)?;
let text = stage::process_stages(&source)?;
let parameters = FxHashMap::from_iter(meta.parameters.into_iter().map(|p| (p.id.clone(), p)));

View file

@ -3,7 +3,7 @@ name = "librashader-presets"
edition = "2021"
license = "MPL-2.0 OR GPL-3.0-only"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
repository = "https://github.com/SnowflakePowered/librashader"
readme = "../README.md"
@ -15,7 +15,7 @@ description = "RetroArch shaders for all."
thiserror = "1.0.37"
nom = "7.1.1"
nom_locate = "4.0.0"
librashader-common = { path = "../librashader-common", version = "0.2.0-beta.5" }
librashader-common = { path = "../librashader-common", version = "0.2.0-beta.7" }
num-traits = "0.2"
[features]

View file

@ -115,7 +115,7 @@ pub fn resolve_values(mut values: Vec<Value>) -> ShaderPreset {
let shader = ShaderPassConfig {
id,
name,
name: librashader_common::ShaderStorage::Path(name),
alias: shader_values.iter().find_map(|f| match f {
Value::Alias(_, value) => Some(value.to_string()),
_ => None,

View file

@ -10,7 +10,7 @@ pub struct ShaderPassConfig {
/// The index of the shader pass relative to its parent preset.
pub id: i32,
/// The fully qualified path to the shader pass source file.
pub name: PathBuf,
pub name: librashader_common::ShaderStorage,
/// The alias of the shader pass if available.
pub alias: Option<String>,
/// The filtering mode that this shader pass should expect.

View file

@ -3,7 +3,7 @@ name = "librashader-reflect"
edition = "2021"
license = "MPL-2.0 OR GPL-3.0-only"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
repository = "https://github.com/SnowflakePowered/librashader"
readme = "../README.md"
@ -12,16 +12,16 @@ keywords = ["shader", "retroarch", "SPIR-V"]
description = "RetroArch shaders for all."
[dependencies]
shaderc = { version = "0.8.3", features = [] }
glslang = "0.2"
bytemuck = "1.13.0"
thiserror = "1.0.37"
bitflags = "1.3.2"
rustc-hash = "1.1.0"
librashader-common = { path = "../librashader-common", version = "0.2.0-beta.5" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.5" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.5" }
librashader-common = { path = "../librashader-common", version = "0.2.0-beta.7" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.7" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.7" }
spirv_cross = { package = "librashader-spirv-cross", version = "0.23", optional = true }
@ -40,7 +40,6 @@ optional = true
[features]
default = ["cross", "wgsl", "serialize"]
standalone = ["shaderc/build-from-source", "shaderc/prefer-static-linking"]
dxil = ["cross", "spirv-to-dxil"]
wgsl = ["cross", "naga", "spirv", "rspirv"]
cross = [ "spirv_cross", "spirv_cross/glsl", "spirv_cross/hlsl" ]

View file

@ -10,13 +10,13 @@ pub enum ShaderCompileError {
#[error("shader")]
NagaCompileError(Vec<naga::front::glsl::Error>),
/// Compilation error from shaderc (glslang).
#[error("shaderc")]
ShaderCCompileError(#[from] shaderc::Error),
/// Compilation error from glslang.
#[error("glslang")]
GlslangError(#[from] glslang::error::GlslangError),
/// Error when initializing the shaderc compiler.
#[error("shaderc init")]
ShaderCInitError,
/// Error when initializing the glslang compiler.
#[error("glslang init")]
CompilerInitError,
/// Error when transpiling from spirv-cross.
#[error("cross")]

View file

@ -0,0 +1,76 @@
use crate::error::ShaderCompileError;
use glslang::input::{CompilerOptions, ShaderInput};
use glslang::limits::ResourceLimits;
use librashader_preprocess::ShaderSource;
#[cfg(feature = "serialize")]
use serde::{Deserialize, Serialize};
/// A reflectable shader compilation via glslang.
#[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
#[derive(Debug, Clone)]
pub struct GlslangCompilation {
pub(crate) vertex: Vec<u32>,
pub(crate) fragment: Vec<u32>,
}
impl GlslangCompilation {
/// Tries to compile SPIR-V from the provided shader source.
pub fn compile(source: &ShaderSource) -> Result<Self, ShaderCompileError> {
compile_spirv(source)
}
}
impl TryFrom<&ShaderSource> for GlslangCompilation {
type Error = ShaderCompileError;
/// Tries to compile SPIR-V from the provided shader source.
fn try_from(source: &ShaderSource) -> Result<Self, Self::Error> {
GlslangCompilation::compile(source)
}
}
pub(crate) fn compile_spirv(
source: &ShaderSource,
) -> Result<GlslangCompilation, ShaderCompileError> {
let compiler = glslang::Compiler::acquire().ok_or(ShaderCompileError::CompilerInitError)?;
let limits = ResourceLimits::default();
let options = CompilerOptions::default();
let vertex = glslang::input::ShaderSource::from(source.vertex.as_str());
let vertex = ShaderInput::new(
&vertex,
&limits,
glslang::ShaderStage::Vertex,
&options,
None,
);
let vertex = compiler.create_shader(vertex)?;
let fragment = glslang::input::ShaderSource::from(source.fragment.as_str());
let fragment = ShaderInput::new(
&fragment,
&limits,
glslang::ShaderStage::Fragment,
&options,
None,
);
let fragment = compiler.create_shader(fragment)?;
let vertex = Vec::from(vertex.compile()?);
let fragment = Vec::from(fragment.compile()?);
Ok(GlslangCompilation { vertex, fragment })
}
#[cfg(test)]
mod test {
use crate::front::glslang::compile_spirv;
use librashader_preprocess::ShaderSource;
#[test]
pub fn compile_shader() {
let result = ShaderSource::load("../test/basic.slang").unwrap();
let _spirv = compile_spirv(&result).unwrap();
}
}

View file

@ -1,9 +1,9 @@
use crate::error::ShaderCompileError;
use librashader_preprocess::ShaderSource;
mod shaderc;
mod glslang;
pub use crate::front::shaderc::GlslangCompilation;
pub use crate::front::glslang::GlslangCompilation;
/// Trait for types that can compile shader sources into a compilation unit.
pub trait ShaderCompilation: Sized {

View file

@ -1,162 +0,0 @@
use crate::error::ShaderCompileError;
use librashader_preprocess::ShaderSource;
use shaderc::{CompileOptions, Limit, ShaderKind};
#[cfg(feature = "serialize")]
use serde::{Deserialize, Serialize};
/// A reflectable shader compilation via glslang (shaderc).
#[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
#[derive(Debug, Clone)]
pub struct GlslangCompilation {
pub(crate) vertex: Vec<u32>,
pub(crate) fragment: Vec<u32>,
}
impl GlslangCompilation {
/// Tries to compile SPIR-V from the provided shader source.
pub fn compile(source: &ShaderSource) -> Result<Self, ShaderCompileError> {
compile_spirv(source)
}
}
impl TryFrom<&ShaderSource> for GlslangCompilation {
type Error = ShaderCompileError;
/// Tries to compile SPIR-V from the provided shader source.
fn try_from(source: &ShaderSource) -> Result<Self, Self::Error> {
GlslangCompilation::compile(source)
}
}
fn get_shaderc_options() -> Result<CompileOptions<'static>, ShaderCompileError> {
let mut options = CompileOptions::new().ok_or(ShaderCompileError::ShaderCInitError)?;
options.set_include_callback(|_, _, _, _| {
Err("RetroArch shaders must already have includes be preprocessed".into())
});
options.set_limit(Limit::MaxLights, 32);
options.set_limit(Limit::MaxClipPlanes, 6);
options.set_limit(Limit::MaxTextureUnits, 32);
options.set_limit(Limit::MaxTextureCoords, 32);
options.set_limit(Limit::MaxVertexAttribs, 64);
options.set_limit(Limit::MaxVertexUniformComponents, 4096);
options.set_limit(Limit::MaxVaryingFloats, 64);
options.set_limit(Limit::MaxVertexTextureImageUnits, 32);
options.set_limit(Limit::MaxCombinedTextureImageUnits, 80);
options.set_limit(Limit::MaxTextureImageUnits, 32);
options.set_limit(Limit::MaxFragmentUniformComponents, 4096);
options.set_limit(Limit::MaxDrawBuffers, 32);
options.set_limit(Limit::MaxVertexUniformVectors, 128);
options.set_limit(Limit::MaxVaryingVectors, 8);
options.set_limit(Limit::MaxFragmentUniformVectors, 16);
options.set_limit(Limit::MaxVertexOutputVectors, 16);
options.set_limit(Limit::MaxFragmentInputVectors, 15);
options.set_limit(Limit::MinProgramTexelOffset, -8);
options.set_limit(Limit::MaxProgramTexelOffset, 7);
options.set_limit(Limit::MaxClipDistances, 8);
options.set_limit(Limit::MaxComputeWorkGroupCountX, 65535);
options.set_limit(Limit::MaxComputeWorkGroupCountY, 65535);
options.set_limit(Limit::MaxComputeWorkGroupCountZ, 65535);
options.set_limit(Limit::MaxComputeWorkGroupSizeX, 1024);
options.set_limit(Limit::MaxComputeWorkGroupSizeY, 1024);
options.set_limit(Limit::MaxComputeWorkGroupSizeZ, 64);
options.set_limit(Limit::MaxComputeUniformComponents, 1024);
options.set_limit(Limit::MaxComputeTextureImageUnits, 16);
options.set_limit(Limit::MaxComputeImageUniforms, 8);
options.set_limit(Limit::MaxComputeAtomicCounters, 8);
options.set_limit(Limit::MaxComputeAtomicCounterBuffers, 1);
options.set_limit(Limit::MaxVaryingComponents, 60);
options.set_limit(Limit::MaxVertexOutputComponents, 64);
options.set_limit(Limit::MaxGeometryInputComponents, 64);
options.set_limit(Limit::MaxGeometryOutputComponents, 128);
options.set_limit(Limit::MaxFragmentInputComponents, 128);
options.set_limit(Limit::MaxImageUnits, 8);
options.set_limit(Limit::MaxCombinedImageUnitsAndFragmentOutputs, 8);
options.set_limit(Limit::MaxCombinedShaderOutputResources, 8);
options.set_limit(Limit::MaxImageSamples, 0);
options.set_limit(Limit::MaxVertexImageUniforms, 0);
options.set_limit(Limit::MaxTessControlImageUniforms, 0);
options.set_limit(Limit::MaxTessEvaluationImageUniforms, 0);
options.set_limit(Limit::MaxGeometryImageUniforms, 0);
options.set_limit(Limit::MaxFragmentImageUniforms, 8);
options.set_limit(Limit::MaxCombinedImageUniforms, 8);
options.set_limit(Limit::MaxGeometryTextureImageUnits, 16);
options.set_limit(Limit::MaxGeometryOutputVertices, 256);
options.set_limit(Limit::MaxGeometryTotalOutputComponents, 1024);
options.set_limit(Limit::MaxGeometryUniformComponents, 1024);
options.set_limit(Limit::MaxGeometryVaryingComponents, 64);
options.set_limit(Limit::MaxTessControlInputComponents, 128);
options.set_limit(Limit::MaxTessControlOutputComponents, 128);
options.set_limit(Limit::MaxTessControlTextureImageUnits, 16);
options.set_limit(Limit::MaxTessControlUniformComponents, 1024);
options.set_limit(Limit::MaxTessControlTotalOutputComponents, 4096);
options.set_limit(Limit::MaxTessEvaluationInputComponents, 128);
options.set_limit(Limit::MaxTessEvaluationOutputComponents, 128);
options.set_limit(Limit::MaxTessEvaluationTextureImageUnits, 16);
options.set_limit(Limit::MaxTessEvaluationUniformComponents, 1024);
options.set_limit(Limit::MaxTessPatchComponents, 120);
options.set_limit(Limit::MaxPatchVertices, 32);
options.set_limit(Limit::MaxTessGenLevel, 64);
options.set_limit(Limit::MaxViewports, 16);
options.set_limit(Limit::MaxVertexAtomicCounters, 0);
options.set_limit(Limit::MaxTessControlAtomicCounters, 0);
options.set_limit(Limit::MaxTessEvaluationAtomicCounters, 0);
options.set_limit(Limit::MaxGeometryAtomicCounters, 0);
options.set_limit(Limit::MaxFragmentAtomicCounters, 8);
options.set_limit(Limit::MaxCombinedAtomicCounters, 8);
options.set_limit(Limit::MaxAtomicCounterBindings, 1);
options.set_limit(Limit::MaxVertexAtomicCounterBuffers, 0);
options.set_limit(Limit::MaxTessControlAtomicCounterBuffers, 0);
options.set_limit(Limit::MaxTessEvaluationAtomicCounterBuffers, 0);
options.set_limit(Limit::MaxGeometryAtomicCounterBuffers, 0);
options.set_limit(Limit::MaxFragmentAtomicCounterBuffers, 1);
options.set_limit(Limit::MaxCombinedAtomicCounterBuffers, 1);
options.set_limit(Limit::MaxAtomicCounterBufferSize, 16384);
options.set_limit(Limit::MaxTransformFeedbackBuffers, 4);
options.set_limit(Limit::MaxTransformFeedbackInterleavedComponents, 64);
options.set_limit(Limit::MaxCullDistances, 8);
options.set_limit(Limit::MaxCombinedClipAndCullDistances, 8);
options.set_limit(Limit::MaxSamples, 4);
Ok(options)
}
pub(crate) fn compile_spirv(
source: &ShaderSource,
) -> Result<GlslangCompilation, ShaderCompileError> {
let compiler = shaderc::Compiler::new().ok_or(ShaderCompileError::ShaderCInitError)?;
let name = source.name.as_deref().unwrap_or("shader.slang");
let options = get_shaderc_options()?;
let vertex = compiler.compile_into_spirv(
&source.vertex,
ShaderKind::Vertex,
name,
"main",
Some(&options),
)?;
let fragment = compiler.compile_into_spirv(
&source.fragment,
ShaderKind::Fragment,
name,
"main",
Some(&options),
)?;
// shaderc has a GIL so Send is unsafe.
let vertex = Vec::from(vertex.as_binary());
let fragment = Vec::from(fragment.as_binary());
Ok(GlslangCompilation { vertex, fragment })
}
#[cfg(test)]
mod test {
use crate::front::shaderc::compile_spirv;
use librashader_preprocess::ShaderSource;
#[test]
pub fn compile_shader() {
let result = ShaderSource::load("../test/basic.slang").unwrap();
let _spirv = compile_spirv(&result).unwrap();
}
}

View file

@ -44,7 +44,7 @@
//! matured enough to support [the features librashader needs](https://github.com/gfx-rs/naga/issues/1012).
//!
//! In the meanwhile, the only supported compilation type is [GlslangCompilation](crate::front::GlslangCompilation),
//! which does transpilation via [shaderc](https://github.com/google/shaderc) and [SPIRV-Cross](https://github.com/KhronosGroup/SPIRV-Cross).
//! which does transpilation via [glslang](https://github.com/KhronosGroup/glslang) and [SPIRV-Cross](https://github.com/KhronosGroup/SPIRV-Cross).
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]
#![feature(let_chains)]

View file

@ -3,7 +3,7 @@ name = "librashader-runtime-d3d11"
edition = "2021"
license = "MPL-2.0 OR GPL-3.0-only"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
repository = "https://github.com/SnowflakePowered/librashader"
readme = "../README.md"
@ -12,13 +12,13 @@ keywords = ["shader", "retroarch", "SPIR-V"]
description = "RetroArch shaders for all."
[dependencies]
librashader-common = { path = "../librashader-common", features = ["d3d11"], version = "0.2.0-beta.5" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.5" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.5" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.5", features = ["standalone"] }
librashader-runtime = { path = "../librashader-runtime", version = "0.2.0-beta.5" }
librashader-common = { path = "../librashader-common", features = ["d3d11"], version = "0.2.0-beta.7" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.7" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.7" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.7" }
librashader-runtime = { path = "../librashader-runtime", version = "0.2.0-beta.7" }
spirv_cross = { package = "librashader-spirv-cross", version = "0.23" }
librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.5", features = ["d3d"] }
librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.7", features = ["d3d"] }
thiserror = "1.0.37"
rustc-hash = "1.1.0"

View file

@ -3,7 +3,7 @@ name = "librashader-runtime-d3d12"
edition = "2021"
license = "MPL-2.0 OR GPL-3.0-only"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
repository = "https://github.com/SnowflakePowered/librashader"
readme = "../README.md"
@ -12,12 +12,12 @@ keywords = ["shader", "retroarch", "SPIR-V"]
description = "RetroArch shaders for all."
[dependencies]
librashader-common = { path = "../librashader-common", features = ["d3d12"], version = "0.2.0-beta.5" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.5" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.5" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.5", features = ["dxil", "standalone"] }
librashader-runtime = { path = "../librashader-runtime", version = "0.2.0-beta.5" }
librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.5", features = ["d3d"] }
librashader-common = { path = "../librashader-common", features = ["d3d12"], version = "0.2.0-beta.7" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.7" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.7" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.7", features = ["dxil"] }
librashader-runtime = { path = "../librashader-runtime", version = "0.2.0-beta.7" }
librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.7", features = ["d3d"] }
thiserror = "1.0.37"
spirv_cross = { package = "librashader-spirv-cross", version = "0.23" }

View file

@ -3,7 +3,7 @@ name = "librashader-runtime-gl"
edition = "2021"
license = "MPL-2.0 OR GPL-3.0-only"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
repository = "https://github.com/SnowflakePowered/librashader"
readme = "../README.md"
@ -12,12 +12,12 @@ keywords = ["shader", "retroarch", "SPIR-V"]
description = "RetroArch shaders for all."
[dependencies]
librashader-common = { path = "../librashader-common", features = ["opengl"], version = "0.2.0-beta.5" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.5" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.5" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.5", features = ["standalone"] }
librashader-runtime = { path = "../librashader-runtime" , version = "0.2.0-beta.5" }
librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.5" }
librashader-common = { path = "../librashader-common", features = ["opengl"], version = "0.2.0-beta.7" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.7" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.7" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.7" }
librashader-runtime = { path = "../librashader-runtime" , version = "0.2.0-beta.7" }
librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.7" }
spirv_cross = { package = "librashader-spirv-cross", version = "0.23" }
rustc-hash = "1.1.0"

View file

@ -3,7 +3,7 @@ name = "librashader-runtime-vk"
edition = "2021"
license = "MPL-2.0 OR GPL-3.0-only"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
repository = "https://github.com/SnowflakePowered/librashader"
readme = "../README.md"
@ -14,18 +14,18 @@ description = "RetroArch shaders for all."
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
librashader-common = { path = "../librashader-common", features = ["vulkan"], version = "0.2.0-beta.5" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.5" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.5" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.5", features = [] }
librashader-runtime = { path = "../librashader-runtime" , version = "0.2.0-beta.5" }
librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.5" }
librashader-common = { path = "../librashader-common", features = ["vulkan"], version = "0.2.0-beta.7" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.7" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.7" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.7" }
librashader-runtime = { path = "../librashader-runtime" , version = "0.2.0-beta.7" }
librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.7" }
spirv_cross = { package = "librashader-spirv-cross", version = "0.23" }
rustc-hash = "1.1.0"
bytemuck = "1.12.3"
thiserror = "1.0.37"
ash = { version = "0.37.1+1.3.235", features = ["linked", "debug"] }
ash = { version = "0.37.1+1.3.235", features = ["debug"] }
gpu-allocator = { version = "0.22.0", default-features = false, features = ["vulkan"] }
parking_lot = "0.12.1"
rayon = "1.6.1"

View file

@ -186,9 +186,6 @@ impl Drop for RawVulkanBuffer {
fn drop(&mut self) {
unsafe {
ManuallyDrop::drop(&mut self.buffer);
if self.buffer.handle != vk::Buffer::null() {
self.buffer.device.destroy_buffer(self.buffer.handle, None);
}
}
}
}

View file

@ -11,7 +11,7 @@ fn triangle_vk() {
unsafe {
let filter = FilterChainVulkan::load_from_path(
"../test/slang-shaders/crt/crt-royale.slangp",
"../test/shaders_slang/crt/crt-royale.slangp",
// "../test/Mega_Bezel_Packs/Duimon-Mega-Bezel/Presets/Advanced/Nintendo_GBA_SP/GBA_SP-[ADV]-[LCD-GRID]-[Night].slangp",
&base,
// "../test/slang-shaders/test/feedback.slancargogp",
@ -20,7 +20,7 @@ fn triangle_vk() {
frames_in_flight: 3,
force_no_mipmaps: false,
use_render_pass: true,
disable_cache: false,
disable_cache: true,
}),
)
.unwrap();

View file

@ -2,7 +2,7 @@
name = "librashader-runtime-wgpu"
edition = "2021"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
license = "MPL-2.0 OR GPL-3.0-only"
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
repository = "https://github.com/SnowflakePowered/librashader"
@ -14,11 +14,11 @@ description = "RetroArch shaders for all."
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
librashader-common = { path = "../librashader-common", features = ["wgpu"], version = "0.2.0-beta.5" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.5" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.5" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.5", features = ["wgsl"], default-features = false }
librashader-runtime = { path = "../librashader-runtime" , version = "0.2.0-beta.5" }
librashader-common = { path = "../librashader-common", features = ["wgpu"], version = "0.2.0-beta.7" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.7" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.7" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.7", features = ["wgsl"], default-features = false }
librashader-runtime = { path = "../librashader-runtime" , version = "0.2.0-beta.7" }
wgpu = { version = "0.19.0", features = ["spirv"] }
rustc-hash = "1.1.0"

View file

@ -23,6 +23,5 @@ mod util;
pub use filter_chain::FilterChainWgpu;
pub use framebuffer::WgpuOutputView;
pub mod error;
pub mod options;

View file

@ -3,7 +3,7 @@ name = "librashader-runtime"
edition = "2021"
license = "MPL-2.0 OR GPL-3.0-only"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
repository = "https://github.com/SnowflakePowered/librashader"
readme = "../README.md"
@ -12,10 +12,10 @@ keywords = ["shader", "retroarch", "SPIR-V"]
description = "RetroArch shaders for all."
[dependencies]
librashader-common = { path = "../librashader-common", version = "0.2.0-beta.5" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.5" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.5" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.5" }
librashader-common = { path = "../librashader-common", version = "0.2.0-beta.7" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.7" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.7" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.7" }
bytemuck = "1.12.3"
rustc-hash = "1.1.0"
num-traits = "0.2.15"

View file

@ -11,9 +11,6 @@ License: MPL-2.0
URL: https://github.com/SnowflakePowered/%{name}
%undefine _disable_source_fetch
Source: {{{ git_dir_pack }}}
BuildRequires: pkgconfig(vulkan)
BuildRequires: pkgconfig(shaderc)
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: git
BuildRequires: g++

View file

@ -4,7 +4,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
license = "MPL-2.0 OR GPL-3.0-only"
version = "0.2.0-beta.5"
version = "0.2.0-beta.7"
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
repository = "https://github.com/SnowflakePowered/librashader"
readme = "../README.md"
@ -13,21 +13,22 @@ keywords = ["shader", "retroarch", "SPIR-V"]
description = "RetroArch shaders for all."
[dependencies]
librashader-common = { path = "../librashader-common", version = "0.2.0-beta.5" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.5" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.5" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.5", features = ["standalone"] }
librashader-runtime = { path = "../librashader-runtime", version = "0.2.0-beta.5" }
librashader-runtime-d3d11 = { path = "../librashader-runtime-d3d11", version = "0.2.0-beta.5", optional = true }
librashader-runtime-d3d12 = { path = "../librashader-runtime-d3d12", version = "0.2.0-beta.5", optional = true }
librashader-runtime-gl = { path = "../librashader-runtime-gl", version = "0.2.0-beta.5", optional = true }
librashader-runtime-vk = { path = "../librashader-runtime-vk", version = "0.2.0-beta.5", optional = true }
librashader-runtime-wgpu = { path = "../librashader-runtime-wgpu", version = "0.2.0-beta.5", optional = true }
librashader-common = { path = "../librashader-common", version = "0.2.0-beta.7" }
librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.7" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.7" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.7" }
librashader-runtime = { path = "../librashader-runtime", version = "0.2.0-beta.7" }
librashader-runtime-d3d11 = { path = "../librashader-runtime-d3d11", version = "0.2.0-beta.7", optional = true }
librashader-runtime-d3d12 = { path = "../librashader-runtime-d3d12", version = "0.2.0-beta.7", optional = true }
librashader-runtime-gl = { path = "../librashader-runtime-gl", version = "0.2.0-beta.7", optional = true }
librashader-runtime-vk = { path = "../librashader-runtime-vk", version = "0.2.0-beta.7", optional = true }
librashader-runtime-wgpu = { path = "../librashader-runtime-wgpu", version = "0.2.0-beta.7", optional = true }
librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.5" }
librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.7" }
ash = { version = "0.37", optional = true }
wgpu = { version = "0.19.1", optional = true }
wgpu = { version = "0.19", optional = true }
wgpu-types = { version = "0.19", optional = true }
[target.'cfg(windows)'.dependencies.windows]
version = "0.48.0"
@ -46,7 +47,7 @@ runtime-gl = [ "runtime", "reflect-cross", "librashader-common/opengl", "librash
runtime-d3d11 = [ "runtime", "reflect-cross","librashader-common/d3d11", "librashader-runtime-d3d11", "windows/Win32_Graphics_Direct3D11" ]
runtime-d3d12 = [ "runtime", "reflect-cross", "reflect-dxil", "librashader-common/d3d12", "librashader-runtime-d3d12", "windows/Win32_Graphics_Direct3D12" ]
runtime-vk = ["runtime", "reflect-cross", "librashader-common/vulkan", "librashader-runtime-vk", "ash" ]
runtime-wgpu = [ "runtime", "reflect-naga", "librashader-common/wgpu", "librashader-runtime-wgpu", "wgpu" ]
runtime-wgpu = [ "runtime", "reflect-naga", "librashader-common/wgpu", "librashader-runtime-wgpu", "wgpu", "wgpu-types" ]
# reflection
reflect-cross = ["reflect", "librashader-reflect/cross"]

View file

@ -130,7 +130,7 @@ pub mod preprocess {
/// matured enough to support [the features librashader needs](https://github.com/gfx-rs/naga/issues/1012).
///
/// In the meanwhile, the only supported compilation type is [GlslangCompilation](crate::reflect::cross::GlslangCompilation),
/// which does transpilation via [shaderc](https://github.com/google/shaderc) and [SPIRV-Cross](https://github.com/KhronosGroup/SPIRV-Cross).
/// which does transpilation via [glslang](https://github.com/KhronosGroup/glslang/) and [SPIRV-Cross](https://github.com/KhronosGroup/SPIRV-Cross).
pub mod reflect {
/// Supported shader compiler targets.
pub mod targets {

View file

@ -6,5 +6,5 @@ includedir=${exec_prefix}/include
Name: librashader
Description: RetroArch shaders for all
Version: 0.2.0
Libs: -L${libdir} -lvulkan -lrashader
Libs: -L${libdir} -lrashader
Cflags: -I${includedir}

View file

@ -11,9 +11,6 @@ License: MPL-2.0
URL: https://github.com/SnowflakePowered/%{name}
%undefine _disable_source_fetch
Source: https://github.com/SnowflakePowered/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
BuildRequires: pkgconfig(vulkan)
BuildRequires: pkgconfig(shaderc)
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: g++
BuildRequires: ninja-build

View file

@ -6,7 +6,7 @@ arch=('x86_64' 'aarch64')
url="https://github.com/SnowflakePowered/librashader"
license=('MPL-2.0')
groups=('')
depends=('vulkan-icd-loader' 'shaderc' 'cmake' 'gcc' 'rust' 'patchelf' 'ninja')
depends=('vulkan-icd-loader' 'gcc' 'rust' 'patchelf' 'ninja')
provides=("$pkgname=$pkgver" 'librashader.so')
backup=('')
source=("$pkgname-$pkgver.tar.xz" 'vendor.tar.xz' 'cargo_config')

View file

@ -9,11 +9,8 @@ URL: https://github.com/SnowflakePowered/%{name}
Source0: librashader-%{version}.tar.xz
Source1: vendor.tar.xz
Source2: cargo_config
BuildRequires: pkgconfig(vulkan)
BuildRequires: pkgconfig(shaderc)
BuildRequires: ninja-build
BuildRequires: patchelf
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: cargo