mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
40febd9dd1
This PR contains the implementation of the External webgpu surfaces /
BYOW proposal. BYOW stands for "Bring your own window".
Closes #21713
Adds `Deno.UnsafeWindowSurface` ( `--unstable-webgpu` API) to the `Deno`
namespace:
```typescript
class UnsafeWindowSurface {
constructor(
system: "cocoa" | "x11" | "win32",
winHandle: Deno.PointerValue,
displayHandle: Deno.PointerValue | null
);
getContext(type: "webgpu"): GPUCanvasContext;
present(): void;
}
```
For the initial pass, I've opted to support the three major windowing
systems. The parameters correspond to the table below:
| system | winHandle | displayHandle |
| ----------------- | ---------- | ------- |
| "cocoa" (macOS) | `NSView*` | - |
| "win32" (Windows) | `HWND` | `HINSTANCE` |
| "x11" (Linux) | Xlib `Window` | Xlib `Display*` |
Ecosystem support:
- [x] deno_sdl2 (sdl2) -
[mod.ts#L1209](
|
||
---|---|---|
.. | ||
broadcast_channel | ||
cache | ||
console | ||
cron | ||
crypto | ||
fetch | ||
ffi | ||
fs | ||
http | ||
io | ||
kv | ||
napi | ||
net | ||
node | ||
tls | ||
url | ||
web | ||
webgpu | ||
webidl | ||
websocket | ||
webstorage |