mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-21 22:33:49 +00:00
Remove wgpu-bindings in favor of configuration scripts
This commit is contained in:
parent
0011d9f4ff
commit
61fca00f34
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@
|
||||
.vscode
|
||||
.vs
|
||||
build
|
||||
ffi/dawn*.h
|
||||
|
@ -43,4 +43,4 @@ before_install:
|
||||
|
||||
script:
|
||||
- cargo test
|
||||
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then (brew update && brew upgrade cmake && brew install glfw3 && make ci-examples); fi
|
||||
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then (brew update && brew upgrade cmake && brew install glfw3 && make ffi-examples); fi
|
||||
|
100
Cargo.lock
generated
100
Cargo.lock
generated
@ -26,14 +26,6 @@ name = "android_glue"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "approx"
|
||||
version = "0.3.1"
|
||||
@ -141,21 +133,6 @@ name = "byteorder"
|
||||
version = "1.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cbindgen"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.30"
|
||||
@ -176,20 +153,6 @@ dependencies = [
|
||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.32.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cloudabi"
|
||||
version = "0.0.3"
|
||||
@ -560,11 +523,6 @@ dependencies = [
|
||||
"uuid 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "kernel32-sys"
|
||||
version = "0.2.2"
|
||||
@ -1054,11 +1012,6 @@ dependencies = [
|
||||
"stb_truetype 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.4"
|
||||
@ -1103,16 +1056,6 @@ dependencies = [
|
||||
"syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.7.1"
|
||||
@ -1189,11 +1132,6 @@ dependencies = [
|
||||
"lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.13.11"
|
||||
@ -1256,14 +1194,6 @@ dependencies = [
|
||||
"redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "0.3.6"
|
||||
@ -1272,14 +1202,6 @@ dependencies = [
|
||||
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.10.0"
|
||||
@ -1290,11 +1212,6 @@ name = "ucd-util"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.1.0"
|
||||
@ -1395,13 +1312,6 @@ dependencies = [
|
||||
"wgpu-native 0.2.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-bindings"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cbindgen 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-native"
|
||||
version = "0.2.6"
|
||||
@ -1562,7 +1472,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5"
|
||||
"checksum andrew 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "142e9e6a99ad0d63a4cf6ce58a4c979f472c5815cbf7e5ca4e47b26a10dc728e"
|
||||
"checksum android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407"
|
||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
"checksum approx 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c57ff1a5b00753647aebbbcf4ea67fa1e711a65ea7a30eb90dbf07de2485aee"
|
||||
"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee"
|
||||
"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71"
|
||||
@ -1577,11 +1486,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab"
|
||||
"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40"
|
||||
"checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb"
|
||||
"checksum cbindgen 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "32e01024aaf5390d6a8145047371a4f5b0063a14c1e411bc731353bd2278ca44"
|
||||
"checksum cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)" = "d01c69d08ff207f231f07196e30f84c70f1c815b04f980f8b7b01ff01f05eb92"
|
||||
"checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4"
|
||||
"checksum cgmath 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "283944cdecc44bf0b8dd010ec9af888d3b4f142844fdbe026c20ef68148d6fe7"
|
||||
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
|
||||
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
|
||||
"checksum cmake 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "6ec65ee4f9c9d16f335091d23693457ed4928657ba4982289d7fafee03bc614a"
|
||||
"checksum cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cf79daa4e11e5def06e55306aa3601b87de6b5149671529318da048f67cdd77b"
|
||||
@ -1619,7 +1526,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114"
|
||||
"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08"
|
||||
"checksum ipc-channel 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f82db24b0c53ee2d54b420bb9258f2b787611fe3e7a28d514b5ea54fe65cd365"
|
||||
"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
|
||||
"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14"
|
||||
@ -1677,14 +1583,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619"
|
||||
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||
"checksum rusttype 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ce3926a2057b315b3e8bca6d1cec1e97f19436a8f9127621cd538cda9c96a38b"
|
||||
"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7"
|
||||
"checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267"
|
||||
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
|
||||
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
"checksum serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "92514fb95f900c9b5126e32d020f5c6d40564c27a5ea6d1d7d9f157a96623560"
|
||||
"checksum serde_derive 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)" = "ac38f51a52a556cd17545798e29536885fb1a3fa63d6399f5ef650f4a7d35901"
|
||||
"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d"
|
||||
"checksum sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0"
|
||||
"checksum shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11"
|
||||
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||
@ -1694,19 +1598,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
||||
"checksum stb_truetype 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "69b7df505db8e81d54ff8be4693421e5b543e08214bd8d99eb761fcb4d5668ba"
|
||||
"checksum storage-map 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cb94f167ccba0941876c8e722e888be8b4c05511ffdacc8cfcd4c647adfd424d"
|
||||
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
|
||||
"checksum syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)" = "14f9bf6292f3a61d2c716723fdb789a41bbe104168e6f496dc6497e531ea1b9b"
|
||||
"checksum syn 0.15.27 (registry+https://github.com/rust-lang/crates.io-index)" = "525bd55255f03c816e5d7f615587bd13030c7103354fadb104993dcee6a788ec"
|
||||
"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015"
|
||||
"checksum tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b86c784c88d98c801132806dadd3819ed29d8600836c4088e855cdf3e178ed8a"
|
||||
"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f"
|
||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||
"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
|
||||
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
|
||||
"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f"
|
||||
"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
|
||||
"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86"
|
||||
"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
|
||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737"
|
||||
"checksum uuid 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0238db0c5b605dd1cf51de0f21766f97fba2645897024461d6a00c036819a768"
|
||||
|
@ -1,7 +1,6 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"wgpu-native",
|
||||
"wgpu-bindings",
|
||||
"wgpu-remote",
|
||||
"wgpu-rs",
|
||||
"examples",
|
||||
|
18
Makefile
18
Makefile
@ -30,9 +30,9 @@ else
|
||||
endif
|
||||
|
||||
|
||||
.PHONY: all check test doc clear lib-native lib-remote lib-rust ci-examples examples-rust examples-gfx gfx
|
||||
.PHONY: all check test doc clear lib-native lib-remote lib-rust examples-rust examples-gfx gfx ffi-examples
|
||||
|
||||
all: ci-examples examples-rust examples-gfx
|
||||
all: examples-rust examples-gfx ffi-examples
|
||||
|
||||
check:
|
||||
cargo check --all
|
||||
@ -56,19 +56,23 @@ lib-remote: Cargo.lock wgpu-remote/Cargo.toml $(wildcard wgpu-native/**/*.rs wgp
|
||||
lib-rust: Cargo.lock wgpu-rs/Cargo.toml $(wildcard wgpu-rs/**/*.rs)
|
||||
cargo build --manifest-path wgpu-rs/Cargo.toml --features $(FEATURE_RUST)
|
||||
|
||||
ffi/wgpu.h: wgpu-native/cbindgen.toml $(wildcard wgpu-native/**/*.rs)
|
||||
cbindgen wgpu-native >ffi/wgpu.h
|
||||
|
||||
ffi/wgpu-remote.h: wgpu-remote/cbindgen.toml $(wildcard wgpu-native/**/*.rs wgpu-remote/**/*.rs)
|
||||
cbindgen wgpu-remote >ffi/wgpu-remote.h
|
||||
|
||||
wgpu-bindings/*.h: Cargo.lock $(wildcard wgpu-bindings/src/*.rs) lib-native lib-remote
|
||||
cargo +nightly run --manifest-path wgpu-bindings/Cargo.toml
|
||||
|
||||
ci-examples:
|
||||
cargo build --manifest-path wgpu-native/Cargo.toml --features=local,$(FEATURE_NATIVE)
|
||||
cargo build --manifest-path wgpu-remote/Cargo.toml --features=$(FEATURE_RUST)
|
||||
ffi-examples: lib-native lib-remote ffi/wgpu.h ffi/wgpu-remote.h
|
||||
cd examples/hello_triangle_c && mkdir -p build && cd build && cmake .. && make
|
||||
cd examples/hello_remote_c && mkdir -p build && cd build && cmake .. && make
|
||||
|
||||
examples-rust: lib-rust examples/Cargo.toml $(wildcard wgpu-native/**/*.rs)
|
||||
examples-rust: examples/Cargo.toml $(wildcard wgpu-native/**/*.rs wgpu-rs/**/*.rs)
|
||||
cargo build --manifest-path examples/Cargo.toml --features $(FEATURE_RUST)
|
||||
|
||||
examples-gfx: lib-rust gfx-examples/Cargo.toml $(wildcard gfx-examples/*.rs)
|
||||
examples-gfx: examples-rust gfx-examples/Cargo.toml $(wildcard gfx-examples/*.rs)
|
||||
cargo build --manifest-path gfx-examples/Cargo.toml --features $(FEATURE_RUST)
|
||||
|
||||
gfx:
|
||||
|
@ -7,7 +7,6 @@ This is an experimental [WebGPU](https://www.w3.org/community/gpu/) implementati
|
||||
|
||||
The implementation consists of the following parts:
|
||||
- `wgpu-native` - the native implementation of WebGPU as a C API library
|
||||
- `wgpu-bindings` - automatic generator of actual C headers
|
||||
- `wgpu-remote` - remoting layer to work with WebGPU across the process boundary
|
||||
- `wgpu-rs` - idiomatic Rust wrapper of the native library
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "./../../wgpu-bindings/wgpu-native.h"
|
||||
#include "./../../wgpu-bindings/wgpu-remote.h"
|
||||
#include "./../../ffi/wgpu-remote.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
@ -12,7 +11,7 @@ int main() {
|
||||
|
||||
//TODO: do something meaningful
|
||||
|
||||
wgpu_terminate(infra.client);
|
||||
wgpu_client_terminate(infra.client);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "./../../wgpu-bindings/wgpu.h"
|
||||
#include "./../../ffi/wgpu.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define WGPU_TARGET_MACOS 1
|
||||
|
67
ffi/wgpu-remote.h
Normal file
67
ffi/wgpu-remote.h
Normal file
@ -0,0 +1,67 @@
|
||||
|
||||
|
||||
/* Generated with cbindgen:0.8.3 */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef enum {
|
||||
WGPUPowerPreference_Default = 0,
|
||||
WGPUPowerPreference_LowPower = 1,
|
||||
WGPUPowerPreference_HighPerformance = 2,
|
||||
} WGPUPowerPreference;
|
||||
|
||||
typedef struct WGPUClient WGPUClient;
|
||||
|
||||
typedef struct WGPUServer WGPUServer;
|
||||
|
||||
typedef struct WGPUTrackPermit WGPUTrackPermit;
|
||||
|
||||
typedef uint32_t WGPUIndex;
|
||||
|
||||
typedef uint32_t WGPUEpoch;
|
||||
|
||||
typedef struct {
|
||||
WGPUIndex _0;
|
||||
WGPUEpoch _1;
|
||||
} WGPUId;
|
||||
|
||||
typedef WGPUId WGPUDeviceId;
|
||||
|
||||
typedef WGPUId WGPUAdapterId;
|
||||
|
||||
typedef struct {
|
||||
bool anisotropic_filtering;
|
||||
} WGPUExtensions;
|
||||
|
||||
typedef struct {
|
||||
WGPUExtensions extensions;
|
||||
} WGPUDeviceDescriptor;
|
||||
|
||||
typedef struct {
|
||||
WGPUPowerPreference power_preference;
|
||||
} WGPUAdapterDescriptor;
|
||||
|
||||
typedef struct {
|
||||
WGPUClient *client;
|
||||
WGPUServer *server;
|
||||
const uint8_t *error;
|
||||
} WGPUInfrastructure;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WGPUDeviceId wgpu_client_adapter_create_device(const WGPUClient *client,
|
||||
WGPUAdapterId adapter_id,
|
||||
const WGPUDeviceDescriptor *desc);
|
||||
|
||||
WGPUAdapterId wgpu_client_get_adapter(const WGPUClient *client, const WGPUAdapterDescriptor *desc);
|
||||
|
||||
void wgpu_client_terminate(WGPUClient *client);
|
||||
|
||||
WGPUInfrastructure wgpu_initialize(void);
|
||||
|
||||
void wgpu_server_process(const WGPUServer *server);
|
@ -1,10 +1,12 @@
|
||||
|
||||
|
||||
/* Generated with cbindgen:0.8.3 */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define WGPUBITS_PER_BYTE 8
|
||||
|
||||
#define WGPUMAX_BIND_GROUPS 4
|
||||
|
||||
#define WGPUMAX_COLOR_TARGETS 4
|
||||
@ -251,6 +253,8 @@ typedef enum {
|
||||
WGPUVertexFormat_Int4 = 48,
|
||||
} WGPUVertexFormat;
|
||||
|
||||
typedef struct WGPUTrackPermit WGPUTrackPermit;
|
||||
|
||||
typedef uint32_t WGPUIndex;
|
||||
|
||||
typedef uint32_t WGPUEpoch;
|
||||
@ -260,10 +264,12 @@ typedef struct {
|
||||
WGPUEpoch _1;
|
||||
} WGPUId;
|
||||
|
||||
typedef WGPUId WGPUDeviceId;
|
||||
|
||||
typedef WGPUId WGPUAdapterId;
|
||||
|
||||
typedef struct {
|
||||
WGPUPowerPreference power_preference;
|
||||
} WGPUAdapterDescriptor;
|
||||
|
||||
typedef struct {
|
||||
bool anisotropic_filtering;
|
||||
} WGPUExtensions;
|
||||
@ -272,6 +278,16 @@ typedef struct {
|
||||
WGPUExtensions extensions;
|
||||
} WGPUDeviceDescriptor;
|
||||
|
||||
#if defined(WGPU_REMOTE)
|
||||
typedef struct {
|
||||
WGPUAdapterId adapter;
|
||||
WGPUAdapterDescriptor adapter_desc;
|
||||
WGPUDeviceDescriptor device_desc;
|
||||
} WGPUForcedExports;
|
||||
#endif
|
||||
|
||||
typedef WGPUId WGPUDeviceId;
|
||||
|
||||
typedef WGPUId WGPUBindGroupId;
|
||||
|
||||
typedef WGPUId WGPUBufferId;
|
||||
@ -324,6 +340,12 @@ typedef struct {
|
||||
float b;
|
||||
float a;
|
||||
} WGPUColor;
|
||||
#define WGPUColor_TRANSPARENT (WGPUColor){ .r = 0, .g = 0, .b = 0, .a = 0 }
|
||||
#define WGPUColor_BLACK (WGPUColor){ .r = 0, .g = 0, .b = 0, .a = 1 }
|
||||
#define WGPUColor_WHITE (WGPUColor){ .r = 1, .g = 1, .b = 1, .a = 1 }
|
||||
#define WGPUColor_RED (WGPUColor){ .r = 1, .g = 0, .b = 0, .a = 1 }
|
||||
#define WGPUColor_GREEN (WGPUColor){ .r = 0, .g = 1, .b = 0, .a = 1 }
|
||||
#define WGPUColor_BLUE (WGPUColor){ .r = 0, .g = 0, .b = 1, .a = 1 }
|
||||
|
||||
typedef struct {
|
||||
WGPUTextureViewId attachment;
|
||||
@ -401,6 +423,9 @@ typedef struct {
|
||||
} WGPUBindGroupDescriptor;
|
||||
|
||||
typedef uint32_t WGPUShaderStageFlags;
|
||||
#define WGPUShaderStageFlags_VERTEX 1
|
||||
#define WGPUShaderStageFlags_FRAGMENT 2
|
||||
#define WGPUShaderStageFlags_COMPUTE 4
|
||||
|
||||
typedef struct {
|
||||
uint32_t binding;
|
||||
@ -414,6 +439,16 @@ typedef struct {
|
||||
} WGPUBindGroupLayoutDescriptor;
|
||||
|
||||
typedef uint32_t WGPUBufferUsageFlags;
|
||||
#define WGPUBufferUsageFlags_MAP_READ 1
|
||||
#define WGPUBufferUsageFlags_MAP_WRITE 2
|
||||
#define WGPUBufferUsageFlags_TRANSFER_SRC 4
|
||||
#define WGPUBufferUsageFlags_TRANSFER_DST 8
|
||||
#define WGPUBufferUsageFlags_INDEX 16
|
||||
#define WGPUBufferUsageFlags_VERTEX 32
|
||||
#define WGPUBufferUsageFlags_UNIFORM 64
|
||||
#define WGPUBufferUsageFlags_STORAGE 128
|
||||
#define WGPUBufferUsageFlags_NONE 0
|
||||
#define WGPUBufferUsageFlags_WRITE_ALL 2 + 8 + 128
|
||||
|
||||
typedef struct {
|
||||
uint32_t size;
|
||||
@ -460,6 +495,12 @@ typedef struct {
|
||||
} WGPUBlendDescriptor;
|
||||
|
||||
typedef uint32_t WGPUColorWriteFlags;
|
||||
#define WGPUColorWriteFlags_RED 1
|
||||
#define WGPUColorWriteFlags_GREEN 2
|
||||
#define WGPUColorWriteFlags_BLUE 4
|
||||
#define WGPUColorWriteFlags_ALPHA 8
|
||||
#define WGPUColorWriteFlags_COLOR 7
|
||||
#define WGPUColorWriteFlags_ALL 15
|
||||
|
||||
typedef struct {
|
||||
WGPUTextureFormat format;
|
||||
@ -547,6 +588,14 @@ typedef WGPUId WGPUSurfaceId;
|
||||
typedef WGPUSurfaceId WGPUSwapChainId;
|
||||
|
||||
typedef uint32_t WGPUTextureUsageFlags;
|
||||
#define WGPUTextureUsageFlags_TRANSFER_SRC 1
|
||||
#define WGPUTextureUsageFlags_TRANSFER_DST 2
|
||||
#define WGPUTextureUsageFlags_SAMPLED 4
|
||||
#define WGPUTextureUsageFlags_STORAGE 8
|
||||
#define WGPUTextureUsageFlags_OUTPUT_ATTACHMENT 16
|
||||
#define WGPUTextureUsageFlags_NONE 0
|
||||
#define WGPUTextureUsageFlags_WRITE_ALL 2 + 8 + 16
|
||||
#define WGPUTextureUsageFlags_UNINITIALIZED 65535
|
||||
|
||||
typedef struct {
|
||||
WGPUTextureUsageFlags usage;
|
||||
@ -565,16 +614,15 @@ typedef struct {
|
||||
|
||||
typedef WGPUDeviceId WGPUQueueId;
|
||||
|
||||
typedef struct {
|
||||
WGPUPowerPreference power_preference;
|
||||
} WGPUAdapterDescriptor;
|
||||
|
||||
typedef struct {
|
||||
WGPUTextureId texture_id;
|
||||
WGPUTextureViewId view_id;
|
||||
} WGPUSwapChainOutput;
|
||||
|
||||
typedef uint32_t WGPUTextureAspectFlags;
|
||||
#define WGPUTextureAspectFlags_COLOR 1
|
||||
#define WGPUTextureAspectFlags_DEPTH 2
|
||||
#define WGPUTextureAspectFlags_STENCIL 4
|
||||
|
||||
typedef struct {
|
||||
WGPUTextureFormat format;
|
||||
@ -586,79 +634,13 @@ typedef struct {
|
||||
uint32_t array_count;
|
||||
} WGPUTextureViewDescriptor;
|
||||
|
||||
#define WGPUBufferUsageFlags_INDEX 16
|
||||
|
||||
#define WGPUBufferUsageFlags_MAP_READ 1
|
||||
|
||||
#define WGPUBufferUsageFlags_MAP_WRITE 2
|
||||
|
||||
#define WGPUBufferUsageFlags_NONE 0
|
||||
|
||||
#define WGPUBufferUsageFlags_STORAGE 128
|
||||
|
||||
#define WGPUBufferUsageFlags_TRANSFER_DST 8
|
||||
|
||||
#define WGPUBufferUsageFlags_TRANSFER_SRC 4
|
||||
|
||||
#define WGPUBufferUsageFlags_UNIFORM 64
|
||||
|
||||
#define WGPUBufferUsageFlags_VERTEX 32
|
||||
|
||||
#define WGPUColorWriteFlags_ALL 15
|
||||
|
||||
#define WGPUColorWriteFlags_ALPHA 8
|
||||
|
||||
#define WGPUColorWriteFlags_BLUE 4
|
||||
|
||||
#define WGPUColorWriteFlags_COLOR 7
|
||||
|
||||
#define WGPUColorWriteFlags_GREEN 2
|
||||
|
||||
#define WGPUColorWriteFlags_RED 1
|
||||
|
||||
#define WGPUColor_BLACK (WGPUColor){ .r = 0, .g = 0, .b = 0, .a = 1 }
|
||||
|
||||
#define WGPUColor_BLUE (WGPUColor){ .r = 0, .g = 0, .b = 1, .a = 1 }
|
||||
|
||||
#define WGPUColor_GREEN (WGPUColor){ .r = 0, .g = 1, .b = 0, .a = 1 }
|
||||
|
||||
#define WGPUColor_RED (WGPUColor){ .r = 1, .g = 0, .b = 0, .a = 1 }
|
||||
|
||||
#define WGPUColor_TRANSPARENT (WGPUColor){ .r = 0, .g = 0, .b = 0, .a = 0 }
|
||||
|
||||
#define WGPUColor_WHITE (WGPUColor){ .r = 1, .g = 1, .b = 1, .a = 1 }
|
||||
|
||||
#define WGPUPipelineFlags_BLEND_COLOR 1
|
||||
|
||||
#define WGPUShaderStageFlags_COMPUTE 4
|
||||
|
||||
#define WGPUShaderStageFlags_FRAGMENT 2
|
||||
|
||||
#define WGPUShaderStageFlags_VERTEX 1
|
||||
|
||||
#define WGPUTextureAspectFlags_COLOR 1
|
||||
|
||||
#define WGPUTextureAspectFlags_DEPTH 2
|
||||
|
||||
#define WGPUTextureAspectFlags_STENCIL 4
|
||||
|
||||
#define WGPUTextureUsageFlags_NONE 0
|
||||
|
||||
#define WGPUTextureUsageFlags_OUTPUT_ATTACHMENT 16
|
||||
|
||||
#define WGPUTextureUsageFlags_SAMPLED 4
|
||||
|
||||
#define WGPUTextureUsageFlags_STORAGE 8
|
||||
|
||||
#define WGPUTextureUsageFlags_TRANSFER_DST 2
|
||||
|
||||
#define WGPUTextureUsageFlags_TRANSFER_SRC 1
|
||||
|
||||
#define WGPUTextureUsageFlags_UNINITIALIZED 65535
|
||||
|
||||
#define WGPUTrackPermit_EXTEND (WGPUTrackPermit){ .bits = 1 }
|
||||
|
||||
#define WGPUTrackPermit_REPLACE (WGPUTrackPermit){ .bits = 2 }
|
||||
#if defined(WGPU_REMOTE)
|
||||
void forced_exports(WGPUForcedExports fe);
|
||||
#endif
|
||||
|
||||
WGPUDeviceId wgpu_adapter_create_device(WGPUAdapterId adapter_id, const WGPUDeviceDescriptor *desc);
|
||||
|
||||
@ -718,6 +700,12 @@ void wgpu_compute_pass_dispatch(WGPUComputePassId pass_id, uint32_t x, uint32_t
|
||||
|
||||
WGPUCommandBufferId wgpu_compute_pass_end_pass(WGPUComputePassId pass_id);
|
||||
|
||||
void wgpu_compute_pass_set_bind_group(WGPUComputePassId pass_id,
|
||||
uint32_t index,
|
||||
WGPUBindGroupId bind_group_id,
|
||||
const uint32_t *offsets_ptr,
|
||||
uintptr_t offsets_count);
|
||||
|
||||
void wgpu_compute_pass_set_pipeline(WGPUComputePassId pass_id, WGPUComputePipelineId pipeline_id);
|
||||
|
||||
WGPUInstanceId wgpu_create_instance(void);
|
||||
@ -770,6 +758,11 @@ WGPUSurfaceId wgpu_instance_create_surface_from_windows_hwnd(WGPUInstanceId inst
|
||||
void *hinstance,
|
||||
void *hwnd);
|
||||
|
||||
#if defined(WGPU_WINDOW_WINIT)
|
||||
WGPUSurfaceId wgpu_instance_create_surface_from_winit(WGPUInstanceId instance_id,
|
||||
const WGPUWindow *window);
|
||||
#endif
|
||||
|
||||
WGPUSurfaceId wgpu_instance_create_surface_from_xlib(WGPUInstanceId instance_id,
|
||||
const void **display,
|
||||
uint64_t window);
|
@ -1,14 +0,0 @@
|
||||
[package]
|
||||
name = "wgpu-bindings"
|
||||
version = "0.1.0"
|
||||
authors = [
|
||||
"Dzmitry Malyshau <kvark@mozilla.com>",
|
||||
"Joshua Groves <josh@joshgroves.com>",
|
||||
]
|
||||
edition = "2018"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
[dependencies]
|
||||
cbindgen = "0.7.1"
|
@ -1,63 +0,0 @@
|
||||
extern crate cbindgen;
|
||||
|
||||
use cbindgen::ItemType as It;
|
||||
use std::path::PathBuf;
|
||||
|
||||
struct Binding<'a> {
|
||||
library: &'a str,
|
||||
features: &'a [&'a str],
|
||||
output: &'a str,
|
||||
item_types: &'a [It],
|
||||
}
|
||||
|
||||
const BINDINGS: [Binding; 3] = [
|
||||
Binding {
|
||||
library: "wgpu-native",
|
||||
features: &["local"],
|
||||
output: "wgpu.h",
|
||||
item_types: &[It::Enums, It::Constants, It::Structs, It::Typedefs, It::Functions],
|
||||
},
|
||||
Binding {
|
||||
library: "wgpu-native",
|
||||
features: &["remote"],
|
||||
output: "wgpu-native.h",
|
||||
item_types: &[It::Enums, It::Constants, It::Structs, It::Typedefs],
|
||||
},
|
||||
Binding {
|
||||
library: "wgpu-remote",
|
||||
features: &[],
|
||||
output: "wgpu-remote.h",
|
||||
item_types: &[It::Enums, It::Constants, It::Structs, It::Typedefs, It::OpaqueItems, It::Functions],
|
||||
},
|
||||
];
|
||||
|
||||
fn main() {
|
||||
let crate_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
let parent = crate_dir.parent().unwrap();
|
||||
|
||||
for bind in &BINDINGS {
|
||||
let config = cbindgen::Config {
|
||||
enumeration: cbindgen::EnumConfig {
|
||||
prefix_with_name: true,
|
||||
..Default::default()
|
||||
},
|
||||
export: cbindgen::ExportConfig {
|
||||
prefix: Some(String::from("WGPU")),
|
||||
item_types: bind.item_types.to_vec(),
|
||||
..Default::default()
|
||||
},
|
||||
language: cbindgen::Language::C,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
println!("Generating {}...", bind.output);
|
||||
cbindgen::Builder::new()
|
||||
.with_crate(parent.join(bind.library))
|
||||
.with_config(config)
|
||||
.with_parse_expand(&[bind.library])
|
||||
.with_parse_expand_features(bind.features)
|
||||
.generate()
|
||||
.unwrap()
|
||||
.write_to_file(crate_dir.join(bind.output));
|
||||
}
|
||||
}
|
@ -1,196 +0,0 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define WGPUBITS_PER_BYTE 8
|
||||
|
||||
#define WGPUMAX_BIND_GROUPS 4
|
||||
|
||||
#define WGPUMAX_COLOR_TARGETS 4
|
||||
|
||||
typedef enum {
|
||||
WGPUBufferMapAsyncStatus_Success,
|
||||
WGPUBufferMapAsyncStatus_Error,
|
||||
WGPUBufferMapAsyncStatus_Unknown,
|
||||
WGPUBufferMapAsyncStatus_ContextLost,
|
||||
} WGPUBufferMapAsyncStatus;
|
||||
|
||||
typedef enum {
|
||||
WGPUPowerPreference_Default = 0,
|
||||
WGPUPowerPreference_LowPower = 1,
|
||||
WGPUPowerPreference_HighPerformance = 2,
|
||||
} WGPUPowerPreference;
|
||||
|
||||
typedef uint32_t WGPUIndex;
|
||||
|
||||
typedef uint32_t WGPUEpoch;
|
||||
|
||||
typedef struct {
|
||||
WGPUIndex _0;
|
||||
WGPUEpoch _1;
|
||||
} WGPUId;
|
||||
|
||||
typedef WGPUId WGPUAdapterId;
|
||||
|
||||
typedef struct {
|
||||
WGPUPowerPreference power_preference;
|
||||
} WGPUAdapterDescriptor;
|
||||
|
||||
typedef struct {
|
||||
bool anisotropic_filtering;
|
||||
} WGPUExtensions;
|
||||
|
||||
typedef struct {
|
||||
WGPUExtensions extensions;
|
||||
} WGPUDeviceDescriptor;
|
||||
|
||||
typedef struct {
|
||||
WGPUAdapterId adapter;
|
||||
WGPUAdapterDescriptor adapter_desc;
|
||||
WGPUDeviceDescriptor device_desc;
|
||||
} WGPUForcedExports;
|
||||
|
||||
typedef WGPUId WGPUBindGroupId;
|
||||
|
||||
typedef WGPUId WGPUBufferId;
|
||||
|
||||
typedef void (*WGPUBufferMapReadCallback)(WGPUBufferMapAsyncStatus status, const uint8_t *data, uint8_t *userdata);
|
||||
|
||||
typedef void (*WGPUBufferMapWriteCallback)(WGPUBufferMapAsyncStatus status, uint8_t *data, uint8_t *userdata);
|
||||
|
||||
typedef WGPUId WGPUCommandBufferId;
|
||||
|
||||
typedef struct {
|
||||
WGPUBufferId buffer;
|
||||
uint32_t offset;
|
||||
uint32_t row_pitch;
|
||||
uint32_t image_height;
|
||||
} WGPUBufferCopyView;
|
||||
|
||||
typedef WGPUId WGPUTextureId;
|
||||
|
||||
typedef struct {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
} WGPUOrigin3d;
|
||||
|
||||
typedef struct {
|
||||
WGPUTextureId texture;
|
||||
uint32_t level;
|
||||
uint32_t slice;
|
||||
WGPUOrigin3d origin;
|
||||
} WGPUTextureCopyView;
|
||||
|
||||
typedef struct {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t depth;
|
||||
} WGPUExtent3d;
|
||||
|
||||
typedef WGPUCommandBufferId WGPUCommandEncoderId;
|
||||
|
||||
typedef WGPUId WGPUComputePassId;
|
||||
|
||||
typedef WGPUId WGPUComputePipelineId;
|
||||
|
||||
typedef WGPUId WGPUDeviceId;
|
||||
|
||||
typedef WGPUDeviceId WGPUQueueId;
|
||||
|
||||
typedef WGPUId WGPURenderPassId;
|
||||
|
||||
typedef struct {
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
float a;
|
||||
} WGPUColor;
|
||||
|
||||
typedef WGPUId WGPURenderPipelineId;
|
||||
|
||||
typedef WGPUId WGPUTextureViewId;
|
||||
|
||||
typedef struct {
|
||||
WGPUTextureId texture_id;
|
||||
WGPUTextureViewId view_id;
|
||||
} WGPUSwapChainOutput;
|
||||
|
||||
typedef WGPUId WGPUSurfaceId;
|
||||
|
||||
typedef WGPUSurfaceId WGPUSwapChainId;
|
||||
|
||||
#define WGPUBufferUsageFlags_INDEX 16
|
||||
|
||||
#define WGPUBufferUsageFlags_MAP_READ 1
|
||||
|
||||
#define WGPUBufferUsageFlags_MAP_WRITE 2
|
||||
|
||||
#define WGPUBufferUsageFlags_NONE 0
|
||||
|
||||
#define WGPUBufferUsageFlags_STORAGE 128
|
||||
|
||||
#define WGPUBufferUsageFlags_TRANSFER_DST 8
|
||||
|
||||
#define WGPUBufferUsageFlags_TRANSFER_SRC 4
|
||||
|
||||
#define WGPUBufferUsageFlags_UNIFORM 64
|
||||
|
||||
#define WGPUBufferUsageFlags_VERTEX 32
|
||||
|
||||
#define WGPUColorWriteFlags_ALL 15
|
||||
|
||||
#define WGPUColorWriteFlags_ALPHA 8
|
||||
|
||||
#define WGPUColorWriteFlags_BLUE 4
|
||||
|
||||
#define WGPUColorWriteFlags_COLOR 7
|
||||
|
||||
#define WGPUColorWriteFlags_GREEN 2
|
||||
|
||||
#define WGPUColorWriteFlags_RED 1
|
||||
|
||||
#define WGPUColor_BLACK (WGPUColor){ .r = 0, .g = 0, .b = 0, .a = 1 }
|
||||
|
||||
#define WGPUColor_BLUE (WGPUColor){ .r = 0, .g = 0, .b = 1, .a = 1 }
|
||||
|
||||
#define WGPUColor_GREEN (WGPUColor){ .r = 0, .g = 1, .b = 0, .a = 1 }
|
||||
|
||||
#define WGPUColor_RED (WGPUColor){ .r = 1, .g = 0, .b = 0, .a = 1 }
|
||||
|
||||
#define WGPUColor_TRANSPARENT (WGPUColor){ .r = 0, .g = 0, .b = 0, .a = 0 }
|
||||
|
||||
#define WGPUColor_WHITE (WGPUColor){ .r = 1, .g = 1, .b = 1, .a = 1 }
|
||||
|
||||
#define WGPUPipelineFlags_BLEND_COLOR 1
|
||||
|
||||
#define WGPUShaderStageFlags_COMPUTE 4
|
||||
|
||||
#define WGPUShaderStageFlags_FRAGMENT 2
|
||||
|
||||
#define WGPUShaderStageFlags_VERTEX 1
|
||||
|
||||
#define WGPUTextureAspectFlags_COLOR 1
|
||||
|
||||
#define WGPUTextureAspectFlags_DEPTH 2
|
||||
|
||||
#define WGPUTextureAspectFlags_STENCIL 4
|
||||
|
||||
#define WGPUTextureUsageFlags_NONE 0
|
||||
|
||||
#define WGPUTextureUsageFlags_OUTPUT_ATTACHMENT 16
|
||||
|
||||
#define WGPUTextureUsageFlags_SAMPLED 4
|
||||
|
||||
#define WGPUTextureUsageFlags_STORAGE 8
|
||||
|
||||
#define WGPUTextureUsageFlags_TRANSFER_DST 2
|
||||
|
||||
#define WGPUTextureUsageFlags_TRANSFER_SRC 1
|
||||
|
||||
#define WGPUTextureUsageFlags_UNINITIALIZED 65535
|
||||
|
||||
#define WGPUTrackPermit_EXTEND (WGPUTrackPermit){ .bits = 1 }
|
||||
|
||||
#define WGPUTrackPermit_REPLACE (WGPUTrackPermit){ .bits = 2 }
|
@ -1,27 +0,0 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct WGPUClient WGPUClient;
|
||||
|
||||
typedef struct WGPUServer WGPUServer;
|
||||
|
||||
typedef struct {
|
||||
WGPUClient *client;
|
||||
WGPUServer *server;
|
||||
const uint8_t *error;
|
||||
} WGPUInfrastructure;
|
||||
|
||||
WGPUDeviceId wgpu_adapter_create_device(const WGPUClient *client,
|
||||
WGPUAdapterId adapter_id,
|
||||
const WGPUDeviceDescriptor *desc);
|
||||
|
||||
WGPUInfrastructure wgpu_initialize(void);
|
||||
|
||||
WGPUAdapterId wgpu_instance_get_adapter(const WGPUClient *client,
|
||||
const WGPUAdapterDescriptor *desc);
|
||||
|
||||
void wgpu_server_process(const WGPUServer *server);
|
||||
|
||||
void wgpu_terminate(WGPUClient *client);
|
31
wgpu-native/cbindgen.toml
Normal file
31
wgpu-native/cbindgen.toml
Normal file
@ -0,0 +1,31 @@
|
||||
header = ""
|
||||
include_version = true
|
||||
braces = "SameLine"
|
||||
line_length = 100
|
||||
tab_width = 2
|
||||
language = "C"
|
||||
|
||||
[export]
|
||||
prefix = "WGPU"
|
||||
|
||||
[parse]
|
||||
parse_deps = false
|
||||
|
||||
[parse.expand]
|
||||
features = ["local"]
|
||||
|
||||
[fn]
|
||||
|
||||
[struct]
|
||||
derive_eq = true
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
derive_helper_methods = true
|
||||
|
||||
[macro_expansion]
|
||||
bitflags = true
|
||||
|
||||
[defines]
|
||||
"feature = window-winit" = "WGPU_WINDOW_WINIT"
|
||||
"feature = remote" = "WGPU_REMOTE"
|
@ -12,7 +12,8 @@ use crate::{
|
||||
|
||||
use hal::{self, command::RawCommandBuffer};
|
||||
|
||||
use std::iter;
|
||||
use std::{iter, slice};
|
||||
|
||||
|
||||
pub struct ComputePass<B: hal::Backend> {
|
||||
raw: B::CommandBuffer,
|
||||
@ -56,13 +57,23 @@ pub extern "C" fn wgpu_compute_pass_set_bind_group(
|
||||
pass_id: ComputePassId,
|
||||
index: u32,
|
||||
bind_group_id: BindGroupId,
|
||||
offsets: &[u32],
|
||||
offsets_ptr: *const u32,
|
||||
offsets_count: usize,
|
||||
) {
|
||||
let mut pass_guard = HUB.compute_passes.write();
|
||||
let pass = &mut pass_guard[pass_id];
|
||||
let bind_group_guard = HUB.bind_groups.read();
|
||||
let bind_group = &bind_group_guard[bind_group_id];
|
||||
|
||||
assert_eq!(bind_group.dynamic_count, offsets_count);
|
||||
let offsets = if offsets_count != 0 {
|
||||
unsafe {
|
||||
slice::from_raw_parts(offsets_ptr, offsets_count)
|
||||
}
|
||||
} else {
|
||||
&[]
|
||||
};
|
||||
|
||||
//Note: currently, WebGPU compute passes have synchronization defined
|
||||
// at a dispatch granularity, so we insert the necessary barriers here.
|
||||
|
||||
|
@ -43,14 +43,15 @@ pub fn create_instance() -> ::back::Instance {
|
||||
::back::Instance::create("wgpu", 1)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
#[cfg(feature = "local")]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_create_instance() -> InstanceId {
|
||||
let inst = create_instance();
|
||||
HUB.instances.register_local(inst)
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "local", feature = "window-winit"))]
|
||||
|
||||
#[cfg(feature = "window-winit")]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_instance_create_surface_from_winit(
|
||||
instance_id: InstanceId,
|
||||
|
@ -41,27 +41,9 @@ pub use self::swap_chain::*;
|
||||
use std::ptr;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
|
||||
type SubmissionIndex = usize;
|
||||
|
||||
//TODO: remove this structure and entry point.
|
||||
// They are currently needed to force `cbindgen` to export some of
|
||||
// the types when building with `remote` feature excluding the
|
||||
// functions export (as a `wgpu-remote.h` dependency).
|
||||
#[cfg(feature = "remote")]
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct ForcedExports {
|
||||
pub adapter: AdapterId,
|
||||
pub adapter_desc: AdapterDescriptor,
|
||||
pub device_desc: DeviceDescriptor,
|
||||
}
|
||||
#[cfg(feature = "remote")]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn forced_exports(fe: ForcedExports) {
|
||||
println!("{:?}", fe);
|
||||
}
|
||||
|
||||
|
||||
//TODO: make it private. Currently used for swapchain creation impl.
|
||||
#[derive(Debug)]
|
||||
pub struct RefCount(ptr::NonNull<AtomicUsize>);
|
||||
|
@ -12,13 +12,13 @@ crate-type = ["lib", "cdylib", "staticlib"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
vulkan = ["wgn/gfx-backend-vulkan"]
|
||||
dx11 = ["wgn/gfx-backend-dx11"]
|
||||
dx12 = ["wgn/gfx-backend-dx12"]
|
||||
metal = ["wgn/gfx-backend-metal"]
|
||||
vulkan = ["wgpu-native/gfx-backend-vulkan"]
|
||||
dx11 = ["wgpu-native/gfx-backend-dx11"]
|
||||
dx12 = ["wgpu-native/gfx-backend-dx12"]
|
||||
metal = ["wgpu-native/gfx-backend-metal"]
|
||||
|
||||
[dependencies]
|
||||
wgn = { package = "wgpu-native", path = "../wgpu-native", features = ["remote"] }
|
||||
wgpu-native = { path = "../wgpu-native", version = "0.2", features = ["remote"] }
|
||||
ipc-channel = "0.11"
|
||||
lazy_static = "1"
|
||||
log = "0.4"
|
||||
|
25
wgpu-remote/cbindgen.toml
Normal file
25
wgpu-remote/cbindgen.toml
Normal file
@ -0,0 +1,25 @@
|
||||
header = ""
|
||||
include_version = true
|
||||
braces = "SameLine"
|
||||
line_length = 100
|
||||
tab_width = 2
|
||||
language = "C"
|
||||
|
||||
[export]
|
||||
prefix = "WGPU"
|
||||
|
||||
[parse]
|
||||
parse_deps = true
|
||||
include = ["wgpu_native"]
|
||||
|
||||
[fn]
|
||||
|
||||
[struct]
|
||||
derive_eq = true
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
derive_helper_methods = true
|
||||
|
||||
[macro_expansion]
|
||||
bitflags = true
|
@ -1,3 +1,6 @@
|
||||
//TODO: remove once `cbindgen` is smart enough
|
||||
extern crate wgpu_native as wgn;
|
||||
|
||||
use crate::server::Server;
|
||||
|
||||
use ipc_channel::ipc;
|
||||
@ -5,7 +8,6 @@ use lazy_static::lazy_static;
|
||||
use log::error;
|
||||
use parking_lot::Mutex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use wgn;
|
||||
|
||||
use std::ptr;
|
||||
|
||||
@ -83,7 +85,7 @@ pub extern "C" fn wgpu_initialize() -> Infrastructure {
|
||||
Infrastructure {
|
||||
client: ptr::null_mut(),
|
||||
server: ptr::null_mut(),
|
||||
error: ptr::null(), //TODO
|
||||
error: ptr::null(), //TODO_remote_
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -91,7 +93,7 @@ pub extern "C" fn wgpu_initialize() -> Infrastructure {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_terminate(client: *mut Client) {
|
||||
pub extern "C" fn wgpu_client_terminate(client: *mut Client) {
|
||||
let client = unsafe {
|
||||
Box::from_raw(client)
|
||||
};
|
||||
@ -100,7 +102,7 @@ pub extern "C" fn wgpu_terminate(client: *mut Client) {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_instance_get_adapter(
|
||||
pub extern "C" fn wgpu_client_get_adapter(
|
||||
client: &Client,
|
||||
desc: &wgn::AdapterDescriptor,
|
||||
) -> wgn::AdapterId {
|
||||
@ -115,7 +117,7 @@ pub extern "C" fn wgpu_instance_get_adapter(
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_adapter_create_device(
|
||||
pub extern "C" fn wgpu_client_adapter_create_device(
|
||||
client: &Client,
|
||||
adapter_id: wgn::AdapterId,
|
||||
desc: &wgn::DeviceDescriptor,
|
||||
|
@ -906,7 +906,13 @@ impl<'a> Drop for RenderPass<'a> {
|
||||
|
||||
impl<'a> ComputePass<'a> {
|
||||
pub fn set_bind_group(&mut self, index: u32, bind_group: &BindGroup, offsets: &[u32]) {
|
||||
wgn::wgpu_compute_pass_set_bind_group(self.id, index, bind_group.id, offsets);
|
||||
wgn::wgpu_compute_pass_set_bind_group(
|
||||
self.id,
|
||||
index,
|
||||
bind_group.id,
|
||||
offsets.as_ptr(),
|
||||
offsets.len(),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn set_pipeline(&mut self, pipeline: &ComputePipeline) {
|
||||
|
Loading…
Reference in New Issue
Block a user