wgpu/examples/src/stencil_triangles
Erich Gubler 765c20235e
refactor: use include_wgsl!(…) more (#6326)
This change uses `include_wgsl!(…)` in usages where an
`include_str!("….wgsl")` was used to construct
a `ShaderModuleDescriptor`'s `source, but the `label` was set to `None`.
This should (1) showcase a nice idiomatic convenience we offer in our
examples better, (2) make code more concise, and (3) get some
automatically generated labels in diagnostics where it seems it won't
hurt.
2024-09-26 08:47:57 +02:00
..
mod.rs refactor: use include_wgsl!(…) more (#6326) 2024-09-26 08:47:57 +02:00
README.md Update examples readme files (#4774) 2023-11-25 22:59:40 +00:00
screenshot.png Move to A Single Example Executable (#4756) 2023-11-23 05:26:42 -05:00
shader.wgsl Move to A Single Example Executable (#4756) 2023-11-23 05:26:42 -05:00

stencil_triangles

This example renders two different sized triangles to display three same sized triangles, by demonstrating the use of stencil buffers.

First it draws a small "mask" triangle, which sets the stencil buffer at every pixel to 1.

Then, it draws a larger "outer" triangle which only touches pixels where the stencil buffer is less than 1.

To Run

cargo run --bin wgpu-examples stencil_triangles

Screenshots

Stencil Triangles window