-
Notifications
You must be signed in to change notification settings - Fork 335
Add validation rules on copyTextureToTexture #725
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
Conversation
This patch adds the validation rules on copyTextureToTexture: - Updated "GPUTextureCopyView Valid Usage" and "Valid Texture Copy Range" to reuse them in the validations of copyTextureToTexture. - The format of the source texture must be the same as the one of the destination texture as is required on Metal. - We can only copy the whole subresource when the textures are in depth-stencil formats or the textures are multisampled as is required by D3D12. - The source and destination subresources must be different as is required by D3D12.
"The format of the source texture must be the same as the one of "We can only copy the whole subresource when the textures are in "The source and destination subresources must be different as is |
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.
Looks good to me, thank you! Just a few notes.
spec/index.bs
Outdated
{{GPUTextureCopyView}} |destination|, {{GPUExtent3D}} |copySize|, let | ||
|
||
- |copy on the whole subresource| be the copy whose parameters |source|, |destination| and |copySize| meets the following conditions: | ||
- The width of the [=physical size=] of |source|.{{GPUTextureCopyView/texture}} [=subresource=] at [=mipmap level=] {{GPUTextureCopyView/mipLevel}} must be equal to |copySize|.[=Extent3D/width=]. |
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.
can we have a short define for mip(n) of a texture to avoid repeating this 6 times?
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've written this part in another way. PTAL, thanks!
It's fine for now, but in the future we need to allow copies between different formats of the same size. In Metal, that would be done by creating a texture view with a different format, and copying into it. |
Thanks @kvark for your review. Hi @kainino0x @JusSn, could you take a look when you have time? |
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.
Was just in the middle of it :) LGTM, just some nits.
- (|textureCopyView|.{{GPUTextureCopyView/origin}}.{{GPUOrigin3DDict/y}} + |copySize|.[=Extent3D/height=]) must be less than or equal to the [=Extent3D/height=] of the [=textureCopyView subresource size=] of |textureCopyView|. | ||
- (|textureCopyView|.{{GPUTextureCopyView/arrayLayer}} + |copySize|.[=Extent3D/depth=]) must be less than or equal to the [=Extent3D/depth=] of the [=textureCopyView subresource size=] of |textureCopyView|. | ||
- |copySize|.[=Extent3D/width=] must be a multiple of |blockWidth|. | ||
- |copySize|.[=Extent3D/height=] must be a multiple of |blockHeight|. |
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.
Do we have these rules for origin.x and origin.y somewhere? Seems they should be here.
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've put them in "GPUTextureCopyView Valid Usage".
@JusSn please review this post-landing! |
We need to follow up with a clarification of what is considered to be "subresource", and that it's forbidden to have the 2 sets of subresources (source and destination) to intersect if the parent texture is the same. |
Ended up doing this in #730 because I needed to edit that text anyway. |
* Add validation rules on copyTextureToTexture This patch adds the validation rules on copyTextureToTexture: - Updated "GPUTextureCopyView Valid Usage" and "Valid Texture Copy Range" to reuse them in the validations of copyTextureToTexture. - The format of the source texture must be the same as the one of the destination texture as is required on Metal. - We can only copy the whole subresource when the textures are in depth-stencil formats or the textures are multisampled as is required by D3D12. - The source and destination subresources must be different as is required by D3D12. * Address reviewer's comments * Define "textureCopyView subresource size" in an algorithm * Address more reviewer's comments
* Add validation rules on copyTextureToTexture This patch adds the validation rules on copyTextureToTexture: - Updated "GPUTextureCopyView Valid Usage" and "Valid Texture Copy Range" to reuse them in the validations of copyTextureToTexture. - The format of the source texture must be the same as the one of the destination texture as is required on Metal. - We can only copy the whole subresource when the textures are in depth-stencil formats or the textures are multisampled as is required by D3D12. - The source and destination subresources must be different as is required by D3D12. * Address reviewer's comments * Define "textureCopyView subresource size" in an algorithm * Address more reviewer's comments
This patch adds the validation rules on copyTextureToTexture:
Range" to reuse them in the validations of copyTextureToTexture.
the destination texture as is required on Metal.
depth-stencil formats or the textures are multisampled as is
required by D3D12.
required by D3D12.
Preview | Diff