Skip to content

WebGPU generation is missing. #287

Description

@munrocket

As I understand webgpu.idl is supported in package:web but it is impossible to use because navigator.gpu on page does not exist. Typical WebGPU example in JS starting like this:

const adapter = await navigator.gpu?.requestAdapter();
const device = await adapter?.requestDevice();
if (!device) {
  fail('need a browser that supports WebGPU');
  return;
}

// Get a WebGPU context from the canvas and configure it
const canvas = document.querySelector('canvas');
const context = canvas.getContext('webgpu');
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
  device,
  format: presentationFormat,
});

So this should compile in dart without commented lines.

import 'package:web/web.dart';
void main() async {
  console.log(window.navigator as dynamic);
  //console.log(window.navigator.gpu as dynamic);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions