diff --git a/Cargo.toml b/Cargo.toml index 7922ee15c60..44df0955be2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,158 +1,24 @@ -[package] -name = "gfx_app" -version = "0.7.0" -description = "GFX example application framework" -homepage = "https://github.com/gfx-rs/gfx" -keywords = ["graphics", "gamedev"] -license = "Apache-2.0" -authors = ["The Gfx-rs Developers"] -documentation = "https://docs.rs/gfx_app" -exclude = ["bors.toml", ".travis.yml"] - -[features] -default = ["gl"] -mint = ["gfx/mint", "gfx_core/mint"] -metal = ["gfx_device_metal", "gfx_window_metal", "gfx_device_metalll"] -metal_argument_buffer = ["gfx_device_metalll/argument_buffer"] -gl = ["gfx_device_gl", "gfx_window_glutin"] -dx11 = ["gfx_device_dx11", "gfx_window_dxgi"] -dx12 = ["gfx_device_dx12", "gfx_window_dxgi"] -vulkan = ["gfx_device_vulkan", "gfx_device_vulkanll", "gfx_window_vulkan"] -sdl = ["gfx_window_sdl"] -serialize = ["gfx/serialize", "gfx_core/serialize"] -headless = ["gfx_window_glutin/headless"] -unstable = [] - -[lib] -name = "gfx_app" - -[dependencies] -log = "0.3" -env_logger = "0.4" -glutin = "0.9" -winit = "0.7" -gfx_core = { path = "src/core", version = "0.7.1" } -gfx_corell = { path = "src/corell", version = "0.1" } -gfx = { path = "src/render", version = "0.16" } -gfx_macros = { path = "src/macros", version = "0.2" } - -gfx_device_gl = { path = "src/backend/gl", version = "0.14", optional = true } -gfx_window_glutin = { path = "src/window/glutin", version = "0.17", optional = true } - -[dependencies.gfx_device_vulkan] -path = "src/backend/vulkan" -version = "0.2" -optional = true - -[dependencies.gfx_device_vulkanll] -path = "src/backend/vulkanll" -version = "0.1" -optional = true - -[dependencies.gfx_window_vulkan] -path = "src/window/vulkan" -version = "0.3" -optional = true - -[dependencies.gfx_device_metal] -path = "src/backend/metal" -version = "0.3" -optional = true - -[dependencies.gfx_window_metal] -path = "src/window/metal" -version = "0.4" -optional = true - -[dependencies.gfx_device_metalll] -path = "src/backend/metalll" -version = "0.2" -optional = true -#features = ["native_fence"] - -[dependencies.gfx_window_sdl] -path = "src/window/sdl" -version = "0.7" -optional = true - -[target.'cfg(unix)'.dependencies] -gfx_window_glfw = { path = "src/window/glfw", version = "0.15" } -gfx_window_sdl = { path = "src/window/sdl", version = "0.7" } - -[target.'cfg(windows)'.dependencies] -gfx_device_dx11 = { path = "src/backend/dx11", version = "0.6", optional = true } -gfx_device_dx12 = { path = "src/backend/dx12", version = "0.1", optional = true } -gfx_window_dxgi = { path = "src/window/dxgi", version = "0.9", optional = true } -gfx_device_dx12ll = { path = "src/backend/dx12ll", version = "0.1" } - -[[example]] -name = "blend" -path = "examples/blend/main.rs" - -[[example]] -name = "cube" -path = "examples/cube/main.rs" - -[[example]] -name = "deferred" -path = "examples/deferred/main.rs" - -[[example]] -name = "flowmap" -path = "examples/flowmap/main.rs" - -[[example]] -name = "gamma" -path = "examples/gamma/main.rs" - -[[example]] -name = "performance" -path = "examples/performance/main.rs" - -[[example]] -name = "shadow" -path = "examples/shadow/main.rs" - -[[example]] -name = "skybox" -path = "examples/skybox/main.rs" - -[[example]] -name = "terrain" -path = "examples/terrain/main.rs" - -[[example]] -name = "terrain_tessellated" -path = "examples/terrain_tessellated/main.rs" - -[[example]] -name = "triangle" -path = "examples/triangle/main.rs" - -[[example]] -name = "instancing" -path = "examples/instancing/main.rs" - -[[example]] -name = "ubo_tilemap" -path = "examples/ubo_tilemap/main.rs" - -[[example]] -name = "mipmap" -path = "examples/mipmap/main.rs" - -[[example]] -name = "particle" -path = "examples/particle/main.rs" - -[[example]] -name = "trianglell" -path = "examples/trianglell/main.rs" - -[dev-dependencies] -cgmath = "0.15" -gfx_gl = "0.3" -rand = "0.3" -genmesh = "0.5" -noise = "0.4" -image = "0.15" +[workspace] + +members = [ + "src/backend/dx11", + "src/backend/dx12", + "src/backend/dx12ll", + "src/backend/gl", + "src/backend/metal", + "src/backend/metalll", + "src/backend/vulkan", + "src/backend/vulkanll", + "src/core", + "src/corell", + "src/macros", + "src/render", + "src/support", + "src/window/dxgi", + "src/window/glfw", + "src/window/glutin", + "src/window/metal", + "src/window/sdl", + "src/window/vulkan", + "examples" +] diff --git a/README.md b/README.md index 05404337935..b29089481b0 100644 --- a/README.md +++ b/README.md @@ -97,32 +97,21 @@ Shiny screens, including some older projects: ## Getting started -The gfx-rs git repository contains a number of examples. -Those examples are automatically downloaded if you clone the gfx directory: - - $ cd - $ git clone https://github.com/gfx-rs/gfx - -where `` is a directory name of your choice. Once gfx is downloaded you can build any of the gfx examples. -The examples are listed in the `/gfx/Cargo.toml` file. -For example try: - - $ cd gfx - $ cargo run --example cube - -If you compile the example for the first time, it may take some while since all dependencies must be compiled too. - If you want to build your own stand-alone gfx program, add the following to your new `Cargo.toml`: [dependencies] gfx = "0.16" +or, if you want the absolute latest commits to master, you can instead add. + + [dependencies] + gfx = { git = "https://github.com/gfx-rs/gfx.git" } For gfx to work, it needs access to the graphics system of the OS. This is typically provided through some window initialization API. gfx can use a couple of those to acquire graphical contexts. For example; [glfw](https://github.com/PistonDevelopers/glfw-rs) or [glutin](https://github.com/tomaka/glutin/). -To see how the graphic context is acquired, see the [cube example](https://github.com/gfx-rs/gfx/tree/master/examples/cube) or the [triangle example](https://github.com/gfx-rs/gfx/tree/master/examples/triangle). +To see how the graphic context is acquired, see the [cube example](https://github.com/gfx-rs/gfx/tree/master/support/examples/cube) or the [triangle example](https://github.com/gfx-rs/gfx/tree/master/render/examples/triangle). To use `glutin`, for example, your `Cargo.toml` must be extended with the following dependencies: @@ -133,13 +122,19 @@ To use `glutin`, for example, your `Cargo.toml` must be extended with the follow Alternatively, an excellent introduction into gfx and its related crates can be found [here](https://wiki.alopex.li/LearningGfx). +## Running the Examples + +The [examples directory](./examples) contains all the examples for GFX, as well as the +[accompanying documentation](./examples/README.md) for understanding and running those examples. + + ## Structure and current versions `gfx` consist of several crates. You can find all of them in this repository. | Core functionality: | Graphic backends: | Window backends: | | :---: | :---: | :---: | | [![gfx on crates.io](http://img.shields.io/crates/v/gfx.svg?label=gfx)](http://crates.io/crates/gfx) | [![gfx_device_gl on crates.io](http://img.shields.io/crates/v/gfx_device_gl.svg?label=gfx_device_gl)](http://crates.io/crates/gfx_device_gl) | [![gfx_window_sdl on crates.io](http://img.shields.io/crates/v/gfx_window_sdl.svg?label=gfx_window_sdl)](http://crates.io/crates/gfx_window_sdl) | -| [![gfx_app on crates.io](http://img.shields.io/crates/v/gfx_app.svg?label=gfx_app)](http://crates.io/crates/gfx_app) | [![gfx_device_dx11 on crates.io](http://img.shields.io/crates/v/gfx_device_dx11.svg?label=gfx_device_dx11)](http://crates.io/crates/gfx_device_dx11) | [![gfx_window_dxgi on crates.io](http://img.shields.io/crates/v/gfx_window_dxgi.svg?label=gfx_window_dxgi)](http://crates.io/crates/gfx_window_dxgi) | +| | [![gfx_device_dx11 on crates.io](http://img.shields.io/crates/v/gfx_device_dx11.svg?label=gfx_device_dx11)](http://crates.io/crates/gfx_device_dx11) | [![gfx_window_dxgi on crates.io](http://img.shields.io/crates/v/gfx_window_dxgi.svg?label=gfx_window_dxgi)](http://crates.io/crates/gfx_window_dxgi) | | [![gfx_core on crates.io](http://img.shields.io/crates/v/gfx_core.svg?label=gfx_core)](http://crates.io/crates/gfx_core) | [![gfx_device_metal on crates.io](http://img.shields.io/crates/v/gfx_device_metal.svg?label=gfx_device_metal)](http://crates.io/crates/gfx_device_metal) | [![gfx_window_glfw on crates.io](http://img.shields.io/crates/v/gfx_window_glfw.svg?label=gfx_window_glfw)](http://crates.io/crates/gfx_window_glfw) | | [![gfx_macros on crates.io](http://img.shields.io/crates/v/gfx_macros.svg?label=gfx_macros)](http://crates.io/crates/gfx_macros) | [![gfx_device_vulkan on crates.io](http://img.shields.io/crates/v/gfx_device_vulkan.svg?label=gfx_device_vulkan)](http://crates.io/crates/gfx_device_vulkan) | [![gfx_window_metal on crates.io](http://img.shields.io/crates/v/gfx_window_metal.svg?label=gfx_window_metal)](http://crates.io/crates/gfx_window_metal) | | | | [![gfx_window_glutin on crates.io](http://img.shields.io/crates/v/gfx_window_glutin.svg?label=gfx_window_glutin)](http://crates.io/crates/gfx_window_glutin) | diff --git a/appveyor.yml b/appveyor.yml index c0e6c94b45f..10b569af5a6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,8 @@ environment: matrix: - - TARGET: 1.18.0-x86_64-pc-windows + - TARGET: 1.19.0-x86_64-pc-windows COMPILER: gnu - - TARGET: 1.18.0-x86_64-pc-windows + - TARGET: 1.19.0-x86_64-pc-windows COMPILER: msvc - TARGET: nightly-x86_64-pc-windows COMPILER: msvc @@ -15,9 +15,43 @@ install: - rustc -vV - cargo -vV build_script: - - cargo build --features vulkan + # No d3d12 support on GNU windows ATM + # context: https://github.com/gfx-rs/gfx/pull/1417 + - if (%COMPILER%==gnu) { + - > + cargo build --all --features vulkan + --exclude gfx_window_glfw + --exclude gfx_device_metal + --exclude gfx_device_metalll + --exclude gfx_window_metal + --exclude gfx_device_dx12ll + } else { + - > + cargo build --all --features vulkan + --exclude gfx_window_glfw + --exclude gfx_device_metal + --exclude gfx_device_metalll + --exclude gfx_window_metal + } test_script: - - cargo test --all --features vulkan - - cargo test -p gfx -p gfx_core --features "mint serialize" - - if %COMPILER%==msvc cargo test --all --features dx11 - - if %COMPILER%==msvc cargo test --all --features dx12 + # re: gfx is gfx_render + - cargo test -p gfx -p gfx_core + - if (%COMPILER%==gnu) { + - > + cargo test --all --features vulkan + --exclude gfx_window_glfw + --exclude gfx_device_metal + --exclude gfx_device_metalll + --exclude gfx_window_metal + --exclude gfx_device_dx12ll + } else { + - > + cargo test --all --features vulkan + --exclude gfx_window_glfw + --exclude gfx_device_metal + --exclude gfx_device_metalll + --exclude gfx_window_metal + - cargo test -p gfx -p gfx_core --features dx11 + - cargo test -p gfx -p gfx_core --features dx12 + - cargo test -p gfx -p gfx_core --features dx12ll + } diff --git a/examples/Cargo.toml b/examples/Cargo.toml new file mode 100644 index 00000000000..b996f42ff5e --- /dev/null +++ b/examples/Cargo.toml @@ -0,0 +1,156 @@ +[package] +name = "gfx_examples" +version = "0.1.0" +workspace = ".." + +[features] +default = ["gl"] +mint = ["gfx/mint", "gfx_core/mint"] +metal = ["gfx_device_metal", "gfx_window_metal", "gfx_device_metalll"] +metal_argument_buffer = ["gfx_device_metalll/argument_buffer"] +gl = ["gfx_device_gl", "gfx_window_glutin"] +dx11 = ["gfx_device_dx11", "gfx_window_dxgi"] +dx12 = ["gfx_device_dx12", "gfx_window_dxgi"] +vulkan = ["gfx_device_vulkan", "gfx_device_vulkanll", "gfx_window_vulkan"] +sdl = ["gfx_window_sdl"] +serialize = ["gfx/serialize", "gfx_core/serialize"] +headless = ["gfx_window_glutin/headless"] +unstable = [] + +[dependencies] +log = "0.3" +env_logger = "0.4" +glutin = "0.9" +winit = "0.7" + +cgmath = "0.15" +gfx_gl = "0.3" +rand = "0.3" +genmesh = "0.5" +noise = "0.4" +image = "0.15" + +gfx = { path = "../src/render", version = "0.16" } +gfx_core = { path = "../src/core", version = "0.7.1" } +gfx_corell = { path = "../src/corell", version = "0.1" } +gfx_support = { path = "../src/support", version = "0.7" } + +gfx_device_gl = { path = "../src/backend/gl", version = "0.14", optional = true } +gfx_window_glutin = { path = "../src/window/glutin", version = "0.17", optional = true } + +[dependencies.gfx_device_vulkan] +path = "../src/backend/vulkan" +version = "0.2" +optional = true + +[dependencies.gfx_device_vulkanll] +path = "../src/backend/vulkanll" +version = "0.1" +optional = true + +[dependencies.gfx_window_vulkan] +path = "../src/window/vulkan" +version = "0.3" +optional = true + +[dependencies.gfx_device_metal] +path = "../src/backend/metal" +version = "0.3" +optional = true + +[dependencies.gfx_window_metal] +path = "../src/window/metal" +version = "0.4" +optional = true + +[dependencies.gfx_device_metalll] +path = "../src/backend/metalll" +version = "0.2" +optional = true +#features = ["native_fence"] + +[dependencies.gfx_window_sdl] +path = "../src/window/sdl" +version = "0.7" +optional = true + +[target.'cfg(unix)'.dependencies] +gfx_window_glfw = { path = "../src/window/glfw", version = "0.15" } +gfx_window_sdl = { path = "../src/window/sdl", version = "0.7" } + +[target.'cfg(windows)'.dependencies] +gfx_device_dx11 = { path = "../src/backend/dx11", version = "0.6", optional = true } +gfx_device_dx12 = { path = "../src/backend/dx12", version = "0.1", optional = true } +gfx_window_dxgi = { path = "../src/window/dxgi", version = "0.9", optional = true } +gfx_device_dx12ll = { path = "../src/backend/dx12ll", version = "0.1" } + +# Support examples. +[[bin]] +name = "blend" +path = "support/blend/main.rs" + +[[bin]] +name = "cube" +path = "support/cube/main.rs" + +[[bin]] +name = "deferred" +path = "support/deferred/main.rs" + +[[bin]] +name = "flowmap" +path = "support/flowmap/main.rs" + +[[bin]] +name = "performance" +path = "support/performance/main.rs" + +[[bin]] +name = "shadow" +path = "support/shadow/main.rs" + +[[bin]] +name = "skybox" +path = "support/skybox/main.rs" + +[[bin]] +name = "terrain" +path = "support/terrain/main.rs" + +[[bin]] +name = "terrain_tessellated" +path = "support/terrain_tessellated/main.rs" + +[[bin]] +name = "instancing" +path = "support/instancing/main.rs" + +[[bin]] +name = "ubo_tilemap" +path = "support/ubo_tilemap/main.rs" + +[[bin]] +name = "mipmap" +path = "support/mipmap/main.rs" + +[[bin]] +name = "particle" +path = "support/particle/main.rs" + +[[bin]] +name = "triangle" +path = "support/triangle/main.rs" + +# corell examples +[[bin]] +name = "trianglell" +path = "corell/trianglell/main.rs" + +# render examples +[[bin]] +name = "triangle_render" +path = "render/triangle/main.rs" + +[[bin]] +name = "gamma" +path = "render/gamma/main.rs" diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 00000000000..f2ace034030 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,36 @@ + # GFX Examples + +A collection of GFX examples for using the different different GFX API's. + +## Getting Started +The gfx-rs git repository contains a number of examples. +Those examples are automatically downloaded if you clone the gfx directory: + + $ cd + $ git clone https://github.com/gfx-rs/gfx + +where `` is a directory name of your choice. Once gfx is downloaded you can build any of the gfx examples. + +### Why three different example directories? + +The examples are split across three directories, each pertaining to the GFX library they are using. + +1. examples/corell contains low level examples. +2. examples/render shows how to use the render crate directly. +3. examples/support shows how to utilize the support module, showing you how you can build an +application using minimal setup. + +To the run the examples, set your working directory to the examples/ directory and execute +`cargo run --bin *` where * is the example you wan to run. + +For example, try: + + $ cd /examples + $ cargo run --bin triangle + +or + + $ cd /examples + $ cargo run --bin trianglell + +If you compile the example for the first time, it may take some while since all dependencies must be compiled too. diff --git a/examples/trianglell/data/logo.png b/examples/corell/trianglell/data/logo.png similarity index 100% rename from examples/trianglell/data/logo.png rename to examples/corell/trianglell/data/logo.png diff --git a/examples/trianglell/data/ps_main.o b/examples/corell/trianglell/data/ps_main.o similarity index 100% rename from examples/trianglell/data/ps_main.o rename to examples/corell/trianglell/data/ps_main.o diff --git a/examples/trianglell/data/ps_main.spv b/examples/corell/trianglell/data/ps_main.spv similarity index 100% rename from examples/trianglell/data/ps_main.spv rename to examples/corell/trianglell/data/ps_main.spv diff --git a/examples/trianglell/data/vs_main.o b/examples/corell/trianglell/data/vs_main.o similarity index 100% rename from examples/trianglell/data/vs_main.o rename to examples/corell/trianglell/data/vs_main.o diff --git a/examples/trianglell/data/vs_main.spv b/examples/corell/trianglell/data/vs_main.spv similarity index 100% rename from examples/trianglell/data/vs_main.spv rename to examples/corell/trianglell/data/vs_main.spv diff --git a/examples/trianglell/main.rs b/examples/corell/trianglell/main.rs similarity index 100% rename from examples/trianglell/main.rs rename to examples/corell/trianglell/main.rs diff --git a/examples/trianglell/shader/triangle.frag b/examples/corell/trianglell/shader/triangle.frag similarity index 100% rename from examples/trianglell/shader/triangle.frag rename to examples/corell/trianglell/shader/triangle.frag diff --git a/examples/trianglell/shader/triangle.hlsl b/examples/corell/trianglell/shader/triangle.hlsl similarity index 100% rename from examples/trianglell/shader/triangle.hlsl rename to examples/corell/trianglell/shader/triangle.hlsl diff --git a/examples/trianglell/shader/triangle.metal b/examples/corell/trianglell/shader/triangle.metal similarity index 100% rename from examples/trianglell/shader/triangle.metal rename to examples/corell/trianglell/shader/triangle.metal diff --git a/examples/trianglell/shader/triangle.vert b/examples/corell/trianglell/shader/triangle.vert similarity index 100% rename from examples/trianglell/shader/triangle.vert rename to examples/corell/trianglell/shader/triangle.vert diff --git a/examples/trianglell/shader/triangle_indirect.metal b/examples/corell/trianglell/shader/triangle_indirect.metal similarity index 100% rename from examples/trianglell/shader/triangle_indirect.metal rename to examples/corell/trianglell/shader/triangle_indirect.metal diff --git a/examples/gamma/README.md b/examples/render/gamma/README.md similarity index 100% rename from examples/gamma/README.md rename to examples/render/gamma/README.md diff --git a/examples/gamma/compile.cmd b/examples/render/gamma/compile.cmd similarity index 100% rename from examples/gamma/compile.cmd rename to examples/render/gamma/compile.cmd diff --git a/examples/gamma/data/pixel.fx b/examples/render/gamma/data/pixel.fx similarity index 100% rename from examples/gamma/data/pixel.fx rename to examples/render/gamma/data/pixel.fx diff --git a/examples/gamma/data/vertex.fx b/examples/render/gamma/data/vertex.fx similarity index 100% rename from examples/gamma/data/vertex.fx rename to examples/render/gamma/data/vertex.fx diff --git a/examples/gamma/main.rs b/examples/render/gamma/main.rs similarity index 100% rename from examples/gamma/main.rs rename to examples/render/gamma/main.rs diff --git a/examples/gamma/screenshot.png b/examples/render/gamma/screenshot.png similarity index 100% rename from examples/gamma/screenshot.png rename to examples/render/gamma/screenshot.png diff --git a/examples/gamma/shader/quad.hlsl b/examples/render/gamma/shader/quad.hlsl similarity index 100% rename from examples/gamma/shader/quad.hlsl rename to examples/render/gamma/shader/quad.hlsl diff --git a/examples/gamma/shader/quad_150.glslf b/examples/render/gamma/shader/quad_150.glslf similarity index 100% rename from examples/gamma/shader/quad_150.glslf rename to examples/render/gamma/shader/quad_150.glslf diff --git a/examples/gamma/shader/quad_150.glslv b/examples/render/gamma/shader/quad_150.glslv similarity index 100% rename from examples/gamma/shader/quad_150.glslv rename to examples/render/gamma/shader/quad_150.glslv diff --git a/examples/triangle/README.md b/examples/render/triangle/README.md similarity index 100% rename from examples/triangle/README.md rename to examples/render/triangle/README.md diff --git a/examples/triangle/compile.cmd b/examples/render/triangle/compile.cmd similarity index 100% rename from examples/triangle/compile.cmd rename to examples/render/triangle/compile.cmd diff --git a/examples/terrain/data/pixel.fx b/examples/render/triangle/data/pixel.fx similarity index 100% rename from examples/terrain/data/pixel.fx rename to examples/render/triangle/data/pixel.fx diff --git a/examples/terrain_tessellated/data/vertex.fx b/examples/render/triangle/data/vertex.fx similarity index 100% rename from examples/terrain_tessellated/data/vertex.fx rename to examples/render/triangle/data/vertex.fx diff --git a/examples/triangle/main.rs b/examples/render/triangle/main.rs similarity index 97% rename from examples/triangle/main.rs rename to examples/render/triangle/main.rs index 0336a191532..3451ca8c5c3 100644 --- a/examples/triangle/main.rs +++ b/examples/render/triangle/main.rs @@ -71,8 +71,8 @@ pub fn main() { let views = swap_chain.create_color_views(&mut device); let pso = device.create_pipeline_simple( - include_bytes!("shader/triangle_150.glslv"), - include_bytes!("shader/triangle_150.glslf"), + include_bytes!("shader/triangle_120.glslv"), + include_bytes!("shader/triangle_120.glslf"), pipe::new() ).unwrap(); let (vertex_buffer, slice) = device.create_vertex_buffer_with_slice(&TRIANGLE, ()); diff --git a/examples/triangle/screenshot.png b/examples/render/triangle/screenshot.png similarity index 100% rename from examples/triangle/screenshot.png rename to examples/render/triangle/screenshot.png diff --git a/examples/triangle/shader/triangle.hlsl b/examples/render/triangle/shader/triangle.hlsl similarity index 100% rename from examples/triangle/shader/triangle.hlsl rename to examples/render/triangle/shader/triangle.hlsl diff --git a/examples/triangle/shader/triangle_120.glslf b/examples/render/triangle/shader/triangle_120.glslf similarity index 100% rename from examples/triangle/shader/triangle_120.glslf rename to examples/render/triangle/shader/triangle_120.glslf diff --git a/examples/triangle/shader/triangle_120.glslv b/examples/render/triangle/shader/triangle_120.glslv similarity index 100% rename from examples/triangle/shader/triangle_120.glslv rename to examples/render/triangle/shader/triangle_120.glslv diff --git a/examples/skybox/compile.cmd b/examples/skybox/compile.cmd deleted file mode 100644 index 11b110440c7..00000000000 --- a/examples/skybox/compile.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -set FXC="%DXSDK_DIR%\Utilities\bin\x64\fxc.exe" -nologo -if not exist data mkdir data -%FXC% /T vs_4_0 /E Vertex /Fo data/vertex.fx shader/cubemap.hlsl -%FXC% /T ps_4_0 /E Pixel /Fo data/pixel.fx shader/cubemap.hlsl diff --git a/examples/blend/README.md b/examples/support/blend/README.md similarity index 100% rename from examples/blend/README.md rename to examples/support/blend/README.md diff --git a/examples/blend/compile.cmd b/examples/support/blend/compile.cmd similarity index 100% rename from examples/blend/compile.cmd rename to examples/support/blend/compile.cmd diff --git a/examples/blend/data/pixel.fx b/examples/support/blend/data/pixel.fx similarity index 100% rename from examples/blend/data/pixel.fx rename to examples/support/blend/data/pixel.fx diff --git a/examples/blend/data/vertex.fx b/examples/support/blend/data/vertex.fx similarity index 100% rename from examples/blend/data/vertex.fx rename to examples/support/blend/data/vertex.fx diff --git a/examples/blend/image/lena.png b/examples/support/blend/image/lena.png similarity index 100% rename from examples/blend/image/lena.png rename to examples/support/blend/image/lena.png diff --git a/examples/blend/image/tint.png b/examples/support/blend/image/tint.png similarity index 100% rename from examples/blend/image/tint.png rename to examples/support/blend/image/tint.png diff --git a/examples/blend/main.rs b/examples/support/blend/main.rs similarity index 89% rename from examples/blend/main.rs rename to examples/support/blend/main.rs index 22376b5485f..ad3e531cb7c 100644 --- a/examples/blend/main.rs +++ b/examples/support/blend/main.rs @@ -14,11 +14,11 @@ #[macro_use] extern crate gfx; -extern crate gfx_app; +extern crate gfx_support; extern crate image; extern crate winit; -use gfx_app::{BackbufferView, ColorFormat}; +use gfx_support::{BackbufferView, ColorFormat}; use gfx::format::Rgba8; use gfx::Bundle; use gfx::GraphicsPoolExt; @@ -82,25 +82,25 @@ struct App { views: Vec>, } -impl gfx_app::Application for App { +impl gfx_support::Application for App { fn new(device: &mut B::Device, _: &mut gfx::queue::GraphicsQueue, - backend: gfx_app::shade::Backend, - window_targets: gfx_app::WindowTargets) -> Self + backend: gfx_support::shade::Backend, + window_targets: gfx_support::WindowTargets) -> Self { use gfx::traits::DeviceExt; - let vs = gfx_app::shade::Source { + let vs = gfx_support::shade::Source { glsl_120: include_bytes!("shader/blend_120.glslv"), glsl_150: include_bytes!("shader/blend_150.glslv"), hlsl_40: include_bytes!("data/vertex.fx"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let ps = gfx_app::shade::Source { + let ps = gfx_support::shade::Source { glsl_120: include_bytes!("shader/blend_120.glslf"), glsl_150: include_bytes!("shader/blend_150.glslf"), hlsl_40: include_bytes!("data/pixel.fx"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; // fullscreen quad @@ -149,7 +149,7 @@ impl gfx_app::Application for App { } } - fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_app::SyncPrimitives), + fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_support::SyncPrimitives), pool: &mut gfx::GraphicsCommandPool, queue: &mut gfx::queue::GraphicsQueue) { let (cur_color, _) = self.views[frame.id()].clone(); @@ -181,12 +181,12 @@ impl gfx_app::Application for App { } } - fn on_resize(&mut self, window_targets: gfx_app::WindowTargets) { + fn on_resize(&mut self, window_targets: gfx_support::WindowTargets) { self.views = window_targets.views; } } pub fn main() { - use gfx_app::Application; + use gfx_support::Application; App::launch_simple("Blending example"); } diff --git a/examples/blend/screenshot.png b/examples/support/blend/screenshot.png similarity index 100% rename from examples/blend/screenshot.png rename to examples/support/blend/screenshot.png diff --git a/examples/blend/shader/blend.hlsl b/examples/support/blend/shader/blend.hlsl similarity index 100% rename from examples/blend/shader/blend.hlsl rename to examples/support/blend/shader/blend.hlsl diff --git a/examples/blend/shader/blend_120.glslf b/examples/support/blend/shader/blend_120.glslf similarity index 100% rename from examples/blend/shader/blend_120.glslf rename to examples/support/blend/shader/blend_120.glslf diff --git a/examples/blend/shader/blend_120.glslv b/examples/support/blend/shader/blend_120.glslv similarity index 100% rename from examples/blend/shader/blend_120.glslv rename to examples/support/blend/shader/blend_120.glslv diff --git a/examples/blend/shader/blend_150.glslf b/examples/support/blend/shader/blend_150.glslf similarity index 100% rename from examples/blend/shader/blend_150.glslf rename to examples/support/blend/shader/blend_150.glslf diff --git a/examples/blend/shader/blend_150.glslv b/examples/support/blend/shader/blend_150.glslv similarity index 100% rename from examples/blend/shader/blend_150.glslv rename to examples/support/blend/shader/blend_150.glslv diff --git a/examples/cube/README.md b/examples/support/cube/README.md similarity index 100% rename from examples/cube/README.md rename to examples/support/cube/README.md diff --git a/examples/cube/compile.cmd b/examples/support/cube/compile.cmd similarity index 100% rename from examples/cube/compile.cmd rename to examples/support/cube/compile.cmd diff --git a/examples/cube/data/frag.spv b/examples/support/cube/data/frag.spv similarity index 100% rename from examples/cube/data/frag.spv rename to examples/support/cube/data/frag.spv diff --git a/examples/cube/data/pixel.fx b/examples/support/cube/data/pixel.fx similarity index 100% rename from examples/cube/data/pixel.fx rename to examples/support/cube/data/pixel.fx diff --git a/examples/cube/data/vert.spv b/examples/support/cube/data/vert.spv similarity index 100% rename from examples/cube/data/vert.spv rename to examples/support/cube/data/vert.spv diff --git a/examples/cube/data/vertex.fx b/examples/support/cube/data/vertex.fx similarity index 100% rename from examples/cube/data/vertex.fx rename to examples/support/cube/data/vertex.fx diff --git a/examples/cube/main.rs b/examples/support/cube/main.rs similarity index 91% rename from examples/cube/main.rs rename to examples/support/cube/main.rs index c7f0de88d3f..0cb9b276336 100644 --- a/examples/cube/main.rs +++ b/examples/support/cube/main.rs @@ -15,9 +15,9 @@ extern crate cgmath; #[macro_use] extern crate gfx; -extern crate gfx_app; +extern crate gfx_support; -use gfx_app::{BackbufferView, ColorFormat, DepthFormat}; +use gfx_support::{BackbufferView, ColorFormat, DepthFormat}; use cgmath::{Deg, Matrix4, Point3, Vector3}; use gfx::{Bundle, Device, texture}; @@ -64,31 +64,31 @@ struct App { bundle: Bundle>, } -impl gfx_app::Application for App { +impl gfx_support::Application for App { fn new(device: &mut B::Device, _: &mut gfx::queue::GraphicsQueue, - backend: gfx_app::shade::Backend, - window_targets: gfx_app::WindowTargets) -> Self + backend: gfx_support::shade::Backend, + window_targets: gfx_support::WindowTargets) -> Self { use gfx::traits::DeviceExt; - let vs = gfx_app::shade::Source { + let vs = gfx_support::shade::Source { glsl_120: include_bytes!("shader/cube_120.glslv"), glsl_150: include_bytes!("shader/cube_150.glslv"), glsl_es_100: include_bytes!("shader/cube_100_es.glslv"), hlsl_40: include_bytes!("data/vertex.fx"), msl_11: include_bytes!("shader/cube_vertex.metal"), vulkan: include_bytes!("data/vert.spv"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let ps = gfx_app::shade::Source { + let ps = gfx_support::shade::Source { glsl_120: include_bytes!("shader/cube_120.glslf"), glsl_150: include_bytes!("shader/cube_150.glslf"), glsl_es_100: include_bytes!("shader/cube_100_es.glslf"), hlsl_40: include_bytes!("data/pixel.fx"), msl_11: include_bytes!("shader/cube_frag.metal"), vulkan: include_bytes!("data/frag.spv"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; let vertex_data = [ @@ -167,7 +167,7 @@ impl gfx_app::Application for App { } } - fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_app::SyncPrimitives), + fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_support::SyncPrimitives), pool: &mut gfx::GraphicsCommandPool, queue: &mut gfx::queue::GraphicsQueue) { let (cur_color, cur_depth) = self.views[frame.id()].clone(); @@ -184,7 +184,7 @@ impl gfx_app::Application for App { .expect("Could not flush encoder"); } - fn on_resize(&mut self, window_targets: gfx_app::WindowTargets) { + fn on_resize(&mut self, window_targets: gfx_support::WindowTargets) { self.views = window_targets.views; // In this example the transform is static except for window resizes. @@ -194,7 +194,7 @@ impl gfx_app::Application for App { } pub fn main() { - use gfx_app::Application; + use gfx_support::Application; App::launch_simple("Cube example"); } diff --git a/examples/cube/screenshot.png b/examples/support/cube/screenshot.png similarity index 100% rename from examples/cube/screenshot.png rename to examples/support/cube/screenshot.png diff --git a/examples/cube/shader/cube.hlsl b/examples/support/cube/shader/cube.hlsl similarity index 100% rename from examples/cube/shader/cube.hlsl rename to examples/support/cube/shader/cube.hlsl diff --git a/examples/cube/shader/cube_100_es.glslf b/examples/support/cube/shader/cube_100_es.glslf similarity index 100% rename from examples/cube/shader/cube_100_es.glslf rename to examples/support/cube/shader/cube_100_es.glslf diff --git a/examples/cube/shader/cube_100_es.glslv b/examples/support/cube/shader/cube_100_es.glslv similarity index 100% rename from examples/cube/shader/cube_100_es.glslv rename to examples/support/cube/shader/cube_100_es.glslv diff --git a/examples/cube/shader/cube_120.glslf b/examples/support/cube/shader/cube_120.glslf similarity index 100% rename from examples/cube/shader/cube_120.glslf rename to examples/support/cube/shader/cube_120.glslf diff --git a/examples/cube/shader/cube_120.glslv b/examples/support/cube/shader/cube_120.glslv similarity index 100% rename from examples/cube/shader/cube_120.glslv rename to examples/support/cube/shader/cube_120.glslv diff --git a/examples/cube/shader/cube_150.glslf b/examples/support/cube/shader/cube_150.glslf similarity index 100% rename from examples/cube/shader/cube_150.glslf rename to examples/support/cube/shader/cube_150.glslf diff --git a/examples/cube/shader/cube_150.glslv b/examples/support/cube/shader/cube_150.glslv similarity index 100% rename from examples/cube/shader/cube_150.glslv rename to examples/support/cube/shader/cube_150.glslv diff --git a/examples/cube/shader/cube_frag.metal b/examples/support/cube/shader/cube_frag.metal similarity index 100% rename from examples/cube/shader/cube_frag.metal rename to examples/support/cube/shader/cube_frag.metal diff --git a/examples/cube/shader/cube_vertex.metal b/examples/support/cube/shader/cube_vertex.metal similarity index 100% rename from examples/cube/shader/cube_vertex.metal rename to examples/support/cube/shader/cube_vertex.metal diff --git a/examples/cube/shader/cube_vulkan.glsl.frag b/examples/support/cube/shader/cube_vulkan.glsl.frag similarity index 100% rename from examples/cube/shader/cube_vulkan.glsl.frag rename to examples/support/cube/shader/cube_vulkan.glsl.frag diff --git a/examples/cube/shader/cube_vulkan.glsl.vert b/examples/support/cube/shader/cube_vulkan.glsl.vert similarity index 100% rename from examples/cube/shader/cube_vulkan.glsl.vert rename to examples/support/cube/shader/cube_vulkan.glsl.vert diff --git a/examples/cube/shader/make_vulkan.sh b/examples/support/cube/shader/make_vulkan.sh similarity index 100% rename from examples/cube/shader/make_vulkan.sh rename to examples/support/cube/shader/make_vulkan.sh diff --git a/examples/deferred/README.md b/examples/support/deferred/README.md similarity index 100% rename from examples/deferred/README.md rename to examples/support/deferred/README.md diff --git a/examples/deferred/compile.cmd b/examples/support/deferred/compile.cmd similarity index 100% rename from examples/deferred/compile.cmd rename to examples/support/deferred/compile.cmd diff --git a/examples/deferred/data/blit_ps.fx b/examples/support/deferred/data/blit_ps.fx similarity index 100% rename from examples/deferred/data/blit_ps.fx rename to examples/support/deferred/data/blit_ps.fx diff --git a/examples/deferred/data/blit_vs.fx b/examples/support/deferred/data/blit_vs.fx similarity index 100% rename from examples/deferred/data/blit_vs.fx rename to examples/support/deferred/data/blit_vs.fx diff --git a/examples/deferred/data/emitter_ps.fx b/examples/support/deferred/data/emitter_ps.fx similarity index 100% rename from examples/deferred/data/emitter_ps.fx rename to examples/support/deferred/data/emitter_ps.fx diff --git a/examples/deferred/data/emitter_vs.fx b/examples/support/deferred/data/emitter_vs.fx similarity index 100% rename from examples/deferred/data/emitter_vs.fx rename to examples/support/deferred/data/emitter_vs.fx diff --git a/examples/deferred/data/light_ps.fx b/examples/support/deferred/data/light_ps.fx similarity index 100% rename from examples/deferred/data/light_ps.fx rename to examples/support/deferred/data/light_ps.fx diff --git a/examples/deferred/data/light_vs.fx b/examples/support/deferred/data/light_vs.fx similarity index 100% rename from examples/deferred/data/light_vs.fx rename to examples/support/deferred/data/light_vs.fx diff --git a/examples/deferred/data/terrain_ps.fx b/examples/support/deferred/data/terrain_ps.fx similarity index 100% rename from examples/deferred/data/terrain_ps.fx rename to examples/support/deferred/data/terrain_ps.fx diff --git a/examples/deferred/data/terrain_vs.fx b/examples/support/deferred/data/terrain_vs.fx similarity index 100% rename from examples/deferred/data/terrain_vs.fx rename to examples/support/deferred/data/terrain_vs.fx diff --git a/examples/deferred/main.rs b/examples/support/deferred/main.rs similarity index 94% rename from examples/deferred/main.rs rename to examples/support/deferred/main.rs index 21d4f3012b6..58a70d047af 100644 --- a/examples/deferred/main.rs +++ b/examples/support/deferred/main.rs @@ -31,12 +31,12 @@ extern crate cgmath; extern crate gfx; extern crate gfx_window_glutin; extern crate glutin; -extern crate gfx_app; +extern crate gfx_support; extern crate genmesh; extern crate noise; extern crate winit; -use gfx_app::{BackbufferView, ColorFormat}; +use gfx_support::{BackbufferView, ColorFormat}; #[cfg(feature="metal")] use gfx::format::Depth32F as Depth; @@ -230,11 +230,11 @@ struct App { start_time: Instant, } -impl gfx_app::Application for App { +impl gfx_support::Application for App { fn new(device: &mut B::Device, _: &mut gfx::queue::GraphicsQueue, - backend: gfx_app::shade::Backend, - window_targets: gfx_app::WindowTargets) -> Self + backend: gfx_support::shade::Backend, + window_targets: gfx_support::WindowTargets) -> Self { use gfx::traits::DeviceExt; @@ -275,17 +275,17 @@ impl gfx_app::Application for App { let (vbuf, slice) = device.create_vertex_buffer_with_slice(&vertex_data, &index_data[..]); - let vs = gfx_app::shade::Source { + let vs = gfx_support::shade::Source { glsl_150: include_bytes!("shader/terrain.glslv"), hlsl_40: include_bytes!("data/terrain_vs.fx"), msl_11: include_bytes!("shader/terrain_vertex.metal"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let ps = gfx_app::shade::Source { + let ps = gfx_support::shade::Source { glsl_150: include_bytes!("shader/terrain.glslf"), hlsl_40: include_bytes!("data/terrain_ps.fx"), msl_11: include_bytes!("shader/terrain_frag.metal"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; let pso = device.create_pipeline_simple( @@ -315,17 +315,17 @@ impl gfx_app::Application for App { let (vbuf, slice) = device.create_vertex_buffer_with_slice(&vertex_data, ()); - let vs = gfx_app::shade::Source { + let vs = gfx_support::shade::Source { glsl_150: include_bytes!("shader/blit.glslv"), hlsl_40: include_bytes!("data/blit_vs.fx"), msl_11: include_bytes!("shader/blit_vertex.metal"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let ps = gfx_app::shade::Source { + let ps = gfx_support::shade::Source { glsl_150: include_bytes!("shader/blit.glslf"), hlsl_40: include_bytes!("data/blit_ps.fx"), msl_11: include_bytes!("shader/blit_frag.metal"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; let pso = device.create_pipeline_simple( @@ -393,17 +393,17 @@ impl gfx_app::Application for App { light_slice.instances = Some((NUM_LIGHTS as gfx::InstanceCount, 0)); let light = { - let vs = gfx_app::shade::Source { + let vs = gfx_support::shade::Source { glsl_150: include_bytes!("shader/light.glslv"), hlsl_40: include_bytes!("data/light_vs.fx"), msl_11: include_bytes!("shader/light_vertex.metal"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let ps = gfx_app::shade::Source { + let ps = gfx_support::shade::Source { glsl_150: include_bytes!("shader/light.glslf"), hlsl_40: include_bytes!("data/light_ps.fx"), msl_11: include_bytes!("shader/light_frag.metal"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; let pso = device.create_pipeline_simple( @@ -428,17 +428,17 @@ impl gfx_app::Application for App { }; let emitter = { - let vs = gfx_app::shade::Source { + let vs = gfx_support::shade::Source { glsl_150: include_bytes!("shader/emitter.glslv"), hlsl_40: include_bytes!("data/emitter_vs.fx"), msl_11: include_bytes!("shader/emitter_vertex.metal"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let ps = gfx_app::shade::Source { + let ps = gfx_support::shade::Source { glsl_150: include_bytes!("shader/emitter.glslf"), hlsl_40: include_bytes!("data/emitter_ps.fx"), msl_11: include_bytes!("shader/emitter_frag.metal"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; let pso = device.create_pipeline_simple( @@ -475,7 +475,7 @@ impl gfx_app::Application for App { } } - fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_app::SyncPrimitives), + fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_support::SyncPrimitives), pool: &mut gfx::GraphicsCommandPool, queue: &mut gfx::queue::GraphicsQueue) { let elapsed = self.start_time.elapsed(); @@ -582,7 +582,7 @@ impl gfx_app::Application for App { } } - fn on_resize_ext(&mut self, device: &mut B::Device, window_targets: gfx_app::WindowTargets) { + fn on_resize_ext(&mut self, device: &mut B::Device, window_targets: gfx_support::WindowTargets) { let (width, height, _, _) = window_targets.views[0].0.get_dimensions(); let (gpos, gnormal, gdiffuse, depth_resource, depth_target) = @@ -613,6 +613,6 @@ impl gfx_app::Application for App { } pub fn main() { - use gfx_app::Application; + use gfx_support::Application; App::launch_simple("Deferred rendering example with gfx-rs"); } diff --git a/examples/deferred/screenshot.png b/examples/support/deferred/screenshot.png similarity index 100% rename from examples/deferred/screenshot.png rename to examples/support/deferred/screenshot.png diff --git a/examples/deferred/shader/blit.glslf b/examples/support/deferred/shader/blit.glslf similarity index 100% rename from examples/deferred/shader/blit.glslf rename to examples/support/deferred/shader/blit.glslf diff --git a/examples/deferred/shader/blit.glslv b/examples/support/deferred/shader/blit.glslv similarity index 100% rename from examples/deferred/shader/blit.glslv rename to examples/support/deferred/shader/blit.glslv diff --git a/examples/deferred/shader/blit_frag.metal b/examples/support/deferred/shader/blit_frag.metal similarity index 100% rename from examples/deferred/shader/blit_frag.metal rename to examples/support/deferred/shader/blit_frag.metal diff --git a/examples/deferred/shader/blit_vertex.metal b/examples/support/deferred/shader/blit_vertex.metal similarity index 100% rename from examples/deferred/shader/blit_vertex.metal rename to examples/support/deferred/shader/blit_vertex.metal diff --git a/examples/deferred/shader/deferred.hlsl b/examples/support/deferred/shader/deferred.hlsl similarity index 100% rename from examples/deferred/shader/deferred.hlsl rename to examples/support/deferred/shader/deferred.hlsl diff --git a/examples/deferred/shader/emitter.glslf b/examples/support/deferred/shader/emitter.glslf similarity index 100% rename from examples/deferred/shader/emitter.glslf rename to examples/support/deferred/shader/emitter.glslf diff --git a/examples/deferred/shader/emitter.glslv b/examples/support/deferred/shader/emitter.glslv similarity index 100% rename from examples/deferred/shader/emitter.glslv rename to examples/support/deferred/shader/emitter.glslv diff --git a/examples/deferred/shader/emitter_frag.metal b/examples/support/deferred/shader/emitter_frag.metal similarity index 100% rename from examples/deferred/shader/emitter_frag.metal rename to examples/support/deferred/shader/emitter_frag.metal diff --git a/examples/deferred/shader/emitter_vertex.metal b/examples/support/deferred/shader/emitter_vertex.metal similarity index 100% rename from examples/deferred/shader/emitter_vertex.metal rename to examples/support/deferred/shader/emitter_vertex.metal diff --git a/examples/deferred/shader/light.glslf b/examples/support/deferred/shader/light.glslf similarity index 100% rename from examples/deferred/shader/light.glslf rename to examples/support/deferred/shader/light.glslf diff --git a/examples/deferred/shader/light.glslv b/examples/support/deferred/shader/light.glslv similarity index 100% rename from examples/deferred/shader/light.glslv rename to examples/support/deferred/shader/light.glslv diff --git a/examples/deferred/shader/light_frag.metal b/examples/support/deferred/shader/light_frag.metal similarity index 100% rename from examples/deferred/shader/light_frag.metal rename to examples/support/deferred/shader/light_frag.metal diff --git a/examples/deferred/shader/light_vertex.metal b/examples/support/deferred/shader/light_vertex.metal similarity index 100% rename from examples/deferred/shader/light_vertex.metal rename to examples/support/deferred/shader/light_vertex.metal diff --git a/examples/deferred/shader/terrain.glslf b/examples/support/deferred/shader/terrain.glslf similarity index 100% rename from examples/deferred/shader/terrain.glslf rename to examples/support/deferred/shader/terrain.glslf diff --git a/examples/deferred/shader/terrain.glslv b/examples/support/deferred/shader/terrain.glslv similarity index 100% rename from examples/deferred/shader/terrain.glslv rename to examples/support/deferred/shader/terrain.glslv diff --git a/examples/deferred/shader/terrain_frag.metal b/examples/support/deferred/shader/terrain_frag.metal similarity index 100% rename from examples/deferred/shader/terrain_frag.metal rename to examples/support/deferred/shader/terrain_frag.metal diff --git a/examples/deferred/shader/terrain_vertex.metal b/examples/support/deferred/shader/terrain_vertex.metal similarity index 100% rename from examples/deferred/shader/terrain_vertex.metal rename to examples/support/deferred/shader/terrain_vertex.metal diff --git a/examples/flowmap/README.md b/examples/support/flowmap/README.md similarity index 100% rename from examples/flowmap/README.md rename to examples/support/flowmap/README.md diff --git a/examples/flowmap/compile.cmd b/examples/support/flowmap/compile.cmd similarity index 100% rename from examples/flowmap/compile.cmd rename to examples/support/flowmap/compile.cmd diff --git a/examples/flowmap/data/pixel.fx b/examples/support/flowmap/data/pixel.fx similarity index 100% rename from examples/flowmap/data/pixel.fx rename to examples/support/flowmap/data/pixel.fx diff --git a/examples/flowmap/data/vertex.fx b/examples/support/flowmap/data/vertex.fx similarity index 100% rename from examples/flowmap/data/vertex.fx rename to examples/support/flowmap/data/vertex.fx diff --git a/examples/flowmap/image/flow.png b/examples/support/flowmap/image/flow.png similarity index 100% rename from examples/flowmap/image/flow.png rename to examples/support/flowmap/image/flow.png diff --git a/examples/flowmap/image/noise.png b/examples/support/flowmap/image/noise.png similarity index 100% rename from examples/flowmap/image/noise.png rename to examples/support/flowmap/image/noise.png diff --git a/examples/flowmap/image/water.png b/examples/support/flowmap/image/water.png similarity index 100% rename from examples/flowmap/image/water.png rename to examples/support/flowmap/image/water.png diff --git a/examples/flowmap/main.rs b/examples/support/flowmap/main.rs similarity index 89% rename from examples/flowmap/main.rs rename to examples/support/flowmap/main.rs index 39a069ab647..ad0a973889f 100644 --- a/examples/flowmap/main.rs +++ b/examples/support/flowmap/main.rs @@ -14,13 +14,13 @@ #[macro_use] extern crate gfx; -extern crate gfx_app; +extern crate gfx_support; extern crate image; use std::io::Cursor; use std::time::Instant; use gfx::format::Rgba8; -use gfx_app::{BackbufferView, ColorFormat}; +use gfx_support::{BackbufferView, ColorFormat}; use gfx::{Bundle, GraphicsPoolExt}; gfx_defines!{ @@ -72,27 +72,27 @@ struct App { time_start: Instant, } -impl gfx_app::Application for App { +impl gfx_support::Application for App { fn new(device: &mut B::Device, _: &mut gfx::queue::GraphicsQueue, - backend: gfx_app::shade::Backend, - window_targets: gfx_app::WindowTargets) -> Self + backend: gfx_support::shade::Backend, + window_targets: gfx_support::WindowTargets) -> Self { use gfx::traits::DeviceExt; - let vs = gfx_app::shade::Source { + let vs = gfx_support::shade::Source { glsl_120: include_bytes!("shader/flowmap_120.glslv"), glsl_150: include_bytes!("shader/flowmap_150.glslv"), hlsl_40: include_bytes!("data/vertex.fx"), msl_11: include_bytes!("shader/flowmap_vertex.metal"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let ps = gfx_app::shade::Source { + let ps = gfx_support::shade::Source { glsl_120: include_bytes!("shader/flowmap_120.glslf"), glsl_150: include_bytes!("shader/flowmap_150.glslf"), hlsl_40: include_bytes!("data/pixel.fx"), msl_11: include_bytes!("shader/flowmap_frag.metal"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; let vertex_data = [ @@ -137,7 +137,7 @@ impl gfx_app::Application for App { } } - fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_app::SyncPrimitives), + fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_support::SyncPrimitives), pool: &mut gfx::GraphicsCommandPool, queue: &mut gfx::queue::GraphicsQueue) { let delta = self.time_start.elapsed(); @@ -172,12 +172,12 @@ impl gfx_app::Application for App { .expect("Could not flush encoder"); } - fn on_resize(&mut self, window_targets: gfx_app::WindowTargets) { + fn on_resize(&mut self, window_targets: gfx_support::WindowTargets) { self.views = window_targets.views; } } pub fn main() { - use gfx_app::Application; + use gfx_support::Application; App::launch_simple("Flowmap example"); } diff --git a/examples/flowmap/screenshot.png b/examples/support/flowmap/screenshot.png similarity index 100% rename from examples/flowmap/screenshot.png rename to examples/support/flowmap/screenshot.png diff --git a/examples/flowmap/shader/flowmap.hlsl b/examples/support/flowmap/shader/flowmap.hlsl similarity index 100% rename from examples/flowmap/shader/flowmap.hlsl rename to examples/support/flowmap/shader/flowmap.hlsl diff --git a/examples/flowmap/shader/flowmap_120.glslf b/examples/support/flowmap/shader/flowmap_120.glslf similarity index 100% rename from examples/flowmap/shader/flowmap_120.glslf rename to examples/support/flowmap/shader/flowmap_120.glslf diff --git a/examples/flowmap/shader/flowmap_120.glslv b/examples/support/flowmap/shader/flowmap_120.glslv similarity index 100% rename from examples/flowmap/shader/flowmap_120.glslv rename to examples/support/flowmap/shader/flowmap_120.glslv diff --git a/examples/flowmap/shader/flowmap_150.glslf b/examples/support/flowmap/shader/flowmap_150.glslf similarity index 100% rename from examples/flowmap/shader/flowmap_150.glslf rename to examples/support/flowmap/shader/flowmap_150.glslf diff --git a/examples/flowmap/shader/flowmap_150.glslv b/examples/support/flowmap/shader/flowmap_150.glslv similarity index 100% rename from examples/flowmap/shader/flowmap_150.glslv rename to examples/support/flowmap/shader/flowmap_150.glslv diff --git a/examples/flowmap/shader/flowmap_frag.metal b/examples/support/flowmap/shader/flowmap_frag.metal similarity index 100% rename from examples/flowmap/shader/flowmap_frag.metal rename to examples/support/flowmap/shader/flowmap_frag.metal diff --git a/examples/flowmap/shader/flowmap_vertex.metal b/examples/support/flowmap/shader/flowmap_vertex.metal similarity index 100% rename from examples/flowmap/shader/flowmap_vertex.metal rename to examples/support/flowmap/shader/flowmap_vertex.metal diff --git a/examples/instancing/README.md b/examples/support/instancing/README.md similarity index 100% rename from examples/instancing/README.md rename to examples/support/instancing/README.md diff --git a/examples/instancing/compile.cmd b/examples/support/instancing/compile.cmd similarity index 100% rename from examples/instancing/compile.cmd rename to examples/support/instancing/compile.cmd diff --git a/examples/instancing/data/pixel.fx b/examples/support/instancing/data/pixel.fx similarity index 100% rename from examples/instancing/data/pixel.fx rename to examples/support/instancing/data/pixel.fx diff --git a/examples/instancing/data/vertex.fx b/examples/support/instancing/data/vertex.fx similarity index 100% rename from examples/instancing/data/vertex.fx rename to examples/support/instancing/data/vertex.fx diff --git a/examples/instancing/main.rs b/examples/support/instancing/main.rs similarity index 89% rename from examples/instancing/main.rs rename to examples/support/instancing/main.rs index d4510b45f7b..28fa8127d81 100644 --- a/examples/instancing/main.rs +++ b/examples/support/instancing/main.rs @@ -16,11 +16,11 @@ extern crate rand; extern crate winit; #[macro_use] extern crate gfx; -extern crate gfx_app; +extern crate gfx_support; use rand::Rng; use gfx::{Device, GraphicsPoolExt}; -use gfx_app::{BackbufferView, ColorFormat}; +use gfx_support::{BackbufferView, ColorFormat}; const QUAD_VERTICES: [Vertex; 4] = [ Vertex { position: [-0.5, 0.5] }, @@ -89,27 +89,27 @@ struct App { uploading: bool, // TODO: not needed if we have the encoder everywhere } -impl gfx_app::Application for App { +impl gfx_support::Application for App { fn new(device: &mut B::Device, _: &mut gfx::queue::GraphicsQueue, - backend: gfx_app::shade::Backend, - window_targets: gfx_app::WindowTargets) -> Self + backend: gfx_support::shade::Backend, + window_targets: gfx_support::WindowTargets) -> Self { use gfx::traits::DeviceExt; - let vs = gfx_app::shade::Source { + let vs = gfx_support::shade::Source { glsl_120: include_bytes!("shader/instancing_120.glslv"), glsl_150: include_bytes!("shader/instancing_150.glslv"), msl_11: include_bytes!("shader/instancing_vertex.metal"), hlsl_40: include_bytes!("data/vertex.fx"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let fs = gfx_app::shade::Source { + let fs = gfx_support::shade::Source { glsl_120: include_bytes!("shader/instancing_120.glslf"), glsl_150: include_bytes!("shader/instancing_150.glslf"), msl_11: include_bytes!("shader/instancing_frag.metal"), hlsl_40: include_bytes!("data/pixel.fx"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; let instances_per_length: u32 = 32; @@ -160,7 +160,7 @@ impl gfx_app::Application for App { } } - fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_app::SyncPrimitives), + fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_support::SyncPrimitives), pool: &mut gfx::GraphicsCommandPool, queue: &mut gfx::queue::GraphicsQueue) { let mut encoder = pool.acquire_graphics_encoder(); @@ -180,12 +180,12 @@ impl gfx_app::Application for App { // TODO: rerandomize instance data on event, needs device - fn on_resize(&mut self, window_targets: gfx_app::WindowTargets) { + fn on_resize(&mut self, window_targets: gfx_support::WindowTargets) { self.views = window_targets.views; } } pub fn main() { - use gfx_app::Application; + use gfx_support::Application; App::launch_simple("Instancing example"); } diff --git a/examples/instancing/screenshot.png b/examples/support/instancing/screenshot.png similarity index 100% rename from examples/instancing/screenshot.png rename to examples/support/instancing/screenshot.png diff --git a/examples/instancing/shader/instancing.hlsl b/examples/support/instancing/shader/instancing.hlsl similarity index 100% rename from examples/instancing/shader/instancing.hlsl rename to examples/support/instancing/shader/instancing.hlsl diff --git a/examples/instancing/shader/instancing_120.glslf b/examples/support/instancing/shader/instancing_120.glslf similarity index 100% rename from examples/instancing/shader/instancing_120.glslf rename to examples/support/instancing/shader/instancing_120.glslf diff --git a/examples/instancing/shader/instancing_120.glslv b/examples/support/instancing/shader/instancing_120.glslv similarity index 100% rename from examples/instancing/shader/instancing_120.glslv rename to examples/support/instancing/shader/instancing_120.glslv diff --git a/examples/instancing/shader/instancing_150.glslf b/examples/support/instancing/shader/instancing_150.glslf similarity index 100% rename from examples/instancing/shader/instancing_150.glslf rename to examples/support/instancing/shader/instancing_150.glslf diff --git a/examples/instancing/shader/instancing_150.glslv b/examples/support/instancing/shader/instancing_150.glslv similarity index 100% rename from examples/instancing/shader/instancing_150.glslv rename to examples/support/instancing/shader/instancing_150.glslv diff --git a/examples/instancing/shader/instancing_frag.metal b/examples/support/instancing/shader/instancing_frag.metal similarity index 100% rename from examples/instancing/shader/instancing_frag.metal rename to examples/support/instancing/shader/instancing_frag.metal diff --git a/examples/instancing/shader/instancing_vertex.metal b/examples/support/instancing/shader/instancing_vertex.metal similarity index 100% rename from examples/instancing/shader/instancing_vertex.metal rename to examples/support/instancing/shader/instancing_vertex.metal diff --git a/examples/mipmap/compile.cmd b/examples/support/mipmap/compile.cmd similarity index 100% rename from examples/mipmap/compile.cmd rename to examples/support/mipmap/compile.cmd diff --git a/examples/mipmap/data/pixel.fx b/examples/support/mipmap/data/pixel.fx similarity index 100% rename from examples/mipmap/data/pixel.fx rename to examples/support/mipmap/data/pixel.fx diff --git a/examples/mipmap/data/vertex.fx b/examples/support/mipmap/data/vertex.fx similarity index 100% rename from examples/mipmap/data/vertex.fx rename to examples/support/mipmap/data/vertex.fx diff --git a/examples/mipmap/main.rs b/examples/support/mipmap/main.rs similarity index 87% rename from examples/mipmap/main.rs rename to examples/support/mipmap/main.rs index 9304fdbe212..fb3e7c9327c 100644 --- a/examples/mipmap/main.rs +++ b/examples/support/mipmap/main.rs @@ -14,10 +14,10 @@ #[macro_use] extern crate gfx; -extern crate gfx_app; +extern crate gfx_support; use gfx::{texture, Device, GraphicsPoolExt}; -use gfx_app::{BackbufferView, ColorFormat}; +use gfx_support::{BackbufferView, ColorFormat}; gfx_defines!{ vertex Vertex { @@ -66,25 +66,25 @@ struct App { slice: gfx::Slice, } -impl gfx_app::Application for App { +impl gfx_support::Application for App { fn new(device: &mut B::Device, _: &mut gfx::queue::GraphicsQueue, - backend: gfx_app::shade::Backend, - window_targets: gfx_app::WindowTargets) -> Self + backend: gfx_support::shade::Backend, + window_targets: gfx_support::WindowTargets) -> Self { use gfx::traits::DeviceExt; - let vs = gfx_app::shade::Source { + let vs = gfx_support::shade::Source { glsl_120: include_bytes!("shader/120.glslv"), glsl_150: include_bytes!("shader/150.glslv"), hlsl_40: include_bytes!("data/vertex.fx"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let fs = gfx_app::shade::Source { + let fs = gfx_support::shade::Source { glsl_120: include_bytes!("shader/120.glslf"), glsl_150: include_bytes!("shader/150.glslf"), hlsl_40: include_bytes!("data/pixel.fx"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; let vertex_data = [ @@ -126,7 +126,7 @@ impl gfx_app::Application for App { } } - fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_app::SyncPrimitives), + fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_support::SyncPrimitives), pool: &mut gfx::GraphicsCommandPool, queue: &mut gfx::queue::GraphicsQueue) { let (cur_color, _) = self.views[frame.id()].clone(); @@ -139,12 +139,12 @@ impl gfx_app::Application for App { .expect("Could not flush encoder"); } - fn on_resize(&mut self, window_targets: gfx_app::WindowTargets) { + fn on_resize(&mut self, window_targets: gfx_support::WindowTargets) { self.views = window_targets.views; } } pub fn main() { - use gfx_app::Application; + use gfx_support::Application; App::launch_simple("Mipmap example"); } diff --git a/examples/mipmap/shader/120.glslf b/examples/support/mipmap/shader/120.glslf similarity index 100% rename from examples/mipmap/shader/120.glslf rename to examples/support/mipmap/shader/120.glslf diff --git a/examples/mipmap/shader/120.glslv b/examples/support/mipmap/shader/120.glslv similarity index 100% rename from examples/mipmap/shader/120.glslv rename to examples/support/mipmap/shader/120.glslv diff --git a/examples/mipmap/shader/150.glslf b/examples/support/mipmap/shader/150.glslf similarity index 100% rename from examples/mipmap/shader/150.glslf rename to examples/support/mipmap/shader/150.glslf diff --git a/examples/mipmap/shader/150.glslv b/examples/support/mipmap/shader/150.glslv similarity index 100% rename from examples/mipmap/shader/150.glslv rename to examples/support/mipmap/shader/150.glslv diff --git a/examples/mipmap/shader/fx.hlsl b/examples/support/mipmap/shader/fx.hlsl similarity index 100% rename from examples/mipmap/shader/fx.hlsl rename to examples/support/mipmap/shader/fx.hlsl diff --git a/examples/particle/README.md b/examples/support/particle/README.md similarity index 100% rename from examples/particle/README.md rename to examples/support/particle/README.md diff --git a/examples/particle/compile.cmd b/examples/support/particle/compile.cmd similarity index 100% rename from examples/particle/compile.cmd rename to examples/support/particle/compile.cmd diff --git a/examples/particle/data/gs_particle.fx b/examples/support/particle/data/gs_particle.fx similarity index 100% rename from examples/particle/data/gs_particle.fx rename to examples/support/particle/data/gs_particle.fx diff --git a/examples/particle/data/ps_particle.fx b/examples/support/particle/data/ps_particle.fx similarity index 100% rename from examples/particle/data/ps_particle.fx rename to examples/support/particle/data/ps_particle.fx diff --git a/examples/particle/data/vs_particle.fx b/examples/support/particle/data/vs_particle.fx similarity index 100% rename from examples/particle/data/vs_particle.fx rename to examples/support/particle/data/vs_particle.fx diff --git a/examples/particle/main.rs b/examples/support/particle/main.rs similarity index 90% rename from examples/particle/main.rs rename to examples/support/particle/main.rs index 139acfe473f..bca3391900e 100644 --- a/examples/particle/main.rs +++ b/examples/support/particle/main.rs @@ -15,11 +15,11 @@ extern crate rand; #[macro_use] extern crate gfx; -extern crate gfx_app; +extern crate gfx_support; use std::time::Instant; -use gfx_app::{BackbufferView, ColorFormat}; +use gfx_support::{BackbufferView, ColorFormat}; use gfx::{Bundle, Device, GraphicsPoolExt, ShaderSet, Primitive, buffer, Bind, Slice}; use gfx::state::Rasterizer; @@ -75,29 +75,29 @@ fn create_shader_set>(device: &mut D, vs_co ShaderSet::Geometry(vs, gs, ps) } -impl gfx_app::Application for App { +impl gfx_support::Application for App { fn new(device: &mut B::Device, _: &mut gfx::queue::GraphicsQueue, - backend: gfx_app::shade::Backend, - window_targets: gfx_app::WindowTargets) -> Self + backend: gfx_support::shade::Backend, + window_targets: gfx_support::WindowTargets) -> Self { use gfx::traits::DeviceExt; // Load in our vertex, geometry and pixel shaders - let vs = gfx_app::shade::Source { + let vs = gfx_support::shade::Source { glsl_150: include_bytes!("shader/particle_150.glslv"), hlsl_40: include_bytes!("data/vs_particle.fx"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let gs = gfx_app::shade::Source { + let gs = gfx_support::shade::Source { glsl_150: include_bytes!("shader/particle_150.glslg"), hlsl_40: include_bytes!("data/gs_particle.fx"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let ps = gfx_app::shade::Source { + let ps = gfx_support::shade::Source { glsl_150: include_bytes!("shader/particle_150.glslf"), hlsl_40: include_bytes!("data/ps_particle.fx"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; let shader_set = create_shader_set( @@ -147,7 +147,7 @@ impl gfx_app::Application for App { } } - fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_app::SyncPrimitives), + fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_support::SyncPrimitives), pool: &mut gfx::GraphicsCommandPool, queue: &mut gfx::queue::GraphicsQueue) { // Compute the time since last frame @@ -196,12 +196,12 @@ impl gfx_app::Application for App { .expect("Could not flush encoder"); } - fn on_resize(&mut self, window_targets: gfx_app::WindowTargets) { + fn on_resize(&mut self, window_targets: gfx_support::WindowTargets) { self.views = window_targets.views; } } pub fn main() { - use gfx_app::Application; + use gfx_support::Application; App::launch_simple("Particle example"); } diff --git a/examples/particle/screenshot.png b/examples/support/particle/screenshot.png similarity index 100% rename from examples/particle/screenshot.png rename to examples/support/particle/screenshot.png diff --git a/examples/particle/shader/particle.hlsl b/examples/support/particle/shader/particle.hlsl similarity index 100% rename from examples/particle/shader/particle.hlsl rename to examples/support/particle/shader/particle.hlsl diff --git a/examples/particle/shader/particle_150.glslf b/examples/support/particle/shader/particle_150.glslf similarity index 100% rename from examples/particle/shader/particle_150.glslf rename to examples/support/particle/shader/particle_150.glslf diff --git a/examples/particle/shader/particle_150.glslg b/examples/support/particle/shader/particle_150.glslg similarity index 100% rename from examples/particle/shader/particle_150.glslg rename to examples/support/particle/shader/particle_150.glslg diff --git a/examples/particle/shader/particle_150.glslv b/examples/support/particle/shader/particle_150.glslv similarity index 100% rename from examples/particle/shader/particle_150.glslv rename to examples/support/particle/shader/particle_150.glslv diff --git a/examples/performance/main.rs b/examples/support/performance/main.rs similarity index 100% rename from examples/performance/main.rs rename to examples/support/performance/main.rs diff --git a/examples/shadow/README.md b/examples/support/shadow/README.md similarity index 100% rename from examples/shadow/README.md rename to examples/support/shadow/README.md diff --git a/examples/shadow/compile.cmd b/examples/support/shadow/compile.cmd similarity index 100% rename from examples/shadow/compile.cmd rename to examples/support/shadow/compile.cmd diff --git a/examples/shadow/data/forward_ps.fx b/examples/support/shadow/data/forward_ps.fx similarity index 100% rename from examples/shadow/data/forward_ps.fx rename to examples/support/shadow/data/forward_ps.fx diff --git a/examples/shadow/data/forward_vs.fx b/examples/support/shadow/data/forward_vs.fx similarity index 100% rename from examples/shadow/data/forward_vs.fx rename to examples/support/shadow/data/forward_vs.fx diff --git a/examples/shadow/data/shadow_ps.fx b/examples/support/shadow/data/shadow_ps.fx similarity index 100% rename from examples/shadow/data/shadow_ps.fx rename to examples/support/shadow/data/shadow_ps.fx diff --git a/examples/shadow/data/shadow_vs.fx b/examples/support/shadow/data/shadow_vs.fx similarity index 100% rename from examples/shadow/data/shadow_vs.fx rename to examples/support/shadow/data/shadow_vs.fx diff --git a/examples/shadow/main.rs b/examples/support/shadow/main.rs similarity index 97% rename from examples/shadow/main.rs rename to examples/support/shadow/main.rs index 5f4cb3289b4..4b77ee0ded8 100644 --- a/examples/shadow/main.rs +++ b/examples/support/shadow/main.rs @@ -15,11 +15,11 @@ extern crate cgmath; #[macro_use] extern crate gfx; -extern crate gfx_app; +extern crate gfx_support; extern crate winit; use gfx::{Device, GraphicsPoolExt}; -use gfx_app::{ColorFormat, DepthFormat}; +use gfx_support::{ColorFormat, DepthFormat}; #[cfg(feature="metal")] pub use gfx::format::Depth32F as Depth; @@ -398,7 +398,7 @@ where // Section-5: application struct App { - window_targets: gfx_app::WindowTargets, + window_targets: gfx_support::WindowTargets, is_parallel: bool, forward_pso: gfx::PipelineState, scene: Scene, @@ -426,15 +426,15 @@ impl App { } } -impl gfx_app::Application for App { +impl gfx_support::Application for App { fn new(device: &mut B::Device, queue: &mut gfx::queue::GraphicsQueue, - backend: gfx_app::shade::Backend, - window_targets: gfx_app::WindowTargets) -> Self + backend: gfx_support::shade::Backend, + window_targets: gfx_support::WindowTargets) -> Self { use std::env; use gfx::traits::DeviceExt; - use gfx_app::shade::Source; + use gfx_support::shade::Source; let mut is_parallel = true; for arg in env::args().skip(1) { @@ -504,7 +504,7 @@ impl gfx_app::Application for App { } } - fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_app::SyncPrimitives), + fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_support::SyncPrimitives), pool: &mut gfx::GraphicsCommandPool, mut queue: &mut gfx::queue::GraphicsQueue) { let (cur_color, cur_depth) = self.window_targets.views[frame.id()].clone(); @@ -632,7 +632,7 @@ impl gfx_app::Application for App { } } - fn on_resize(&mut self, window_targets: gfx_app::WindowTargets) { + fn on_resize(&mut self, window_targets: gfx_support::WindowTargets) { for ent in self.scene.share.write().unwrap().entities.iter_mut() { ent.batch_forward.out_color = window_targets.views[0].0.clone(); ent.batch_forward.out_depth = window_targets.views[0].1.clone(); @@ -645,6 +645,6 @@ impl gfx_app::Application for App { // Section-6: main entry point pub fn main() { - use gfx_app::Application; + use gfx_support::Application; App::launch_simple("Shadow example"); } diff --git a/examples/shadow/screenshot.png b/examples/support/shadow/screenshot.png similarity index 100% rename from examples/shadow/screenshot.png rename to examples/support/shadow/screenshot.png diff --git a/examples/shadow/shader/forward.hlsl b/examples/support/shadow/shader/forward.hlsl similarity index 100% rename from examples/shadow/shader/forward.hlsl rename to examples/support/shadow/shader/forward.hlsl diff --git a/examples/shadow/shader/forward_150.glslf b/examples/support/shadow/shader/forward_150.glslf similarity index 100% rename from examples/shadow/shader/forward_150.glslf rename to examples/support/shadow/shader/forward_150.glslf diff --git a/examples/shadow/shader/forward_150.glslv b/examples/support/shadow/shader/forward_150.glslv similarity index 100% rename from examples/shadow/shader/forward_150.glslv rename to examples/support/shadow/shader/forward_150.glslv diff --git a/examples/shadow/shader/forward_frag.metal b/examples/support/shadow/shader/forward_frag.metal similarity index 100% rename from examples/shadow/shader/forward_frag.metal rename to examples/support/shadow/shader/forward_frag.metal diff --git a/examples/shadow/shader/forward_vertex.metal b/examples/support/shadow/shader/forward_vertex.metal similarity index 100% rename from examples/shadow/shader/forward_vertex.metal rename to examples/support/shadow/shader/forward_vertex.metal diff --git a/examples/shadow/shader/shadow.hlsl b/examples/support/shadow/shader/shadow.hlsl similarity index 100% rename from examples/shadow/shader/shadow.hlsl rename to examples/support/shadow/shader/shadow.hlsl diff --git a/examples/shadow/shader/shadow_150.glslf b/examples/support/shadow/shader/shadow_150.glslf similarity index 100% rename from examples/shadow/shader/shadow_150.glslf rename to examples/support/shadow/shader/shadow_150.glslf diff --git a/examples/shadow/shader/shadow_150.glslv b/examples/support/shadow/shader/shadow_150.glslv similarity index 100% rename from examples/shadow/shader/shadow_150.glslv rename to examples/support/shadow/shader/shadow_150.glslv diff --git a/examples/shadow/shader/shadow_frag.metal b/examples/support/shadow/shader/shadow_frag.metal similarity index 100% rename from examples/shadow/shader/shadow_frag.metal rename to examples/support/shadow/shader/shadow_frag.metal diff --git a/examples/shadow/shader/shadow_vertex.metal b/examples/support/shadow/shader/shadow_vertex.metal similarity index 100% rename from examples/shadow/shader/shadow_vertex.metal rename to examples/support/shadow/shader/shadow_vertex.metal diff --git a/examples/skybox/README.md b/examples/support/skybox/README.md similarity index 100% rename from examples/skybox/README.md rename to examples/support/skybox/README.md diff --git a/examples/support/skybox/compile.cmd b/examples/support/skybox/compile.cmd new file mode 100644 index 00000000000..e69de29bb2d diff --git a/examples/skybox/data/pixel.fx b/examples/support/skybox/data/pixel.fx similarity index 100% rename from examples/skybox/data/pixel.fx rename to examples/support/skybox/data/pixel.fx diff --git a/examples/skybox/data/vertex.fx b/examples/support/skybox/data/vertex.fx similarity index 100% rename from examples/skybox/data/vertex.fx rename to examples/support/skybox/data/vertex.fx diff --git a/examples/skybox/image/negx.jpg b/examples/support/skybox/image/negx.jpg similarity index 100% rename from examples/skybox/image/negx.jpg rename to examples/support/skybox/image/negx.jpg diff --git a/examples/skybox/image/negy.jpg b/examples/support/skybox/image/negy.jpg similarity index 100% rename from examples/skybox/image/negy.jpg rename to examples/support/skybox/image/negy.jpg diff --git a/examples/skybox/image/negz.jpg b/examples/support/skybox/image/negz.jpg similarity index 100% rename from examples/skybox/image/negz.jpg rename to examples/support/skybox/image/negz.jpg diff --git a/examples/skybox/image/posx.jpg b/examples/support/skybox/image/posx.jpg similarity index 100% rename from examples/skybox/image/posx.jpg rename to examples/support/skybox/image/posx.jpg diff --git a/examples/skybox/image/posy.jpg b/examples/support/skybox/image/posy.jpg similarity index 100% rename from examples/skybox/image/posy.jpg rename to examples/support/skybox/image/posy.jpg diff --git a/examples/skybox/image/posz.jpg b/examples/support/skybox/image/posz.jpg similarity index 100% rename from examples/skybox/image/posz.jpg rename to examples/support/skybox/image/posz.jpg diff --git a/examples/skybox/main.rs b/examples/support/skybox/main.rs similarity index 89% rename from examples/skybox/main.rs rename to examples/support/skybox/main.rs index f1fe51bf1b0..c40798d500a 100644 --- a/examples/skybox/main.rs +++ b/examples/support/skybox/main.rs @@ -14,11 +14,11 @@ #[macro_use] extern crate gfx; -extern crate gfx_app; +extern crate gfx_support; extern crate cgmath; extern crate image; -use gfx_app::{BackbufferView, ColorFormat}; +use gfx_support::{BackbufferView, ColorFormat}; use gfx::format::Rgba8; use cgmath::{Deg, Matrix4}; @@ -88,23 +88,23 @@ struct App { start_time: Instant, } -impl gfx_app::Application for App { +impl gfx_support::Application for App { fn new(device: &mut B::Device, _: &mut gfx::queue::GraphicsQueue, - backend: gfx_app::shade::Backend, - window_targets: gfx_app::WindowTargets) -> Self + backend: gfx_support::shade::Backend, + window_targets: gfx_support::WindowTargets) -> Self { use gfx::traits::DeviceExt; - let vs = gfx_app::shade::Source { + let vs = gfx_support::shade::Source { glsl_150: include_bytes!("shader/cubemap_150.glslv"), hlsl_40: include_bytes!("data/vertex.fx"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let ps = gfx_app::shade::Source { + let ps = gfx_support::shade::Source { glsl_150: include_bytes!("shader/cubemap_150.glslf"), hlsl_40: include_bytes!("data/pixel.fx"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; let vertex_data = [ @@ -148,7 +148,7 @@ impl gfx_app::Application for App { } } - fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_app::SyncPrimitives), + fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_support::SyncPrimitives), pool: &mut gfx::GraphicsCommandPool, queue: &mut gfx::queue::GraphicsQueue) { let (cur_color, _) = self.views[frame.id()].clone(); @@ -183,13 +183,13 @@ impl gfx_app::Application for App { .expect("Could not flush encoder"); } - fn on_resize(&mut self, window_targets: gfx_app::WindowTargets) { + fn on_resize(&mut self, window_targets: gfx_support::WindowTargets) { self.views = window_targets.views; self.projection = cgmath::perspective(Deg(60.0f32), window_targets.aspect_ratio, 0.01, 100.0); } } pub fn main() { - use gfx_app::Application; + use gfx_support::Application; App::launch_simple("Skybox example"); } diff --git a/examples/skybox/screenshot.png b/examples/support/skybox/screenshot.png similarity index 100% rename from examples/skybox/screenshot.png rename to examples/support/skybox/screenshot.png diff --git a/examples/skybox/shader/cubemap.hlsl b/examples/support/skybox/shader/cubemap.hlsl similarity index 100% rename from examples/skybox/shader/cubemap.hlsl rename to examples/support/skybox/shader/cubemap.hlsl diff --git a/examples/skybox/shader/cubemap_150.glslf b/examples/support/skybox/shader/cubemap_150.glslf similarity index 100% rename from examples/skybox/shader/cubemap_150.glslf rename to examples/support/skybox/shader/cubemap_150.glslf diff --git a/examples/skybox/shader/cubemap_150.glslv b/examples/support/skybox/shader/cubemap_150.glslv similarity index 100% rename from examples/skybox/shader/cubemap_150.glslv rename to examples/support/skybox/shader/cubemap_150.glslv diff --git a/examples/terrain/README.md b/examples/support/terrain/README.md similarity index 100% rename from examples/terrain/README.md rename to examples/support/terrain/README.md diff --git a/examples/terrain/compile.cmd b/examples/support/terrain/compile.cmd similarity index 100% rename from examples/terrain/compile.cmd rename to examples/support/terrain/compile.cmd diff --git a/examples/terrain/data/frag.spv b/examples/support/terrain/data/frag.spv similarity index 100% rename from examples/terrain/data/frag.spv rename to examples/support/terrain/data/frag.spv diff --git a/examples/terrain_tessellated/data/pixel.fx b/examples/support/terrain/data/pixel.fx similarity index 100% rename from examples/terrain_tessellated/data/pixel.fx rename to examples/support/terrain/data/pixel.fx diff --git a/examples/terrain/data/vert.spv b/examples/support/terrain/data/vert.spv similarity index 100% rename from examples/terrain/data/vert.spv rename to examples/support/terrain/data/vert.spv diff --git a/examples/terrain/data/vertex.fx b/examples/support/terrain/data/vertex.fx similarity index 100% rename from examples/terrain/data/vertex.fx rename to examples/support/terrain/data/vertex.fx diff --git a/examples/terrain/main.rs b/examples/support/terrain/main.rs similarity index 89% rename from examples/terrain/main.rs rename to examples/support/terrain/main.rs index 9b5a9b32f1a..85334338ebc 100644 --- a/examples/terrain/main.rs +++ b/examples/support/terrain/main.rs @@ -15,13 +15,13 @@ extern crate cgmath; #[macro_use] extern crate gfx; -extern crate gfx_app; +extern crate gfx_support; extern crate genmesh; extern crate noise; extern crate winit; use gfx::GraphicsPoolExt; -use gfx_app::{BackbufferView, ColorFormat, DepthFormat}; +use gfx_support::{BackbufferView, ColorFormat, DepthFormat}; use cgmath::{Deg, Matrix4, Point3, SquareMatrix, Vector3}; use genmesh::{Vertices, Triangulate}; @@ -73,29 +73,29 @@ struct App { start_time: Instant, } -impl gfx_app::Application for App { +impl gfx_support::Application for App { fn new(device: &mut B::Device, _: &mut gfx::queue::GraphicsQueue, - backend: gfx_app::shade::Backend, - window_targets: gfx_app::WindowTargets) -> Self + backend: gfx_support::shade::Backend, + window_targets: gfx_support::WindowTargets) -> Self { use gfx::traits::DeviceExt; - let vs = gfx_app::shade::Source { + let vs = gfx_support::shade::Source { glsl_120: include_bytes!("shader/terrain_120.glslv"), glsl_150: include_bytes!("shader/terrain_150.glslv"), hlsl_40: include_bytes!("data/vertex.fx"), msl_11: include_bytes!("shader/terrain_vertex.metal"), vulkan: include_bytes!("data/vert.spv"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let ps = gfx_app::shade::Source { + let ps = gfx_support::shade::Source { glsl_120: include_bytes!("shader/terrain_120.glslf"), glsl_150: include_bytes!("shader/terrain_150.glslf"), hlsl_40: include_bytes!("data/pixel.fx"), msl_11: include_bytes!("shader/terrain_frag.metal"), vulkan: include_bytes!("data/frag.spv"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; let perlin = Perlin::new(); @@ -143,7 +143,7 @@ impl gfx_app::Application for App { } } - fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_app::SyncPrimitives), + fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_support::SyncPrimitives), pool: &mut gfx::GraphicsCommandPool, queue: &mut gfx::queue::GraphicsQueue) { let elapsed = self.start_time.elapsed(); @@ -175,7 +175,7 @@ impl gfx_app::Application for App { .expect("Could not flush encoder"); } - fn on_resize(&mut self, window_targets: gfx_app::WindowTargets) { + fn on_resize(&mut self, window_targets: gfx_support::WindowTargets) { self.views = window_targets.views; self.data.proj = cgmath::perspective( Deg(60.0f32), window_targets.aspect_ratio, 0.1, 1000.0 @@ -184,6 +184,6 @@ impl gfx_app::Application for App { } pub fn main() { - use gfx_app::Application; + use gfx_support::Application; App::launch_simple("Terrain example"); } diff --git a/examples/terrain/screenshot.png b/examples/support/terrain/screenshot.png similarity index 100% rename from examples/terrain/screenshot.png rename to examples/support/terrain/screenshot.png diff --git a/examples/terrain/shader/make_vulkan.sh b/examples/support/terrain/shader/make_vulkan.sh similarity index 100% rename from examples/terrain/shader/make_vulkan.sh rename to examples/support/terrain/shader/make_vulkan.sh diff --git a/examples/terrain/shader/terrain.hlsl b/examples/support/terrain/shader/terrain.hlsl similarity index 100% rename from examples/terrain/shader/terrain.hlsl rename to examples/support/terrain/shader/terrain.hlsl diff --git a/examples/terrain/shader/terrain_120.glslf b/examples/support/terrain/shader/terrain_120.glslf similarity index 100% rename from examples/terrain/shader/terrain_120.glslf rename to examples/support/terrain/shader/terrain_120.glslf diff --git a/examples/terrain/shader/terrain_120.glslv b/examples/support/terrain/shader/terrain_120.glslv similarity index 100% rename from examples/terrain/shader/terrain_120.glslv rename to examples/support/terrain/shader/terrain_120.glslv diff --git a/examples/terrain/shader/terrain_150.glslf b/examples/support/terrain/shader/terrain_150.glslf similarity index 100% rename from examples/terrain/shader/terrain_150.glslf rename to examples/support/terrain/shader/terrain_150.glslf diff --git a/examples/terrain/shader/terrain_150.glslv b/examples/support/terrain/shader/terrain_150.glslv similarity index 100% rename from examples/terrain/shader/terrain_150.glslv rename to examples/support/terrain/shader/terrain_150.glslv diff --git a/examples/terrain/shader/terrain_frag.metal b/examples/support/terrain/shader/terrain_frag.metal similarity index 100% rename from examples/terrain/shader/terrain_frag.metal rename to examples/support/terrain/shader/terrain_frag.metal diff --git a/examples/terrain/shader/terrain_vertex.metal b/examples/support/terrain/shader/terrain_vertex.metal similarity index 100% rename from examples/terrain/shader/terrain_vertex.metal rename to examples/support/terrain/shader/terrain_vertex.metal diff --git a/examples/terrain_tessellated/README.md b/examples/support/terrain_tessellated/README.md similarity index 100% rename from examples/terrain_tessellated/README.md rename to examples/support/terrain_tessellated/README.md diff --git a/examples/terrain_tessellated/compile.cmd b/examples/support/terrain_tessellated/compile.cmd similarity index 100% rename from examples/terrain_tessellated/compile.cmd rename to examples/support/terrain_tessellated/compile.cmd diff --git a/examples/terrain_tessellated/data/domain.fx b/examples/support/terrain_tessellated/data/domain.fx similarity index 100% rename from examples/terrain_tessellated/data/domain.fx rename to examples/support/terrain_tessellated/data/domain.fx diff --git a/examples/terrain_tessellated/data/frag.spv b/examples/support/terrain_tessellated/data/frag.spv similarity index 100% rename from examples/terrain_tessellated/data/frag.spv rename to examples/support/terrain_tessellated/data/frag.spv diff --git a/examples/terrain_tessellated/data/hull.fx b/examples/support/terrain_tessellated/data/hull.fx similarity index 100% rename from examples/terrain_tessellated/data/hull.fx rename to examples/support/terrain_tessellated/data/hull.fx diff --git a/examples/triangle/data/pixel.fx b/examples/support/terrain_tessellated/data/pixel.fx similarity index 100% rename from examples/triangle/data/pixel.fx rename to examples/support/terrain_tessellated/data/pixel.fx diff --git a/examples/terrain_tessellated/data/vert.spv b/examples/support/terrain_tessellated/data/vert.spv similarity index 100% rename from examples/terrain_tessellated/data/vert.spv rename to examples/support/terrain_tessellated/data/vert.spv diff --git a/examples/triangle/data/vertex.fx b/examples/support/terrain_tessellated/data/vertex.fx similarity index 100% rename from examples/triangle/data/vertex.fx rename to examples/support/terrain_tessellated/data/vertex.fx diff --git a/examples/terrain_tessellated/main.rs b/examples/support/terrain_tessellated/main.rs similarity index 88% rename from examples/terrain_tessellated/main.rs rename to examples/support/terrain_tessellated/main.rs index 6967d511238..a08a5f07da5 100644 --- a/examples/terrain_tessellated/main.rs +++ b/examples/support/terrain_tessellated/main.rs @@ -16,10 +16,10 @@ extern crate cgmath; extern crate genmesh; #[macro_use] extern crate gfx; -extern crate gfx_app; +extern crate gfx_support; extern crate noise; -use gfx_app::{BackbufferView, ColorFormat, DepthFormat}; +use gfx_support::{BackbufferView, ColorFormat, DepthFormat}; use gfx::GraphicsPoolExt; use cgmath::{Deg, Matrix4, Point3, SquareMatrix, Vector3}; @@ -72,41 +72,41 @@ struct App { start_time: Instant, } -impl gfx_app::Application for App { +impl gfx_support::Application for App { fn new(device: &mut B::Device, _: &mut gfx::queue::GraphicsQueue, - backend: gfx_app::shade::Backend, - window_targets: gfx_app::WindowTargets) -> Self + backend: gfx_support::shade::Backend, + window_targets: gfx_support::WindowTargets) -> Self { use gfx::traits::DeviceExt; - let vs = gfx_app::shade::Source { + let vs = gfx_support::shade::Source { glsl_150: include_bytes!("shader/terrain.glslv"), //v = vertex hlsl_40: include_bytes!("data/vertex.fx"), msl_11: include_bytes!("shader/terrain_vertex.metal"), vulkan: include_bytes!("data/vert.spv"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let hs = gfx_app::shade::Source { + let hs = gfx_support::shade::Source { glsl_150: include_bytes!("shader/terrain.glslc"), //c = tess control hlsl_50: include_bytes!("data/hull.fx"), msl_11: include_bytes!("shader/terrain_frag.metal"), vulkan: include_bytes!("data/frag.spv"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let ds = gfx_app::shade::Source { + let ds = gfx_support::shade::Source { glsl_150: include_bytes!("shader/terrain.glsle"), //e = tess evaluation hlsl_50: include_bytes!("data/domain.fx"), msl_11: include_bytes!("shader/terrain_frag.metal"), vulkan: include_bytes!("data/frag.spv"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let ps = gfx_app::shade::Source { + let ps = gfx_support::shade::Source { glsl_150: include_bytes!("shader/terrain.glslf"), //f = fragment hlsl_40: include_bytes!("data/pixel.fx"), msl_11: include_bytes!("shader/terrain_frag.metal"), vulkan: include_bytes!("data/frag.spv"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; let perlin = Perlin::new(); @@ -158,7 +158,7 @@ impl gfx_app::Application for App { } } - fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_app::SyncPrimitives), + fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_support::SyncPrimitives), pool: &mut gfx::GraphicsCommandPool, queue: &mut gfx::queue::GraphicsQueue) { let elapsed = self.start_time.elapsed(); @@ -191,7 +191,7 @@ impl gfx_app::Application for App { .expect("Could not flush encoder"); } - fn on_resize(&mut self, window_targets: gfx_app::WindowTargets) { + fn on_resize(&mut self, window_targets: gfx_support::WindowTargets) { self.views = window_targets.views; self.data.proj = cgmath::perspective( Deg(60.0f32), window_targets.aspect_ratio, 0.1, 1000.0 @@ -200,6 +200,6 @@ impl gfx_app::Application for App { } pub fn main() { - use gfx_app::Application; + use gfx_support::Application; App::launch_simple("Terrain tessellation example"); } diff --git a/examples/terrain_tessellated/screenshot.png b/examples/support/terrain_tessellated/screenshot.png similarity index 100% rename from examples/terrain_tessellated/screenshot.png rename to examples/support/terrain_tessellated/screenshot.png diff --git a/examples/terrain_tessellated/shader/make_vulkan.sh b/examples/support/terrain_tessellated/shader/make_vulkan.sh similarity index 100% rename from examples/terrain_tessellated/shader/make_vulkan.sh rename to examples/support/terrain_tessellated/shader/make_vulkan.sh diff --git a/examples/terrain_tessellated/shader/terrain.glslc b/examples/support/terrain_tessellated/shader/terrain.glslc similarity index 100% rename from examples/terrain_tessellated/shader/terrain.glslc rename to examples/support/terrain_tessellated/shader/terrain.glslc diff --git a/examples/terrain_tessellated/shader/terrain.glsle b/examples/support/terrain_tessellated/shader/terrain.glsle similarity index 100% rename from examples/terrain_tessellated/shader/terrain.glsle rename to examples/support/terrain_tessellated/shader/terrain.glsle diff --git a/examples/terrain_tessellated/shader/terrain.glslf b/examples/support/terrain_tessellated/shader/terrain.glslf similarity index 100% rename from examples/terrain_tessellated/shader/terrain.glslf rename to examples/support/terrain_tessellated/shader/terrain.glslf diff --git a/examples/terrain_tessellated/shader/terrain.glslv b/examples/support/terrain_tessellated/shader/terrain.glslv similarity index 100% rename from examples/terrain_tessellated/shader/terrain.glslv rename to examples/support/terrain_tessellated/shader/terrain.glslv diff --git a/examples/terrain_tessellated/shader/terrain.hlsl b/examples/support/terrain_tessellated/shader/terrain.hlsl similarity index 100% rename from examples/terrain_tessellated/shader/terrain.hlsl rename to examples/support/terrain_tessellated/shader/terrain.hlsl diff --git a/examples/terrain_tessellated/shader/terrain_frag.metal b/examples/support/terrain_tessellated/shader/terrain_frag.metal similarity index 100% rename from examples/terrain_tessellated/shader/terrain_frag.metal rename to examples/support/terrain_tessellated/shader/terrain_frag.metal diff --git a/examples/terrain_tessellated/shader/terrain_vertex.metal b/examples/support/terrain_tessellated/shader/terrain_vertex.metal similarity index 100% rename from examples/terrain_tessellated/shader/terrain_vertex.metal rename to examples/support/terrain_tessellated/shader/terrain_vertex.metal diff --git a/examples/support/triangle/README.md b/examples/support/triangle/README.md new file mode 100644 index 00000000000..f3a38141dab --- /dev/null +++ b/examples/support/triangle/README.md @@ -0,0 +1,25 @@ + + +# Triangle Example + +A simple example showing how to render a colored triangle using vertex and index +buffers, GLSL shaders. This is the most basic example that renders geometry, +aside from it's advanced use of 3 colors. + +## Screenshot + +![Triangle Example](screenshot.png) diff --git a/examples/support/triangle/compile.cmd b/examples/support/triangle/compile.cmd new file mode 100644 index 00000000000..0a3d0c4be1c --- /dev/null +++ b/examples/support/triangle/compile.cmd @@ -0,0 +1,5 @@ +@echo off +set FXC="%DXSDK_DIR%\Utilities\bin\x64\fxc.exe" -nologo +if not exist data mkdir data +%FXC% /T vs_4_0 /E Vertex /Fo data/vertex.fx shader/triangle.hlsl +%FXC% /T ps_4_0 /E Pixel /Fo data/pixel.fx shader/triangle.hlsl diff --git a/examples/support/triangle/data/pixel.fx b/examples/support/triangle/data/pixel.fx new file mode 100644 index 00000000000..5cd96e6a62d Binary files /dev/null and b/examples/support/triangle/data/pixel.fx differ diff --git a/examples/support/triangle/data/vertex.fx b/examples/support/triangle/data/vertex.fx new file mode 100644 index 00000000000..e7f94666bbf Binary files /dev/null and b/examples/support/triangle/data/vertex.fx differ diff --git a/examples/support/triangle/main.rs b/examples/support/triangle/main.rs new file mode 100644 index 00000000000..e5c1c781f57 --- /dev/null +++ b/examples/support/triangle/main.rs @@ -0,0 +1,111 @@ +// Copyright 2017 The Gfx-rs Developers. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#[deny(dead_code)] +#[macro_use] +extern crate gfx; +extern crate gfx_support; + +use gfx::Bundle; +use gfx::GraphicsPoolExt; +use gfx_support::{Application, BackbufferView, ColorFormat}; + +gfx_defines!{ + vertex Vertex { + pos: [f32; 2] = "a_Pos", + color: [f32; 3] = "a_Color", + } + + pipeline pipe { + vbuf: gfx::VertexBuffer = (), + out: gfx::RenderTarget = "Target0", + } +} + +// ---------------------------------------- +struct App { + views: Vec>, + bundle: Bundle>, +} + +impl Application for App { + fn new(device: &mut B::Device, + _: &mut gfx::queue::GraphicsQueue, + backend: gfx_support::shade::Backend, + window_targets: gfx_support::WindowTargets) + -> Self { + use gfx::traits::DeviceExt; + + let pso = { + let vs = gfx_support::shade::Source { + glsl_120: include_bytes!("shader/triangle_120.glslv"), + ..gfx_support::shade::Source::empty() + }; + let ps = gfx_support::shade::Source { + glsl_120: include_bytes!("shader/triangle_120.glslf"), + ..gfx_support::shade::Source::empty() + }; + + device.create_pipeline_simple(vs.select(backend).unwrap(), + ps.select(backend).unwrap(), + pipe::new()) + .unwrap() + }; + let (vertex_buffer, slice) = { + const TRIANGLE: [Vertex; 3] = [Vertex { + pos: [-0.5, -0.5], + color: [1.0, 0.0, 0.0], + }, + Vertex { + pos: [0.5, -0.5], + color: [0.0, 1.0, 0.0], + }, + Vertex { + pos: [0.0, 0.5], + color: [0.0, 0.0, 1.0], + }]; + device.create_vertex_buffer_with_slice(&TRIANGLE, ()) + }; + let data = pipe::Data { + vbuf: vertex_buffer, + out: window_targets.views[0].0.clone(), + }; + + App { + views: window_targets.views, + bundle: Bundle::new(slice, pso, data), + } + } + + fn render(&mut self, + (_, sync): (gfx::Frame, &gfx_support::SyncPrimitives), + pool: &mut gfx::GraphicsCommandPool, + queue: &mut gfx::queue::GraphicsQueue) { + let mut encoder = pool.acquire_graphics_encoder(); + { + const CLEAR_COLOR: [f32; 4] = [0.2, 0.1, 0.1, 1.0]; + encoder.clear(&self.bundle.data.out, CLEAR_COLOR); + } + self.bundle.encode(&mut encoder); + encoder.synced_flush(queue, &[&sync.rendering], &[], Some(&sync.frame_fence)) + .expect("Could not flush encoder"); + } + + fn on_resize(&mut self, window_targets: gfx_support::WindowTargets) { + self.views = window_targets.views; + } +} + +pub fn main() { + App::launch_simple("gfx_support Triangle example"); +} diff --git a/examples/support/triangle/screenshot.png b/examples/support/triangle/screenshot.png new file mode 100644 index 00000000000..316c7fb64e2 Binary files /dev/null and b/examples/support/triangle/screenshot.png differ diff --git a/examples/support/triangle/shader/triangle.hlsl b/examples/support/triangle/shader/triangle.hlsl new file mode 100644 index 00000000000..6a5a0c865d6 --- /dev/null +++ b/examples/support/triangle/shader/triangle.hlsl @@ -0,0 +1,16 @@ +struct VsOutput { + float4 pos: SV_Position; + float3 color: COLOR; +}; + +VsOutput Vertex(float3 pos : a_Pos, float3 color : a_Color) { + VsOutput output = { + float4(pos, 1.0), + color, + }; + return output; +} + +float4 Pixel(VsOutput pin) : SV_Target { + return float4(pin.color, 1.0); +} diff --git a/examples/gamma/shader/quad_120.glslf b/examples/support/triangle/shader/triangle_120.glslf similarity index 100% rename from examples/gamma/shader/quad_120.glslf rename to examples/support/triangle/shader/triangle_120.glslf diff --git a/examples/gamma/shader/quad_120.glslv b/examples/support/triangle/shader/triangle_120.glslv similarity index 100% rename from examples/gamma/shader/quad_120.glslv rename to examples/support/triangle/shader/triangle_120.glslv diff --git a/examples/ubo_tilemap/README.md b/examples/support/ubo_tilemap/README.md similarity index 100% rename from examples/ubo_tilemap/README.md rename to examples/support/ubo_tilemap/README.md diff --git a/examples/ubo_tilemap/compile.cmd b/examples/support/ubo_tilemap/compile.cmd similarity index 100% rename from examples/ubo_tilemap/compile.cmd rename to examples/support/ubo_tilemap/compile.cmd diff --git a/examples/ubo_tilemap/data/pixel.fx b/examples/support/ubo_tilemap/data/pixel.fx similarity index 100% rename from examples/ubo_tilemap/data/pixel.fx rename to examples/support/ubo_tilemap/data/pixel.fx diff --git a/examples/ubo_tilemap/data/vertex.fx b/examples/support/ubo_tilemap/data/vertex.fx similarity index 100% rename from examples/ubo_tilemap/data/vertex.fx rename to examples/support/ubo_tilemap/data/vertex.fx diff --git a/examples/ubo_tilemap/main.rs b/examples/support/ubo_tilemap/main.rs similarity index 95% rename from examples/ubo_tilemap/main.rs rename to examples/support/ubo_tilemap/main.rs index 87a77da3f52..85b5e9216a1 100644 --- a/examples/ubo_tilemap/main.rs +++ b/examples/support/ubo_tilemap/main.rs @@ -16,12 +16,12 @@ extern crate cgmath; extern crate genmesh; #[macro_use] extern crate gfx; -extern crate gfx_app; +extern crate gfx_support; extern crate image; extern crate winit; use gfx::GraphicsPoolExt; -use gfx_app::{BackbufferView, ColorFormat, DepthFormat}; +use gfx_support::{BackbufferView, ColorFormat, DepthFormat}; use cgmath::{Deg, Matrix4, Point3, SquareMatrix, Vector3}; use genmesh::{Vertices, Triangulate}; @@ -113,7 +113,7 @@ pub struct TileMapPlane where B: gfx::Backend { impl TileMapPlane where B: gfx::Backend { pub fn new(device: &mut B::Device, width: usize, height: usize, tile_size: usize, - targets: gfx_app::WindowTargets) -> Self { + targets: gfx_support::WindowTargets) -> Self { // charmap info let half_width = (tile_size * width) / 2; let half_height = (tile_size * height) / 2; @@ -203,7 +203,7 @@ impl TileMapPlane where B: gfx::Backend { } } - fn resize(&mut self, targets: gfx_app::WindowTargets) { + fn resize(&mut self, targets: gfx_support::WindowTargets) { self.views = targets.views; self.proj_stuff.proj = cgmath::perspective(Deg(60.0f32), targets.aspect_ratio, 0.1, 4000.0).into(); self.proj_dirty = true; @@ -399,23 +399,23 @@ fn populate_tilemap(tilemap: &mut TileMap, tilemap_size: [usize; 2]) where tilemap.set_tile(6,11,[2.0, 2.0, 0.0, 0.0]); } -impl gfx_app::Application for TileMap { +impl gfx_support::Application for TileMap { fn new(device: &mut B::Device, _: &mut gfx::queue::GraphicsQueue, - backend: gfx_app::shade::Backend, - window_targets: gfx_app::WindowTargets) -> Self + backend: gfx_support::shade::Backend, + window_targets: gfx_support::WindowTargets) -> Self { use gfx::traits::DeviceExt; - let vs = gfx_app::shade::Source { + let vs = gfx_support::shade::Source { glsl_150: include_bytes!("shader/tilemap_150.glslv"), hlsl_40: include_bytes!("data/vertex.fx"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; - let ps = gfx_app::shade::Source { + let ps = gfx_support::shade::Source { glsl_150: include_bytes!("shader/tilemap_150.glslf"), hlsl_40: include_bytes!("data/pixel.fx"), - .. gfx_app::shade::Source::empty() + .. gfx_support::shade::Source::empty() }; // set up charmap plane and configure its tiles @@ -461,7 +461,7 @@ impl gfx_app::Application for TileMap { tm } - fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_app::SyncPrimitives), + fn render(&mut self, (frame, sync): (gfx::Frame, &gfx_support::SyncPrimitives), pool: &mut gfx::GraphicsCommandPool, queue: &mut gfx::queue::GraphicsQueue) { // view configuration based on current position @@ -511,12 +511,12 @@ impl gfx_app::Application for TileMap { } } - fn on_resize(&mut self, window_targets: gfx_app::WindowTargets) { + fn on_resize(&mut self, window_targets: gfx_support::WindowTargets) { self.tilemap_plane.resize(window_targets); } } pub fn main() { - use gfx_app::Application; + use gfx_support::Application; TileMap::launch_simple("Tilemap example"); } diff --git a/examples/ubo_tilemap/scifitiles-sheet_0.png b/examples/support/ubo_tilemap/scifitiles-sheet_0.png similarity index 100% rename from examples/ubo_tilemap/scifitiles-sheet_0.png rename to examples/support/ubo_tilemap/scifitiles-sheet_0.png diff --git a/examples/ubo_tilemap/screenshot.png b/examples/support/ubo_tilemap/screenshot.png similarity index 100% rename from examples/ubo_tilemap/screenshot.png rename to examples/support/ubo_tilemap/screenshot.png diff --git a/examples/ubo_tilemap/shader/tilemap.hlsl b/examples/support/ubo_tilemap/shader/tilemap.hlsl similarity index 100% rename from examples/ubo_tilemap/shader/tilemap.hlsl rename to examples/support/ubo_tilemap/shader/tilemap.hlsl diff --git a/examples/ubo_tilemap/shader/tilemap_150.glslf b/examples/support/ubo_tilemap/shader/tilemap_150.glslf similarity index 100% rename from examples/ubo_tilemap/shader/tilemap_150.glslf rename to examples/support/ubo_tilemap/shader/tilemap_150.glslf diff --git a/examples/ubo_tilemap/shader/tilemap_150.glslv b/examples/support/ubo_tilemap/shader/tilemap_150.glslv similarity index 100% rename from examples/ubo_tilemap/shader/tilemap_150.glslv rename to examples/support/ubo_tilemap/shader/tilemap_150.glslv diff --git a/examples/triangle/shader/triangle_150.glslf b/examples/triangle/shader/triangle_150.glslf deleted file mode 100644 index 7c587e0effb..00000000000 --- a/examples/triangle/shader/triangle_150.glslf +++ /dev/null @@ -1,8 +0,0 @@ -#version 150 core - -in vec4 v_Color; -out vec4 Target0; - -void main() { - Target0 = v_Color; -} diff --git a/examples/triangle/shader/triangle_150.glslv b/examples/triangle/shader/triangle_150.glslv deleted file mode 100644 index 2ce6461bff7..00000000000 --- a/examples/triangle/shader/triangle_150.glslv +++ /dev/null @@ -1,10 +0,0 @@ -#version 150 core - -in vec2 a_Pos; -in vec3 a_Color; -out vec4 v_Color; - -void main() { - v_Color = vec4(a_Color, 1.0); - gl_Position = vec4(a_Pos, 0.0, 1.0); -} diff --git a/info/contrib.md b/info/contrib.md index cced1ab8cc3..381124d228f 100644 --- a/info/contrib.md +++ b/info/contrib.md @@ -28,15 +28,17 @@ Finally, feel free to hop on [#rust-gamedev](http://chat.mibbit.com/?server=irc. ### Directory Structure -* _examples_ : GFX's examples -* _tests_ : GFX's tests -* _info_ : Information and documentation -* _src_ : gfx_app, an application framework for GFX -* _src/core_ : gfx_core, core structures and the interface that backends must provide -* _src/backend_ : The backends implementations -* _src/render_ : The main gfx package +* _src/backend_ : The different backends GFX supports. +* _src/core_ : core structures and the interface that backends must provide +* _src/corell_ : contains low-level graphics implementation (no resource management overhead). +* _src/macros_ : Macros used internally by GFX. +* _src/support_ : Support code that is used by GFX examples. This package contains all of the + non-essential functionality for running the GFX examples. Feel free to use this code in your own + project. +* _info_ : Information and documentation. +* _src/render_ : The main gfx package. This is where all user code that uses gfx::* lives. * _src/window_ : Different backends to create windows and initialize their graphics ### Code -gfx-rs adheres to [Rust Coding Guidelines](http://aturon.github.io/). \ No newline at end of file +gfx-rs adheres to [Rust Coding Guidelines](http://aturon.github.io/). diff --git a/scripts/travis-script.sh b/scripts/travis-script.sh index 51ac6089e76..b308f9737b9 100644 --- a/scripts/travis-script.sh +++ b/scripts/travis-script.sh @@ -6,26 +6,37 @@ if [[ $TRAVIS_RUST_VERSION == "nightly" && $TRAVIS_BRANCH == "staging" ]]; then exit fi export RUST_BACKTRACE=1 + +EXCLUDES="" +EXCLUDSE+=" --exclude gfx_window_glfw" +EXCLUDES+=" --exclude gfx_window_dxgi" + +EXCLUDES+=" --exclude gfx_device_dx11" +EXCLUDES+=" --exclude gfx_device_dx12ll" +EXCLUDES+=" --exclude gfx_device_dx12" + +FEATURES="" if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export PATH=$PATH:$HOME/deps/bin export LIBRARY_PATH=$HOME/deps/usr/lib/x86_64-linux-gnu export LD_LIBRARY_PATH=$LIBRARY_PATH - cargo build --features vulkan + + EXCLUDES+=" --exclude gfx_device_metal" + EXCLUDES+=" --exclude gfx_device_metalll" + EXCLUDES+=" --exclude gfx_window_metal" + + FEATURES+="vulkan" elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + EXCLUDES+=" --exclude gfx_window_vulkan" + EXCLUDES+=" --exclude gfx_device_vulkan" + EXCLUDES+=" --exclude gfx_device_vulkanll" + + FEATURES+="metal metal_argument_buffer" GLUTIN_HEADLESS_FEATURE="--features headless" - cargo build --features metal -else - cargo build fi -cargo test --all -cargo test -p gfx -p gfx_core --features "mint serialize" -cargo test -p gfx_window_sdl -cargo test -p gfx_device_gl + +cargo build --all --features "$FEATURES" $EXCLUDES + +cargo test --all --features $FEATURES $EXCLUDES +cargo test --all --features "$FEATURES mint serialize" $EXCLUDES cargo test -p gfx_window_glutin $GLUTIN_HEADLESS_FEATURE -cargo test -p gfx_window_glfw -if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - cargo test --all --features vulkan -elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - cargo test --all --features metal - cargo test --all --features "metal metal_argument_buffer" -fi diff --git a/src/backend/dx11/Cargo.toml b/src/backend/dx11/Cargo.toml index 354f43ebf25..24855357ea9 100644 --- a/src/backend/dx11/Cargo.toml +++ b/src/backend/dx11/Cargo.toml @@ -23,6 +23,7 @@ license = "Apache-2.0" authors = ["The Gfx-rs Developers"] readme = "README.md" documentation = "https://docs.rs/gfx_device_dx11" +workspace = "../../.." [lib] name = "gfx_device_dx11" diff --git a/src/backend/dx12/Cargo.toml b/src/backend/dx12/Cargo.toml index 495cf98b476..40f0d0457f1 100644 --- a/src/backend/dx12/Cargo.toml +++ b/src/backend/dx12/Cargo.toml @@ -23,6 +23,7 @@ license = "Apache-2.0" authors = ["The Gfx-rs Developers"] readme = "README.md" documentation = "https://docs.rs/gfx_device_dx12" +workspace = "../../.." [lib] name = "gfx_device_dx12" diff --git a/src/backend/dx12ll/Cargo.toml b/src/backend/dx12ll/Cargo.toml index b9e3c048ec2..bdf72e1d446 100644 --- a/src/backend/dx12ll/Cargo.toml +++ b/src/backend/dx12ll/Cargo.toml @@ -22,6 +22,7 @@ repository = "https://github.com/gfx-rs/gfx" keywords = ["graphics", "gamedev"] license = "Apache-2.0" authors = ["The Gfx-rs Developers"] +workspace = "../../.." [lib] name = "gfx_device_dx12ll" diff --git a/src/backend/gl/Cargo.toml b/src/backend/gl/Cargo.toml index 80ece963f2a..d0c5378145f 100644 --- a/src/backend/gl/Cargo.toml +++ b/src/backend/gl/Cargo.toml @@ -23,6 +23,7 @@ license = "Apache-2.0" authors = ["The Gfx-rs Developers"] readme = "README.md" documentation = "https://docs.rs/gfx_device_gl" +workspace = "../../.." [lib] name = "gfx_device_gl" diff --git a/src/backend/metal/Cargo.toml b/src/backend/metal/Cargo.toml index b8df3827d45..2a1aee169a8 100644 --- a/src/backend/metal/Cargo.toml +++ b/src/backend/metal/Cargo.toml @@ -23,6 +23,7 @@ license = "Apache-2.0" authors = ["The Gfx-rs Developers"] readme = "README.md" documentation = "https://docs.rs/gfx_device_metal" +workspace = "../../.." [lib] name = "gfx_device_metal" diff --git a/src/backend/metalll/Cargo.toml b/src/backend/metalll/Cargo.toml index f615a9d9fd0..d0a59209328 100644 --- a/src/backend/metalll/Cargo.toml +++ b/src/backend/metalll/Cargo.toml @@ -6,6 +6,7 @@ repository = "https://github.com/gfx-rs/gfx" keywords = ["graphics", "gamedev"] license = "Apache-2.0" authors = ["The Gfx-rs Developers"] +workspace = "../../.." [features] default = [] diff --git a/src/backend/vulkan/Cargo.toml b/src/backend/vulkan/Cargo.toml index 19eadc4b395..327aacbefe1 100644 --- a/src/backend/vulkan/Cargo.toml +++ b/src/backend/vulkan/Cargo.toml @@ -23,6 +23,7 @@ license = "Apache-2.0" authors = ["The Gfx-rs Developers"] readme = "README.md" documentation = "https://docs.rs/gfx_device_vulkan" +workspace = "../../.." [lib] name = "gfx_device_vulkan" diff --git a/src/backend/vulkanll/Cargo.toml b/src/backend/vulkanll/Cargo.toml index 30ef96d3951..8afba90ba99 100644 --- a/src/backend/vulkanll/Cargo.toml +++ b/src/backend/vulkanll/Cargo.toml @@ -21,6 +21,7 @@ repository = "https://github.com/gfx-rs/gfx" keywords = ["graphics", "gamedev"] license = "Apache-2.0" authors = ["The Gfx-rs Developers"] +workspace = "../../.." [lib] name = "gfx_device_vulkanll" diff --git a/src/core/Cargo.toml b/src/core/Cargo.toml index b151820d8fe..135d4d96092 100644 --- a/src/core/Cargo.toml +++ b/src/core/Cargo.toml @@ -22,6 +22,11 @@ keywords = ["graphics"] license = "Apache-2.0" authors = ["The Gfx-rs Developers"] documentation = "https://docs.rs/gfx_core" +workspace = "../.." + +[features] +serialize = ["serde", "serde_derive", "draw_state/serialize"] +unstable = [] [lib] name = "gfx_core" @@ -36,7 +41,3 @@ log = "0.3" serde = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true } smallvec = "0.4.1" - -[features] -serialize = ["serde", "serde_derive", "draw_state/serialize"] -unstable = [] diff --git a/tests/handle.rs b/src/core/tests/handle.rs similarity index 100% rename from tests/handle.rs rename to src/core/tests/handle.rs diff --git a/src/corell/Cargo.toml b/src/corell/Cargo.toml index 78a49ae25da..eb366df6a51 100644 --- a/src/corell/Cargo.toml +++ b/src/corell/Cargo.toml @@ -21,6 +21,7 @@ repository = "https://github.com/gfx-rs/gfx" keywords = ["graphics"] license = "Apache-2.0" authors = ["The Gfx-rs Developers"] +workspace = "../.." [lib] name = "gfx_corell" diff --git a/src/macros/Cargo.toml b/src/macros/Cargo.toml index 56f4916e0c6..c90e8a4f2e7 100644 --- a/src/macros/Cargo.toml +++ b/src/macros/Cargo.toml @@ -23,6 +23,7 @@ license = "Apache-2.0" authors = ["The Gfx-rs Developers"] documentation = "https://docs.rs/gfx_macros" categories = ["rendering::graphics-api"] +workspace = "../.." [lib] proc-macro = true @@ -30,3 +31,6 @@ proc-macro = true [dependencies] syn = "0.11" quote = "0.3" + +[dev-dependencies] +gfx = { path = "../render", version = "0.16" } diff --git a/tests/derive.rs b/src/macros/tests/derive.rs similarity index 80% rename from tests/derive.rs rename to src/macros/tests/derive.rs index 48164e6af09..e2b5974a322 100644 --- a/tests/derive.rs +++ b/src/macros/tests/derive.rs @@ -1,5 +1,6 @@ extern crate gfx; -#[macro_use] extern crate gfx_macros; +#[macro_use] +extern crate gfx_macros; #[derive(VertexData)] struct Vertex { diff --git a/tests/macros.rs b/src/macros/tests/macros.rs similarity index 86% rename from tests/macros.rs rename to src/macros/tests/macros.rs index d93ba634466..f0aa50d7e48 100644 --- a/tests/macros.rs +++ b/src/macros/tests/macros.rs @@ -1,5 +1,6 @@ #[macro_use] extern crate gfx; + pub use gfx::format as fm; #[derive(Clone, Debug, PartialEq)] @@ -43,9 +44,9 @@ gfx_defines!{ } } -fn _test_pso(device: &mut D) -> gfx::PipelineState where - R: gfx::Resources, - D: gfx::traits::DeviceExt, +fn _test_pso(device: &mut D) -> gfx::PipelineState + where R: gfx::Resources, + D: gfx::traits::DeviceExt { device.create_pipeline_simple(&[], &[], testpipe::new()).unwrap() } @@ -58,9 +59,9 @@ gfx_pipeline_base!( testraw { target: gfx::RawRenderTarget, }); -fn _test_raw(device: &mut D) -> gfx::PipelineState where - R: gfx::Resources, - D: gfx::traits::DeviceExt, +fn _test_raw(device: &mut D) -> gfx::PipelineState + where R: gfx::Resources, + D: gfx::traits::DeviceExt { let special = gfx::pso::buffer::Element { format: fm::Format(fm::SurfaceType::R32, fm::ChannelType::Float), @@ -71,8 +72,9 @@ fn _test_raw(device: &mut D) -> gfx::PipelineState where cbuf: "Locals", tex: "Specular", target: ("o_Color2", - fm::Format(fm::SurfaceType::R8_G8_B8_A8, fm::ChannelType::Unorm), - gfx::state::MASK_ALL, None), + fm::Format(fm::SurfaceType::R8_G8_B8_A8, fm::ChannelType::Unorm), + gfx::state::MASK_ALL, + None), }; device.create_pipeline_simple(&[], &[], init).unwrap() } diff --git a/src/render/Cargo.toml b/src/render/Cargo.toml index 64d360d1035..edd92916329 100644 --- a/src/render/Cargo.toml +++ b/src/render/Cargo.toml @@ -24,6 +24,7 @@ authors = ["The Gfx-rs Developers"] readme = "../../README.md" documentation = "https://docs.rs/gfx" categories = ["rendering::graphics-api"] +workspace = "../.." [lib] name = "gfx" @@ -39,3 +40,4 @@ derivative = "1.0" draw_state = "0.7" gfx_core = { path = "../core", version = "0.7.1" } log = "0.3" + diff --git a/src/support/Cargo.toml b/src/support/Cargo.toml new file mode 100644 index 00000000000..de56540505d --- /dev/null +++ b/src/support/Cargo.toml @@ -0,0 +1,98 @@ +# Copyright 2017 The Gfx-rs Developers. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[package] +name = "gfx_support" +version = "0.7.0" +description = "GFX support application framework" +homepage = "https://github.com/gfx-rs/gfx" +repository = "https://github.com/gfx-rs/gfx" +keywords = ["graphics", "gamedev"] +license = "Apache-2.0" +authors = ["The Gfx-rs Developers"] +readme = "README.md" +documentation = "https://docs.rs/gfx_support" +workspace = "../.." + +[lib] +name = "gfx_support" + +[features] +default = ["gl"] +mint = ["gfx/mint", "gfx_core/mint"] +metal = ["gfx_device_metal", "gfx_window_metal", "gfx_device_metalll"] +metal_argument_buffer = ["gfx_device_metalll/argument_buffer"] +gl = ["gfx_device_gl", "gfx_window_glutin"] +dx11 = ["gfx_device_dx11", "gfx_window_dxgi"] +dx12 = ["gfx_device_dx12", "gfx_window_dxgi"] +vulkan = ["gfx_device_vulkan", "gfx_device_vulkanll", "gfx_window_vulkan"] +serialize = ["gfx/serialize", "gfx_core/serialize"] +headless = ["gfx_window_glutin/headless"] +unstable = [] + +[dependencies.gfx_device_vulkan] +path = "../backend/vulkan" +version = "0.2" +optional = true + +[dependencies.gfx_device_vulkanll] +path = "../backend/vulkanll" +version = "0.1" +optional = true + +[dependencies.gfx_window_vulkan] +path = "../window/vulkan" +version = "0.3" +optional = true + +[dependencies.gfx_device_metal] +path = "../backend/metal" +version = "0.3" +optional = true + +[dependencies.gfx_window_metal] +path = "../window/metal" +version = "0.4" +optional = true + +[dependencies.gfx_device_metalll] +path = "../backend/metalll" +version = "0.2" +optional = true +#features = ["native_fence"] + +[target.'cfg(windows)'.dependencies] +gfx_device_dx11 = { path = "../backend/dx11", version = "0.6", optional = true } +gfx_device_dx12 = { path = "../backend/dx12", version = "0.1", optional = true } +gfx_window_dxgi = { path = "../window/dxgi", version = "0.9", optional = true } +gfx_device_dx12ll = { path = "../backend/dx12ll", version = "0.1" } + +[dependencies] +log = "0.3" +env_logger = "0.4" +glutin = "0.9" +winit = "0.7" +gfx_core = { path = "../core", version = "0.7.1" } +gfx = { path = "../render", version = "0.16" } + +gfx_device_gl = { path = "../backend/gl", version = "0.14", optional = true } +gfx_window_glutin = { path = "../window/glutin", version = "0.17", optional = true } + +[dev-dependencies] +cgmath = "0.15" +gfx_gl = "0.3" +rand = "0.3" +genmesh = "0.5" +noise = "0.4" +image = "0.15" diff --git a/src/lib.rs b/src/support/src/lib.rs similarity index 100% rename from src/lib.rs rename to src/support/src/lib.rs diff --git a/src/shade.rs b/src/support/src/shade.rs similarity index 100% rename from src/shade.rs rename to src/support/src/shade.rs diff --git a/src/window/dxgi/Cargo.toml b/src/window/dxgi/Cargo.toml index af1489b78e3..1c5a511a454 100644 --- a/src/window/dxgi/Cargo.toml +++ b/src/window/dxgi/Cargo.toml @@ -22,6 +22,7 @@ keywords = ["graphics", "gamedev"] license = "Apache-2.0" authors = ["The Gfx-rs Developers"] documentation = "https://docs.rs/gfx_window_dxgi" +workspace = "../../.." [lib] name = "gfx_window_dxgi" diff --git a/src/window/glfw/Cargo.toml b/src/window/glfw/Cargo.toml index d8246993832..c0949dfeafb 100644 --- a/src/window/glfw/Cargo.toml +++ b/src/window/glfw/Cargo.toml @@ -23,6 +23,7 @@ license = "Apache-2.0" authors = ["The Gfx-rs Developers"] readme = "README.md" documentation = "https://docs.rs/gfx_window_glfw" +workspace = "../../.." [lib] name = "gfx_window_glfw" diff --git a/src/window/glutin/Cargo.toml b/src/window/glutin/Cargo.toml index 86b77d91701..8dc6ed88459 100644 --- a/src/window/glutin/Cargo.toml +++ b/src/window/glutin/Cargo.toml @@ -23,6 +23,7 @@ license = "Apache-2.0" authors = ["The Gfx-rs Developers"] readme = "README.md" documentation = "https://docs.rs/gfx_window_glutin" +workspace = "../../.." [lib] name = "gfx_window_glutin" diff --git a/src/window/metal/Cargo.toml b/src/window/metal/Cargo.toml index edc97a03455..e68a679467d 100644 --- a/src/window/metal/Cargo.toml +++ b/src/window/metal/Cargo.toml @@ -22,6 +22,7 @@ keywords = ["graphics", "gamedev"] license = "Apache-2.0" authors = ["The Gfx-rs Developers"] documentation = "https://docs.rs/gfx_window_metal" +workspace = "../../.." [lib] name = "gfx_window_metal" diff --git a/src/window/sdl/Cargo.toml b/src/window/sdl/Cargo.toml index eddcc7fbb5f..ae19a8b26ad 100644 --- a/src/window/sdl/Cargo.toml +++ b/src/window/sdl/Cargo.toml @@ -22,6 +22,7 @@ keywords = ["graphics", "gamedev"] license = "Apache-2.0" authors = ["The Gfx-rs Developers"] documentation = "https://docs.rs/gfx_window_sdl" +workspace = "../../.." [lib] name = "gfx_window_sdl" diff --git a/src/window/vulkan/Cargo.toml b/src/window/vulkan/Cargo.toml index 434c47e7d19..267daf7755d 100644 --- a/src/window/vulkan/Cargo.toml +++ b/src/window/vulkan/Cargo.toml @@ -8,6 +8,7 @@ keywords = ["graphics", "gamedev"] license = "Apache-2.0" authors = ["The Gfx-rs Developers"] documentation = "https://docs.rs/gfx_window_vulkan" +workspace = "../../.." [lib] name = "gfx_window_vulkan"