fix(textures): default createImageBitmapSupport to 'auto' so Chrome 38 doesn't throw#132
Merged
Merged
Conversation
…8 doesn't throw
The default was 'full', which makes CoreTextureManager set
hasCreateImageBitmap = true WITHOUT probing. On any runtime that lacks
createImageBitmap — including the documented Chrome 38 support floor, since
the API was not added until Chrome 50 — ImageTexture then calls the
undefined global via WebPlatform.createImageBitmap and throws on the first
image load.
'auto' runs the existing 1x1-PNG probe (validateCreateImageBitmap) through
the platform, correctly detecting support and falling back to `new Image()`
when it's absent. On modern browsers the probe resolves to full support, so
capability is unchanged; the only cost is a negligible one-time startup
probe. Integrators on a known-modern runtime can still set 'full'/'options'/
'basic' explicitly to skip it.
This aligns the default with the behavior BROWSERS.md already documents
("the renderer will use a 1x1 PNG Pixel to validate whether the
createImageBitmap API is available").
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Changes the default
createImageBitmapSupportfrom'full'to'auto'.Why
createImageBitmapwas not added to Chrome until v50, but the renderer's documented support floor is Chrome 38. With the old default'full',CoreTextureManagersetshasCreateImageBitmap = truewithout probing (initialize()), so on any runtime lacking the API — including Chrome 38–49 —ImageTexturecalls the undefined global throughWebPlatform.createImageBitmapand throws on the first image load. The renderer effectively did not work out-of-the-box on its own stated floor unless the integrator knew to passcreateImageBitmapSupport: 'auto'.How
'auto'runs the existing 1×1-PNG probe (validateCreateImageBitmap) through the platform, correctly detecting basic/options/full support and falling back tonew Image()when the API is absent. This path already exists and is well-tested; the fix just makes it the default.platform.createImageBitmap, custom platforms are detected correctly (a bare globaltypeofguard would not respect them).'full'/'options'/'basic'explicitly to skip the probe.Also updates the setting's doc comment (
@defaultValue, fallback behavior, and a note that forcing a level the runtime lacks will fail to load images).Reviewer notes
BROWSERS.mdalready documents: "the renderer will use a 1×1 PNG Pixel to validate whether the createImageBitmap API is available."initializedfires are drained on init, and Stage listens for theinitializedevent. No consumer contract changes.'auto'resolves to'full', so there is no visual difference; the fix matters only on runtimes withoutcreateImageBitmap. Verified viatsc --build+ existingImageTexture/Stage/ texture-manager unit tests (all green).queueMicrotaskfallback; per-frame allocation cleanups inCoreTextNode/Stage; evaluatealpha:falseon the drawing buffer.🤖 Generated with Claude Code