wgpu/examples
Andreas Reich 0ffdae31a1
Metal encoder & pass timestamp support (#4008)
Implements timer queries via write_timestamp on Metal for encoders (whenever timer queries are available) and passes (for Intel/AMD GPUs, where we should advertise TIMESTAMP_QUERY_INSIDE_PASSES now).

Due to some bugs in Metal this was a lot harder than expected. I believe the solution is close to optimal with the current restrictions in place. For details see code comments.
2023-09-16 20:01:46 +00:00
..
boids Skip test_multithreaded_compute on MoltenVK. (#4096) 2023-09-04 03:54:39 +00:00
bunnymark feature: Timestamp queries (#3636) 2023-08-02 18:04:24 -04:00
capture Allow specifying minor GLES3 version (#3998) 2023-08-16 11:51:56 -04:00
common Skip test_multithreaded_compute on MoltenVK. (#4096) 2023-09-04 03:54:39 +00:00
conservative-raster feature: Timestamp queries (#3636) 2023-08-02 18:04:24 -04:00
cube feature: Timestamp queries (#3636) 2023-08-02 18:04:24 -04:00
hello Formatting and example command fixes (#3872) 2023-06-15 20:05:26 +00:00
hello-compute Skip test_multithreaded_compute on MoltenVK. (#4096) 2023-09-04 03:54:39 +00:00
hello-triangle feature: Timestamp queries (#3636) 2023-08-02 18:04:24 -04:00
hello-windows feature: Timestamp queries (#3636) 2023-08-02 18:04:24 -04:00
mipmap Skip test_multithreaded_compute on MoltenVK. (#4096) 2023-09-04 03:54:39 +00:00
msaa-line Skip test_multithreaded_compute on MoltenVK. (#4096) 2023-09-04 03:54:39 +00:00
shadow Skip test_multithreaded_compute on MoltenVK. (#4096) 2023-09-04 03:54:39 +00:00
skybox Skip test_multithreaded_compute on MoltenVK. (#4096) 2023-09-04 03:54:39 +00:00
stencil-triangles feature: Timestamp queries (#3636) 2023-08-02 18:04:24 -04:00
texture-arrays feature: Timestamp queries (#3636) 2023-08-02 18:04:24 -04:00
timestamp-queries Metal encoder & pass timestamp support (#4008) 2023-09-16 20:01:46 +00:00
water feature: Timestamp queries (#3636) 2023-08-02 18:04:24 -04:00
README.md Formatting and example command fixes (#3872) 2023-06-15 20:05:26 +00:00

Structure

For the simplest examples without using any helping code (see framework.rs here), check out:

  • hello for printing adapter information
  • hello-triangle for graphics and presentation
  • hello-compute for pure computing

Notably, capture example shows rendering without a surface/window. It reads back the contents and saves them to a file.

All the examples use WGSL shaders unless specified otherwise.

All framework-based examples render to the window and are reftested against the screenshot in the directory.

Feature matrix

Feature boids bunnymark cube mipmap msaa-line shadow skybox texture-arrays water conservative-raster stencil-triangles
vertex attributes
instancing
lines and points
dynamic buffer offsets
implicit layout
sampled color textures
storage textures
comparison samplers
subresource views
cubemaps
multisampling
off-screen rendering
stencil testing
depth testing
depth biasing
read-only depth
blending
render bundles
compute passes
error scopes
optional extensions
- SPIR-V shaders
- binding array
- push constants
- depth clamping
- compressed textures
- polygon mode
- queries
- conservative rasterization
integrations
- staging belt
- typed arena
- obj loading

Hacking

You can record an API trace any of the framework-based examples by starting them as:

mkdir -p trace && WGPU_TRACE=trace cargo run --features trace --bin <example-name>