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" checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289"
dependencies = [ dependencies = [
"android-properties", "android-properties",
"bitflags 2.5.0", "bitflags 2.6.0",
"cc", "cc",
"cesu8", "cesu8",
"jni", "jni",
@ -167,13 +167,22 @@ dependencies = [
"libloading 0.7.4", "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]] [[package]]
name = "ash-window" name = "ash-window"
version = "0.12.0" version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b912285a7c29f3a8f87ca6f55afc48768624e5e33ec17dbd2f2075903f5e35ab" checksum = "b912285a7c29f3a8f87ca6f55afc48768624e5e33ec17dbd2f2075903f5e35ab"
dependencies = [ dependencies = [
"ash", "ash 0.37.3+1.3.251",
"raw-window-handle 0.5.2", "raw-window-handle 0.5.2",
"raw-window-metal", "raw-window-metal",
] ]
@ -268,18 +277,18 @@ dependencies = [
[[package]] [[package]]
name = "bit-set" name = "bit-set"
version = "0.5.3" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" checksum = "f0481a0e032742109b1133a095184ee93d88f3dc9e0d28a5d033dc77a073f44f"
dependencies = [ dependencies = [
"bit-vec", "bit-vec",
] ]
[[package]] [[package]]
name = "bit-vec" name = "bit-vec"
version = "0.6.3" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" checksum = "d2c54ff287cfc0a34f38a6b832ea1bd8e448a330b3e40a50859e6488bee07f22"
[[package]] [[package]]
name = "bit_field" name = "bit_field"
@ -295,9 +304,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "2.5.0" version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]] [[package]]
name = "bitstream-io" name = "bitstream-io"
@ -442,7 +451,7 @@ version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"log", "log",
"polling", "polling",
"rustix", "rustix",
@ -839,12 +848,12 @@ checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991"
[[package]] [[package]]
name = "d3d12" name = "d3d12"
version = "0.20.0" version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b28bfe653d79bd16c77f659305b195b82bb5ce0c0eb2a4846b82ddbd77586813" checksum = "bdbd1f579714e3c809ebd822c81ef148b1ceaeb3d535352afc73fd0c4c6a0017"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"libloading 0.8.3", "libloading 0.7.4",
"winapi", "winapi",
] ]
@ -908,9 +917,9 @@ checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"
[[package]] [[package]]
name = "document-features" name = "document-features"
version = "0.2.8" version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef5282ad69563b5fc40319526ba27e0e7363d552a896f0297d54f767717f9b95" checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0"
dependencies = [ dependencies = [
"litrs", "litrs",
] ]
@ -1211,9 +1220,9 @@ dependencies = [
[[package]] [[package]]
name = "glutin_wgl_sys" name = "glutin_wgl_sys"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead" checksum = "0a4e1951bbd9434a81aa496fe59ccc2235af3820d27b85f9314e279609211e2c"
dependencies = [ dependencies = [
"gl_generator", "gl_generator",
] ]
@ -1224,7 +1233,7 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"gpu-alloc-types", "gpu-alloc-types",
] ]
@ -1234,7 +1243,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
] ]
[[package]] [[package]]
@ -1243,7 +1252,18 @@ version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f56f6318968d03c18e1bcf4857ff88c61157e9da8e47c5f29055d60e1228884" checksum = "6f56f6318968d03c18e1bcf4857ff88c61157e9da8e47c5f29055d60e1228884"
dependencies = [ 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", "log",
"presser", "presser",
"thiserror", "thiserror",
@ -1257,7 +1277,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c08c1f623a8d0b722b8b99f821eb0ba672a1618f0d3b16ddbee1cedd2dd8557" checksum = "9c08c1f623a8d0b722b8b99f821eb0ba672a1618f0d3b16ddbee1cedd2dd8557"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"gpu-descriptor-types", "gpu-descriptor-types",
"hashbrown 0.14.5", "hashbrown 0.14.5",
] ]
@ -1268,7 +1288,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
] ]
[[package]] [[package]]
@ -1315,7 +1335,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890" checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"com", "com",
"libc", "libc",
"libloading 0.8.3", "libloading 0.8.3",
@ -1607,7 +1627,7 @@ dependencies = [
name = "librashader" name = "librashader"
version = "0.2.7" version = "0.2.7"
dependencies = [ dependencies = [
"ash", "ash 0.38.0+1.3.281",
"glob", "glob",
"halfbrown", "halfbrown",
"icrate 0.1.2", "icrate 0.1.2",
@ -1660,7 +1680,7 @@ dependencies = [
name = "librashader-capi" name = "librashader-capi"
version = "0.2.7" version = "0.2.7"
dependencies = [ dependencies = [
"ash", "ash 0.37.3+1.3.251",
"gl", "gl",
"icrate 0.1.2", "icrate 0.1.2",
"librashader", "librashader",
@ -1677,7 +1697,7 @@ dependencies = [
name = "librashader-common" name = "librashader-common"
version = "0.2.7" version = "0.2.7"
dependencies = [ dependencies = [
"ash", "ash 0.38.0+1.3.281",
"gl", "gl",
"halfbrown", "halfbrown",
"icrate 0.1.2", "icrate 0.1.2",
@ -1719,7 +1739,7 @@ dependencies = [
name = "librashader-reflect" name = "librashader-reflect"
version = "0.2.7" version = "0.2.7"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"bytemuck", "bytemuck",
"glslang", "glslang",
"indexmap 2.2.6", "indexmap 2.2.6",
@ -1851,11 +1871,11 @@ name = "librashader-runtime-vk"
version = "0.2.7" version = "0.2.7"
dependencies = [ dependencies = [
"array-concat", "array-concat",
"ash", "ash 0.37.3+1.3.251",
"ash-window", "ash-window",
"bytemuck", "bytemuck",
"glfw 0.49.1", "glfw 0.49.1",
"gpu-allocator", "gpu-allocator 0.25.0",
"librashader-cache", "librashader-cache",
"librashader-common", "librashader-common",
"librashader-preprocess", "librashader-preprocess",
@ -1911,7 +1931,7 @@ version = "0.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"libc", "libc",
"redox_syscall 0.4.1", "redox_syscall 0.4.1",
] ]
@ -1922,7 +1942,7 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"libc", "libc",
] ]
@ -2020,11 +2040,11 @@ dependencies = [
[[package]] [[package]]
name = "metal" name = "metal"
version = "0.28.0" version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5637e166ea14be6063a3f8ba5ccb9a4159df7d8f6d61c02fc3d480b1f90dcfcb" checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"block", "block",
"core-graphics-types", "core-graphics-types",
"foreign-types", "foreign-types",
@ -2051,19 +2071,20 @@ dependencies = [
[[package]] [[package]]
name = "naga" name = "naga"
version = "0.20.0" version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e536ae46fcab0876853bd4a632ede5df4b1c2527a58f6c5a4150fe86be858231" checksum = "09eeccb9b50f4f7839b214aa3e08be467159506a986c18e0702170ccf720a453"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
"bitflags 2.5.0", "bitflags 2.6.0",
"cfg_aliases",
"codespan-reporting", "codespan-reporting",
"hexf-parse", "hexf-parse",
"indexmap 2.2.6", "indexmap 2.2.6",
"log", "log",
"num-traits",
"petgraph", "petgraph",
"pp-rs",
"rustc-hash", "rustc-hash",
"spirv", "spirv",
"termcolor", "termcolor",
@ -2077,7 +2098,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"jni-sys", "jni-sys",
"log", "log",
"ndk-sys", "ndk-sys",
@ -2497,6 +2518,15 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2" 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]] [[package]]
name = "ppv-lite86" name = "ppv-lite86"
version = "0.2.17" version = "0.2.17"
@ -2772,7 +2802,7 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
] ]
[[package]] [[package]]
@ -2873,7 +2903,7 @@ version = "0.38.34"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"errno", "errno",
"libc", "libc",
"linux-raw-sys", "linux-raw-sys",
@ -3022,7 +3052,7 @@ version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a" checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"calloop", "calloop",
"calloop-wayland-source", "calloop-wayland-source",
"cursor-icon", "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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
] ]
[[package]] [[package]]
@ -3191,18 +3221,18 @@ checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9"
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.61" version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.61" version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -3509,7 +3539,7 @@ version = "0.31.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e63801c85358a431f986cffa74ba9599ff571fc5774ac113ed3b490c19a1133" checksum = "1e63801c85358a431f986cffa74ba9599ff571fc5774ac113ed3b490c19a1133"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"rustix", "rustix",
"wayland-backend", "wayland-backend",
"wayland-scanner", "wayland-scanner",
@ -3521,7 +3551,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"cursor-icon", "cursor-icon",
"wayland-backend", "wayland-backend",
] ]
@ -3543,7 +3573,7 @@ version = "0.31.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4" checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"wayland-backend", "wayland-backend",
"wayland-client", "wayland-client",
"wayland-scanner", "wayland-scanner",
@ -3555,7 +3585,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"wayland-backend", "wayland-backend",
"wayland-client", "wayland-client",
"wayland-protocols", "wayland-protocols",
@ -3568,7 +3598,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"wayland-backend", "wayland-backend",
"wayland-client", "wayland-client",
"wayland-protocols", "wayland-protocols",
@ -3626,12 +3656,11 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
[[package]] [[package]]
name = "wgpu" name = "wgpu"
version = "0.20.1" version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90e37c7b9921b75dfd26dd973fdcbce36f13dfa6e2dc82aece584e0ed48c355c" checksum = "c87e07e87a179614940ad845397e03201847453a37b43a31a3b54eee2e6e32ce"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"cfg-if",
"cfg_aliases", "cfg_aliases",
"document-features", "document-features",
"js-sys", "js-sys",
@ -3652,15 +3681,14 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core" name = "wgpu-core"
version = "0.21.0" version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d59e0d5fc509601c69e4e1fa06c1eb3c4c9f12956a5e30c79b61ef1c1be7daf0" checksum = "e0f191908a21968991463fcf3b42cb6c9648c0fb7fa301b8fc733bc21a9ed9bd"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-vec", "bit-vec",
"bitflags 2.5.0", "bitflags 2.6.0",
"cfg_aliases", "cfg_aliases",
"codespan-reporting",
"document-features", "document-features",
"indexmap 2.2.6", "indexmap 2.2.6",
"log", "log",
@ -3672,22 +3700,21 @@ dependencies = [
"rustc-hash", "rustc-hash",
"smallvec", "smallvec",
"thiserror", "thiserror",
"web-sys",
"wgpu-hal", "wgpu-hal",
"wgpu-types", "wgpu-types",
] ]
[[package]] [[package]]
name = "wgpu-hal" name = "wgpu-hal"
version = "0.21.0" version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6aa24c3889f885a3fb9133b454c8418bfcfaadcfe4ed3be96ac80e76703b863b" checksum = "f6bbf4b4de8b2a83c0401d9e5ae0080a2792055f25859a02bf9be97952bbed4f"
dependencies = [ dependencies = [
"android_system_properties", "android_system_properties",
"arrayvec", "arrayvec",
"ash", "ash 0.38.0+1.3.281",
"bit-set", "bit-set",
"bitflags 2.5.0", "bitflags 2.6.0",
"block", "block",
"cfg_aliases", "cfg_aliases",
"core-graphics-types", "core-graphics-types",
@ -3695,7 +3722,7 @@ dependencies = [
"glow", "glow",
"glutin_wgl_sys", "glutin_wgl_sys",
"gpu-alloc", "gpu-alloc",
"gpu-allocator", "gpu-allocator 0.26.0",
"gpu-descriptor", "gpu-descriptor",
"hassle-rs", "hassle-rs",
"js-sys", "js-sys",
@ -3724,11 +3751,11 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-types" name = "wgpu-types"
version = "0.20.0" version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1353d9a46bff7f955a680577f34c69122628cc2076e1d6f3a9be6ef00ae793ef" checksum = "bc9d91f0e2c4b51434dfa6db77846f2793149d8e73f800fa2e41f52b8eac3c5d"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"js-sys", "js-sys",
"web-sys", "web-sys",
] ]
@ -4003,7 +4030,7 @@ dependencies = [
"ahash 0.8.11", "ahash 0.8.11",
"android-activity", "android-activity",
"atomic-waker", "atomic-waker",
"bitflags 2.5.0", "bitflags 2.6.0",
"bytemuck", "bytemuck",
"calloop", "calloop",
"cfg_aliases", "cfg_aliases",
@ -4114,7 +4141,7 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.6.0",
"dlib", "dlib",
"log", "log",
"once_cell", "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>> { pub(crate) fn get_cache() -> Result<Persy, Box<dyn Error>> {
let cache_dir = get_cache_dir()?; let cache_dir = get_cache_dir()?;
match Persy::open_or_create_with( match Persy::open_or_create_with(
&cache_dir.join("librashader.db.1"), cache_dir.join("librashader.db.1"),
Config::new(), Config::new(),
|persy| { |persy| {
let tx = persy.begin()?; let tx = persy.begin()?;
@ -110,13 +110,13 @@ where
T: Cacheable, T: Cacheable,
{ {
if bypass_cache { if bypass_cache {
return Ok(load(factory(keys)?)?); return load(factory(keys)?);
} }
let cache = internal::get_cache(); let cache = internal::get_cache();
let Ok(cache) = cache else { let Ok(cache) = cache else {
return Ok(load(factory(keys)?)?); return load(factory(keys)?);
}; };
let hashkey = { let hashkey = {
@ -124,8 +124,8 @@ where
for subkeys in keys { for subkeys in keys {
hasher.update(subkeys.hash_bytes()); hasher.update(subkeys.hash_bytes());
} }
let hash = hasher.finalize();
hash hasher.finalize()
}; };
'attempt: { 'attempt: {
@ -145,7 +145,7 @@ where
if let Some(slice) = T::to_bytes(&blob) { if let Some(slice) = T::to_bytes(&blob) {
let _ = internal::set_blob(&cache, index, hashkey.as_bytes(), &slice); let _ = internal::set_blob(&cache, index, hashkey.as_bytes(), &slice);
} }
Ok(load(blob)?) load(blob)
} }
/// Cache a pipeline state object. /// Cache a pipeline state object.
@ -166,13 +166,13 @@ where
T: Cacheable, T: Cacheable,
{ {
if bypass_cache { if bypass_cache {
return Ok(restore_pipeline(None)?); return restore_pipeline(None);
} }
let cache = internal::get_cache(); let cache = internal::get_cache();
let Ok(cache) = cache else { let Ok(cache) = cache else {
return Ok(restore_pipeline(None)?); return restore_pipeline(None);
}; };
let hashkey = { let hashkey = {
@ -180,18 +180,15 @@ where
for subkeys in keys { for subkeys in keys {
hasher.update(subkeys.hash_bytes()); hasher.update(subkeys.hash_bytes());
} }
let hash = hasher.finalize();
hash hasher.finalize()
}; };
let pipeline = 'attempt: { let pipeline = 'attempt: {
if let Ok(Some(blob)) = internal::get_blob(&cache, index, hashkey.as_bytes()) { if let Ok(Some(blob)) = internal::get_blob(&cache, index, hashkey.as_bytes()) {
let cached = restore_pipeline(Some(blob)); let cached = restore_pipeline(Some(blob));
match cached { if let Ok(res) = cached {
Ok(res) => { break 'attempt res;
break 'attempt res;
}
_ => (),
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -275,6 +275,12 @@ impl Display for ContextItem {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WildcardContext(VecDeque<ContextItem>); pub struct WildcardContext(VecDeque<ContextItem>);
impl Default for WildcardContext {
fn default() -> Self {
Self::new()
}
}
impl WildcardContext { impl WildcardContext {
/// Create a new wildcard context. /// Create a new wildcard context.
pub fn new() -> Self { 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) { if let Some(replacement) = context.get(key) {
return OsString::from(replacement.to_string()).into_encoded_bytes(); 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 // 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`. // 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), _ => new_path.push(component),
} }

View file

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

View file

@ -16,7 +16,7 @@ fn parses_all_slang_presets() {
#[test] #[test]
fn parses_problematic() { fn parses_problematic() {
let path = "../test/Mega_Bezel_Packs/Duimon-Mega-Bezel/Presets/Advanced/Nintendo_NDS_DREZ/NDS-[DREZ]-[Native]-[ADV]-[Guest]-[Night].slangp"; 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] #[test]
@ -30,5 +30,5 @@ fn parses_wildcard() {
context.append_item(ContextItem::CoreName(String::from("image display"))); context.append_item(ContextItem::CoreName(String::from("image display")));
ShaderPreset::try_parse_with_context(path, context) 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 } 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 } 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 } serde = { version = "1.0", features = ["derive"], optional = true }
@ -42,7 +42,20 @@ optional = true
default = ["cross", "naga", "serialize", "wgsl", "msl"] default = ["cross", "naga", "serialize", "wgsl", "msl"]
dxil = ["spirv_cross/hlsl", "spirv-to-dxil"] dxil = ["spirv_cross/hlsl", "spirv-to-dxil"]
wgsl = ["cross", "naga/wgsl-out", "spirv", "rspirv"] wgsl = ["cross", "naga/wgsl-out", "spirv", "rspirv"]
cross = [ "spirv_cross", "spirv_cross/glsl", "spirv_cross/hlsl", "spirv_cross/msl" ] cross = [
naga = [ "rspirv", "spirv", "naga/spv-in", "naga/spv-out", "naga/wgsl-out", "naga/msl-out" ] "spirv_cross",
serialize = [ "serde" ] "spirv_cross/glsl",
msl = [ "spirv_cross/msl", "naga/msl-out" ] "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 true;
} }
return false; false
} }
// Check if the mangled name matches. // 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; use librashader_preprocess::ShaderSource;
pub fn test() { 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(); let _cross = Glslang::compile(&result).unwrap();
} }
} }

View file

@ -35,7 +35,6 @@ mod test {
use crate::reflect::naga::NagaLoweringOptions; use crate::reflect::naga::NagaLoweringOptions;
use crate::reflect::semantics::{Semantic, ShaderSemantics, UniformSemantic, UniqueSemantics}; use crate::reflect::semantics::{Semantic, ShaderSemantics, UniformSemantic, UniqueSemantics};
use crate::reflect::ReflectShader; use crate::reflect::ReflectShader;
use bitflags::Flags;
use librashader_common::map::FastHashMap; use librashader_common::map::FastHashMap;
use librashader_preprocess::ShaderSource; use librashader_preprocess::ShaderSource;
@ -43,7 +42,10 @@ mod test {
pub fn test_into() { 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/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(); let mut uniform_semantics: FastHashMap<String, UniformSemantic> = Default::default();

View file

@ -57,7 +57,10 @@ mod test {
use librashader_preprocess::ShaderSource; use librashader_preprocess::ShaderSource;
#[test] #[test]
pub fn compile_shader() { 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(); let _spirv = compile_spirv(&result).unwrap();
} }
} }

View file

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

View file

@ -33,12 +33,12 @@ struct OpAccessChain<'a> {
impl<'a> LowerCombinedImageSamplerPass<'a> { impl<'a> LowerCombinedImageSamplerPass<'a> {
pub fn new(builder: &'a mut Builder) -> Self { pub fn new(builder: &'a mut Builder) -> Self {
let val = Self {
Self {
builder, builder,
seen_functions: FxHashSet::default(), seen_functions: FxHashSet::default(),
}; }
val
} }
pub(crate) fn do_pass(&mut self) { pub(crate) fn do_pass(&mut self) {
@ -109,7 +109,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
return None; return None;
} }
let Some(&Operand::IdRef(target)) = &i.operands.get(0) else { let Some(&Operand::IdRef(target)) = &i.operands.first() else {
return None; return None;
}; };
@ -121,7 +121,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
return None; return None;
}; };
return Some(format!("_{string}_sampler")); Some(format!("_{string}_sampler"))
}) })
} }
@ -130,7 +130,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
return None; return None;
} }
let Some(&Operand::IdRef(referand)) = inst.operands.get(0) else { let Some(&Operand::IdRef(referand)) = inst.operands.first() else {
return None; return None;
}; };
@ -183,7 +183,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
self.builder.decorate( self.builder.decorate(
sampler_uniform, sampler_uniform,
decoration_type, 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 { 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 { else {
continue; 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. // 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); instructions.push(instr);
continue; 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. // 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); instructions.push(instr);
continue; continue;
}; };
@ -565,7 +565,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
continue; 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); instructions.push(instr);
continue; continue;
}; };
@ -656,7 +656,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
continue; continue;
} }
let Some(&Operand::IdRef(function_id)) = instr.operands.get(0) else { let Some(&Operand::IdRef(function_id)) = instr.operands.first() else {
continue; continue;
}; };
@ -729,7 +729,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
continue; 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); instructions.push(instr);
continue; continue;
}; };
@ -742,7 +742,7 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
return false; return false;
}; };
op_access_chains.contains_key(&op_ref_id) op_access_chains.contains_key(op_ref_id)
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
@ -861,9 +861,9 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
seen_functions seen_functions
} }
fn rewrite_functions_definitions<'b>( fn rewrite_functions_definitions(
&mut self, &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> { ) -> FxHashMap<spirv::Word, CombinedImageSampler> {
let mut sampled_refs = FxHashMap::default(); let mut sampled_refs = FxHashMap::default();
let mut functions = self.builder.module_ref().functions.clone(); 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 { pub(crate) fn load_module(words: &[u32]) -> rspirv::dr::Module {
let mut loader = rspirv::dr::Loader::new(); let mut loader = rspirv::dr::Loader::new();
rspirv::binary::parse_words(words, &mut loader).unwrap(); rspirv::binary::parse_words(words, &mut loader).unwrap();
let module = loader.module();
module loader.module()
} }

View file

@ -754,7 +754,10 @@ mod test {
#[test] #[test]
pub fn test_into() { 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(); let mut uniform_semantics: FastHashMap<String, UniformSemantic> = Default::default();
for (_index, param) in result.parameters.iter().enumerate() { for (_index, param) in result.parameters.iter().enumerate() {

View file

@ -120,7 +120,10 @@ mod test {
pub fn test_into() { 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/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(); 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 // Verify types
if self.vertex.global_variables.iter().any(|(_, gv)| { if self.vertex.global_variables.iter().any(|(_, gv)| {
let ty = &self.vertex.types[gv.ty]; let ty = &self.vertex.types[gv.ty];
match ty.inner { !matches!(
ty.inner,
TypeInner::Scalar { .. } TypeInner::Scalar { .. }
| TypeInner::Vector { .. } | TypeInner::Vector { .. }
| TypeInner::Matrix { .. } | TypeInner::Matrix { .. }
| TypeInner::Struct { .. } => false, | TypeInner::Struct { .. }
_ => true, )
}
}) { }) {
return Err(ShaderReflectError::VertexSemanticError( return Err(ShaderReflectError::VertexSemanticError(
SemanticsErrorKind::InvalidResourceType, SemanticsErrorKind::InvalidResourceType,
@ -483,7 +483,7 @@ impl NagaReflect {
SemanticsErrorKind::InvalidInputCount(vert_inputs), 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 { let &Some(Binding::Location { location, .. }) = &input.binding else {
return Err(ShaderReflectError::VertexSemanticError( return Err(ShaderReflectError::VertexSemanticError(
SemanticsErrorKind::MissingBinding, SemanticsErrorKind::MissingBinding,
@ -644,7 +644,7 @@ impl NagaReflect {
offset_type: UniformMemberBlock, offset_type: UniformMemberBlock,
blame: SemanticErrorBlame, blame: SemanticErrorBlame,
) -> Result<(), ShaderReflectError> { ) -> 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]; let resource = &module.global_variables[resource];
@ -824,7 +824,7 @@ impl NagaReflect {
Ok(TextureData { Ok(TextureData {
// id: texture.id, // id: texture.id,
// descriptor_set, // descriptor_set,
name: &name, name,
binding: binding.binding, 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> { ) -> Result<(String, TranslationInfo), ShaderCompileError> {
let mut valid = let mut valid =
naga::valid::Validator::new(ValidationFlags::all(), Capabilities::empty()); naga::valid::Validator::new(ValidationFlags::all(), Capabilities::empty());
let info = valid.validate(&module)?; let info = valid.validate(module)?;
let pipeline_options = PipelineOptions { let pipeline_options = PipelineOptions {
allow_and_force_point_size: false, 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) Ok(msl)
} }
@ -170,7 +172,10 @@ mod test {
#[test] #[test]
pub fn test_into() { 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(); let mut uniform_semantics: FastHashMap<String, UniformSemantic> = Default::default();

View file

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

View file

@ -16,7 +16,7 @@ impl CompileShader<WGSL> for NagaReflect {
options: Self::Options, options: Self::Options,
) -> Result<ShaderCompilerOutput<String, Self::Context>, ShaderCompileError> { ) -> Result<ShaderCompilerOutput<String, Self::Context>, ShaderCompileError> {
fn write_wgsl(module: &Module, info: &ModuleInfo) -> Result<String, 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) 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 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [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-presets = { path = "../librashader-presets", version = "0.2.7" }
librashader-preprocess = { path = "../librashader-preprocess", 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-reflect = { path = "../librashader-reflect", version = "0.2.7", features = [
librashader-runtime = { path = "../librashader-runtime" , version = "0.2.7" } "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" image = "0.25.1"
thiserror = "1.0.50" thiserror = "1.0.50"
bytemuck = { version = "1.14.0", features = ["derive"] } bytemuck = { version = "1.14.0", features = ["derive"] }

View file

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

View file

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

View file

@ -95,8 +95,8 @@ where
type UniformOffset: ContextOffset<H, C, Self::DeviceContext>; type UniformOffset: ContextOffset<H, C, Self::DeviceContext>;
/// Bind a texture to the input descriptor set /// Bind a texture to the input descriptor set
fn bind_texture<'a>( fn bind_texture(
descriptors: &mut Self::DescriptorSet<'a>, descriptors: &mut Self::DescriptorSet<'_>,
samplers: &Self::SamplerSet, samplers: &Self::SamplerSet,
binding: &TextureBinding, binding: &TextureBinding,
texture: &Self::InputTexture, texture: &Self::InputTexture,
@ -105,11 +105,11 @@ where
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
/// Write uniform and texture semantics to the provided storages. /// Write uniform and texture semantics to the provided storages.
fn bind_semantics<'a>( fn bind_semantics(
device: &Self::DeviceContext, device: &Self::DeviceContext,
sampler_set: &Self::SamplerSet, sampler_set: &Self::SamplerSet,
uniform_storage: &mut UniformStorage<H, C, U, P, Self::DeviceContext>, uniform_storage: &mut UniformStorage<H, C, U, P, Self::DeviceContext>,
descriptor_set: &mut Self::DescriptorSet<'a>, descriptor_set: &mut Self::DescriptorSet<'_>,
uniform_inputs: UniformInputs<'_>, uniform_inputs: UniformInputs<'_>,
original: &Self::InputTexture, original: &Self::InputTexture,
source: &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 /// Create a new framebuffer initializer with the given
/// closures to create owned framebuffers and image views. /// closures to create owned framebuffers and image views.
pub fn new( pub fn new(
filters: impl Iterator<Item = &'a BindingMeta> + ExactSizeIterator, filters: impl ExactSizeIterator<Item = &'a BindingMeta>,
owned_generator: &'a dyn Fn() -> Result<F, E>, owned_generator: &'a dyn Fn() -> Result<F, E>,
input_generator: &'a dyn Fn() -> I, input_generator: &'a dyn Fn() -> I,
) -> Self { ) -> Self {

View file

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

View file

@ -39,6 +39,16 @@ pub struct InlineRingBuffer<T, const SIZE: usize> {
index: 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> impl<T, const SIZE: usize> InlineRingBuffer<T, SIZE>
where where
T: Copy, T: Copy,

View file

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

2
rust-toolchain.toml Normal file
View file

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