Skip to content

[Sketch for discussion] Separate 3d-texture depth from 2d-array-texture layer#520

Closed
kainino0x wants to merge 1 commit intogpuweb:masterfrom
kainino0x:separate-depth-and-layercount
Closed

[Sketch for discussion] Separate 3d-texture depth from 2d-array-texture layer#520
kainino0x wants to merge 1 commit intogpuweb:masterfrom
kainino0x:separate-depth-and-layercount

Conversation

@kainino0x
Copy link
Contributor

@kainino0x kainino0x commented Dec 17, 2019

Tries to disentangle these two concepts.

Also theoretically makes 3d array textures expressible.


Preview | Diff

Disentangles these two concepts.

Also theoretically makes 3d array textures expressible.
@Kangz
Copy link
Contributor

Kangz commented Dec 17, 2019

As mentioned in #519 the concepts of layer and depth slices become very blurry with higher feature levels because texture views allows seeing a 3D texture as a 2Darray view or vice-versa. So I don't think we should disentangled the concept, since they become a single concept in the future.

@kainino0x
Copy link
Contributor Author

Should we do the opposite of this change - try to merge "arrayLayerCount" and "depth" in other places? (e.g. texture descriptor)

@kainino0x
Copy link
Contributor Author

This was discussed in the 2020-01-06 meeting

@kvark
Copy link
Contributor

kvark commented Jan 8, 2020

As discussed, we can't completely merge the 2d-array with 3d textures, because it matters for the tiling modes (which are not exposed in the API). Separating them also makes sense for the view creation, given the ability to have arrays of cube or 3D textures. The only place where separation doesn't do good is transfer operations, but merging them only for the transfers would be inconsistent with the rest of the API... so it sounds like actually accepting this PR is most reasonable?

@Kangz
Copy link
Contributor

Kangz commented Jan 8, 2020

@kvark why does 2d-array vs. 3d matter because of tiling modes? The declared dimensionality in the GPUTextureDescriptor would decide of the tiling, but having views of the opposite dimension would still work. For example sampling 3D tiled as 2D array is simple and just requires sampling with a rounded Z coordinate.

IIRC all APIs allow reinterpreting between 2D array and 3D and have the same overloaded semantic for Z in places. I think it is a pretty clear direction in API design and something we should take into account in WebGPU.

@kainino0x
Copy link
Contributor Author

The inverse of this change would be:

  • merge GPUTextureDescriptor.size.depth and .arrayLayerCount
  • merge GPUTextureCopyView.origin.z and .arrayLayer
  • possibly rename GPUTextureViewDescriptor.baseArrayLayer and .arrayLayerCount depending on whether it should be allowed to take views of 3d texture slices

and this seems like a pretty good idea to me.

@kvark
Copy link
Contributor

kvark commented Jan 8, 2020

@Kangz yeah, I think the concern about tiling is not valid, as long as we still specify the 2D/3D in the texture descriptor.
@kainino0x how would GPUTextureDescriptor look like for cube/3D array textures?

@kainino0x
Copy link
Contributor Author

IIUC:

2D array texture:

{ dimension: "2d", size: [1, 1, 10], format, usage }

View can be dimension "2d", "2d-array", "cube", or "cube-array".

3D texture:

{ dimension: "3d", size: [1, 1, 10], format, usage }

View can only be dimension "3d".

@kainino0x
Copy link
Contributor Author

Closing in favor of doing the opposite change: consistently merge the two concepts.

@kainino0x kainino0x closed this Feb 13, 2020
@kainino0x kainino0x deleted the separate-depth-and-layercount branch March 13, 2020 06:20
ben-clayton pushed a commit to ben-clayton/gpuweb that referenced this pull request Sep 6, 2022
Now node.tsconfig.json only excludes files that use or transitively
use import.meta.url. This is not available until more recent versions
of Node.js.
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.

3 participants