Repository navigation
fix(ext/webgpu): allow empty writeBuffer data - #37264
Open
caiotheodoro wants to merge 1 commit into
Open
caiotheodoro wants to merge 1 commit into
caiotheodoro wants to merge 1 commit into
Conversation
GPUQueue.writeBuffer() panicked for empty ArrayBuffers, typed arrays, and views because V8 uses a null data pointer for zero-length backing stores. Return an empty slice when the input byte length is zero so wgpu can treat the write as a no-op. Fixes denoland#37182
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #37182.
GPUQueue.writeBuffer()panicked for emptyArrayBuffers, typed arrays, and views because V8 uses a null data pointer for zero-length backing stores. Deno unwrapped that missing pointer while converting the input to a slice, before wgpu could treat the empty write as a no-op.This change returns an empty slice when the input byte length is zero. Non-empty inputs use the existing slice construction.
Added a regression test covering:
new ArrayBuffer(0)new Uint8Array(0)new DataView(new ArrayBuffer(0))Validation performed on macOS aarch64:
ext/webgpu/queue.rs:160cargo build --bin denopasses1 passed | 0 failedtools/format.jspassestools/lint.js --jspassesAI assistance was used to prepare this patch; the validation results above are from local runs.