From d63e0718fa062494bb71159b72631e25c49b0197 Mon Sep 17 00:00:00 2001 From: John Owens Date: Wed, 6 Nov 2024 15:24:20 -0800 Subject: [PATCH] doing a standalone query-set test --- deno-query-set.mjs | 31 +++++++++++++++++++++++++++++++ query-set.html | 14 ++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 deno-query-set.mjs create mode 100644 query-set.html diff --git a/deno-query-set.mjs b/deno-query-set.mjs new file mode 100644 index 0000000..31e786e --- /dev/null +++ b/deno-query-set.mjs @@ -0,0 +1,31 @@ +async function main(navigator) { + const adapter = await navigator.gpu?.requestAdapter(); + const canTimestamp = adapter.features.has("timestamp-query"); + const device = await adapter?.requestDevice({ + requiredFeatures: [...(canTimestamp ? ["timestamp-query"] : [])], + }); + + if (!device) { + fail("Fatal error: Device does not support WebGPU."); + } + + if (!canTimestamp) { + fail( + 'Fatal error: Device does not support WebGPU timestamp query (`adapter.features.has("timestamp-query")` is false).' + ); + } + + const querySet = device.createQuerySet({ + type: "timestamp", + count: 2, + }); + + console.log(querySet); + + function fail(msg) { + // eslint-disable-next-line no-alert + alert(msg); + } +} + +await main(navigator); diff --git a/query-set.html b/query-set.html new file mode 100644 index 0000000..f764b83 --- /dev/null +++ b/query-set.html @@ -0,0 +1,14 @@ + + + + + + Testing Query Set + + + +
+ + + +