Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move examples to explicit gfx_support crate/module. Also move to virtual cargo workspace. #1417

Merged
merged 2 commits into from
Aug 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 24 additions & 158 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
]
29 changes: 12 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <my_dir>
$ git clone https://github.com/gfx-rs/gfx

where `<my_dir>` 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 `<my_dir>/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:

Expand All @@ -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) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this row removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was indicated earlier in the discussion that it was desirable to kill of gfx_app all together.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but what about the other crates?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't realize multiple items on one line. Fixed!

| | [![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) |
Expand Down
48 changes: 41 additions & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appveyor should transit to cargo test --all --excludes ... later as not everything is tested as far as I can see. But that requires some more changes to the current gfx_window_dxgi, which we can/should address later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, yeah I played with test --all, but kept getting a linker error with d312. I wasn't sure, so I opted to keep it as before this time.

Copy link
Member

@kvark kvark Aug 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(edit: this is referring to the headers in each and every source file we have, not anything to do with this appveyor config line in particular)

Well, if you ask me, I'd rather remove all those headers entirely. They are just cluttering the source.
Last time we discussed this with the gfx-rs core team (~3 years ago? lol), the main argument for keeping the comments was that Rust uses the same scheme. Hard to counter that :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just a LICENSE file in the root directory?

- 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
}
Loading