Skip to content

Dev/issue 4110 wasm 4gb swapchain rendering#4122

Open
Soumilgit wants to merge 2 commits into
mono:mainfrom
Soumilgit:dev/issue-4110-wasm-4gb-swapchain-rendering
Open

Dev/issue 4110 wasm 4gb swapchain rendering#4122
Soumilgit wants to merge 2 commits into
mono:mainfrom
Soumilgit:dev/issue-4110-wasm-4gb-swapchain-rendering

Conversation

@Soumilgit

Copy link
Copy Markdown

Description of Change

This fixes WASM rendering issues when apps run with Emscripten MAXIMUM_MEMORY=4GB.

The WebGL-backed view path now installs a guarded upload fallback for large WASM heaps. When texture upload APIs receive a typed-array view backed by a heap larger than the 2GB signed boundary, the view is copied before calling WebGL. This avoids browser-side texSubImage2D: ArrayBufferView not big enough for request failures caused by large-heap view/offset handling.

This also fixes an Uno SKXamlCanvas raster path bug where the non-secure path constructed Uint8ClampedArray with byteLength as the heap offset instead of pData.

Tests were limited by the local environment:

  • node --check passed for the changed JavaScript assets.
  • dotnet test tests/SkiaSharp.Tests.Console/SkiaSharp.Tests.Console.csproj was blocked by missing mobile workloads.
  • dotnet test tests/SkiaSharp.Tests.Console/SkiaSharp.Tests.Console.csproj -p:TargetFrameworks=net10.0 timed out locally after 10 minutes.

Bugs Fixed

API Changes

None.

Behavioral Changes

WASM WebGL views defensively copy texture upload typed-array data when the backing WASM heap is larger than 2GB. This is intended to preserve rendering correctness for apps using larger Emscripten memory limits.

Required skia PR

None.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Merged related skia PRs
  • Changes adhere to coding standard
  • Updated documentation

@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

📦 Try the packages from this PR

Warning

Do not run these scripts without first reviewing the code in this PR.

Step 1 — Download the packages

bash / macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 4122

PowerShell / Windows:

iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 4122"

Step 2 — Add the local NuGet source

dotnet nuget add source ~/.skiasharp/hives/pr-4122/packages --name skiasharp-pr-4122
More options
Option Description
--successful-only / -SuccessfulOnly Only use successful builds
--force / -Force Overwrite previously downloaded packages
--list / -List List available artifacts without downloading
--build-id ID / -BuildId ID Download from a specific build

Or download manually from Azure Pipelines — look for the nuget artifact on the build for this PR.

Remove the source when you're done:

dotnet nuget remove source skiasharp-pr-4122

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[BUG] SKSwapChainPanel text/image rendering breaks when Emscripten MAXIMUM_MEMORY is set to 4GB

1 participant