From 5f8d408fb82375aab901cd20ac2e7682007b4dc9 Mon Sep 17 00:00:00 2001 From: Jamie Nicol Date: Tue, 27 May 2025 09:13:58 +0100 Subject: [PATCH] [deno_webgpu] Add stub GPUExternalTexture implementation This doesn't do anything yet, but unblocks running some CTS tests. --- cts_runner/src/bootstrap.js | 1 + deno_webgpu/01_webgpu.js | 2 ++ deno_webgpu/lib.rs | 1 + deno_webgpu/texture.rs | 11 +++++++++++ 4 files changed, 15 insertions(+) diff --git a/cts_runner/src/bootstrap.js b/cts_runner/src/bootstrap.js index 8984ba009..6f3a2dc3a 100644 --- a/cts_runner/src/bootstrap.js +++ b/cts_runner/src/bootstrap.js @@ -200,6 +200,7 @@ const windowOrWorkerGlobalScope = { GPUTextureUsage: util.nonEnumerable(webgpu.GPUTextureUsage), GPUTexture: util.nonEnumerable(webgpu.GPUTexture), GPUTextureView: util.nonEnumerable(webgpu.GPUTextureView), + GPUExternalTexture: util.nonEnumerable(webgpu.GPUExternalTexture), GPUSampler: util.nonEnumerable(webgpu.GPUSampler), GPUBindGroupLayout: util.nonEnumerable(webgpu.GPUBindGroupLayout), GPUPipelineLayout: util.nonEnumerable(webgpu.GPUPipelineLayout), diff --git a/deno_webgpu/01_webgpu.js b/deno_webgpu/01_webgpu.js index 5fd4ca309..5345a2e62 100644 --- a/deno_webgpu/01_webgpu.js +++ b/deno_webgpu/01_webgpu.js @@ -35,6 +35,7 @@ import { GPUSupportedLimits, GPUTexture, GPUTextureView, + GPUExternalTexture, op_create_gpu, } from "ext:core/ops"; const { @@ -866,6 +867,7 @@ export { GPUTexture, GPUTextureUsage, GPUTextureView, + GPUExternalTexture, GPUUncapturedErrorEvent, GPUValidationError, initGPU, diff --git a/deno_webgpu/lib.rs b/deno_webgpu/lib.rs index 708ed7674..6ce31a29c 100644 --- a/deno_webgpu/lib.rs +++ b/deno_webgpu/lib.rs @@ -93,6 +93,7 @@ deno_core::extension!( adapter::GPUSupportedLimits, texture::GPUTexture, texture::GPUTextureView, + texture::GPUExternalTexture, byow::UnsafeWindowSurface, surface::GPUCanvasContext, ], diff --git a/deno_webgpu/texture.rs b/deno_webgpu/texture.rs index 1ae74ab16..7a7af62c5 100644 --- a/deno_webgpu/texture.rs +++ b/deno_webgpu/texture.rs @@ -660,3 +660,14 @@ impl From for TextureFormat { } } } + +pub struct GPUExternalTexture {} + +impl WebIdlInterfaceConverter for GPUExternalTexture { + const NAME: &'static str = "GPUExternalTexture"; +} + +impl GarbageCollected for GPUExternalTexture {} + +#[op2] +impl GPUExternalTexture {}