mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-29 17:44:09 +01:00
Prevent OpenGL from taking preference over Vulkan (#2853)
* Prevent OpenGL from taking preference over Vulkan * update changelog * fix wasm build of example
This commit is contained in:
1 parent
b574354af4
commit
1da5bbd7b4
6 files changed
+34
-10
No files matched your search
@@ -11,6 +11,10 @@ cargo run --example hello
|
||||
## Example output
|
||||
|
||||
```
|
||||
# You might see different output as it depends on your graphics card
|
||||
AdapterInfo { name: "Intel(R) UHD Graphics 630", vendor: 0, device: 0, device_type: IntegratedGpu, backend: Metal }
|
||||
# You might see different output as it depends on your graphics card and drivers
|
||||
Available adapters:
|
||||
AdapterInfo { name: "AMD RADV VEGA10", vendor: 4098, device: 26751, device_type: DiscreteGpu, backend: Vulkan }
|
||||
AdapterInfo { name: "llvmpipe (LLVM 12.0.0, 256 bits)", vendor: 65541, device: 0, device_type: Cpu, backend: Vulkan }
|
||||
AdapterInfo { name: "Radeon RX Vega (VEGA10, DRM 3.41.0, 5.13.0-52-generic, LLVM 12.0.0)", vendor: 4098, device: 0, device_type: Other, backend: Gl }
|
||||
Selected adapter: AdapterInfo { name: "AMD RADV VEGA10", vendor: 4098, device: 26751, device_type: DiscreteGpu, backend: Vulkan }
|
||||
```
|
||||
@@ -1,13 +1,23 @@
|
||||
/// This example shows how to describe the adapter in use.
|
||||
async fn run() {
|
||||
#[cfg_attr(target_arch = "wasm32", allow(unused_variables))]
|
||||
let adapter = wgpu::Instance::new(wgpu::Backends::all())
|
||||
.request_adapter(&wgpu::RequestAdapterOptions::default())
|
||||
.await
|
||||
.unwrap();
|
||||
let adapter = {
|
||||
let instance = wgpu::Instance::new(wgpu::Backends::all());
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
println!("Available adapters:");
|
||||
for a in instance.enumerate_adapters(wgpu::Backends::all()) {
|
||||
println!(" {:?}", a.get_info())
|
||||
}
|
||||
}
|
||||
instance
|
||||
.request_adapter(&wgpu::RequestAdapterOptions::default())
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
println!("{:?}", adapter.get_info())
|
||||
println!("Selected adapter: {:?}", adapter.get_info())
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
Reference in new issue
Block a user