-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
John Owens
committed
Nov 6, 2024
1 parent
d12bd2d
commit d63e071
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Testing Query Set</title> | ||
</head> | ||
|
||
<body> | ||
<div id="plot"></div> | ||
<script src="http://localhost:8000/webgpu-sandbox/deno-query-set.mjs" type="module"></script> | ||
</script> | ||
</body> | ||
</html> |