playcanvas / playcanvas/engine

Texture API issues

Open
#4,290 8 comments 0 reactions 1 assignee View on GitHub

@slimbuck is already working on this.

Since May 31, 2022.

area: graphics enhancement
Dominant language
JavaScript
Stars
16.8k
Forks
2k
Avg merge
4h 32m
Merged PRs (30d)
222

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.