Skip to content

Hitting the MAX_COMMAND_BUFFERS limit for Metal #3084

@JayTee42

Description

@JayTee42

Description
The Metal backend enforces a limit of 2048 pending command buffers here:

const MAX_COMMAND_BUFFERS: u64 = 2048;

I am creating mipmaps for a very large (> 200 layers) texture array. My code is basically equivalent to this loop in the mipmap example (except I have to fill m x n mipmaps for m mipmap levels and n array layers):

for target_mip in 1..mip_count as usize {

Apparently, the loop hits the limit of 2048 command buffers. My code deadlocks when trying to drop the current render pass inside the loop.

Repro steps
Just reduce MAX_COMMAND_BUFFERS to something like 10 and try the mipmap example, this has the same effect.

Expected vs observed behavior
The root problem seems to be the fact that each render pass starts a new command buffer. Maybe multiple render passes can be batched into one? Or maybe wgpu can at least notify me when the limit is reached by making begin_render_pass() fallible?

Platform
wgpu 0.14, metal backend on macOS / iOS

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions