pub struct PendingUpload { /* private fields */ }Expand description
An UploadBatch submitted by
submit_deferred and not yet known to
have run: what it still owns, and the timeline value that says when it may
go.
§Why the textures may be sampled before it retires
The batch’s last barrier on each image leaves it in
ResourceState::ShaderRead, and what reads it next is a frame submitted
to the same queue after it. That is ordered without a host wait on every
backend here:
- Vulkan: a pipeline barrier’s second synchronisation scope is every
command later in submission order on the queue, which spans later
vkQueueSubmits, and the image’s layout is a property of the image, not of the command buffer that transitioned it. - D3D12: a resource barrier’s state persists past its command list, and
command lists on one queue run in
ExecuteCommandListsorder. An image explicitly transitioned does not decay; a buffer does, toCOMMON, the same as it does afterUploadBatch::submit’s wait. - Metal: every resource
crcbl-mtlallocates is hazard-tracked, and the driver orders tracked hazards between command buffers committed to one queue. - WebGPU: never reaches here —
UploadBatch::submit_deferredwaits on a device without timeline semaphores, which is every browser’s — andqueue.submitorder is WebGPU’s own guarantee anyway.
Another queue has none of these guarantees, which is why the batch’s queue must be the one its readers submit to.
§What it still owns
The staging and zero buffers the copies read, the command buffer
(Device::destroy_command_buffer may not run before its submission
completes) and the semaphore. poll releases them once the
semaphore has reached LANDED, without blocking;
wait blocks for it. One of the two must have released them
before the device is destroyed: dropping a pending upload leaks them, and
says so in the log, because releasing a buffer the GPU may still be reading
is the worse failure.
Implementations§
Source§impl PendingUpload
impl PendingUpload
Sourcepub const LANDED: u64 = 1
pub const LANDED: u64 = 1
The value the submission signals its semaphore to once its copies have run. The semaphore is the upload’s own, so it is the first value.
Sourcepub const fn is_retired(&self) -> bool
pub const fn is_retired(&self) -> bool
Whether everything has been released — at once for an upload that waited at its submit.
Sourcepub fn wait(&mut self, device: &dyn Device) -> Result<(), HalError>
pub fn wait(&mut self, device: &dyn Device) -> Result<(), HalError>
Blocks until the copies have run, then releases everything. Returns at once for one already retired.
No timeout, like the Device::wait_idle it replaces: a GPU that
never finishes is a lost device, which the wait reports.
§Errors
HalError from the wait. Nothing is released then.