Skip to content

fix: update HTML-in-Canvas texture upload to new copyElementImageToTexture/texElementImage2D API#8828

Merged
mvaligursky merged 1 commit into
mainfrom
mv-html-in-canvas-api
Jun 3, 2026
Merged

fix: update HTML-in-Canvas texture upload to new copyElementImageToTexture/texElementImage2D API#8828
mvaligursky merged 1 commit into
mainfrom
mv-html-in-canvas-api

Conversation

@mvaligursky
Copy link
Copy Markdown
Contributor

@mvaligursky mvaligursky commented Jun 3, 2026

Update the HTML-in-Canvas texture upload paths to match the breaking API change in Chromium's HTML-in-Canvas proposal (see the explainer). This only affects Chrome Canary, not a release version of any browser.

Changes:

  • WebGPU: copyElementImageToTexture now takes two dictionaries — a source { source: element } and a destination { destination, width, height } — instead of positional (element, width, height, dst) args.
  • WebGL: texElementImage2D now takes (target, internalformat, element), dropping the old level, srcFormat, and destType parameters. The sized internal format (_glInternalFormat, e.g. gl.RGBA8) is used directly.

API Changes:

  • WebGPU, before:
    queue.copyElementImageToTexture(element, width, height, { texture })
    after:
    queue.copyElementImageToTexture({ source: element }, { destination: { texture }, width, height })
  • WebGL, before:
    gl.texElementImage2D(TEXTURE_2D, level, internalFormat, srcFormat, destType, element)
    after:
    gl.texElementImage2D(TEXTURE_2D, RGBA8, element)

These are internal graphics-layer calls; the public Texture.setSource() / Texture.upload() API is unchanged, so the html-texture and html-texture-configurator examples need no changes.

WebGPU copyElementImageToTexture now takes source and destination
dictionaries instead of positional args. WebGL texElementImage2D now
takes (target, internalformat, element), dropping level/srcFormat/destType.
@mvaligursky mvaligursky self-assigned this Jun 3, 2026
@mvaligursky mvaligursky added the area: graphics Graphics related issue label Jun 3, 2026
@mvaligursky mvaligursky merged commit ff8ee51 into main Jun 3, 2026
8 checks passed
@mvaligursky mvaligursky deleted the mv-html-in-canvas-api branch June 3, 2026 08:53
mvaligursky added a commit that referenced this pull request Jun 3, 2026
WebGPU copyElementImageToTexture now takes source and destination
dictionaries instead of positional args. WebGL texElementImage2D now
takes (target, internalformat, element), dropping level/srcFormat/destType.

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant