Closed
Description
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
Labels
No labels