Skip to content

Commit

Permalink
Fixed missing device feature in mipmap example (#3081)
Browse files Browse the repository at this point in the history
  • Loading branch information
Olaroll authored Oct 8, 2022
1 parent 02cc2ae commit f57db15
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Add the `"wgsl"` feature, to enable WGSL shaders in `wgpu-core` and `wgpu`. Enab
#### General

- Bother to free the `hal::Api::CommandBuffer` when a `wgpu_core::command::CommandEncoder` is dropped. By @jimblandy in [#3069](https://github.com/gfx-rs/wgpu/pull/3069).
- Fixed the mipmap example by adding the missing WRITE_TIMESTAMP_INSIDE_PASSES feature. By @Olaroll in [#3081](https://github.com/gfx-rs/wgpu/pull/3081).

### Testing/Internal

Expand Down
13 changes: 8 additions & 5 deletions wgpu/examples/mipmap/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ impl Example {

impl framework::Example for Example {
fn optional_features() -> wgpu::Features {
wgpu::Features::TIMESTAMP_QUERY | wgpu::Features::PIPELINE_STATISTICS_QUERY
wgpu::Features::TIMESTAMP_QUERY
| wgpu::Features::PIPELINE_STATISTICS_QUERY
| wgpu::Features::WRITE_TIMESTAMP_INSIDE_PASSES
}

fn init(
Expand Down Expand Up @@ -323,10 +325,11 @@ impl framework::Example for Example {
});

// If both kinds of query are supported, use queries
let query_sets = if device
.features()
.contains(wgpu::Features::TIMESTAMP_QUERY | wgpu::Features::PIPELINE_STATISTICS_QUERY)
{
let query_sets = if device.features().contains(
wgpu::Features::TIMESTAMP_QUERY
| wgpu::Features::PIPELINE_STATISTICS_QUERY
| wgpu::Features::WRITE_TIMESTAMP_INSIDE_PASSES,
) {
// For N total mips, it takes N - 1 passes to generate them, and we're measuring those.
let mip_passes = MIP_LEVEL_COUNT - 1;

Expand Down

0 comments on commit f57db15

Please sign in to comment.