From 9ecc25e9071cdd0a67f05f71b963362ebbdf3f99 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Tue, 18 Sep 2018 21:14:04 -0400 Subject: [PATCH] Restructure the repo to host multiple crates --- Cargo.lock | 26 +++++++++--------- Cargo.toml | 20 +++----------- README.md | 2 +- examples/hello_triangle.rs | 19 ------------- wgpu-native/Cargo.toml | 19 +++++++++++++ .../examples}/data/hello_triangle.frag | 0 .../examples}/data/hello_triangle.frag.spv | Bin .../examples}/data/hello_triangle.vert | 0 .../examples}/data/hello_triangle.vert.spv | Bin wgpu-native/examples/hello_triangle.rs | 19 +++++++++++++ {src => wgpu-native/src}/binding_model.rs | 0 {src => wgpu-native/src}/command/compute.rs | 0 {src => wgpu-native/src}/command/mod.rs | 0 {src => wgpu-native/src}/command/render.rs | 0 {src => wgpu-native/src}/conv.rs | 0 {src => wgpu-native/src}/device.rs | 0 {src => wgpu-native/src}/handle.rs | 0 {src => wgpu-native/src}/instance.rs | 0 {src => wgpu-native/src}/lib.rs | 0 {src => wgpu-native/src}/pipeline.rs | 0 {src => wgpu-native/src}/resource.rs | 0 21 files changed, 56 insertions(+), 49 deletions(-) delete mode 100644 examples/hello_triangle.rs create mode 100644 wgpu-native/Cargo.toml rename {examples => wgpu-native/examples}/data/hello_triangle.frag (100%) rename {examples => wgpu-native/examples}/data/hello_triangle.frag.spv (100%) rename {examples => wgpu-native/examples}/data/hello_triangle.vert (100%) rename {examples => wgpu-native/examples}/data/hello_triangle.vert.spv (100%) create mode 100644 wgpu-native/examples/hello_triangle.rs rename {src => wgpu-native/src}/binding_model.rs (100%) rename {src => wgpu-native/src}/command/compute.rs (100%) rename {src => wgpu-native/src}/command/mod.rs (100%) rename {src => wgpu-native/src}/command/render.rs (100%) rename {src => wgpu-native/src}/conv.rs (100%) rename {src => wgpu-native/src}/device.rs (100%) rename {src => wgpu-native/src}/handle.rs (100%) rename {src => wgpu-native/src}/instance.rs (100%) rename {src => wgpu-native/src}/lib.rs (100%) rename {src => wgpu-native/src}/pipeline.rs (100%) rename {src => wgpu-native/src}/resource.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index a2e1c2b95..c5914c520 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -298,19 +298,6 @@ dependencies = [ "relevant 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "gpu-native" -version = "0.1.0" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx-backend-dx12 0.1.0 (git+https://github.com/gfx-rs/gfx?rev=a435a05)", - "gfx-backend-empty 0.1.0 (git+https://github.com/gfx-rs/gfx?rev=a435a05)", - "gfx-backend-metal 0.1.0 (git+https://github.com/gfx-rs/gfx?rev=a435a05)", - "gfx-backend-vulkan 0.1.0 (git+https://github.com/gfx-rs/gfx?rev=a435a05)", - "gfx-hal 0.1.0 (git+https://github.com/gfx-rs/gfx?rev=a435a05)", - "gfx-memory 0.1.0 (git+https://github.com/gfx-rs/gfx-memory?rev=483d64d)", -] - [[package]] name = "itertools" version = "0.5.10" @@ -727,6 +714,19 @@ dependencies = [ "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "wgpu-native" +version = "0.1.0" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx-backend-dx12 0.1.0 (git+https://github.com/gfx-rs/gfx?rev=a435a05)", + "gfx-backend-empty 0.1.0 (git+https://github.com/gfx-rs/gfx?rev=a435a05)", + "gfx-backend-metal 0.1.0 (git+https://github.com/gfx-rs/gfx?rev=a435a05)", + "gfx-backend-vulkan 0.1.0 (git+https://github.com/gfx-rs/gfx?rev=a435a05)", + "gfx-hal 0.1.0 (git+https://github.com/gfx-rs/gfx?rev=a435a05)", + "gfx-memory 0.1.0 (git+https://github.com/gfx-rs/gfx-memory?rev=483d64d)", +] + [[package]] name = "winapi" version = "0.3.5" diff --git a/Cargo.toml b/Cargo.toml index bb9bf6072..d34dc82b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,16 +1,4 @@ -[package] -name = "gpu-native" -version = "0.1.0" -authors = ["Dzmitry Malyshau "] - -[features] -default = [] - -[dependencies] -bitflags = "1.0" -gfx-hal = { git = "https://github.com/gfx-rs/gfx", rev = "a435a05" } # required by gfx-memory -gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "a435a05" } -gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "a435a05", optional = true } -gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "a435a05", optional = true } -gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "a435a05", optional = true } -gfx-memory = { git = "https://github.com/gfx-rs/gfx-memory", rev = "483d64d" } +[workspace] +members = [ + "wgpu-native", +] diff --git a/README.md b/README.md index fce07ab83..920ef49ec 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# WebGPU-native +# WebGPU [![Build Status](https://travis-ci.org/gfx-rs/wgpu-native.svg)](https://travis-ci.org/gfx-rs/wgpu-native) [![Gitter](https://badges.gitter.im/gfx-rs/gfx.svg)](https://gitter.im/gfx-rs/gfx) diff --git a/examples/hello_triangle.rs b/examples/hello_triangle.rs deleted file mode 100644 index 5b4450ae3..000000000 --- a/examples/hello_triangle.rs +++ /dev/null @@ -1,19 +0,0 @@ -extern crate gpu_native as gn; - -fn main() { - let instance = gn::create_instance(); - let adapter = gn::instance_get_adapter(instance, gn::AdapterDescriptor { - power_preference: gn::PowerPreference::LowPower, - }); - let device = gn::adapter_create_device(adapter, gn::DeviceDescriptor { - extensions: gn::Extensions { - anisotropic_filtering: false, - }, - }); - let _vs = gn::device_create_shader_module(device, gn::ShaderModuleDescriptor { - code: include_bytes!("./data/hello_triangle.vert.spv"), - }); - let _fs = gn::device_create_shader_module(device, gn::ShaderModuleDescriptor { - code: include_bytes!("./data/hello_triangle.frag.spv"), - }); -} diff --git a/wgpu-native/Cargo.toml b/wgpu-native/Cargo.toml new file mode 100644 index 000000000..3f6d853c4 --- /dev/null +++ b/wgpu-native/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "wgpu-native" +version = "0.1.0" +authors = [ + "Dzmitry Malyshau ", + "Joshua Groves ", +] + +[features] +default = [] + +[dependencies] +bitflags = "1.0" +gfx-hal = { git = "https://github.com/gfx-rs/gfx", rev = "a435a05" } # required by gfx-memory +gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "a435a05" } +gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "a435a05", optional = true } +gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "a435a05", optional = true } +gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "a435a05", optional = true } +gfx-memory = { git = "https://github.com/gfx-rs/gfx-memory", rev = "483d64d" } diff --git a/examples/data/hello_triangle.frag b/wgpu-native/examples/data/hello_triangle.frag similarity index 100% rename from examples/data/hello_triangle.frag rename to wgpu-native/examples/data/hello_triangle.frag diff --git a/examples/data/hello_triangle.frag.spv b/wgpu-native/examples/data/hello_triangle.frag.spv similarity index 100% rename from examples/data/hello_triangle.frag.spv rename to wgpu-native/examples/data/hello_triangle.frag.spv diff --git a/examples/data/hello_triangle.vert b/wgpu-native/examples/data/hello_triangle.vert similarity index 100% rename from examples/data/hello_triangle.vert rename to wgpu-native/examples/data/hello_triangle.vert diff --git a/examples/data/hello_triangle.vert.spv b/wgpu-native/examples/data/hello_triangle.vert.spv similarity index 100% rename from examples/data/hello_triangle.vert.spv rename to wgpu-native/examples/data/hello_triangle.vert.spv diff --git a/wgpu-native/examples/hello_triangle.rs b/wgpu-native/examples/hello_triangle.rs new file mode 100644 index 000000000..7eaa1bf35 --- /dev/null +++ b/wgpu-native/examples/hello_triangle.rs @@ -0,0 +1,19 @@ +extern crate wgpu_native as wgn; + +fn main() { + let instance = wgn::create_instance(); + let adapter = wgn::instance_get_adapter(instance, wgn::AdapterDescriptor { + power_preference: wgn::PowerPreference::LowPower, + }); + let device = wgn::adapter_create_device(adapter, wgn::DeviceDescriptor { + extensions: wgn::Extensions { + anisotropic_filtering: false, + }, + }); + let _vs = wgn::device_create_shader_module(device, wgn::ShaderModuleDescriptor { + code: include_bytes!("./data/hello_triangle.vert.spv"), + }); + let _fs = wgn::device_create_shader_module(device, wgn::ShaderModuleDescriptor { + code: include_bytes!("./data/hello_triangle.frag.spv"), + }); +} diff --git a/src/binding_model.rs b/wgpu-native/src/binding_model.rs similarity index 100% rename from src/binding_model.rs rename to wgpu-native/src/binding_model.rs diff --git a/src/command/compute.rs b/wgpu-native/src/command/compute.rs similarity index 100% rename from src/command/compute.rs rename to wgpu-native/src/command/compute.rs diff --git a/src/command/mod.rs b/wgpu-native/src/command/mod.rs similarity index 100% rename from src/command/mod.rs rename to wgpu-native/src/command/mod.rs diff --git a/src/command/render.rs b/wgpu-native/src/command/render.rs similarity index 100% rename from src/command/render.rs rename to wgpu-native/src/command/render.rs diff --git a/src/conv.rs b/wgpu-native/src/conv.rs similarity index 100% rename from src/conv.rs rename to wgpu-native/src/conv.rs diff --git a/src/device.rs b/wgpu-native/src/device.rs similarity index 100% rename from src/device.rs rename to wgpu-native/src/device.rs diff --git a/src/handle.rs b/wgpu-native/src/handle.rs similarity index 100% rename from src/handle.rs rename to wgpu-native/src/handle.rs diff --git a/src/instance.rs b/wgpu-native/src/instance.rs similarity index 100% rename from src/instance.rs rename to wgpu-native/src/instance.rs diff --git a/src/lib.rs b/wgpu-native/src/lib.rs similarity index 100% rename from src/lib.rs rename to wgpu-native/src/lib.rs diff --git a/src/pipeline.rs b/wgpu-native/src/pipeline.rs similarity index 100% rename from src/pipeline.rs rename to wgpu-native/src/pipeline.rs diff --git a/src/resource.rs b/wgpu-native/src/resource.rs similarity index 100% rename from src/resource.rs rename to wgpu-native/src/resource.rs