rt(wgpu): fix compiler errors for filer pass

This commit is contained in:
chyyran 2024-02-01 18:03:21 -05:00 committed by Ronny Chan
parent 10358b4966
commit cc26be486b
13 changed files with 498 additions and 302 deletions

View file

@ -12,17 +12,17 @@
<cargoProject FILE="$PROJECT_DIR$/Cargo.toml" />
</component>
<component name="ChangeListManager">
<list default="true" id="02471831-07cd-4975-a00c-e042450023a1" name="Changes" comment="rt(wgpu): create pipeline">
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<list default="true" id="02471831-07cd-4975-a00c-e042450023a1" name="Changes" comment="rt(wgpu): wip filter chain logic">
<change afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/src/options.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Cargo.lock" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-common/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-common/Cargo.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-reflect/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-reflect/Cargo.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-reflect/src/reflect/naga.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-reflect/src/reflect/naga.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/Cargo.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/src/draw_quad.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/src/draw_quad.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-common/src/wgpu.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-common/src/wgpu.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/src/filter_chain.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/src/filter_chain.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/tests/hello_triangle.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/tests/hello_triangle.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/src/filter_pass.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/src/filter_pass.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/src/graphics_pipeline.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/src/graphics_pipeline.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/src/lib.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/src/lib.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/src/luts.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/src/luts.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/src/texture.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/src/texture.rs" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -65,35 +65,35 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"Cargo.Build `Test back::wgsl::test::test_into`.executor": "Run",
"Cargo.Build `Test reflect::cross::test::test_into`.executor": "Run",
"Cargo.Test back::wgsl::test::test_into.executor": "Run",
"Cargo.Test front::naga::test::naga_playground (1).executor": "Run",
"Cargo.Test front::naga::test::naga_playground.executor": "Run",
"Cargo.Test reflect::cross::test::test_into.executor": "Run",
"Cargo.Test triangle_wgpu.executor": "Run",
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.RadMigrateCodeStyle": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.cidr.known.project.marker": "true",
"RunOnceActivity.readMode.enableVisualFormatting": "true",
"cf.first.check.clang-format": "false",
"cidr.known.project.marker": "true",
"git-widget-placeholder": "feat-wgpu-runtime",
"ignore.virus.scanning.warn.message": "true",
"last_opened_file_path": "D:/Runtime/Rust/rustup",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"org.rust.cargo.project.model.PROJECT_DISCOVERY": "true",
"settings.editor.selected.configurable": "language.rust",
"vue.rearranger.settings.migration": "true"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;Cargo.Build `Test back::wgsl::test::test_into`.executor&quot;: &quot;Run&quot;,
&quot;Cargo.Build `Test reflect::cross::test::test_into`.executor&quot;: &quot;Run&quot;,
&quot;Cargo.Test back::wgsl::test::test_into.executor&quot;: &quot;Run&quot;,
&quot;Cargo.Test front::naga::test::naga_playground (1).executor&quot;: &quot;Run&quot;,
&quot;Cargo.Test front::naga::test::naga_playground.executor&quot;: &quot;Run&quot;,
&quot;Cargo.Test reflect::cross::test::test_into.executor&quot;: &quot;Run&quot;,
&quot;Cargo.Test triangle_wgpu.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.RadMigrateCodeStyle&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.cidr.known.project.marker&quot;: &quot;true&quot;,
&quot;RunOnceActivity.readMode.enableVisualFormatting&quot;: &quot;true&quot;,
&quot;cf.first.check.clang-format&quot;: &quot;false&quot;,
&quot;cidr.known.project.marker&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;feat-wgpu-runtime&quot;,
&quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;D:/Runtime/Rust/rustup&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;org.rust.cargo.project.model.PROJECT_DISCOVERY&quot;: &quot;true&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;language.rust&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
}]]></component>
}</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="F:\coding\librashader\librashader-reflect\src\back\wgsl" />
@ -273,7 +273,11 @@
<workItem from="1702640983281" duration="967000" />
<workItem from="1705541451154" duration="11000" />
<workItem from="1705545414525" duration="65000" />
<workItem from="1705545579395" duration="3250000" />
<workItem from="1705545579395" duration="4368000" />
<workItem from="1705615966293" duration="3099000" />
<workItem from="1706229877283" duration="1844000" />
<workItem from="1706680503632" duration="3415000" />
<workItem from="1706766058493" duration="620000" />
</task>
<task id="LOCAL-00001" summary="rt(wgpu): basic triangle example">
<option name="closed" value="true" />
@ -339,7 +343,39 @@
<option name="project" value="LOCAL" />
<updated>1702562564811</updated>
</task>
<option name="localTasksCounter" value="9" />
<task id="LOCAL-00009" summary="rt(wgpu): update to wgpu 0.19">
<option name="closed" value="true" />
<created>1705548953121</created>
<option name="number" value="00009" />
<option name="presentableId" value="LOCAL-00009" />
<option name="project" value="LOCAL" />
<updated>1705548953121</updated>
</task>
<task id="LOCAL-00010" summary="rt(wgpu): update to wgpu 0.19">
<option name="closed" value="true" />
<created>1705549377634</created>
<option name="number" value="00010" />
<option name="presentableId" value="LOCAL-00010" />
<option name="project" value="LOCAL" />
<updated>1705549377634</updated>
</task>
<task id="LOCAL-00011" summary="rt(wgpu): filter pass logic">
<option name="closed" value="true" />
<created>1706231131155</created>
<option name="number" value="00011" />
<option name="presentableId" value="LOCAL-00011" />
<option name="project" value="LOCAL" />
<updated>1706231131155</updated>
</task>
<task id="LOCAL-00012" summary="rt(wgpu): wip filter chain logic">
<option name="closed" value="true" />
<created>1706680538133</created>
<option name="number" value="00012" />
<option name="presentableId" value="LOCAL-00012" />
<option name="project" value="LOCAL" />
<updated>1706680538133</updated>
</task>
<option name="localTasksCounter" value="13" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -355,7 +391,10 @@
<MESSAGE value="rt(wgpu): create pipeline bind group layouts" />
<MESSAGE value="rt(wgpu): sampler set" />
<MESSAGE value="rt(wgpu): create pipeline" />
<option name="LAST_COMMIT_MESSAGE" value="rt(wgpu): create pipeline" />
<MESSAGE value="rt(wgpu): update to wgpu 0.19" />
<MESSAGE value="rt(wgpu): filter pass logic" />
<MESSAGE value="rt(wgpu): wip filter chain logic" />
<option name="LAST_COMMIT_MESSAGE" value="rt(wgpu): wip filter chain logic" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>

