Skip to content

Use texStorage + texSubImage instead of texImage #151

@dmnsgn

Description

@dmnsgn

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/featA new featuretype/perfA code change that improves performance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions