diff --git a/both_webgpu/both_node.mjs b/both_webgpu/both_node.mjs index 301c3e2..43a5776 100644 --- a/both_webgpu/both_node.mjs +++ b/both_webgpu/both_node.mjs @@ -7,6 +7,9 @@ const require = createRequire(import.meta.url); const dawn = require("../../../src/dawn-build/dawn.node"); Object.assign(globalThis, dawn.globals); // Provides constants like GPUBufferUsage.MAP_READ +import * as Plot from "@observablehq/plot"; +import { JSDOM } from "jsdom"; + let navigator = { gpu: dawn.create(["enable-dawn-features=use_user_defined_labels_in_backend"]), }; @@ -19,4 +22,28 @@ if (typeof process !== "undefined" && process.release.name === "node") { alert("Use this only in Node."); } -main(navigator); +const data = await main(navigator); +console.log(data); +const plot = Plot.plot({ + document: new JSDOM("").window.document, + marks: [ + Plot.lineY(data, { + x: "bytesTransferred", + y: "bandwidth", + stroke: "workgroupSize", + }), + ], +}); + +plot.setAttributeNS( + "http://www.w3.org/2000/xmlns/", + "xmlns", + "http://www.w3.org/2000/svg" +); +plot.setAttributeNS( + "http://www.w3.org/2000/xmlns/", + "xmlns:xlink", + "http://www.w3.org/1999/xlink" +); + +process.stdout.write(plot.outerHTML);