Skip to content

Texture API issues #4290

@slimbuck

Description

@slimbuck

Some observations of the current texture API:

  • setSource only works with 'browser interface' objects (not arrays of data) and the function correctly tracks which mipmap levels are dirty using _levelsUpdated.
  • getSource will return browser interface objects and also arrays of data which it strictly probably shouldn't (since it is matched with setSource).
  • lock and unlock work with arrays data and the entire texture is always re-uploaded if any mipmap level is locked, whether for read or write.

Ideally we'd have an API that:

  • has a single way of updating both types of texture data
  • tracks which face/mipmap levels have been updated and only upload those to GPU
  • makes it simple to get, set and dirtify individual faces/levels

Also, the current API assumes textures have CPU-side data which is uploaded to GPU. However we often have GPU-side texture data which we want to copy back to CPU.

@mvaligursky are there any additional restrictions or requirements imposed by webgpu on texture handling?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions