Skip to content

Commit

Permalink
Allow examples to run from any dir
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Feb 21, 2019
1 parent 855bcfe commit 038e49a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ else
endif


.PHONY: all check test doc clear lib-native lib-rust examples-native examples-rust
.PHONY: all check test doc clear lib-native lib-rust examples-native examples-rust gfx-cube

all: examples-native examples-rust examples-gfx

Expand Down Expand Up @@ -64,3 +64,6 @@ examples-rust: lib-rust examples/Cargo.toml $(wildcard wgpu-native/**/*.rs)

examples-gfx: lib-rust gfx-examples/Cargo.toml $(wildcard gfx-examples/*.rs)
cargo build --manifest-path gfx-examples/Cargo.toml --features $(FEATURE_RUST)

gfx-cube:
cargo run --manifest-path gfx-examples/Cargo.toml --bin cube --features $(FEATURE_RUST)
4 changes: 3 additions & 1 deletion gfx-examples/src/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ pub fn load_glsl(name: &str, stage: ShaderStage) -> Vec<u8> {
ShaderStage::Fragment => glsl_to_spirv::ShaderType::Fragment,
ShaderStage::Compute => glsl_to_spirv::ShaderType::Compute,
};
let path = PathBuf::from("data").join(name);
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("data")
.join(name);
let code = read_to_string(path).unwrap();
let mut output = glsl_to_spirv::compile(&code, ty).unwrap();
let mut spv = Vec::new();
Expand Down
2 changes: 1 addition & 1 deletion wgpu-bindings/wgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -696,4 +696,4 @@ WGPUTextureViewId wgpu_texture_create_view(WGPUTextureId texture_id,

void wgpu_texture_destroy(WGPUTextureId texture_id);

void wgpu_texture_view_destroy(WGPUTextureViewId _texture_view_id);
void wgpu_texture_view_destroy(WGPUTextureViewId texture_view_id);

0 comments on commit 038e49a

Please sign in to comment.