-
Notifications
You must be signed in to change notification settings - Fork 335
Merge GPUTextureCopyView.arrayLayer into .origin.z #730
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
Similar to what was done for GPUTextureDescriptor in gpuweb#613, I just missed it.
I'd like to discuss the Also none of the native APIs do this and instead they have an explicit array layer count:
|
Let's discuss it. If we revert then I'd like to do #520 instead. |
After some offline discussion, looking copies available in all APIs, and remembering that 1D array textures exist (we should maybe have them in WebGPU), I'd like to retract my previous concern. What we can do is better educate users and have nice representations of 2D array that looks like a cube and 1D array that looks like a plan. |
An example of spec complexity arising from separating arrayLayer from depth:
from https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#VUID-VkImageCopy-extent-00140
from just below that, https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#VUID-VkImageCopy-srcImage-01790 |
[editors call] Since this change is conceptually part of #613, which was approved by the group, merging without rehashing the discussion. |
Actually, now that we have landed copyTextureToTexture, this change needs more complete edits. While I was at it I fixed the subresource range set issue and added Origin3D. |
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.
A few minor edits required, looks good in general!
is {{GPUTextureDimension/"2d"}}: | ||
- For each |arrayLayer| of the |copySize|.[=Extent3D/depth=] [=array layers=] | ||
starting at |textureCopyView|.{{GPUTextureCopyView/origin}}.[=Origin3D/z=]: | ||
- The [=subresource=] of |textureCopyView|.{{GPUTextureCopyView/texture}} at |
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 wonder if it's going to be cleaner to define a subresource in a function manner, i.e. [$subresource$](texture, mipmapLevel, arrayLayer)
. This is just an idea, not something you have to fix here.
|
||
An <dfn dfn>Origin3D</dfn> is a {{GPUOrigin3D}}. | ||
[=Origin3D=] is a spec namespace for the following definitions: | ||
<!-- This is silly, but provides convenient syntax for the spec. --> |
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.
what's silly is that we allow both sequence and dictionary representation here, even though sequences are more heavy and can be trivially converted to a dictionary on the user side. This whole section wouldn't need to exist.
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.
Why are sequences more heavy? On the syntax side they're much lighter at least.
As you know I still want to accept only sequence here, but if there's a strong preference we can change it back to dictionary-only. FWIW at some point I do want to consider making it so different users of this type have different defaults (e.g. some require all 3, some require only 2 or 1).
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.
AFAIK, because sequence is a separate object in JS. For this reason we wanted to avoid them in setVertexBuffers
, for example.
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.
A dictionary is also a separate object though. We would avoid a dictionary in setVertexBuffers too.
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.
Indeed! Would there be a difference when coming from WASM though?
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.
Yes actually, I keep forgetting about this. sequence
allows a typed array, and actually I think any iterable (I just tried it with a Float32Array, and a generator (function*() { ... })()
and those worked. Set didn't work but maybe it's supposed to.)
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.
So would it be correct to say that sequence
is heavier for WASM case?
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'd say it's slightly lighter. For WASM you can do any of:
{ x: HEAPF32[i], y: HEAPF32[i + 1], z: HEAPF32[i + 2] }
copy and construct dict[ HEAPF32[i], HEAPF32[i + 1], HEAPF32[i + 2] ]
copy and construct arrayHEAPF32.slice(i, i + 3)
create new Float32Array + ArrayBuffer and memcpyHEAPF32.subarray(i, i + 3)
create new Float32Array pointing to same ArrayBuffer
* Merge GPUTextureCopyView.arrayLayer into .origin.z Similar to what was done for GPUTextureDescriptor in gpuweb#613, I just missed it. * update more text as needed * address comments
* Merge GPUTextureCopyView.arrayLayer into .origin.z Similar to what was done for GPUTextureDescriptor in gpuweb#613, I just missed it. * update more text as needed * address comments
* Merge GPUTextureCopyView.arrayLayer into .origin.z Similar to what was done for GPUTextureDescriptor in gpuweb#613, I just missed it. * update more text as needed * address comments
Similar to what was done for GPUTextureDescriptor in #613, I just missed it.
Preview | Diff