Skip to content
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

Use texStorage + texSubImage instead of texImage #151

Open
dmnsgn opened this issue Jan 16, 2025 · 0 comments
Open

Use texStorage + texSubImage instead of texImage #151

dmnsgn opened this issue Jan 16, 2025 · 0 comments
Labels
type/feat A new feature type/perf A code change that improves performance

Comments

@dmnsgn
Copy link
Member

dmnsgn commented Jan 16, 2025

Best practice for WebGL2 is texStorage + texSubImage.

texStorage has some limitations:

  • size and format cannot be changed after first call
  • but it is more performant to store/update

texImage (current):

  • easy to work with because it handles memory allocation and data upload in one call

We currently use texImage but texStorage for texture 2D Array.

We could either:

  • creation: texImage + update: check for width/height/format/type change to either texImage or if no change texSubImage
  • creation: texStorage + update: same state diff and choose texStorage/texSubImage
  • creation: texImage + update: same state diff + choose texStorage/texSubImage storage as an texture option ctx.texture2D({ ...bla, storage: true }) (like WebGPU usage maybe?)

Related:

  • our pex-renderer post-pro pipeline recycle textures
@dmnsgn dmnsgn added type/feat A new feature type/perf A code change that improves performance labels Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feat A new feature type/perf A code change that improves performance
Projects
None yet
Development

No branches or pull requests

1 participant