Skip to content

WebGPU queryset appears to not work (any use of createQuerySet fails) #26769

Closed
@jowens

Description

I append a short JS code segment that fails when I try to print querySet with console.log. As far as I can tell, I can't use the output of createQuerySet at all.

% deno run /tmp/foo.mjs
error: Uncaught (in promise) AssertionError: Assertion failed
  console.log(querySet);
          ^
    at assert (ext:deno_console/01_console.js:199:11)
    at getKeys (ext:deno_console/01_console.js:1294:7)
    at formatRaw (ext:deno_console/01_console.js:761:14)
    at formatValue (ext:deno_console/01_console.js:545:10)
    at inspect (ext:deno_console/01_console.js:3469:10)
    at GPUQuerySet.[Deno.privateCustomInspect] (ext:deno_webgpu/01_webgpu.js:5252:12)
    at formatValue (ext:deno_console/01_console.js:487:48)
    at inspectArgs (ext:deno_console/01_console.js:3071:17)
    at console.log (ext:deno_console/01_console.js:3140:7)
    at main (file:///tmp/foo.mjs:23:11)
deno 2.0.4 (stable, release, aarch64-apple-darwin)
v8 12.9.202.13-rusty
typescript 5.6.2
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);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working correctlywebgpuWebGPU API

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions