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
[WebGPU] mip level validation is not handled correctly in copyBuffer/TextureToBuffer/Texture #11727
Conversation
EWS run on previous version of this PR (hash 986ca43) |
|| destination.origin.x + widthForMetal > logicalSize.width | ||
|| destination.origin.y + heightForMetal > logicalSize.height | ||
|| destination.origin.z + depthForMetal > logicalSize.depthOrArrayLayers | ||
|| sourceBytesPerRow > 2048) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe 2048 should be from one of the device limits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't find a device limit, please document with a FIXME to come back and fix it up later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!widthForMetal || !heightForMetal) | ||
return; | ||
|
||
if (widthForMetal * heightForMetal > destinationBuffer.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is wrong, at least it causes a regression in compressed texture formats copyTextureToTexture cases
β¦TextureToBuffer/Texture https://bugs.webkit.org/show_bug.cgi?id=254175 <radar://106958194> Reviewed by NOBODY (OOPS!). The correct sizes were already computed in logicalMiplevelSpecificTextureExtent but they were not used for validation. * Source/WebGPU/WebGPU/CommandEncoder.mm: (WebGPU::CommandEncoder::copyBufferToTexture): (WebGPU::CommandEncoder::copyTextureToBuffer): * Source/WebGPU/WebGPU/Queue.mm: (WebGPU::Queue::writeTexture): 3D textures with rowBytes > 2048 will assert in Metal in debug and release. * Source/WebGPU/WebGPU/Texture.mm: (WebGPU::Texture::validateLinearTextureData): Metal requires the copy size to be a multiple of the block size.
986ca43
to
77d269e
Compare
EWS run on current version of this PR (hash 77d269e) |
Closing since some of this validation is incorrect |
77d269e
77d269e