From e18c7740732c21a53190e28d493f677f86cf571a Mon Sep 17 00:00:00 2001 From: Hugh Kennedy <569817+hughsk@users.noreply.github.com> Date: Thu, 3 Sep 2026 12:17:58 +0100 Subject: [PATCH] Update shader module creation in JavaScript example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API seems to have changed recently — updating the documentation to match! :) --- wiki/Getting-Started-JavaScript.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wiki/Getting-Started-JavaScript.md b/wiki/Getting-Started-JavaScript.md index d33346c..753f48c 100644 --- a/wiki/Getting-Started-JavaScript.md +++ b/wiki/Getting-Started-JavaScript.md @@ -38,13 +38,14 @@ conditional compilation, virtual modules, const injection, [wgsl-edit](wgsl-edit ```ts /// -import { link, createWeslDevice } from "wesl"; +import { link, createShaderModule, makeWeslDevice } from "wesl"; import appWesl from "../shaders/app.wesl?link"; async function example() { - const device = createWeslDevice(await navigator.gpu.requestAdapter()); + const adapter = await navigator.gpu.requestAdapter(); + const device = makeWeslDevice(await adapter.requestDevice()); const linked = await link(appWesl); - const shaderModule = linked.createShaderModule(device, {}); + const shaderModule = createShaderModule(linked, device, {}); } ``` @@ -77,4 +78,4 @@ See [WESL-js Examples] for example projects. [wesl]: https://www.npmjs.com/package/wesl [wesl-plugin]: https://www.npmjs.com/package/wesl-plugin -[wesl-js examples]: https://github.com/webgpu-tools/wesl-js/tree/main/examples \ No newline at end of file +[wesl-js examples]: https://github.com/webgpu-tools/wesl-js/tree/main/examples