mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-22 07:21:04 +01:00
Fix bind group initialization in benchmarks (#6916)
This commit is contained in:
1 parent
90a97a1ed9
commit
2cfea40acc
3 files changed
+39
-39
No files matched your search
@@ -62,52 +62,52 @@ impl BindGroupState {
|
||||
fn run_bench(ctx: &mut Criterion) {
|
||||
let state = LazyLock::new(BindGroupState::new);
|
||||
|
||||
if !state
|
||||
.device_state
|
||||
.device
|
||||
.features()
|
||||
.contains(wgpu::Features::TEXTURE_BINDING_ARRAY)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
let mut group = ctx.benchmark_group("Bind Group Creation");
|
||||
|
||||
for count in [5, 50, 500, 5_000, 50_000] {
|
||||
if count
|
||||
> state
|
||||
.device_state
|
||||
.device
|
||||
.limits()
|
||||
.max_sampled_textures_per_shader_stage
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
let bind_group_layout =
|
||||
state
|
||||
.device_state
|
||||
.device
|
||||
.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
label: None,
|
||||
entries: &[wgpu::BindGroupLayoutEntry {
|
||||
binding: 0,
|
||||
visibility: wgpu::ShaderStages::FRAGMENT,
|
||||
ty: wgpu::BindingType::Texture {
|
||||
sample_type: wgpu::TextureSampleType::Float { filterable: true },
|
||||
view_dimension: wgpu::TextureViewDimension::D2,
|
||||
multisampled: false,
|
||||
},
|
||||
count: Some(NonZeroU32::new(count).unwrap()),
|
||||
}],
|
||||
});
|
||||
|
||||
group.throughput(Throughput::Elements(count as u64));
|
||||
group.bench_with_input(
|
||||
format!("{} Element Bind Group", count),
|
||||
&count,
|
||||
|b, &count| {
|
||||
b.iter_custom(|iters| {
|
||||
if !state
|
||||
.device_state
|
||||
.device
|
||||
.features()
|
||||
.contains(wgpu::Features::TEXTURE_BINDING_ARRAY)
|
||||
{
|
||||
return Duration::ZERO;
|
||||
}
|
||||
|
||||
if count
|
||||
> state
|
||||
.device_state
|
||||
.device
|
||||
.limits()
|
||||
.max_sampled_textures_per_shader_stage
|
||||
{
|
||||
return Duration::ZERO;
|
||||
}
|
||||
|
||||
let bind_group_layout = state.device_state.device.create_bind_group_layout(
|
||||
&wgpu::BindGroupLayoutDescriptor {
|
||||
label: None,
|
||||
entries: &[wgpu::BindGroupLayoutEntry {
|
||||
binding: 0,
|
||||
visibility: wgpu::ShaderStages::FRAGMENT,
|
||||
ty: wgpu::BindingType::Texture {
|
||||
sample_type: wgpu::TextureSampleType::Float {
|
||||
filterable: true,
|
||||
},
|
||||
view_dimension: wgpu::TextureViewDimension::D2,
|
||||
multisampled: false,
|
||||
},
|
||||
count: Some(NonZeroU32::new(count).unwrap()),
|
||||
}],
|
||||
},
|
||||
);
|
||||
|
||||
let texture_view_refs: Vec<_> =
|
||||
state.texture_views.iter().take(count as usize).collect();
|
||||
|
||||
|
||||
@@ -550,7 +550,7 @@ fn run_bench(ctx: &mut Criterion) {
|
||||
|
||||
// Need bindless to run this benchmark
|
||||
if state.bindless_bind_group.is_none() {
|
||||
return Duration::from_secs_f32(1.0);
|
||||
return Duration::from_secs(1);
|
||||
}
|
||||
|
||||
let mut duration = Duration::ZERO;
|
||||
|
||||
@@ -457,7 +457,7 @@ fn run_bench(ctx: &mut Criterion) {
|
||||
|
||||
// This benchmark hangs on Apple Paravirtualized GPUs. No idea why.
|
||||
if state.device_state.adapter_info.name.contains("Paravirtual") {
|
||||
return Duration::from_secs_f32(1.0);
|
||||
return Duration::from_secs(1);
|
||||
}
|
||||
|
||||
let mut duration = Duration::ZERO;
|
||||
|
||||
Reference in new issue
Block a user