diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82ab08363c..f386154fa8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Install CI Libraries run: sudo ./ci/install-ci-libraries.sh 10 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 37f809efb5..934baf2e8f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -9,7 +9,7 @@ jobs: name: Test and Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal diff --git a/.gitignore b/.gitignore index 42a856f29f..5741484e8e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ vgcore.* #editors .idea/ +.vscode/ diff --git a/Cargo.lock b/Cargo.lock index 0a211dcfda..aabd2bbf8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -69,12 +69,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "anyhow" -version = "1.0.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf8dcb5b4bbaa28653b647d8c77bd4ed40183b48882e130c1f1ffb73de069fd7" - [[package]] name = "approx" version = "0.3.2" @@ -407,15 +401,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "cmake" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb6210b637171dfba4cda12e579ac6dc73f5165ad56133e5d72ef3131f320855" -dependencies = [ - "cc", -] - [[package]] name = "cocoa" version = "0.20.2" @@ -1234,12 +1219,6 @@ version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" -[[package]] -name = "glob" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" - [[package]] name = "glyph_brush" version = "0.7.0" @@ -2658,15 +2637,12 @@ dependencies = [ name = "roc_editor" version = "0.1.0" dependencies = [ - "anyhow", "arraystring", "bumpalo", "bytemuck", "cgmath", "env_logger 0.7.1", - "fs_extra", "futures", - "glob", "glyph_brush", "im", "im-rc", @@ -2697,7 +2673,6 @@ dependencies = [ "roc_types", "roc_unify", "roc_uniq", - "shaderc", "target-lexicon", "wgpu", "wgpu_glyph", @@ -3232,26 +3207,6 @@ dependencies = [ "opaque-debug", ] -[[package]] -name = "shaderc" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50b8aeaae10b9bda5cba66736a7e265f67698e912e1cc6a4678acba286e22be9" -dependencies = [ - "libc", - "shaderc-sys", -] - -[[package]] -name = "shaderc-sys" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b12d7c62d6732884c9dfab587503fa3a795b108df152415a89da23812d4737e" -dependencies = [ - "cmake", - "libc", -] - [[package]] name = "signal-hook-registry" version = "1.2.2" diff --git a/compiler/unify/src/unify.rs b/compiler/unify/src/unify.rs index 89fe4b44e9..c3767540ad 100644 --- a/compiler/unify/src/unify.rs +++ b/compiler/unify/src/unify.rs @@ -1239,5 +1239,8 @@ fn gather_tags( } fn is_recursion_var(subs: &Subs, var: Variable) -> bool { - matches!(subs.get_without_compacting(var).content, Content::RecursionVar { .. }) + matches!( + subs.get_without_compacting(var).content, + Content::RecursionVar { .. } + ) } diff --git a/editor/.gitignore b/editor/.gitignore index 27ca244cf3..8b13789179 100644 --- a/editor/.gitignore +++ b/editor/.gitignore @@ -1 +1 @@ -*.spv + diff --git a/editor/Cargo.toml b/editor/Cargo.toml index 43d2ff5c29..4e1e639c8f 100644 --- a/editor/Cargo.toml +++ b/editor/Cargo.toml @@ -74,8 +74,11 @@ indoc = "0.3.3" quickcheck = "0.8" quickcheck_macros = "0.8" -[build-dependencies] -anyhow = "1.0" -fs_extra = "1.1" -glob = "0.3" -shaderc = "0.6" +# uncomment everything below if you have made changes to any shaders and +# want to compile them to .spv +#[build-dependencies] +#rayon = "1.5.0" +#anyhow = "1.0" +#fs_extra = "1.1" +#glob = "0.3" +#shaderc = "0.6" diff --git a/editor/build.rs b/editor/build_shaders.rs similarity index 76% rename from editor/build.rs rename to editor/build_shaders.rs index 7c80d06d23..52990c1c4c 100644 --- a/editor/build.rs +++ b/editor/build_shaders.rs @@ -2,9 +2,14 @@ use anyhow::*; use glob::glob; use std::fs::{read_to_string, write}; use std::path::PathBuf; +use rayon::prelude::*; -// Build script for shaders used from: -// https://sotrh.github.io/learn-wgpu/beginner/tutorial3-pipeline/#compiling-shaders-and-include-spirv +// Adapted from https://github.com/sotrh/learn-wgpu +// by Benjamin Hansen, licensed under the MIT license + + +// Rename this file to build.rs and uncomment the build-dependencies in Cargo.toml to compile +// the shaders into .spv files struct ShaderData { src: String, @@ -41,17 +46,16 @@ impl ShaderData { fn main() -> Result<()> { // Collect all shaders recursively within /src/ - let mut shader_paths = [ - glob("./src/**/*.vert")?, - glob("./src/**/*.frag")?, - glob("./src/**/*.comp")?, - ]; + let mut shader_paths = Vec::new(); + shader_paths.extend(glob("./src/**/*.vert")?); + shader_paths.extend(glob("./src/**/*.frag")?); + shader_paths.extend(glob("./src/**/*.comp")?); - // This could be parallelized - let shaders = shader_paths - .iter_mut() - .flatten() - .map(|glob_result| ShaderData::load(glob_result?)) + + let shaders = shader_paths.into_par_iter() + .map(|glob_result| { + ShaderData::load(glob_result?) + }) .collect::>>() .into_iter() .collect::>>()?; diff --git a/editor/src/shaders/rect.frag b/editor/src/shaders/rect.frag index dbd8c522f7..2246d723b6 100644 --- a/editor/src/shaders/rect.frag +++ b/editor/src/shaders/rect.frag @@ -2,6 +2,8 @@ // Taken from https://github.com/sotrh/learn-wgpu // by Benjamin Hansen, licensed under the MIT license +// Check build_shaders.rs on how to recompile shaders if you have made changes to this file + layout(location=0) in vec3 color; layout(location=0) out vec4 fColor; diff --git a/editor/src/shaders/rect.frag.spv b/editor/src/shaders/rect.frag.spv new file mode 100644 index 0000000000..ae9c49a4ad Binary files /dev/null and b/editor/src/shaders/rect.frag.spv differ diff --git a/editor/src/shaders/rect.vert b/editor/src/shaders/rect.vert index 4be9792857..3f885aa159 100644 --- a/editor/src/shaders/rect.vert +++ b/editor/src/shaders/rect.vert @@ -3,6 +3,8 @@ // https://github.com/sotrh/learn-wgpu by Benjamin Hansen, licensed under the MIT license // https://github.com/cloudhead/rgx by Alexis Sellier, licensed under the MIT license +// Check build_shaders.rs on how to recompile shaders if you have made changes to this file + layout(set = 0, binding = 0) uniform Globals { // orthographic projection is used to transform pixel coords to the coordinate system used by wgpu mat4 ortho; diff --git a/editor/src/shaders/rect.vert.spv b/editor/src/shaders/rect.vert.spv new file mode 100644 index 0000000000..116f559047 Binary files /dev/null and b/editor/src/shaders/rect.vert.spv differ