315
Cargo.lock generated
View file

@ -74,12 +74,12 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
[[package]]
name = "android-activity"
version = "0.5.1"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39b801912a977c3fd52d80511fe1c0c8480c6f957f21ae2ce1b92ffe970cf4b9"
checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289"
dependencies = [
"android-properties",
"bitflags 2.4.1",
"bitflags 2.4.2",
"cc",
"cesu8",
"jni",
@ -110,9 +110,9 @@ dependencies = [
[[package]]
name = "anstream"
version = "0.6.7"
version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cd2405b3ac1faab2990b74d728624cd9fd115651fcecc7c2d8daf01376275ba"
checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5"
dependencies = [
"anstyle",
"anstyle-parse",
@ -124,9 +124,9 @@ dependencies = [
[[package]]
name = "anstyle"
version = "1.0.4"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
checksum = "2faccea4cc4ab4a667ce676a30e8ec13922a692c99bb8f5b11f1502c72e04220"
[[package]]
name = "anstyle-parse"
@ -321,9 +321,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.4.1"
version = "2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
[[package]]
name = "bitvec"
@ -404,9 +404,9 @@ checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205"
[[package]]
name = "bytemuck"
version = "1.14.0"
version = "1.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6"
checksum = "ed2490600f404f2b94c167e31d3ed1d5f3c225a0f3b80230053b3e0b7b962bd9"
dependencies = [
"bytemuck_derive",
]
@ -454,7 +454,7 @@ version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"log",
"polling",
"rustix",
@ -471,7 +471,7 @@ dependencies = [
"calloop 0.12.4",
"rustix",
"wayland-backend",
"wayland-client 0.31.1",
"wayland-client 0.31.2",
]
[[package]]
@ -538,9 +538,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.4.17"
version = "4.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80932e03c33999b9235edb8655bc9df3204adc9887c2f95b50cb1deb9fd54253"
checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c"
dependencies = [
"clap_builder",
"clap_derive",
@ -548,9 +548,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.4.17"
version = "4.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6c0db58c659eef1c73e444d298c27322a1b52f6927d2ad470c0c0f96fa7b8fa"
checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7"
dependencies = [
"anstream",
"anstyle",
@ -902,7 +902,7 @@ version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"libloading 0.8.1",
"winapi",
]
@ -1031,9 +1031,9 @@ dependencies = [
[[package]]
name = "env_logger"
version = "0.10.1"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece"
checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580"
dependencies = [
"humantime",
"is-terminal",
@ -1104,9 +1104,9 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]]
name = "fdeflate"
version = "0.3.3"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "209098dd6dfc4445aa6111f0e98653ac323eaa4dfd212c9ca3931bf9955c31bd"
checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645"
dependencies = [
"simd-adler32",
]
@ -1356,7 +1356,7 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"gpu-alloc-types",
]
@ -1366,7 +1366,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
]
[[package]]
@ -1391,7 +1391,7 @@ dependencies = [
"presser",
"thiserror",
"winapi",
"windows 0.51.1",
"windows 0.52.0",
]
[[package]]
@ -1400,7 +1400,7 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"gpu-descriptor-types",
"hashbrown 0.14.3",
]
@ -1411,7 +1411,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bf0b36e6f090b7e1d8a4b49c0cb81c1f8376f72198c65dd3ad9ff3556b8b78c"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
]
[[package]]
@ -1457,7 +1457,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"com",
"libc",
"libloading 0.8.1",
@ -1483,9 +1483,9 @@ dependencies = [
[[package]]
name = "hermit-abi"
version = "0.3.3"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f"
[[package]]
name = "hexf-parse"
@ -1546,9 +1546,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.1.0"
version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
checksum = "433de089bd45971eecf4668ee0ee8f4cec17db4f8bd8f7bc3197a6ce37aa7d9b"
dependencies = [
"equivalent",
"hashbrown 0.14.3",
@ -1572,7 +1572,7 @@ version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455"
dependencies = [
"hermit-abi 0.3.3",
"hermit-abi 0.3.4",
"rustix",
"windows-sys 0.52.0",
]
@ -1721,7 +1721,7 @@ name = "librashader-build-script"
version = "0.1.0"
dependencies = [
"cbindgen",
"clap 4.4.17",
"clap 4.4.18",
]
[[package]]
@ -1819,7 +1819,7 @@ version = "0.2.0-beta.2"
dependencies = [
"bitflags 1.3.2",
"bytemuck",
"indexmap 2.1.0",
"indexmap 2.2.1",
"librashader-common 0.2.0-beta.2",
"librashader-preprocess",
"librashader-presets 0.2.0-beta.2",
@ -1981,7 +1981,7 @@ version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"libc",
"redox_syscall 0.4.1",
]
@ -1992,7 +1992,7 @@ version = "0.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"libc",
"redox_syscall 0.4.1",
]
@ -2016,9 +2016,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "linux-raw-sys"
version = "0.4.12"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456"
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
[[package]]
name = "lock_api"
@ -2068,9 +2068,9 @@ dependencies = [
[[package]]
name = "memmap2"
version = "0.9.3"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45fd3a57831bf88bc63f8cebc0cf956116276e97fef3966103e96416209f7c92"
checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322"
dependencies = [
"libc",
]
@ -2084,22 +2084,13 @@ dependencies = [
"autocfg",
]
[[package]]
name = "memoffset"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg",
]
[[package]]
name = "metal"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"block",
"core-graphics-types",
"foreign-types 0.5.0",
@ -2143,10 +2134,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8878eb410fc90853da3908aebfe61d73d26d4437ef850b70050461f939509899"
dependencies = [
"bit-set",
"bitflags 2.4.1",
"bitflags 2.4.2",
"codespan-reporting",
"hexf-parse",
"indexmap 2.1.0",
"indexmap 2.2.1",
"log",
"num-traits",
"petgraph",
@ -2177,7 +2168,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"jni-sys",
"log",
"ndk-sys 0.5.0+25.2.9519653",
@ -2215,7 +2206,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c"
dependencies = [
"darling",
"proc-macro-crate",
"proc-macro-crate 1.3.1",
"proc-macro2",
"quote",
"syn 1.0.109",
@ -2248,7 +2239,7 @@ dependencies = [
"bitflags 1.3.2",
"cfg-if",
"libc",
"memoffset 0.6.5",
"memoffset",
]
[[package]]
@ -2261,19 +2252,7 @@ dependencies = [
"bitflags 1.3.2",
"cfg-if",
"libc",
"memoffset 0.6.5",
]
[[package]]
name = "nix"
version = "0.26.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b"
dependencies = [
"bitflags 1.3.2",
"cfg-if",
"libc",
"memoffset 0.7.1",
"memoffset",
]
[[package]]
@ -2397,7 +2376,7 @@ version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799"
dependencies = [
"proc-macro-crate",
"proc-macro-crate 1.3.1",
"proc-macro2",
"quote",
"syn 1.0.109",
@ -2409,7 +2388,7 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b"
dependencies = [
"proc-macro-crate",
"proc-macro-crate 3.1.0",
"proc-macro2",
"quote",
"syn 2.0.48",
@ -2598,7 +2577,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9"
dependencies = [
"fixedbitset",
"indexmap 2.1.0",
"indexmap 2.2.1",
]
[[package]]
@ -2609,9 +2588,9 @@ checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
[[package]]
name = "pkg-config"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a"
checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb"
[[package]]
name = "platform-dirs"
@ -2668,23 +2647,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
dependencies = [
"once_cell",
"toml_edit",
"toml_edit 0.19.15",
]
[[package]]
name = "proc-macro-crate"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284"
dependencies = [
"toml_edit 0.21.0",
]
[[package]]
name = "proc-macro2"
version = "1.0.76"
version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c"
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
dependencies = [
"unicode-ident",
]
[[package]]
name = "profiling"
version = "1.0.13"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d135ede8821cf6376eb7a64148901e1690b788c11ae94dc297ae917dbc91dc0e"
checksum = "0f0f7f43585c34e4fdd7497d746bc32e14458cf11c69341cc0587b1d825dde42"
[[package]]
name = "qoi"
@ -2697,9 +2685,9 @@ dependencies = [
[[package]]
name = "quick-xml"
version = "0.30.0"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956"
checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33"
dependencies = [
"memchr",
]
@ -2760,9 +2748,9 @@ dependencies = [
[[package]]
name = "rayon"
version = "1.8.0"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1"
checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051"
dependencies = [
"either",
"rayon-core",
@ -2770,9 +2758,9 @@ dependencies = [
[[package]]
name = "rayon-core"
version = "1.12.0"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed"
checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
dependencies = [
"crossbeam-deque",
"crossbeam-utils",
@ -2809,9 +2797,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.10.2"
version = "1.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
dependencies = [
"aho-corasick",
"memchr",
@ -2821,9 +2809,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.3"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd"
dependencies = [
"aho-corasick",
"memchr",
@ -2914,7 +2902,7 @@ version = "0.38.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"errno",
"libc",
"linux-raw-sys",
@ -2977,25 +2965,25 @@ checksum = "82b2eaf3a5b264a521b988b2e73042e742df700c4f962cde845d1541adb46550"
dependencies = [
"ab_glyph",
"log",
"memmap2 0.9.3",
"memmap2 0.9.4",
"smithay-client-toolkit 0.18.0",
"tiny-skia 0.11.3",
]
[[package]]
name = "serde"
version = "1.0.195"
version = "1.0.196"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02"
checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.195"
version = "1.0.196"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c"
checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67"
dependencies = [
"proc-macro2",
"quote",
@ -3004,9 +2992,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.111"
version = "1.0.113"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4"
checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79"
dependencies = [
"itoa",
"ryu",
@ -3092,9 +3080,9 @@ dependencies = [
[[package]]
name = "smallvec"
version = "1.12.0"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2593d31f82ead8df961d8bd23a64c2ccf2eb5dd34b0a34bfb4dd54011c72009e"
checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
[[package]]
name = "smithay-client-toolkit"
@ -3121,22 +3109,22 @@ version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60e3d9941fa3bacf7c2bf4b065304faa14164151254cd16ce1b1bc8fc381600f"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"calloop 0.12.4",
"calloop-wayland-source",
"cursor-icon",
"libc",
"log",
"memmap2 0.9.3",
"memmap2 0.9.4",
"rustix",
"thiserror",
"wayland-backend",
"wayland-client 0.31.1",
"wayland-client 0.31.2",
"wayland-csd-frame",
"wayland-cursor 0.31.0",
"wayland-protocols 0.31.0",
"wayland-cursor 0.31.1",
"wayland-protocols 0.31.2",
"wayland-protocols-wlr",
"wayland-scanner 0.31.0",
"wayland-scanner 0.31.1",
"xkeysym",
]
@ -3164,7 +3152,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.4.1",
"bitflags 2.4.2",
]
[[package]]
@ -3365,7 +3353,18 @@ version = "0.19.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [
"indexmap 2.1.0",
"indexmap 2.2.1",
"toml_datetime",
"winnow",
]
[[package]]
name = "toml_edit"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03"
dependencies = [
"indexmap 2.2.1",
"toml_datetime",
"winnow",
]
@ -3542,13 +3541,13 @@ checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b"
[[package]]
name = "wayland-backend"
version = "0.3.2"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19152ddd73f45f024ed4534d9ca2594e0ef252c1847695255dae47f34df9fbe4"
checksum = "9d50fa61ce90d76474c87f5fc002828d81b32677340112b4ef08079a9d459a40"
dependencies = [
"cc",
"downcast-rs",
"nix 0.26.4",
"rustix",
"scoped-tls",
"smallvec",
"wayland-sys 0.31.1",
@ -3572,14 +3571,14 @@ dependencies = [
[[package]]
name = "wayland-client"
version = "0.31.1"
version = "0.31.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ca7d52347346f5473bf2f56705f360e8440873052e575e55890c4fa57843ed3"
checksum = "82fb96ee935c2cea6668ccb470fb7771f6215d1691746c2d896b447a00ad3f1f"
dependencies = [
"bitflags 2.4.1",
"nix 0.26.4",
"bitflags 2.4.2",
"rustix",
"wayland-backend",
"wayland-scanner 0.31.0",
"wayland-scanner 0.31.1",
]
[[package]]
@ -3600,7 +3599,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"cursor-icon",
"wayland-backend",
]
@ -3618,12 +3617,12 @@ dependencies = [
[[package]]
name = "wayland-cursor"
version = "0.31.0"
version = "0.31.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a44aa20ae986659d6c77d64d808a046996a932aa763913864dc40c359ef7ad5b"
checksum = "71ce5fa868dd13d11a0d04c5e2e65726d0897be8de247c0c5a65886e283231ba"
dependencies = [
"nix 0.26.4",
"wayland-client 0.31.1",
"rustix",
"wayland-client 0.31.2",
"xcursor",
]
@ -3641,14 +3640,14 @@ dependencies = [
[[package]]
name = "wayland-protocols"
version = "0.31.0"
version = "0.31.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e253d7107ba913923dc253967f35e8561a3c65f914543e46843c88ddd729e21c"
checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"wayland-backend",
"wayland-client 0.31.1",
"wayland-scanner 0.31.0",
"wayland-client 0.31.2",
"wayland-scanner 0.31.1",
]
[[package]]
@ -3657,11 +3656,11 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"wayland-backend",
"wayland-client 0.31.1",
"wayland-protocols 0.31.0",
"wayland-scanner 0.31.0",
"wayland-client 0.31.2",
"wayland-protocols 0.31.2",
"wayland-scanner 0.31.1",
]
[[package]]
@ -3670,11 +3669,11 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"wayland-backend",
"wayland-client 0.31.1",
"wayland-protocols 0.31.0",
"wayland-scanner 0.31.0",
"wayland-client 0.31.2",
"wayland-protocols 0.31.2",
"wayland-scanner 0.31.1",
]
[[package]]
@ -3690,9 +3689,9 @@ dependencies = [
[[package]]
name = "wayland-scanner"
version = "0.31.0"
version = "0.31.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb8e28403665c9f9513202b7e1ed71ec56fde5c107816843fb14057910b2c09c"
checksum = "63b3a62929287001986fb58c789dce9b67604a397c15c611ad9f747300b6c283"
dependencies = [
"proc-macro2",
"quick-xml",
@ -3744,15 +3743,15 @@ dependencies = [
[[package]]
name = "weezl"
version = "0.1.7"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
[[package]]
name = "wgpu"
version = "0.19.0"
version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0b71d2ded29e2161db50ab731d6cb42c037bd7ab94864a98fa66ff36b4721a8"
checksum = "0bfe9a310dcf2e6b85f00c46059aaeaf4184caa8e29a1ecd4b7a704c3482332d"
dependencies = [
"arrayvec 0.7.4",
"cfg-if",
@ -3781,10 +3780,10 @@ checksum = "6b15e451d4060ada0d99a64df44e4d590213496da7c4f245572d51071e8e30ed"
dependencies = [
"arrayvec 0.7.4",
"bit-vec",
"bitflags 2.4.1",
"bitflags 2.4.2",
"cfg_aliases",
"codespan-reporting",
"indexmap 2.1.0",
"indexmap 2.2.1",
"log",
"naga",
"once_cell",
@ -3801,15 +3800,15 @@ dependencies = [
[[package]]
name = "wgpu-hal"
version = "0.19.0"
version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11f259ceb56727fb097da108d92f8a5cbdb5b74a77f9e396bd43626f67299d61"
checksum = "e3bb47856236bfafc0bc591a925eb036ac19cd987624a447ff353e7a7e7e6f72"
dependencies = [
"android_system_properties",
"arrayvec 0.7.4",
"ash",
"bit-set",
"bitflags 2.4.1",
"bitflags 2.4.2",
"block",
"cfg_aliases",
"core-graphics-types",
@ -3849,7 +3848,7 @@ version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "895fcbeb772bfb049eb80b2d6e47f6c9af235284e9703c96fc0218a42ffd5af2"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"js-sys",
"web-sys",
]
@ -3902,21 +3901,21 @@ dependencies = [
[[package]]
name = "windows"
version = "0.51.1"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9"
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
dependencies = [
"windows-core",
"windows-targets 0.48.5",
"windows-targets 0.52.0",
]
[[package]]
name = "windows-core"
version = "0.51.1"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets 0.48.5",
"windows-targets 0.52.0",
]
[[package]]
@ -4202,7 +4201,7 @@ dependencies = [
"ahash 0.8.7",
"android-activity",
"atomic-waker",
"bitflags 2.4.1",
"bitflags 2.4.2",
"bytemuck",
"calloop 0.12.4",
"cfg_aliases",
@ -4213,7 +4212,7 @@ dependencies = [
"js-sys",
"libc",
"log",
"memmap2 0.9.3",
"memmap2 0.9.4",
"ndk 0.8.0",
"ndk-sys 0.5.0+25.2.9519653",
"objc2",
@ -4230,8 +4229,8 @@ dependencies = [
"wasm-bindgen",
"wasm-bindgen-futures",
"wayland-backend",
"wayland-client 0.31.1",
"wayland-protocols 0.31.0",
"wayland-client 0.31.2",
"wayland-protocols 0.31.2",
"wayland-protocols-plasma",
"web-sys",
"web-time",
@ -4243,9 +4242,9 @@ dependencies = [
[[package]]
name = "winnow"
version = "0.5.34"
version = "0.5.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16"
checksum = "1931d78a9c73861da0134f453bb1f790ce49b2e30eba8410b4b79bac72b46a2d"
dependencies = [
"memchr",
]
@ -4312,7 +4311,7 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6924668544c48c0133152e7eec86d644a056ca3d09275eb8d5cdb9855f9d8699"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"dlib",
"log",
"once_cell",

View file

@ -85,17 +85,6 @@ impl From<Option<wgpu_types::TextureFormat>> for ImageFormat {
}
}
//
impl From<Size<u32>> for wgpu_types::Extent3d {
fn from(value: Size<u32>) -> Self {
wgpu_types::Extent3d {
width: value.width,
height: value.height,
depth: 1,
}
}
}
impl From<wgpu_types::Extent3d> for Size<u32> {
fn from(value: wgpu_types::Extent3d) -> Self {
Size {

View file

@ -0,0 +1,54 @@
use std::ops::{Deref, DerefMut};
use std::sync::Arc;
pub struct WgpuMappedBuffer {
buffer: wgpu::Buffer,
backing: Box<[u8]>,
device: Arc<wgpu::Device>
}
impl WgpuMappedBuffer {
pub fn new(
device: &Arc<wgpu::Device>,
usage: wgpu::BufferUsages,
size: wgpu::BufferAddress,
label: wgpu::Label<'static>
) -> WgpuMappedBuffer {
let buffer = device.create_buffer(&wgpu::BufferDescriptor {
label,
size,
usage,
mapped_at_creation: true,
});
WgpuMappedBuffer {
buffer,
backing: vec![0u8; size as usize].into_boxed_slice(),
device: Arc::clone(&device)
}
}
pub fn buffer(&self) -> &wgpu::Buffer {
&self.buffer
}
/// Write the contents of the backing buffer to the device buffer.
pub fn flush(&self) {
self.buffer.slice(..)
.get_mapped_range_mut().copy_from_slice(&self.backing)
}
}
impl Deref for WgpuMappedBuffer {
type Target = [u8];
fn deref(&self) -> &Self::Target {
self.backing.deref()
}
}
impl DerefMut for WgpuMappedBuffer {
fn deref_mut(&mut self) -> &mut Self::Target {
self.backing.deref_mut()
}
}

View file

@ -23,6 +23,7 @@ use librashader_runtime::render_target::RenderTarget;
use librashader_runtime::scaling::ScaleFramebuffer;
use rayon::prelude::*;
use wgpu::{BindGroupEntry, CommandBuffer, CommandEncoder, Device, Queue, TextureAspect, TextureFormat};
use crate::buffer::WgpuMappedBuffer;
use crate::draw_quad::DrawQuad;
use crate::error;
@ -30,8 +31,9 @@ use crate::error::FilterChainError;
use crate::filter_pass::FilterPass;
use crate::graphics_pipeline::WgpuGraphicsPipeline;
use crate::luts::LutTexture;
use crate::options::FrameOptionsWGPU;
use crate::samplers::SamplerSet;
use crate::texture::{InputImage, OwnedImage};
use crate::texture::{Handle, InputImage, OwnedImage};
type ShaderPassMeta =
ShaderPassArtifact<impl CompileReflectShader<WGSL, GlslangCompilation> + Send>;
@ -185,17 +187,19 @@ impl FilterChainWGPU {
})?;
let ubo_size = reflection.ubo.as_ref().map_or(0, |ubo| ubo.size as usize);
let push_size = reflection
.push_constant
.as_ref()
.map_or(0, |push| push.size as wgpu::BufferAddress);
let uniform_storage = UniformStorage::new(
ubo_size,
reflection
.push_constant
.as_ref()
.map_or(0, |push| push.size as usize),
let uniform_storage = UniformStorage::new_with_storage(
WgpuMappedBuffer::new(&device, wgpu::BufferUsages::UNIFORM, ubo_size as wgpu::BufferAddress, Some("ubo")),
WgpuMappedBuffer::new(&device, wgpu::BufferUsages::UNIFORM, push_size as wgpu::BufferAddress, Some("push"))
);
let uniform_bindings = reflection.meta.create_binding_map(|param| param.offset());
//
let render_pass_format: Option<TextureFormat> =
if let Some(format) = config.get_format_override() {
format.into()
@ -210,9 +214,10 @@ impl FilterChainWGPU {
render_pass_format.unwrap_or(TextureFormat::R8Unorm),
);
Ok(FilterPass {
// device: vulkan.device.clone(),
device,
device: Arc::clone(&device),
reflection,
compiled: wgsl,
uniform_storage,
@ -220,10 +225,6 @@ impl FilterChainWGPU {
source,
config,
graphics_pipeline,
// // ubo_ring,
// frames_in_flight,
// texture_heap: [],
// sampler_heap: [],
})
})
.collect();
@ -238,17 +239,19 @@ impl FilterChainWGPU {
viewport: &Viewport<OwnedImage>,
cmd: wgpu::CommandEncoder,
frame_count: usize,
options: Option<&FrameOptionsWGPU>,
) -> error::Result<()> {
let max = std::cmp::min(self.passes.len(), self.common.config.passes_enabled);
let passes = &mut self.passes[0..max];
// if let Some(options) = &options {
// if options.clear_history {
// for history in &mut self.history_framebuffers {
// history.clear(cmd);
// }
// }
// }
if let Some(options) = &options {
if options.clear_history {
for history in &mut self.history_framebuffers {
// history.clear(cmd);
}
}
}
if passes.is_empty() {
return Ok(());
@ -280,8 +283,8 @@ impl FilterChainWGPU {
}
let original = InputImage {
image: input.clone(),
view: original_image_view,
image: Arc::new(input),
view: Arc::new(original_image_view),
wrap_mode,
filter_mode: filter,
mip_filter: filter,
@ -297,12 +300,12 @@ impl FilterChainWGPU {
// rescale render buffers to ensure all bindings are valid.
OwnedImage::scale_framebuffers_with_context(
source.image.size,
source.image.size().into(),
viewport.output.size,
&mut self.output_framebuffers,
&mut self.feedback_framebuffers,
passes,
&None::<()>,
&(),
Some(&mut |index: usize,
pass: &FilterPass,
output: &OwnedImage,
@ -319,7 +322,7 @@ impl FilterChainWGPU {
let passes_len = passes.len();
let (pass, last) = passes.split_at_mut(passes_len - 1);
let frame_direction = options.map_or(1, |f| f.frame_direction);
// let frame_direction = options.map_or(1, |f| f.frame_direction);
Ok(())
}

View file

@ -10,10 +10,12 @@ use rustc_hash::FxHashMap;
use std::sync::Arc;
use wgpu::{BindGroupDescriptor, BindGroupEntry, BindingResource, Buffer, BufferBinding, BufferUsages, RenderPass, ShaderStages, TextureView};
use wgpu::util::{BufferInitDescriptor, DeviceExt};
use librashader_common::{Size, Viewport};
use librashader_common::{ImageFormat, Size, Viewport};
use librashader_runtime::binding::{BindSemantics, TextureInput};
use librashader_runtime::filter_pass::FilterPassMeta;
use librashader_runtime::quad::QuadType;
use librashader_runtime::render_target::RenderTarget;
use crate::buffer::WgpuMappedBuffer;
use crate::error;
use crate::filter_chain::FilterCommon;
use crate::framebuffer::OutputImage;
@ -24,13 +26,12 @@ pub struct FilterPass {
pub device: Arc<wgpu::Device>,
pub reflection: ShaderReflection,
pub(crate) compiled: ShaderCompilerOutput<String, NagaWgslContext>,
pub(crate) uniform_storage: UniformStorage,
pub(crate) uniform_storage: UniformStorage<NoUniformBinder, Option<()>, WgpuMappedBuffer, WgpuMappedBuffer>,
pub uniform_bindings: FxHashMap<UniformBinding, MemberOffset>,
pub source: ShaderSource,
pub config: ShaderPassConfig,
pub graphics_pipeline: WgpuGraphicsPipeline,
// pub ubo_ring: VkUboRing,
// pub frames_in_flight: u32,
}
impl TextureInput for InputImage {
@ -39,12 +40,17 @@ impl TextureInput for InputImage {
}
}
impl BindSemantics<NoUniformBinder, Option<()>> for FilterPass {
pub struct WgpuArcBinding<T> {
binding: u32,
resource: Arc<T>
}
impl BindSemantics<NoUniformBinder, Option<()>, WgpuMappedBuffer, WgpuMappedBuffer> for FilterPass {
type InputTexture = InputImage;
type SamplerSet = SamplerSet;
type DescriptorSet<'a> = (
&'a mut FxHashMap<u32, BindGroupEntry<'a>>,
&'a mut FxHashMap<u32, BindGroupEntry<'a>>,
&'a mut FxHashMap<u32, WgpuArcBinding<wgpu::TextureView>>,
&'a mut FxHashMap<u32, WgpuArcBinding<wgpu::Sampler>>,
);
type DeviceContext = Arc<wgpu::Device>;
type UniformOffset = MemberOffset;
@ -60,13 +66,14 @@ impl BindSemantics<NoUniformBinder, Option<()>> for FilterPass {
let sampler = samplers.get(texture.wrap_mode, texture.filter_mode, texture.mip_filter);
let (texture_binding, sampler_binding) = descriptors;
texture_binding.insert(binding.binding, BindGroupEntry {
texture_binding.insert(binding.binding, WgpuArcBinding {
binding: binding.binding,
resource:BindingResource::TextureView(&texture.view)}
);
sampler_binding.insert(binding.binding, BindGroupEntry {
resource: Arc::clone(&texture.view)
});
sampler_binding.insert(binding.binding, WgpuArcBinding {
binding: binding.binding,
resource: BindingResource::Sampler(&sampler),
resource: sampler,
});
}
}
@ -84,7 +91,7 @@ impl FilterPass {
source: &InputImage,
output: &RenderTarget<OutputImage>,
vbo_type: QuadType,
) -> error::Result<RenderPass> {
) -> error::Result<()> {
let mut main_heap = FxHashMap::default();
let mut sampler_heap = FxHashMap::default();
@ -103,21 +110,29 @@ impl FilterPass {
&mut sampler_heap,
);
let mut main_heap_array = Vec::with_capacity(main_heap.len() + 1);
let mut sampler_heap_array = Vec::with_capacity(sampler_heap.len() + 1);
for binding in main_heap.values() {
main_heap_array.push(BindGroupEntry {
binding: binding.binding,
resource: BindingResource::TextureView(&binding.resource)
})
}
for binding in sampler_heap.values() {
sampler_heap_array.push(BindGroupEntry {
binding: binding.binding,
resource: BindingResource::Sampler(&binding.resource)
})
}
let main_buffer: Buffer;
let pcb_buffer: Buffer;
if let Some(ubo) = &self.reflection.ubo {
main_buffer = self.device
.create_buffer_init(&BufferInitDescriptor {
label: Some("ubo buffer"),
contents: self.uniform_storage.ubo_slice(),
usage: BufferUsages::UNIFORM,
});
main_heap.insert(ubo.binding, BindGroupEntry {
main_heap_array.push(BindGroupEntry {
binding: ubo.binding,
resource: BindingResource::Buffer(BufferBinding {
buffer: &main_buffer,
buffer: self.uniform_storage.inner_ubo().buffer(),
offset: 0,
size: None,
}),
@ -127,17 +142,10 @@ impl FilterPass {
let mut has_pcb_buffer = false;
if let Some(pcb) = &self.reflection.push_constant {
if let Some(binding) = pcb.binding {
pcb_buffer = self.device
.create_buffer_init(&BufferInitDescriptor {
label: Some("ubo buffer"),
contents: self.uniform_storage.push_slice(),
usage: BufferUsages::UNIFORM,
});
main_heap.insert(binding, BindGroupEntry {
main_heap_array.push(BindGroupEntry {
binding,
resource: BindingResource::Buffer(BufferBinding {
buffer: &pcb_buffer,
buffer: self.uniform_storage.inner_push().buffer(),
offset: 0,
size: None,
}),
@ -146,22 +154,21 @@ impl FilterPass {
}
}
let mut render_pass = self.graphics_pipeline
.begin_rendering(output, cmd);
let main_bind_group = self.device.create_bind_group(&BindGroupDescriptor {
label: Some("main bind group"),
layout: &self.graphics_pipeline.layout.main_bind_group_layout,
entries: &main_heap.into_values().collect::<Vec<_>>()
entries: &main_heap_array
});
let sampler_bind_group = self.device.create_bind_group(&BindGroupDescriptor {
label: Some("sampler bind group"),
layout: &self.graphics_pipeline.layout.sampler_bind_group_layout,
entries: &sampler_heap.into_values().collect::<Vec<_>>()
entries: &sampler_heap_array
});
let mut render_pass = self.graphics_pipeline
.begin_rendering(output, cmd);
render_pass.set_bind_group(
0,
&main_bind_group,
@ -191,10 +198,10 @@ impl FilterPass {
parent.draw_quad.draw_quad(&mut render_pass, vbo_type);
Ok(render_pass)
Ok(())
}
fn build_semantics(
fn build_semantics<'a, 'b>(
&mut self,
pass_index: usize,
parent: &FilterCommon,
@ -205,9 +212,9 @@ impl FilterPass {
viewport_size: Size<u32>,
original: &InputImage,
source: &InputImage,
main_heap: &mut FxHashMap<u32, BindGroupEntry>
sampler_heap: &mut FxHashMap<u32, BindGroupEntry>
) {
main_heap: &'a mut FxHashMap<u32, WgpuArcBinding<wgpu::TextureView>>,
sampler_heap: &'a mut FxHashMap<u32, WgpuArcBinding<wgpu::Sampler>>
) where 'a: 'b {
Self::bind_semantics(
&self.device,
&parent.samplers,
@ -231,5 +238,19 @@ impl FilterPass {
&self.source.parameters,
&parent.config.parameters,
);
// flush to buffers
self.uniform_storage.inner_ubo().flush();
self.uniform_storage.inner_push().flush();
}
}
impl FilterPassMeta for FilterPass {
fn framebuffer_format(&self) -> ImageFormat {
self.source.format
}
fn config(&self) -> &ShaderPassConfig {
&self.config
}
}

View file

@ -124,8 +124,8 @@ impl PipelineLayoutObjects {
Self {
layout,
main_bind_group_layout,
sampler_bind_group_layout,
main_bind_group_layout: main_bind_group,
sampler_bind_group_layout: sampler_bind_group,
fragment_entry_name: shader_assembly.context.fragment.entry_points[0]
.name
.clone(),

View file

@ -17,6 +17,8 @@ mod texture;
mod util;
mod framebuffer;
mod luts;
mod options;
mod buffer;
pub use filter_chain::FilterChainWGPU;
pub use filter_pass::FilterPass;

View file

@ -1,11 +1,16 @@
use std::sync::Arc;
use wgpu::{ImageDataLayout, Label, TextureDescriptor};
use wgpu::util::DeviceExt;
use librashader_presets::TextureConfig;
use librashader_runtime::image::{BGRA8, Image};
use librashader_runtime::scaling::MipmapSize;
use crate::texture::{Handle, InputImage};
pub(crate) struct LutTexture {
texture: wgpu::Texture,
pub(crate) struct LutTexture(InputImage);
impl AsRef<InputImage> for LutTexture {
fn as_ref(&self) -> &InputImage {
&self.0
}
}
impl LutTexture {
@ -53,8 +58,26 @@ impl LutTexture {
// todo: mipmaps
Self {
texture
}
// todo: fix this
let view = texture.create_view(&wgpu::TextureViewDescriptor {
label: Some("lut view"),
format: None,
dimension: None,
aspect: Default::default(),
base_mip_level: 0,
mip_level_count: None,
base_array_layer: 0,
array_layer_count: None,
});
let image = InputImage {
image: Arc::new(texture),
view: Arc::new(view),
wrap_mode: config.wrap_mode,
filter_mode: config.filter_mode,
mip_filter: config.filter_mode,
};
Self(image)
}
}

View file

@ -0,0 +1,10 @@
/// Options for each WGPU shader frame.
#[repr(C)]
#[derive(Default, Debug, Clone)]
pub struct FrameOptionsWGPU {
/// Whether or not to clear the history buffers.
pub clear_history: bool,
/// The direction of rendering.
/// -1 indicates that the frames are played in reverse order.
pub frame_direction: i32,
}

View file

@ -6,19 +6,19 @@ use wgpu::{Sampler, SamplerBorderColor, SamplerDescriptor};
pub struct SamplerSet {
// todo: may need to deal with differences in mip filter.
samplers: FxHashMap<(WrapMode, FilterMode, FilterMode), Sampler>,
samplers: FxHashMap<(WrapMode, FilterMode, FilterMode), Arc<Sampler>>,
}
impl SamplerSet {
#[inline(always)]
pub fn get(&self, wrap: WrapMode, filter: FilterMode, mipmap: FilterMode) -> &Sampler {
pub fn get(&self, wrap: WrapMode, filter: FilterMode, mipmap: FilterMode) -> Arc<Sampler> {
// eprintln!("{wrap}, {filter}, {mip}");
// SAFETY: the sampler set is complete for the matrix
// wrap x filter x mipmap
unsafe {
self.samplers
Arc::clone(&self.samplers
.get(&(wrap, filter, mipmap))
.unwrap_unchecked()
.unwrap_unchecked())
}
}
@ -35,7 +35,7 @@ impl SamplerSet {
for mipmap_filter in &[FilterMode::Linear, FilterMode::Nearest] {
samplers.insert(
(*wrap_mode, *filter_mode, *mipmap_filter),
device.create_sampler(&SamplerDescriptor {
Arc::new(device.create_sampler(&SamplerDescriptor {
label: None,
address_mode_u: (*wrap_mode).into(),
address_mode_v: (*wrap_mode).into(),
@ -49,7 +49,7 @@ impl SamplerSet {
anisotropy_clamp: 1,
border_color: Some(SamplerBorderColor::TransparentBlack),
}),
);
));
}
}
}

View file

@ -1,28 +1,60 @@
use std::ops::Deref;
use std::sync::Arc;
use wgpu::TextureFormat;
use wgpu::{TextureFormat, TextureView};
use librashader_common::{FilterMode, ImageFormat, Size, WrapMode};
use librashader_presets::Scale2D;
use librashader_runtime::scaling::{MipmapSize, ViewportSize};
use librashader_runtime::scaling::{MipmapSize, ScaleFramebuffer, ViewportSize};
use crate::error::FilterChainError;
pub struct OwnedImage {
device: Arc<wgpu::Device>,
pub image: wgpu::Texture,
pub view: wgpu::TextureView,
pub image: Arc<wgpu::Texture>,
pub view: Arc<wgpu::TextureView>,
pub max_miplevels: u32,
pub levels: u32,
pub size: Size<u32>,
pub format: wgpu::TextureFormat,
}
pub enum Handle<'a, T> {
Borrowed(&'a T),
Owned(Arc<T>)
}
impl<T> Clone for Handle<'_, T> {
fn clone(&self) -> Self {
match self {
Handle::Borrowed(r) => Handle::Borrowed(r),
Handle::Owned(r) => Handle::Owned(Arc::clone(r))
}
}
}
impl<T> Deref for Handle<'_, T> {
type Target = T;
fn deref(&self) -> &Self::Target {
match self {
Handle::Borrowed(r) => &r,
Handle::Owned(r) => &r
}
}
}
#[derive(Clone)]
pub struct InputImage {
/// A handle to the `VkImage`.
pub image: wgpu::Texture,
pub view: wgpu::TextureView,
pub image: Arc<wgpu::Texture>,
pub view: Arc<wgpu::TextureView>,
pub wrap_mode: WrapMode,
pub filter_mode: FilterMode,
pub mip_filter: FilterMode,
}
impl AsRef<InputImage> for InputImage {
fn as_ref(&self) -> &InputImage {
&self
}
}
impl OwnedImage {
pub fn new(device: Arc<wgpu::Device>,
@ -61,8 +93,8 @@ impl OwnedImage {
Self {
device,
image: texture,
view,
image: Arc::new(texture),
view: Arc::new(view),
max_miplevels,
levels: std::cmp::min(max_miplevels, size.calculate_miplevels()),
size,
@ -94,14 +126,33 @@ impl OwnedImage {
}
pub(crate) fn as_input(&self, filter: FilterMode, wrap_mode: WrapMode) -> InputImage {
let image = self.clone();
InputImage {
image: self.image.clone(),
view: self.clone().,
image: Arc::clone(&self.image),
view: Arc::clone(&self.view),
wrap_mode,
filter_mode: filter,
mip_filter: filter,
}
}
}
impl ScaleFramebuffer for OwnedImage {
type Error = FilterChainError;
type Context = ();
fn scale(&mut self,
scaling: Scale2D,
format: ImageFormat,
viewport_size: &Size<u32>,
source_size: &Size<u32>,
should_mipmap: bool,
_context: &Self::Context) -> Result<Size<u32>, Self::Error> {
Ok(self.scale(
scaling,
format,
viewport_size,
source_size,
should_mipmap,
))
}
}

View file

@ -8,6 +8,11 @@ impl UniformScalar for f32 {}
impl UniformScalar for i32 {}
impl UniformScalar for u32 {}
pub trait AsDerefable {
fn get_deref(&self) -> impl Deref<Target = [u8]>;
fn get_deref_mut(&mut self) -> impl DerefMut<Target = [u8]>;
}
/// A trait for a binder that binds the given value and context into the uniform for a shader pass.
pub trait BindUniform<C, T> {
/// Bind the given value to the shader uniforms given the input context.