Skip to content

webgpu: Support GPUExternalTexture - #45873

Merged
sagudev merged 5 commits into
servo:mainfrom
sagudev:ext-tex
Jul 3, 2026
Merged

webgpu: Support GPUExternalTexture#45873
sagudev merged 5 commits into
servo:mainfrom
sagudev:ext-tex

Conversation

@sagudev

@sagudev sagudev commented Jun 22, 2026

Copy link
Copy Markdown
Member

The idea behind GPUExternalTexture is that one could use texture from decoder in webgpu (and make it zerocopy). We do not have any texture sharing mechanism in servo yet and so this PR does this using CPU copies. We use get_current_frame_data to obtain Snapshot which we then upload to wgpu as normal texture (PlanarTexture in the code and that is per HTMLVideoElement so we can just update instead of creating new whole texture - something similar is done in FF) which is then imported as external texture in wgpu. Unfortunately external textures only work on DirectX12 (Windows) and Metal (Mac) so on vulkan (Linux) we throw Unsupported dom exception. Nevertheless many tests now pass because they do not fail at missing GPUExternalTexture or importExternalTexture.

./servoshell.exe --pref dom_webgpu_enabled --pref dom_webgpu_wgpu_backend=dx12 https://webgpufundamentals.org/webgpu/webgpu-simple-textured-quad-external-video.html:
Servo on windows running https://webgpufundamentals.org/webgpu/webgpu-simple-textured-quad-external-video.html

Testing: Covered by WebGPU CTS (partially) and tested manually using example.

@sagudev
sagudev force-pushed the ext-tex branch 3 times, most recently from 3dfaa8a to a904e0f Compare July 2, 2026 17:21
@sagudev
sagudev marked this pull request as ready for review July 2, 2026 17:21
@sagudev
sagudev requested a review from gterzian as a code owner July 2, 2026 17:21
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jul 2, 2026
Comment thread components/script/dom/html/htmlvideoelement.rs Outdated
Comment thread components/script/dom/webgpu/gpuexternaltexture.rs Outdated
Comment thread components/script/dom/webgpu/gpuexternaltexture.rs Outdated
Comment thread components/script/dom/webgpu/gpuexternaltexture.rs Outdated
@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jul 3, 2026
@sagudev
sagudev enabled auto-merge July 3, 2026 06:18
@sagudev
sagudev added this pull request to the merge queue Jul 3, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 3, 2026
@servo-highfive servo-highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Jul 3, 2026
@yezhizhen

Copy link
Copy Markdown
Member

/_mozilla/mozilla/interfaces.https.html
FAIL [expected PASS] subtest: Interfaces exposed on the window

@sagudev
sagudev added this pull request to the merge queue Jul 3, 2026
@servo-highfive servo-highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Jul 3, 2026
@sagudev
sagudev removed this pull request from the merge queue due to a manual request Jul 3, 2026
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 3, 2026
@sagudev
sagudev enabled auto-merge July 3, 2026 13:02
@sagudev

sagudev commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

I pushed and put to queue at very close time, and we know github ops are not atomic, so I think (hope) it put old version into queue.

@yezhizhen

yezhizhen commented Jul 3, 2026

Copy link
Copy Markdown
Member

I pushed and put to queue at very close time, and we know github ops are not atomic, so I think (hope) it put old version into queue.

Shouldn't hope that by all means🤣

@yezhizhen

Copy link
Copy Markdown
Member

https://github.com/servo/servo/actions/runs/28662273305/job/85005501546
There was a pending job started

sagudev added 4 commits July 3, 2026 16:07
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
@sagudev

sagudev commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

rebased, and that should also retriggered CI

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
@sagudev
sagudev added this pull request to the merge queue Jul 3, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 3, 2026
Merged via the queue into servo:main with commit da153be Jul 3, 2026
31 checks passed
@sagudev
sagudev deleted the ext-tex branch July 3, 2026 18:02
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants