Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

queue_write_texture: Validate the destination texture. #3378

Merged
merged 1 commit into from
Jan 14, 2023

Conversation

jimblandy
Copy link
Member

Calling queue_write_texture with an invalid destination texture id panics, rather than returning an error.

Steps to reproduce from JavaScript:

const adapter = await navigator.gpu.requestAdapter()
const device = await adapter.requestDevice()
const texture = device.createTexture({
  size: [0, 3798880576, 56],
  format: 'bc3-rgba-unorm-srgb',
  usage: GPUTextureUsage.COPY_SRC,
})

const buffer = new ArrayBuffer(64)
device.queue.writeTexture({ texture: texture }, buffer, { bytesPerRow: 3509731313 }, { width: 7251 })

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@jimblandy jimblandy requested a review from nical January 13, 2023 21:22
@jimblandy jimblandy force-pushed the write-texture-validate-texture branch from 6b8d53b to 70ea09f Compare January 14, 2023 01:11
@nical nical merged commit 8c9f3f1 into gfx-rs:master Jan 14, 2023
@nical
Copy link
Contributor

nical commented Jan 14, 2023

Oops I didn't wait for a changelog entry

@jimblandy
Copy link
Member Author

Oops I didn't wait for a changelog entry

Addressed in fac4731.

@jimblandy jimblandy deleted the write-texture-validate-texture branch December 13, 2023 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants