Move top-level crates to crates/ directory (#200)

* Move top-level crates to crates/ directory

* Update docs

* Update test.sh

* Update docs.sh

* Update clippy.sh
This commit is contained in:
XAMPPRocky 2020-11-02 11:26:10 +01:00 committed by GitHub
parent 43c7934ef2
commit ad610b57f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
93 changed files with 36 additions and 28 deletions

View File

@ -28,10 +28,10 @@ function clippy_no_features() {
}
# Core crates
clippy spirv-tools-sys
clippy spirv-tools
clippy rustc_codegen_spirv
clippy spirv-builder
clippy crates/spirv-tools-sys
clippy crates/spirv-tools
clippy crates/rustc_codegen_spirv
clippy crates/spirv-builder
# Examples

View File

@ -17,8 +17,8 @@ function doc() {
}
# Core crates only!
cargo doc --manifest-path "spirv-std/Cargo.toml"
doc spirv-tools-sys
doc spirv-tools
doc rustc_codegen_spirv
doc spirv-builder
cargo doc --manifest-path "crates/spirv-std/Cargo.toml"
doc crates/spirv-tools-sys
doc crates/spirv-tools
doc crates/rustc_codegen_spirv
doc crates/spirv-builder

View File

@ -37,10 +37,10 @@ function cargo_test_no_features() {
}
# Core crates
cargo_test spirv-tools-sys
cargo_test spirv-tools
cargo_test rustc_codegen_spirv
cargo_test spirv-builder
cargo_test crates/spirv-tools-sys
cargo_test crates/spirv-tools
cargo_test crates/rustc_codegen_spirv
cargo_test crates/spirv-builder
# Examples
# See: https://github.com/EmbarkStudios/rust-gpu/issues/84

4
.gitmodules vendored
View File

@ -1,7 +1,7 @@
[submodule "spirv-tools-sys/spirv-headers"]
path = spirv-tools-sys/spirv-headers
path = crates/spirv-tools-sys/spirv-headers
url = https://github.com/KhronosGroup/SPIRV-Headers.git
[submodule "spirv-tools-sys/spirv-tools"]
path = spirv-tools-sys/spirv-tools
path = crates/spirv-tools-sys/spirv-tools
url = https://github.com/EmbarkStudios/SPIRV-Tools.git
branch = patch-to-string

View File

@ -5,11 +5,11 @@ members = [
"examples/runners/wgpu",
"examples/shaders/sky-shader",
"examples/shaders/simplest-shader",
"rustc_codegen_spirv",
"spirv-builder",
"spirv-std",
"spirv-tools",
"spirv-tools-sys",
"crates/rustc_codegen_spirv",
"crates/spirv-builder",
"crates/spirv-std",
"crates/spirv-tools",
"crates/spirv-tools-sys",
]
[patch.crates-io]

View File

@ -29,7 +29,7 @@ how to use and develop on Rust-GPU.
1. **optional** Install [SPIRV-Tools](https://github.com/KhronosGroup/SPIRV-Tools#downloads) and add it to your `PATH`. You can skip this step if you just want to run examples with the defaults. See [Using installed SPIRV-Tools](#using-installed-spirv-tools) if you decide to go with this option.
1. Next, look at the [examples](examples) folder. There are two kinds of targets here: [runners](examples/runners) and [shaders](examples/shaders). The projects inside `shaders` are "GPU crates", i.e. ones that will be compiled one or more SPIR-V modules. The `runner` projects are normal, CPU crates that use some graphics backend (currently, we have a [`wgpu` runner](examples/runners/wgpu), a [Vulkan runner](examples/runners/ash) through `ash`, and a barebones pure software [CPU runner](examples/runners/cpu)) to actually run one of the "GPU crate" shaders.
1. Next, look at the [examples] folder. There are two kinds of targets here: [runners] and [shaders]. The projects inside `shaders` are "GPU crates", i.e. ones that will be compiled one or more SPIR-V modules. The `runner` projects are normal, CPU crates that use some graphics backend (currently, we have a [`wgpu` runner][examples/runners/wgpu], a [Vulkan runner][examples/runners/ash] through `ash`, and a barebones pure software [CPU runner][examples/runners/cpu]) to actually run one of the "GPU crate" shaders.
Run the example:
@ -39,7 +39,7 @@ how to use and develop on Rust-GPU.
This will build `rustc_codegen_spirv`, the compiler, then use that compiler to build [`sky-shader`](examples/shaders/sky-shader) into a SPIR-V module, then finally, build a `wgpu` sample app (modified from [`wgpu`'s examples](https://github.com/gfx-rs/wgpu-rs/tree/master/examples/hello-triangle)) using the built SPIR-V module to display the shader in a window.
All of this is orchestrated by the [spirv-builder](spirv-builder) crate, which is used in each of the example runners' [`build.rs` files](examples/runners/wgpu/build.rs). Please look at that file, as well as both example projects in general, to see how to set up your own shaders!
All of this is orchestrated by the [spirv-builder] crate, which is used in each of the example runners' [`build.rs` files](examples/runners/wgpu/build.rs). Please look at that file, as well as both example projects in general, to see how to set up your own shaders!
Be aware that this project is in a very early phase - if the above doesn't work, please [file an issue](https://github.com/EmbarkStudios/rust-gpu/issues)!
@ -62,9 +62,9 @@ cargo build -Z build-std=core --target spirv-unknown-unknown --release
This will produce a `target/spirv-unknown-unknown/release/crate_name.spv` file.
To create a GPU crate, look at the crates in [examples/shaders](examples/shaders). In short, reference the `spirv-std` crate, and use intrinsics defined there to create your shader.
To create a GPU crate, look at the crates in [examples/shaders]. In short, reference the `spirv-std` crate, and use intrinsics defined there to create your shader.
This is all a little convoluted, hence the [spirv-builder](spirv-builder) crate handles a lot of this.
This is all a little convoluted, hence the [spirv-builder] crate handles a lot of this.
## Using installed SPIRV-Tools
@ -78,3 +78,11 @@ cargo run \
```
You should see `warning: use-installed-tools feature on, skipping compilation of C++ code` during the compilation, but otherwise the build will function just the same as if you compiled the C++ code, with the exception that it will fail if you don't have SPIRV-Tools installed correctly.
[spirv-builder]: https://embarkstudios.github.io/rust-gpu/api/spirv_builder/index.html
[examples]: https://github.com/EmbarkStudios/rust-gpu/tree/main/examples
[examples/runners]: https://github.com/EmbarkStudios/rust-gpu/tree/main/examples/runners
[examples/runners/ash]: https://github.com/EmbarkStudios/rust-gpu/tree/main/examples/runners/ash
[examples/runners/cpu]: https://github.com/EmbarkStudios/rust-gpu/tree/main/examples/runners/cpu
[examples/runners/wgpu]: https://github.com/EmbarkStudios/rust-gpu/tree/main/examples/runners/wgpu
[examples/shaders]: https://github.com/EmbarkStudios/rust-gpu/tree/main/examples/shaders

View File

@ -23,4 +23,4 @@ winit = "0.23.0"
ash-molten = { git = "https://github.com/EmbarkStudios/ash-molten", branch = "moltenvk-1.1.0" }
[build-dependencies]
spirv-builder = { path = "../../../spirv-builder", default-features = false }
spirv-builder = { path = "../../../crates/spirv-builder", default-features = false }

View File

@ -18,7 +18,7 @@ futures = { version = "0.3", default-features = false, features = ["std", "execu
winit = { version = "0.23", features = ["web-sys"] }
[build-dependencies]
spirv-builder = { path = "../../../spirv-builder", default-features = false }
spirv-builder = { path = "../../../crates/spirv-builder", default-features = false }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
wgpu-subscriber = "0.1.0"

View File

@ -10,5 +10,5 @@ publish = false
crate-type = ["dylib"]
[dependencies]
spirv-std = { path = "../../../spirv-std" }
spirv-std = { path = "../../../crates/spirv-std" }
glam = "0.9"

View File

@ -10,5 +10,5 @@ publish = false
crate-type = ["dylib"]
[dependencies]
spirv-std = { path = "../../../spirv-std" }
spirv-std = { path = "../../../crates/spirv-std" }
glam = "0.9"