Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING(webgpu/unstable): move width and height options to UnsafeWindowSurface constructor #24200

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Jun 13, 2024

Fixes #23508

width and height are required to configure the wgpu surface because Deno is headless and depends on user to create a window. The options were non-standard extension of GPUCanvasConfiguration#configure.

This PR adds a required options parameter with the width and height options to Deno.UnsafeWindowSurface constructor.

// Old, non-standard extension of GPUCanvasConfiguration
const surface = new Deno.UnsafeWindowSurface("x11", displaynd, surfaceHnd);

const context  = surface.getContext();
context.configure({ width: 600, height: 800, /* ... */ });
// New
const surface = new Deno.UnsafeWindowSurface("x11", displaynd, surfaceHnd, {
  width: 600,
  height: 800,
});

const context  = surface.getContext();
context.configure({ /* ... */ });

@littledivy littledivy changed the title BREAKING(ext/webgpu): move width and height options to UnsafeWindowSurface constructor BREAKING(unstable/webgpu): move width and height options to UnsafeWindowSurface constructor Jun 13, 2024
@littledivy littledivy changed the title BREAKING(unstable/webgpu): move width and height options to UnsafeWindowSurface constructor BREAKING(webgpu/unstable): move width and height options to UnsafeWindowSurface constructor Jun 13, 2024
@lucacasonato
Copy link
Member

Seems ok, but maybe we should just make this a single option bag for everything now?

const surface = new Deno.UnsafeWindowSurface({
  system: "x11",
  displayHandle,
  surfaceHandle,
  width: 600,
  height: 800,
});

const context  = surface.getContext();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebGPU: Deno's GPUCanvasConfiguration is not standard
2 participants