Skip to content

Commit

Permalink
Test WebGPU backend with extra features
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Jan 6, 2022
1 parent 4bfa272 commit 043e36c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,14 @@ jobs:
- name: check web
if: matrix.kind == 'web'
run: |
cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu
# build examples
cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu --examples
# Build for WebGL
cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu --features webgl -- -D warnings
# build with features
cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu --features glsl,spirv
# build for WebGL
cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu --features webgl
# build docs
cargo doc --target ${{ matrix.target }} -p wgpu --no-deps
Expand Down
4 changes: 4 additions & 0 deletions wgpu-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ git = "https://github.com/gfx-rs/naga"
rev = "09d35f3"
#version = "0.8"

# DEV dependencies

[dev-dependencies.naga]
git = "https://github.com/gfx-rs/naga"
rev = "09d35f3"
Expand All @@ -94,4 +96,6 @@ features = ["wgsl-in"]
[dev-dependencies]
env_logger = "0.8"
winit = "0.26" # for "halmark" example

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
glutin = "0.28" # for "gles" example
7 changes: 6 additions & 1 deletion wgpu-hal/examples/raw-gles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
//! the ability to hook up wgpu-hal to an existing context and draw into it.

extern crate wgpu_hal as hal;
use hal::{Adapter as _, CommandEncoder as _, Device as _, Queue as _};

#[cfg(target_arch = "wasm32")]
fn main() {}

#[cfg(not(target_arch = "wasm32"))]
fn main() {
use hal::{Adapter as _, CommandEncoder as _, Device as _, Queue as _};

env_logger::init();
println!("Initializing external GL context");

Expand Down
5 changes: 4 additions & 1 deletion wgpu-info/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@ fn print_info_from_adapter(adapter: &wgpu::Adapter, idx: usize) {
}
}

#[cfg(target_arch = "wasm32")]
fn main() {}

#[cfg(not(target_arch = "wasm32"))]
fn main() {
env_logger::init();

let args: Vec<_> = std::env::args().skip(1).collect();

let instance = wgpu::Instance::new(wgpu::Backends::all());
Expand Down
2 changes: 2 additions & 0 deletions wgpu/examples/hello-windows/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(target_arch = "wasm32", allow(dead_code))]

use std::collections::HashMap;
use winit::{
event::{Event, WindowEvent},
Expand Down

0 comments on commit 043e36c

Please sign in to comment.