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

Merged

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", displayHandle, windowHandle);

const context  = surface.getContext();
context.configure({ width: 600, height: 800, /* ... */ });
// New
const surface = new Deno.UnsafeWindowSurface({
  system: "x11",
  windowHandle,
  displayHandle,
  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();

Copy link
Member

@crowlKats crowlKats left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@littledivy littledivy merged commit 0cb00a6 into denoland:main Sep 22, 2024
17 checks passed
@littledivy littledivy deleted the update-unsafe-win-surface-dimenstions branch September 22, 2024 03:40
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
3 participants