bors[bot] 451cd217bb Merge #1729
1729: Handle Multi-threaded EGL Context Access r=cwfitzgerald,kvark a=zicklag

**Connections**
https://github.com/gfx-rs/wgpu/discussions/1630, https://github.com/bevyengine/bevy/issues/841

**Description**
Implements the synchronization necessary to use the GL backend from multiple threads. Accomplishes this by using a mutex around the GL context with extra wrapping to bind and unbind the EGL context when locking and unlocking.

**Testing**
Tested on Ubunty 20.04 with a fork of the Bevy game engine and the WGPU examples ( not that the examples test the multi-threading ).

## Remaining Issues

There is only one Bevy example I cannot get to run yet and it's the `load_gltf` example. It fails with a shader translation error:

```
Jul 26 20:36:50.949 ERROR naga::back::glsl: Conflicting samplers for _group_3_binding_10    
Jul 26 20:36:50.950  WARN wgpu::backend::direct: Shader translation error for stage FRAGMENT: A image was used with multiple samplers    
Jul 26 20:36:50.950  WARN wgpu::backend::direct: Please report it to https://github.com/gfx-rs/naga    
Jul 26 20:36:50.950 ERROR wgpu::backend::direct: wgpu error: Validation Error

Caused by:
    In Device::create_render_pipeline
    Internal error in FRAGMENT shader: A image was used with multiple samplers
```

Interestingly, I think the shader in question doesn't have a `group(3), binding(10)` anywhere that I know of so I'm going to have to drill down a bit more and find out exactly which shader translation is failing more.

This could potentially be fixed in a separate PR. I think the rest of this PR is rather straight-forward and the fix for the error above is probably mostly unrelated to the primary changes made in this PR.

Co-authored-by: Zicklag <zicklag@katharostech.com>
2021-07-27 19:43:12 +00:00
2021-07-12 23:38:06 -04:00
2021-06-19 21:06:08 +03:00
2020-12-03 14:52:38 -05:00
2021-07-23 14:30:38 +03:00
2021-07-02 00:13:33 -04:00
2021-07-14 16:21:26 -04:00
2021-07-21 23:54:46 -04:00
2021-06-18 13:40:31 -04:00
2021-06-18 13:40:31 -04:00
2020-03-03 00:10:04 -03:30
2021-07-13 01:04:07 -04:00
2020-04-06 08:55:39 -04:00

wgpu

Matrix Matrix Build Status codecov.io

This is an implementation of WebGPU API in Rust, targeting both native and the Web. See the upstream WebGPU specification (work in progress).

The repository hosts the following parts:

  • Crates.io docs.rs - public Rust API for users
  • Crates.io docs.rs - internal Rust API for WebGPU implementations to use
  • Crates.io docs.rs - internal unsafe GPU abstraction API
  • Crates.io - program that prints out information about all the adapters on the system or invokes a command for every adapter.
  • Crates.io docs.rs - Rust types shared between wgpu-core and wgpu-rs
  • player - standalone application for replaying the API traces, uses winit

Rust examples can be found at wgpu/examples. wgpu is a default member, so you can run the examples directly from the root, e.g. cargo run --example boids.

If you are looking for the native implementation or bindings to the API in other languages, you need wgpu-native.

Supported Platforms

API Windows 7/10 Linux & Android macOS & iOS
DX11 🚧
DX12 🆗
Vulkan
Metal
GLes3 🆗

= Primary support — 🆗 = Secondary support — 🚧 = Unsupported, but support in progress

Testing Infrastructure

wgpu features a set of unit, integration, and example based tests. All framework based examples are automatically reftested against the screenshot in the example directory. The wgpu-info example contains the logic which can automatically run the tests multiple times for all the adapters present on the system. These tests are also run on CI on windows and linux over Vulkan/DX12/DX11/GL on software adapters.

To run the test suite, run the following command:

cargo run --bin wgpu-info -- cargo test --no-fail-fast

To run any individual test on a specific adapter, populate the following environment variables:

  • WGPU_ADAPTER_NAME with a substring of the name of the adapter you want to use (ex. "1080" will match "NVIDIA GeForce 1080ti").
  • WGPU_BACKEND with the name of the backend you want to use (vulkan, metal, dx12, dx11, or gl).

Then to run an example's reftests, run:

cargo test --example <example-name> --no-fail-fast

Or run a part of the integration test suite:

cargo test -p wgpu -- <name-of-test>

If you are a user and want a way to help contribute to wgpu, we always need more help writing test cases.

Description
No description provided
Readme 137 MiB
Languages
Rust 79.9%
WGSL 16.2%
HLSL 2%
GLSL 1.7%
JavaScript 0.2%