mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
feat: add `sharedTexture` module. Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: reito <reito@chromium.org>
22 lines
617 B
JavaScript
22 lines
617 B
JavaScript
window.initWebGpu().catch((err) => {
|
|
console.error('Failed to initialize WebGPU:', err);
|
|
window.textures.webGpuUnavailable();
|
|
});
|
|
|
|
window.textures.onSharedTexture(async (id, importedSubtle) => {
|
|
try {
|
|
// Step 7: Get VideoFrame from the imported texture
|
|
const frame = importedSubtle.getVideoFrame();
|
|
|
|
// Step 8: Render using WebGPU
|
|
await window.renderFrame(frame);
|
|
|
|
// Step 9: Release the VideoFrame as we no longer need it
|
|
frame.close();
|
|
} catch (error) {
|
|
console.error('Error getting VideoFrame:', error);
|
|
}
|
|
});
|
|
|
|
window.textures.verifyCapturedImage(window.verifyCapturedImage);
|