Skip to content

[vulkan] acceleration structure in a descriptor pool are not properly allocated #6859

@Vecvec

Description

@Vecvec

Description
When calculating the counts for a each descriptor type in a descriptor pool acceleration structures are not placed in the array.

//Note: ignoring other types, since they can't appear here
let unfiltered_counts = [
(vk::DescriptorType::SAMPLER, descriptor_count.sampler),
(
vk::DescriptorType::SAMPLED_IMAGE,
descriptor_count.sampled_image,
),
(
vk::DescriptorType::STORAGE_IMAGE,
descriptor_count.storage_image,
),
(
vk::DescriptorType::UNIFORM_BUFFER,
descriptor_count.uniform_buffer,
),
(
vk::DescriptorType::UNIFORM_BUFFER_DYNAMIC,
descriptor_count.uniform_buffer_dynamic,
),
(
vk::DescriptorType::STORAGE_BUFFER,
descriptor_count.storage_buffer,
),
(
vk::DescriptorType::STORAGE_BUFFER_DYNAMIC,
descriptor_count.storage_buffer_dynamic,
),
];

This can lead to Out Of Memory errors on some platforms.
This may also be causing the OOMs in bindgroup creation from #6727 (but not the seg-faults).

Repro steps
Run any ray-tracing example (e.g ray_cube_compute) on a gpu that cares about these (e.g an Intel Arc IGPU)

Expected vs observed behavior
We should allocate this correctly

Extra materials
Section of logs

[2025-01-05T09:28:39Z INFO  wgpu_examples::framework] Entering event loop...
[2025-01-05T09:28:39Z INFO  wgpu_examples::framework] Surface resume PhysicalSize { width: 800, height: 600 }
[2025-01-05T09:28:39Z INFO  wgpu_core::device::ray_tracing] Created blas Id(0,1) with CreateBlasDescriptor { label: None, flags: AccelerationStructureFlags(PREFER_FAST_TRACE), update_mode: Build }
[2025-01-05T09:28:39Z INFO  wgpu_core::device::ray_tracing] Created tlas Id(0,1) with CreateTlasDescriptor { label: None, max_instances: 64, flags: AccelerationStructureFlags(PREFER_FAST_TRACE), update_mode: Build }
[2025-01-05T09:28:39Z ERROR wgpu::backend::wgpu_core] Handling wgpu errors as fatal by default
thread 'main' panicked at wgpu\src\backend\wgpu_core.rs:1175:26:
wgpu error: Validation Error

Caused by:
  In Device::create_bind_group
    Not enough memory left.

Platform
Trunk, Intel arc IGPU.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions