Skip to content

Conversation

GoodBoyDigital
Copy link
Member

Description of change

HTMLImages are no longer converted to a canvas onthe texture side. This now happens on the WebGPU Image upload step, as WebGL can handle Images as resources just fine!

Should help #11331 a bit with Texture.from

Pre-Merge Checklist
  • Tests and/or benchmarks are included
  • Documentation is changed or added
  • Lint process passed (npm run lint)
  • Tests passed (npm run test)

- Updated gpuUploadImageResource to convert HTMLImageElement to canvas for WebGPU compatibility.
- Removed redundant image conversion logic from ImageSource constructor.
- Added visual tests for rendering HTMLImageElement as a texture.
- Included new snapshot images for WebGL1, WebGL2, and WebGPU.
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves HTMLImageElement handling during WebGPU texture uploads by moving the canvas conversion step from the TextureSource to the GPU uploader.

  • Conversion of HTMLImageElement to canvas is now performed in the WebGPU upload step.
  • Removed legacy conversion logic from the ImageSource class.
  • Updated test files to reflect the change in conversion handling.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

File Description
src/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.ts Added conversion of HTMLImageElement to a canvas during the WebGPU upload process and implemented a corresponding warning.
src/rendering/renderers/tests/Extract.test.ts Removed an outdated test that validated conversion and warning behavior for HTMLImageElement in ImageSource.
tests/visual/scenes/textures/image-source-texture.scene.ts Added a visual test to validate rendering of textures created from HTMLImageElement.
src/rendering/renderers/shared/texture/sources/ImageSource.ts Removed canvas conversion logic for HTMLImageElement to align with the new processing path.
Comments suppressed due to low confidence (1)

src/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.ts:20

  • The new conversion logic for HTMLImageElement in the GPU uploader is not covered by any tests. Consider adding tests to verify both the canvas conversion and the proper replacement of the resource.
if (globalThis.HTMLImageElement && resource instanceof HTMLImageElement)

Copy link

codesandbox-ci bot commented Mar 21, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@Zyie Zyie added the ✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t label May 4, 2025
@Zyie Zyie added this pull request to the merge queue May 4, 2025
Merged via the queue into dev with commit 8aec2e0 May 4, 2025
5 checks passed
@Zyie Zyie deleted the chore/allow-html-image-webGL branch May 4, 2025 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Severe VRAM Management Degradation in Pixi v8 Compared to v7
3 participants