Compare commits

...

6 commits

Author SHA1 Message Date
Alex Janka 71d1ddfa2a unstable-naga 2024-07-20 17:45:38 +10:00
Alex Janka e9f2789703 clippy fixes 2024-07-20 17:35:28 +10:00
Alex Janka fedc96730b add "cache: None" 2024-07-20 17:33:19 +10:00
Alex Janka f98be0ad7b fix shaderstorage in tests 2024-07-20 17:29:27 +10:00
Alex Janka 1ea5dcf180 nightly rust-toolchain.toml 2024-07-20 17:26:51 +10:00
Alex Janka d8da2aec24 update wgpu package versions 2024-07-20 17:26:26 +10:00
33 changed files with 340 additions and 238 deletions

167
Cargo.lock generated
View file

@ -76,7 +76,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289"
dependencies = [
"android-properties",
"bitflags 2.5.0",
"bitflags 2.6.0",
"cc",
"cesu8",
"jni",
@ -167,13 +167,22 @@ dependencies = [
"libloading 0.7.4",
]
[[package]]
name = "ash"
version = "0.38.0+1.3.281"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"
dependencies = [
"libloading 0.8.3",
]
[[package]]
name = "ash-window"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b912285a7c29f3a8f87ca6f55afc48768624e5e33ec17dbd2f2075903f5e35ab"
dependencies = [
"ash",
"ash 0.37.3+1.3.251",
"raw-window-handle 0.5.2",
"raw-window-metal",
]
@ -268,18 +277,18 @@ dependencies = [
[[package]]
name = "bit-set"
version = "0.5.3"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"
checksum = "f0481a0e032742109b1133a095184ee93d88f3dc9e0d28a5d033dc77a073f44f"
dependencies = [
"bit-vec",
]
[[package]]
name = "bit-vec"
version = "0.6.3"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
checksum = "d2c54ff287cfc0a34f38a6b832ea1bd8e448a330b3e40a50859e6488bee07f22"
[[package]]
name = "bit_field"
@ -295,9 +304,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.5.0"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
name = "bitstream-io"
@ -442,7 +451,7 @@ version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"log",
"polling",
"rustix",
@ -839,12 +848,12 @@ checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991"
[[package]]
name = "d3d12"
version = "0.20.0"
version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b28bfe653d79bd16c77f659305b195b82bb5ce0c0eb2a4846b82ddbd77586813"
checksum = "bdbd1f579714e3c809ebd822c81ef148b1ceaeb3d535352afc73fd0c4c6a0017"
dependencies = [
"bitflags 2.5.0",
"libloading 0.8.3",
"bitflags 2.6.0",
"libloading 0.7.4",
"winapi",
]
@ -908,9 +917,9 @@ checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"
[[package]]
name = "document-features"
version = "0.2.8"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef5282ad69563b5fc40319526ba27e0e7363d552a896f0297d54f767717f9b95"
checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0"
dependencies = [
"litrs",
]
@ -1211,9 +1220,9 @@ dependencies = [
[[package]]
name = "glutin_wgl_sys"
version = "0.5.0"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead"
checksum = "0a4e1951bbd9434a81aa496fe59ccc2235af3820d27b85f9314e279609211e2c"
dependencies = [
"gl_generator",
]
@ -1224,7 +1233,7 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"gpu-alloc-types",
]
@ -1234,7 +1243,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
]
[[package]]
@ -1243,7 +1252,18 @@ version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f56f6318968d03c18e1bcf4857ff88c61157e9da8e47c5f29055d60e1228884"
dependencies = [
"ash",
"ash 0.37.3+1.3.251",
"log",
"presser",
"thiserror",
]
[[package]]
name = "gpu-allocator"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdd4240fc91d3433d5e5b0fc5b67672d771850dc19bbee03c1381e19322803d7"
dependencies = [
"log",
"presser",
"thiserror",
@ -1257,7 +1277,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c08c1f623a8d0b722b8b99f821eb0ba672a1618f0d3b16ddbee1cedd2dd8557"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"gpu-descriptor-types",
"hashbrown 0.14.5",
]
@ -1268,7 +1288,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
]
[[package]]
@ -1315,7 +1335,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"com",
"libc",
"libloading 0.8.3",
@ -1607,7 +1627,7 @@ dependencies = [
name = "librashader"
version = "0.2.7"
dependencies = [
"ash",
"ash 0.38.0+1.3.281",
"glob",
"halfbrown",
"icrate 0.1.2",
@ -1660,7 +1680,7 @@ dependencies = [
name = "librashader-capi"
version = "0.2.7"
dependencies = [
"ash",
"ash 0.37.3+1.3.251",
"gl",
"icrate 0.1.2",
"librashader",
@ -1677,7 +1697,7 @@ dependencies = [
name = "librashader-common"
version = "0.2.7"
dependencies = [
"ash",
"ash 0.38.0+1.3.281",
"gl",
"halfbrown",
"icrate 0.1.2",
@ -1719,7 +1739,7 @@ dependencies = [
name = "librashader-reflect"
version = "0.2.7"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"bytemuck",
"glslang",
"indexmap 2.2.6",
@ -1851,11 +1871,11 @@ name = "librashader-runtime-vk"
version = "0.2.7"
dependencies = [
"array-concat",
"ash",
"ash 0.37.3+1.3.251",
"ash-window",
"bytemuck",
"glfw 0.49.1",
"gpu-allocator",
"gpu-allocator 0.25.0",
"librashader-cache",
"librashader-common",
"librashader-preprocess",
@ -1911,7 +1931,7 @@ version = "0.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"libc",
"redox_syscall 0.4.1",
]
@ -1922,7 +1942,7 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"libc",
]
@ -2020,11 +2040,11 @@ dependencies = [
[[package]]
name = "metal"
version = "0.28.0"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5637e166ea14be6063a3f8ba5ccb9a4159df7d8f6d61c02fc3d480b1f90dcfcb"
checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"block",
"core-graphics-types",
"foreign-types",
@ -2051,19 +2071,20 @@ dependencies = [
[[package]]
name = "naga"
version = "0.20.0"
version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e536ae46fcab0876853bd4a632ede5df4b1c2527a58f6c5a4150fe86be858231"
checksum = "09eeccb9b50f4f7839b214aa3e08be467159506a986c18e0702170ccf720a453"
dependencies = [
"arrayvec",
"bit-set",
"bitflags 2.5.0",
"bitflags 2.6.0",
"cfg_aliases",
"codespan-reporting",
"hexf-parse",
"indexmap 2.2.6",
"log",
"num-traits",
"petgraph",
"pp-rs",
"rustc-hash",
"spirv",
"termcolor",
@ -2077,7 +2098,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"jni-sys",
"log",
"ndk-sys",
@ -2497,6 +2518,15 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2"
[[package]]
name = "pp-rs"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb458bb7f6e250e6eb79d5026badc10a3ebb8f9a15d1fff0f13d17c71f4d6dee"
dependencies = [
"unicode-xid",
]
[[package]]
name = "ppv-lite86"
version = "0.2.17"
@ -2772,7 +2802,7 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
]
[[package]]
@ -2873,7 +2903,7 @@ version = "0.38.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"errno",
"libc",
"linux-raw-sys",
@ -3022,7 +3052,7 @@ version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"calloop",
"calloop-wayland-source",
"cursor-icon",
@ -3065,7 +3095,7 @@ version = "0.3.0+sdk-1.3.268.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
]
[[package]]
@ -3191,18 +3221,18 @@ checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9"
[[package]]
name = "thiserror"
version = "1.0.61"
version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.61"
version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
dependencies = [
"proc-macro2",
"quote",
@ -3509,7 +3539,7 @@ version = "0.31.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e63801c85358a431f986cffa74ba9599ff571fc5774ac113ed3b490c19a1133"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"rustix",
"wayland-backend",
"wayland-scanner",
@ -3521,7 +3551,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"cursor-icon",
"wayland-backend",
]
@ -3543,7 +3573,7 @@ version = "0.31.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"wayland-backend",
"wayland-client",
"wayland-scanner",
@ -3555,7 +3585,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"wayland-backend",
"wayland-client",
"wayland-protocols",
@ -3568,7 +3598,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"wayland-backend",
"wayland-client",
"wayland-protocols",
@ -3626,12 +3656,11 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
[[package]]
name = "wgpu"
version = "0.20.1"
version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90e37c7b9921b75dfd26dd973fdcbce36f13dfa6e2dc82aece584e0ed48c355c"
checksum = "c87e07e87a179614940ad845397e03201847453a37b43a31a3b54eee2e6e32ce"
dependencies = [
"arrayvec",
"cfg-if",
"cfg_aliases",
"document-features",
"js-sys",
@ -3652,15 +3681,14 @@ dependencies = [
[[package]]
name = "wgpu-core"
version = "0.21.0"
version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d59e0d5fc509601c69e4e1fa06c1eb3c4c9f12956a5e30c79b61ef1c1be7daf0"
checksum = "e0f191908a21968991463fcf3b42cb6c9648c0fb7fa301b8fc733bc21a9ed9bd"
dependencies = [
"arrayvec",
"bit-vec",
"bitflags 2.5.0",
"bitflags 2.6.0",
"cfg_aliases",
"codespan-reporting",
"document-features",
"indexmap 2.2.6",
"log",
@ -3672,22 +3700,21 @@ dependencies = [
"rustc-hash",
"smallvec",
"thiserror",
"web-sys",
"wgpu-hal",
"wgpu-types",
]
[[package]]
name = "wgpu-hal"
version = "0.21.0"
version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6aa24c3889f885a3fb9133b454c8418bfcfaadcfe4ed3be96ac80e76703b863b"
checksum = "f6bbf4b4de8b2a83c0401d9e5ae0080a2792055f25859a02bf9be97952bbed4f"
dependencies = [
"android_system_properties",
"arrayvec",
"ash",
"ash 0.38.0+1.3.281",
"bit-set",
"bitflags 2.5.0",
"bitflags 2.6.0",
"block",
"cfg_aliases",
"core-graphics-types",
@ -3695,7 +3722,7 @@ dependencies = [
"glow",
"glutin_wgl_sys",
"gpu-alloc",
"gpu-allocator",
"gpu-allocator 0.26.0",
"gpu-descriptor",
"hassle-rs",
"js-sys",
@ -3724,11 +3751,11 @@ dependencies = [
[[package]]
name = "wgpu-types"
version = "0.20.0"
version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1353d9a46bff7f955a680577f34c69122628cc2076e1d6f3a9be6ef00ae793ef"
checksum = "bc9d91f0e2c4b51434dfa6db77846f2793149d8e73f800fa2e41f52b8eac3c5d"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"js-sys",
"web-sys",
]
@ -4003,7 +4030,7 @@ dependencies = [
"ahash 0.8.11",
"android-activity",
"atomic-waker",
"bitflags 2.5.0",
"bitflags 2.6.0",
"bytemuck",
"calloop",
"cfg_aliases",
@ -4114,7 +4141,7 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5"
dependencies = [
"bitflags 2.5.0",
"bitflags 2.6.0",
"dlib",
"log",
"once_cell",

View file

@ -120,5 +120,5 @@ pub fn main() -> ExitCode {
}
}
return ExitCode::SUCCESS;
ExitCode::SUCCESS
}

View file

@ -46,7 +46,7 @@ pub(crate) mod internal {
pub(crate) fn get_cache() -> Result<Persy, Box<dyn Error>> {
let cache_dir = get_cache_dir()?;
match Persy::open_or_create_with(
&cache_dir.join("librashader.db.1"),
cache_dir.join("librashader.db.1"),
Config::new(),
|persy| {
let tx = persy.begin()?;
@ -110,13 +110,13 @@ where
T: Cacheable,
{
if bypass_cache {
return Ok(load(factory(keys)?)?);
return load(factory(keys)?);
}
let cache = internal::get_cache();
let Ok(cache) = cache else {
return Ok(load(factory(keys)?)?);
return load(factory(keys)?);
};
let hashkey = {
@ -124,8 +124,8 @@ where
for subkeys in keys {
hasher.update(subkeys.hash_bytes());
}
let hash = hasher.finalize();
hash
hasher.finalize()
};
'attempt: {
@ -145,7 +145,7 @@ where
if let Some(slice) = T::to_bytes(&blob) {
let _ = internal::set_blob(&cache, index, hashkey.as_bytes(), &slice);
}
Ok(load(blob)?)
load(blob)
}
/// Cache a pipeline state object.
@ -166,13 +166,13 @@ where
T: Cacheable,
{
if bypass_cache {
return Ok(restore_pipeline(None)?);
return restore_pipeline(None);
}
let cache = internal::get_cache();
let Ok(cache) = cache else {
return Ok(restore_pipeline(None)?);
return restore_pipeline(None);
};
let hashkey = {
@ -180,19 +180,16 @@ where
for subkeys in keys {
hasher.update(subkeys.hash_bytes());
}
let hash = hasher.finalize();
hash
hasher.finalize()
};
let pipeline = 'attempt: {
if let Ok(Some(blob)) = internal::get_blob(&cache, index, hashkey.as_bytes()) {
let cached = restore_pipeline(Some(blob));
match cached {
Ok(res) => {
if let Ok(res) = cached {
break 'attempt res;
}
_ => (),
}
}
restore_pipeline(None)?

View file

@ -36,8 +36,8 @@ where
let mut hasher = blake3::Hasher::new();
hasher.update(source.vertex.as_bytes());
hasher.update(source.fragment.as_bytes());
let hash = hasher.finalize();
hash
hasher.finalize()
};
let compilation = 'cached: {

View file

@ -7,13 +7,13 @@ pub trait CacheKey {
impl CacheKey for u32 {
fn hash_bytes(&self) -> &[u8] {
&bytemuck::bytes_of(&*self)
bytemuck::bytes_of(self)
}
}
impl CacheKey for i32 {
fn hash_bytes(&self) -> &[u8] {
&bytemuck::bytes_of(&*self)
bytemuck::bytes_of(self)
}
}
@ -25,13 +25,13 @@ impl CacheKey for &[u8] {
impl CacheKey for Vec<u8> {
fn hash_bytes(&self) -> &[u8] {
&self
self
}
}
impl CacheKey for Vec<u32> {
fn hash_bytes(&self) -> &[u8] {
bytemuck::cast_slice(&self)
bytemuck::cast_slice(self)
}
}

View file

@ -24,8 +24,8 @@ metal = ["icrate"]
[dependencies]
gl = { version = "0.14.0", optional = true }
ash = { version = "0.37", optional = true }
wgpu-types = { version = "0.20.0", optional = true }
ash = { version = "0.38", optional = true }
wgpu-types = { version = "22.0.0", optional = true }
num-traits = "0.2.15"
rustc-hash = "1.1.0"
halfbrown = "0.2.4"

View file

@ -105,9 +105,9 @@ mod test {
#[test]
pub fn load_file() {
let result = load_shader_source(
"../test/slang-shaders/blurs/shaders/royale/blur3x3-last-pass.slang",
)
let result = load_shader_source(&librashader_common::ShaderStorage::Path(
"../test/slang-shaders/blurs/shaders/royale/blur3x3-last-pass.slang".into(),
))
.unwrap();
eprintln!("{:#}", result.vertex)
}

View file

@ -275,6 +275,12 @@ impl Display for ContextItem {
#[derive(Debug, Clone)]
pub struct WildcardContext(VecDeque<ContextItem>);
impl Default for WildcardContext {
fn default() -> Self {
Self::new()
}
}
impl WildcardContext {
/// Create a new wildcard context.
pub fn new() -> Self {
@ -391,12 +397,12 @@ pub(crate) fn apply_context(path: &mut PathBuf, context: &FastHashMap<String, St
if let Some(replacement) = context.get(key) {
return OsString::from(replacement.to_string()).into_encoded_bytes();
}
return caps[0].to_vec();
caps[0].to_vec()
});
// SAFETY: The original source is valid encoded bytes, and our replacement is
// valid encoded bytes. This upholds the safety requirements of `from_encoded_bytes_unchecked`.
new_path.push(unsafe { OsStr::from_encoded_bytes_unchecked(&replaced.as_ref()) })
new_path.push(unsafe { OsStr::from_encoded_bytes_unchecked(replaced.as_ref()) })
}
_ => new_path.push(component),
}

View file

@ -23,6 +23,7 @@ use crate::extract_if::MakeExtractIf;
#[derive(Debug)]
pub enum Value {
ShaderCount(i32),
#[allow(dead_code)]
FeedbackPass(i32),
Shader(i32, PathBuf),
ScaleX(i32, ScaleFactor),
@ -376,8 +377,7 @@ pub fn parse_values(
&& t.key.ends_with(*texture)
&& t.key.len() == "filter_".len() + texture.len()
})
// NOPANIC: infallible
.map_or(None, |(_, v)| Some(FilterMode::from_str(&v.value).unwrap()));
.map(|(_, v)| FilterMode::from_str(&v.value).unwrap());
values.push(Value::Texture {
name: texture.to_string(),

View file

@ -16,7 +16,7 @@ fn parses_all_slang_presets() {
#[test]
fn parses_problematic() {
let path = "../test/Mega_Bezel_Packs/Duimon-Mega-Bezel/Presets/Advanced/Nintendo_NDS_DREZ/NDS-[DREZ]-[Native]-[ADV]-[Guest]-[Night].slangp";
ShaderPreset::try_parse(path).expect(&format!("Failed to parse {}", path));
ShaderPreset::try_parse(path).unwrap_or_else(|_| panic!("Failed to parse {}", path));
}
#[test]
@ -30,5 +30,5 @@ fn parses_wildcard() {
context.append_item(ContextItem::CoreName(String::from("image display")));
ShaderPreset::try_parse_with_context(path, context)
.expect(&format!("Failed to parse {}", path));
.unwrap_or_else(|_| panic!("Failed to parse {}", path));
}

View file

@ -24,9 +24,9 @@ librashader-presets = { path = "../librashader-presets", version = "0.2.7" }
spirv_cross = { package = "librashader-spirv-cross", version = "0.25.1", optional = true }
naga = { version = "0.20.0", optional = true }
naga = { version = "22.0.0", optional = true }
rspirv = { version = "0.12.0", optional = true }
spirv = { version = "0.3.0", optional = true}
spirv = { version = "0.3.0", optional = true }
serde = { version = "1.0", features = ["derive"], optional = true }
@ -42,7 +42,20 @@ optional = true
default = ["cross", "naga", "serialize", "wgsl", "msl"]
dxil = ["spirv_cross/hlsl", "spirv-to-dxil"]
wgsl = ["cross", "naga/wgsl-out", "spirv", "rspirv"]
cross = [ "spirv_cross", "spirv_cross/glsl", "spirv_cross/hlsl", "spirv_cross/msl" ]
naga = [ "rspirv", "spirv", "naga/spv-in", "naga/spv-out", "naga/wgsl-out", "naga/msl-out" ]
serialize = [ "serde" ]
msl = [ "spirv_cross/msl", "naga/msl-out" ]
cross = [
"spirv_cross",
"spirv_cross/glsl",
"spirv_cross/hlsl",
"spirv_cross/msl",
]
naga = [
"rspirv",
"spirv",
"naga/spv-in",
"naga/spv-out",
"naga/wgsl-out",
"naga/msl-out",
]
unstable-naga = ["naga", "naga/glsl-in"]
serialize = ["serde"]
msl = ["spirv_cross/msl", "naga/msl-out"]

View file

@ -47,7 +47,7 @@ impl HlslBufferAssignments {
{
return true;
}
return false;
false
}
// Check if the mangled name matches.
@ -87,7 +87,7 @@ impl HlslBufferAssignments {
}
}
return false;
false
}
}

View file

@ -130,7 +130,10 @@ mod test {
use librashader_preprocess::ShaderSource;
pub fn test() {
let result = ShaderSource::load("../test/basic.slang").unwrap();
let result = ShaderSource::load(&librashader_common::ShaderStorage::Path(
"../test/basic.slang".into(),
))
.unwrap();
let _cross = Glslang::compile(&result).unwrap();
}
}

View file

@ -35,7 +35,6 @@ mod test {
use crate::reflect::naga::NagaLoweringOptions;
use crate::reflect::semantics::{Semantic, ShaderSemantics, UniformSemantic, UniqueSemantics};
use crate::reflect::ReflectShader;
use bitflags::Flags;
use librashader_common::map::FastHashMap;
use librashader_preprocess::ShaderSource;
@ -43,7 +42,10 @@ mod test {
pub fn test_into() {
// let result = ShaderSource::load("../test/shaders_slang/crt/shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.slang").unwrap();
// let result = ShaderSource::load("../test/shaders_slang/crt/shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.slang").unwrap();
let result = ShaderSource::load("../test/basic.slang").unwrap();
let result = ShaderSource::load(&librashader_common::ShaderStorage::Path(
"../test/basic.slang".into(),
))
.unwrap();
let mut uniform_semantics: FastHashMap<String, UniformSemantic> = Default::default();

View file

@ -57,7 +57,10 @@ mod test {
use librashader_preprocess::ShaderSource;
#[test]
pub fn compile_shader() {
let result = ShaderSource::load("../test/basic.slang").unwrap();
let result = ShaderSource::load(&librashader_common::ShaderStorage::Path(
"../test/basic.slang".into(),
))
.unwrap();
let _spirv = compile_spirv(&result).unwrap();
}
}

View file

@ -18,7 +18,7 @@ impl<'a> LinkInputs<'a> {
return None;
};
let Some(&Operand::IdRef(target)) = op.operands.get(0) else {
let Some(&Operand::IdRef(target)) = op.operands.first() else {
return None;
};
@ -29,7 +29,7 @@ impl<'a> LinkInputs<'a> {
let Some(&Operand::LiteralBit32(binding)) = op.operands.get(2) else {
return None;
};
return Some(binding);
Some(binding)
})
}
@ -62,7 +62,7 @@ impl<'a> LinkInputs<'a> {
if let Some(frag_ref) = bindings.get(&location) {
// if something is bound to the same location in the vertex shader,
// we're good.
inputs.remove(&frag_ref);
inputs.remove(frag_ref);
}
}
}
@ -112,7 +112,7 @@ impl<'a> LinkInputs<'a> {
}
}
}
return true;
true
});
self.frag_builder.module_mut().annotations.retain(|instr| {
@ -123,7 +123,7 @@ impl<'a> LinkInputs<'a> {
}
}
}
return true;
true
});
for entry_point in self.frag_builder.module_mut().entry_points.iter_mut() {
@ -133,7 +133,7 @@ impl<'a> LinkInputs<'a> {
return false;
}
}
return true;
true
})
}

View file

@ -33,12 +33,12 @@ struct OpAccessChain<'a> {
impl<'a> LowerCombinedImageSamplerPass<'a> {
pub fn new(builder: &'a mut Builder) -> Self {
let val = Self {
Self {
builder,
seen_functions: FxHashSet::default(),
};
val
}
}
pub(crate) fn do_pass(&mut self) {
@ -109,7 +109,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
return None;
}
let Some(&Operand::IdRef(target)) = &i.operands.get(0) else {
let Some(&Operand::IdRef(target)) = &i.operands.first() else {
return None;
};
@ -121,7 +121,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
return None;
};
return Some(format!("_{string}_sampler"));
Some(format!("_{string}_sampler"))
})
}
@ -130,7 +130,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
return None;
}
let Some(&Operand::IdRef(referand)) = inst.operands.get(0) else {
let Some(&Operand::IdRef(referand)) = inst.operands.first() else {
return None;
};
@ -183,7 +183,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
self.builder.decorate(
sampler_uniform,
decoration_type,
decoration.operands[2..].iter().map(|f| f.clone()),
decoration.operands[2..].iter().cloned(),
)
}
@ -264,7 +264,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
}
if uniform_type.class.opcode == spirv::Op::TypeArray {
let Some(&Operand::IdRef(array_base_type)) = uniform_type.operands.get(0)
let Some(&Operand::IdRef(array_base_type)) = uniform_type.operands.first()
else {
continue;
};
@ -402,7 +402,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
}
// This doesn't affect array loads because array loads load the result of the OpAccessChain which can be done in a separate pass.
let Some(Operand::IdRef(op_variable_id)) = &instr.operands.get(0) else {
let Some(Operand::IdRef(op_variable_id)) = &instr.operands.first() else {
instructions.push(instr);
continue;
};
@ -474,7 +474,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
}
// This doesn't affect array loads because array loads load the result of the OpAccessChain which can be done in a separate pass.
let Some(Operand::IdRef(op_variable)) = &instr.operands.get(0) else {
let Some(Operand::IdRef(op_variable)) = &instr.operands.first() else {
instructions.push(instr);
continue;
};
@ -565,7 +565,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
continue;
}
let Some(Operand::IdRef(op_variable)) = &instr.operands.get(0) else {
let Some(Operand::IdRef(op_variable)) = &instr.operands.first() else {
instructions.push(instr);
continue;
};
@ -656,7 +656,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
continue;
}
let Some(&Operand::IdRef(function_id)) = instr.operands.get(0) else {
let Some(&Operand::IdRef(function_id)) = instr.operands.first() else {
continue;
};
@ -729,7 +729,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
continue;
}
let Some(&Operand::IdRef(function_id)) = instr.operands.get(0) else {
let Some(&Operand::IdRef(function_id)) = instr.operands.first() else {
instructions.push(instr);
continue;
};
@ -742,7 +742,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
return false;
};
op_access_chains.contains_key(&op_ref_id)
op_access_chains.contains_key(op_ref_id)
})
.collect::<Vec<_>>();
@ -861,9 +861,9 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
seen_functions
}
fn rewrite_functions_definitions<'b>(
fn rewrite_functions_definitions(
&mut self,
mappings: &FxHashMap<spirv::Word, FxHashMap<spirv::Word, Cow<'b, CombinedImageSampler>>>,
mappings: &FxHashMap<spirv::Word, FxHashMap<spirv::Word, Cow<'_, CombinedImageSampler>>>,
) -> FxHashMap<spirv::Word, CombinedImageSampler> {
let mut sampled_refs = FxHashMap::default();
let mut functions = self.builder.module_ref().functions.clone();

View file

@ -5,6 +5,6 @@ pub mod lower_samplers;
pub(crate) fn load_module(words: &[u32]) -> rspirv::dr::Module {
let mut loader = rspirv::dr::Loader::new();
rspirv::binary::parse_words(words, &mut loader).unwrap();
let module = loader.module();
module
loader.module()
}

View file

@ -754,7 +754,10 @@ mod test {
#[test]
pub fn test_into() {
let result = ShaderSource::load("../test/basic.slang").unwrap();
let result = ShaderSource::load(&librashader_common::ShaderStorage::Path(
"../test/basic.slang".into(),
))
.unwrap();
let mut uniform_semantics: FastHashMap<String, UniformSemantic> = Default::default();
for (_index, param) in result.parameters.iter().enumerate() {

View file

@ -120,7 +120,10 @@ mod test {
pub fn test_into() {
// let result = ShaderSource::load("../test/shaders_slang/crt/shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.slang").unwrap();
// let result = ShaderSource::load("../test/shaders_slang/crt/shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.slang").unwrap();
let result = ShaderSource::load("../test/basic.slang").unwrap();
let result = ShaderSource::load(&librashader_common::ShaderStorage::Path(
"../test/basic.slang".into(),
))
.unwrap();
let mut uniform_semantics: FastHashMap<String, UniformSemantic> = Default::default();

View file

@ -205,7 +205,7 @@ impl ValidateTypeSemantics<&TypeInner> for UniqueSemantics {
}
};
return None;
None
}
}
@ -426,13 +426,13 @@ impl NagaReflect {
// Verify types
if self.vertex.global_variables.iter().any(|(_, gv)| {
let ty = &self.vertex.types[gv.ty];
match ty.inner {
!matches!(
ty.inner,
TypeInner::Scalar { .. }
| TypeInner::Vector { .. }
| TypeInner::Matrix { .. }
| TypeInner::Struct { .. } => false,
_ => true,
}
| TypeInner::Struct { .. }
)
}) {
return Err(ShaderReflectError::VertexSemanticError(
SemanticsErrorKind::InvalidResourceType,
@ -483,7 +483,7 @@ impl NagaReflect {
SemanticsErrorKind::InvalidInputCount(vert_inputs),
));
}
for input in &vertex_entry_point.function.arguments {
if let Some(input) = &vertex_entry_point.function.arguments.first() {
let &Some(Binding::Location { location, .. }) = &input.binding else {
return Err(ShaderReflectError::VertexSemanticError(
SemanticsErrorKind::MissingBinding,
@ -644,7 +644,7 @@ impl NagaReflect {
offset_type: UniformMemberBlock,
blame: SemanticErrorBlame,
) -> Result<(), ShaderReflectError> {
let reachable = Self::collect_uniform_names(&module, resource, blame)?;
let reachable = Self::collect_uniform_names(module, resource, blame)?;
let resource = &module.global_variables[resource];
@ -824,7 +824,7 @@ impl NagaReflect {
Ok(TextureData {
// id: texture.id,
// descriptor_set,
name: &name,
name,
binding: binding.binding,
})
}
@ -1002,44 +1002,3 @@ impl ReflectShader for NagaReflect {
})
}
}
#[cfg(test)]
mod test {
use crate::reflect::semantics::{Semantic, TextureSemantics, UniformSemantic};
use librashader_common::map::FastHashMap;
use librashader_preprocess::ShaderSource;
use librashader_presets::ShaderPreset;
// #[test]
// pub fn test_into() {
// let result = ShaderSource::load("../test/slang-shaders/crt/shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.slang").unwrap();
// let compilation = crate::front::GlslangCompilation::try_from(&result).unwrap();
//
// let mut loader = rspirv::dr::Loader::new();
// rspirv::binary::parse_words(compilation.vertex.as_binary(), &mut loader).unwrap();
// let module = loader.module();
//
// let outputs: Vec<&Instruction> = module
// .types_global_values
// .iter()
// .filter(|i| i.class.opcode == Op::Variable)
// .collect();
//
// println!("{outputs:#?}");
// }
// #[test]
// pub fn mega_bezel_reflect() {
// let preset = ShaderPreset::try_parse(
// "../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
// )
// .unwrap();
//
// let mut uniform_semantics: FastHashMap<String, UniformSemantic> = Default::default();
// let mut texture_semantics: FastHashMap<String, Semantic<TextureSemantics>> = Default::default();
//
//
//
//
// }
}

View file

@ -53,13 +53,15 @@ impl CompileShader<MSL> for NagaReflect {
) -> Result<(String, TranslationInfo), ShaderCompileError> {
let mut valid =
naga::valid::Validator::new(ValidationFlags::all(), Capabilities::empty());
let info = valid.validate(&module)?;
let info = valid.validate(module)?;
let pipeline_options = PipelineOptions {
allow_and_force_point_size: false,
vertex_pulling_transform: false,
vertex_buffer_mappings: Vec::new(),
};
let msl = naga::back::msl::write_string(&module, &info, &options, &pipeline_options)?;
let msl = naga::back::msl::write_string(module, &info, &options, &pipeline_options)?;
Ok(msl)
}
@ -170,7 +172,10 @@ mod test {
#[test]
pub fn test_into() {
let result = ShaderSource::load("../test/basic.slang").unwrap();
let result = ShaderSource::load(&librashader_common::ShaderStorage::Path(
"../test/basic.slang".into(),
))
.unwrap();
let mut uniform_semantics: FastHashMap<String, UniformSemantic> = Default::default();

View file

@ -22,12 +22,14 @@ impl CompileShader<SPIRV> for NagaReflect {
) -> Result<Vec<u32>, ShaderCompileError> {
let mut valid =
naga::valid::Validator::new(ValidationFlags::all(), Capabilities::empty());
let info = valid.validate(&module)?;
let mut options = naga::back::spv::Options::default();
options.lang_version = version;
let info = valid.validate(module)?;
let options = naga::back::spv::Options {
lang_version: version,
..Default::default()
};
let spv = naga::back::spv::write_vec(
&module,
module,
&info,
&options,
Some(&PipelineOptions {

View file

@ -16,7 +16,7 @@ impl CompileShader<WGSL> for NagaReflect {
options: Self::Options,
) -> Result<ShaderCompilerOutput<String, Self::Context>, ShaderCompileError> {
fn write_wgsl(module: &Module, info: &ModuleInfo) -> Result<String, ShaderCompileError> {
let wgsl = naga::back::wgsl::write_string(&module, &info, WriterFlags::empty())?;
let wgsl = naga::back::wgsl::write_string(module, info, WriterFlags::empty())?;
Ok(wgsl)
}

View file

@ -14,13 +14,17 @@ 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.7" }
librashader-common = { path = "../librashader-common", features = [
"wgpu",
], version = "0.2.7" }
librashader-presets = { path = "../librashader-presets", version = "0.2.7" }
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.7" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.7", features = ["wgsl"], default-features = false }
librashader-runtime = { path = "../librashader-runtime" , version = "0.2.7" }
librashader-reflect = { path = "../librashader-reflect", version = "0.2.7", features = [
"wgsl",
], default-features = false }
librashader-runtime = { path = "../librashader-runtime", version = "0.2.7" }
wgpu = { version = "0.20.0", default-features = false, features = ["wgsl"] }
wgpu = { version = "22.0.0", default-features = false, features = ["wgsl"] }
image = "0.25.1"
thiserror = "1.0.50"
bytemuck = { version = "1.14.0", features = ["derive"] }

View file

@ -198,6 +198,7 @@ impl PipelineLayoutObjects {
alpha_to_coverage_enabled: false,
},
multiview: None,
cache: None,
})
}
}

View file

@ -36,6 +36,7 @@ impl MipmapGen {
depth_stencil: None,
multisample: wgpu::MultisampleState::default(),
multiview: None,
cache: None,
});
pipeline

View file

@ -95,8 +95,8 @@ where
type UniformOffset: ContextOffset<H, C, Self::DeviceContext>;
/// Bind a texture to the input descriptor set
fn bind_texture<'a>(
descriptors: &mut Self::DescriptorSet<'a>,
fn bind_texture(
descriptors: &mut Self::DescriptorSet<'_>,
samplers: &Self::SamplerSet,
binding: &TextureBinding,
texture: &Self::InputTexture,
@ -105,11 +105,11 @@ where
#[allow(clippy::too_many_arguments)]
/// Write uniform and texture semantics to the provided storages.
fn bind_semantics<'a>(
fn bind_semantics(
device: &Self::DeviceContext,
sampler_set: &Self::SamplerSet,
uniform_storage: &mut UniformStorage<H, C, U, P, Self::DeviceContext>,
descriptor_set: &mut Self::DescriptorSet<'a>,
descriptor_set: &mut Self::DescriptorSet<'_>,
uniform_inputs: UniformInputs<'_>,
original: &Self::InputTexture,
source: &Self::InputTexture,

View file

@ -14,7 +14,7 @@ impl<'a, F, I, E> FramebufferInit<'a, F, I, E> {
/// Create a new framebuffer initializer with the given
/// closures to create owned framebuffers and image views.
pub fn new(
filters: impl Iterator<Item = &'a BindingMeta> + ExactSizeIterator,
filters: impl ExactSizeIterator<Item = &'a BindingMeta>,
owned_generator: &'a dyn Fn() -> Result<F, E>,
input_generator: &'a dyn Fn() -> I,
) -> Self {

View file

@ -7,8 +7,8 @@ pub trait FilterChainParameters {
fn set_enabled_pass_count(&mut self, count: usize);
/// Enumerates the active parameters as well as their values in the current filter chain.
fn enumerate_parameters<'a>(
&'a self,
fn enumerate_parameters(
&self,
) -> ::librashader_common::map::halfbrown::Iter<String, f32>;
/// Get the value of the given parameter if present.

View file

@ -39,6 +39,16 @@ pub struct InlineRingBuffer<T, const SIZE: usize> {
index: usize,
}
impl<T, const SIZE: usize> Default for InlineRingBuffer<T, SIZE>
where
T: Copy,
T: Default,
{
fn default() -> Self {
Self::new()
}
}
impl<T, const SIZE: usize> InlineRingBuffer<T, SIZE>
where
T: Copy,

View file

@ -26,21 +26,24 @@ librashader-runtime-gl = { path = "../librashader-runtime-gl", version = "0.2.7"
librashader-runtime-vk = { path = "../librashader-runtime-vk", version = "0.2.7", optional = true }
librashader-runtime-mtl = { path = "../librashader-runtime-mtl", version = "0.2.7", optional = true }
ash = { version = "0.37", optional = true }
ash = { version = "0.38.0", optional = true }
halfbrown = "0.2.4"
[target.'cfg(not(all(target_vendor="apple", docsrs)))'.dependencies]
wgpu = { version = "0.20", default-features = false, optional = true }
wgpu = { version = "22.0.0", default-features = false, optional = true }
librashader-runtime-wgpu = { path = "../librashader-runtime-wgpu", version = "0.2.7", optional = true }
wgpu-types = { version = "0.20", optional = true }
wgpu-types = { version = "22.0.0", optional = true }
[target.'cfg(windows)'.dependencies.windows]
workspace = true
optional = true
[target.'cfg(target_vendor="apple")'.dependencies]
icrate = { version = "0.1.0" , features = [ "Metal", "Metal_all" ], optional = true}
objc2 = { version = "0.5.0", features = ["apple"] , optional = true }
icrate = { version = "0.1.0", features = [
"Metal",
"Metal_all",
], optional = true }
objc2 = { version = "0.5.0", features = ["apple"], optional = true }
[features]
# core features and definitions
@ -51,25 +54,81 @@ presets = []
# runtimes
runtime-gl = [ "runtime", "reflect-cross", "librashader-common/opengl", "librashader-runtime-gl" ]
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-d3d9 = [ "runtime", "reflect-cross", "librashader-common/d3d9", "librashader-runtime-d3d9", "windows/Win32_Graphics_Direct3D9" ]
runtime-gl = [
"runtime",
"reflect-cross",
"librashader-common/opengl",
"librashader-runtime-gl",
]
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-d3d9 = [
"runtime",
"reflect-cross",
"librashader-common/d3d9",
"librashader-runtime-d3d9",
"windows/Win32_Graphics_Direct3D9",
]
runtime-vk = ["runtime", "reflect-cross", "librashader-common/vulkan", "librashader-runtime-vk", "ash" ]
runtime-wgpu = [ "runtime", "reflect-naga", "librashader-common/wgpu", "librashader-runtime-wgpu", "wgpu", "wgpu-types" ]
runtime-metal = [ "runtime", "reflect-naga", "reflect-cross", "librashader-common/metal", "librashader-runtime-mtl", "icrate", "objc2" ]
runtime-vk = [
"runtime",
"reflect-cross",
"librashader-common/vulkan",
"librashader-runtime-vk",
"ash",
]
runtime-wgpu = [
"runtime",
"reflect-naga",
"librashader-common/wgpu",
"librashader-runtime-wgpu",
"wgpu",
"wgpu-types",
]
runtime-metal = [
"runtime",
"reflect-naga",
"reflect-cross",
"librashader-common/metal",
"librashader-runtime-mtl",
"icrate",
"objc2",
]
# reflection
reflect-cross = ["reflect", "librashader-reflect/cross"]
reflect-dxil = ["reflect", "librashader-reflect/dxil"]
reflect-naga = ["reflect", "librashader-reflect/naga"]
reflect-naga = [
"reflect",
"librashader-reflect/naga",
"librashader-reflect/unstable-naga",
]
runtime-all = ["runtime-gl", "runtime-d3d11", "runtime-d3d12", "runtime-vk", "runtime-wgpu", "runtime-metal"]
runtime-all = [
"runtime-gl",
"runtime-d3d11",
"runtime-d3d12",
"runtime-vk",
"runtime-wgpu",
"runtime-metal",
]
reflect-all = ["reflect-cross", "reflect-dxil", "reflect-naga"]
# enable all features by default
default = [ "full" ]
default = ["full"]
internal = []
full = ["runtime-all", "reflect-all", "preprocess", "presets"]
@ -86,12 +145,14 @@ rayon = "1.6.1"
once_cell = "1.19.0"
[package.metadata.docs.rs]
targets = [ "x86_64-pc-windows-msvc",
targets = [
"x86_64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"x86_64-apple-darwin",
"aarch64-apple-darwin",
"aarch64-apple-ios",
"i686-pc-windows-msvc",
"i686-unknown-linux-gnu", ]
"i686-unknown-linux-gnu",
]
features = ["docsrs"]
rustc-args = ["--cfg", "docsrs"]

2
rust-toolchain.toml Normal file
View file

@ -0,0 +1,2 @@
[toolchain]
channel = "nightly"