Skip to content

Skip staging buffers when using Queue::write_buffer on supported GPUs #3698

@JMS55

Description

@JMS55

Background

Currently, wgpu keeps around a pool of staging buffers that are DEVICE_LOCAL_BIT | HOST_VISIBLE_BIT | HOST_COHERENT_BIT. Writes to GPU buffers are first written here, and then copied to the final GPU buffers. This is because systems are sometimes limited by the 256MB PCI-E limit, meaning the only DEVICE_LOCAL_BIT | HOST_VISIBLE_BIT | HOST_COHERENT_BIT heap you had was 256 MB.

However, for mobile GPUs, integrated GPUs, and now desktops with resizable bar, this limitation is removed. These devices have heaps with DEVICE_LOCAL_BIT | HOST_VISIBLE_BIT | HOST_COHERENT_BIT that range into the GBs. There's no need for staging buffers in this case.

Feature Request

wgpu should check the size of the DEVICE_LOCAL_BIT | HOST_VISIBLE_BIT | HOST_COHERENT_BIT it uses for buffer writes, and if it's greater than 256 MB, skip creating staging buffers. wgpu will then just directly write to buffers.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions