From b046340a5749490d87fdd21d64e0383b7b02e62d Mon Sep 17 00:00:00 2001 From: Diggory Blake Date: Mon, 30 Nov 2020 17:56:01 +0000 Subject: [PATCH] [rs] Print chosen adapter when running examples --- wgpu/README.md | 28 ++++++++++++++++++++++------ wgpu/examples/framework.rs | 18 +++++++++++++++++- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/wgpu/README.md b/wgpu/README.md index d78efc1b00..b68e6b1a8d 100644 --- a/wgpu/README.md +++ b/wgpu/README.md @@ -1,11 +1,12 @@ # wgpu-rs + [![Build Status](https://github.com/gfx-rs/wgpu-rs/workflows/CI/badge.svg?branch=master)](https://github.com/gfx-rs/wgpu-rs/actions) [![Crates.io](https://img.shields.io/crates/v/wgpu.svg)](https://crates.io/crates/wgpu) [![Docs.rs](https://docs.rs/wgpu/badge.svg)](https://docs.rs/wgpu) -[![Matrix](https://img.shields.io/badge/Dev_Matrix-%23wgpu%3Amatrix.org-blueviolet.svg)](https://matrix.to/#/#wgpu:matrix.org) +[![Matrix](https://img.shields.io/badge/Dev_Matrix-%23wgpu%3Amatrix.org-blueviolet.svg)](https://matrix.to/#/#wgpu:matrix.org) [![Matrix](https://img.shields.io/badge/User_Matrix-%23wgpu--users%3Amatrix.org-blueviolet.svg)](https://matrix.to/#/#wgpu-users:matrix.org) wgpu-rs is an idiomatic Rust wrapper over [wgpu-core](https://github.com/gfx-rs/wgpu). It's designed to be suitable for general purpose graphics and computation needs of Rust community. @@ -32,6 +33,21 @@ The `hello*` examples show bare-bones setup without any helper code. For `hello- cargo run --example hello-compute 1 2 3 4 ``` +The following environment variables can be used to configure how the framework examples run: + +- `WGPU_BACKEND` + + Options: `vulkan`, `metal`, `dx11`, `dx12`, `gl`, `webgpu` + + If unset a default backend is chosen based on what is supported + by your system. + +- `WGPU_POWER_PREF` + + Options: `low`, `high` + + If unset a low power adapter is preferred. + #### Run Examples on the Web (`wasm32-unknown-unknown`) Running on the web is still work-in-progress. You may need to enable experimental flags on your browser. Check browser implementation status on [webgpu.io](https://webgpu.io). Notably, `wgpu-rs` is often ahead in catching up with upstream WebGPU API changes. We keep the `gecko` branch pointing to the code that should work on latest Firefox. @@ -54,8 +70,8 @@ Create an `index.html` file into `target/generated` directory and add the follow ```html - - + +