npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

webgpu-debug-helper

v0.1.4

Published

webgpu debug helper

Downloads

3

Readme

webgpu-debug-helper

A WebGPU debugging helper script

This script makes it easier to debug WebGPU apps.

note: this script is a work in progress.

You can use it in your own projects via a script OR, you can use it as an extension.

At the moment, if you want to use it to help debug workers, you'll need to use this script version.

What does it do?

  • It makes as many errors as possible to return the line they happened on

    This is in contrast to normal WebGPU where errors are returned asynchronously and so the command that caused the error is long forgotten.

  • It adds errors to command encoders and pass encoders (these throw)

    In normal WebGPU, command encoders and pass encoders often do not report errors. Rather, they record the error, mark the encoder as invalid, and then only report the error when the encoder is ended/finished. This can make it hard to find errors as they might have happened hundreds or thousands of calls ago.

    With this script, many of these types of errors will be generated immediately.

Usage:

First off, I recommend the extension as it's just easier to use. Generally you don't want to run with this script enabled. Rather, run your code as normal. When you see an error, if it's not obvious, turn on this script via the extension and check the JavaScript console. You should see messages with stacks. Click the links in the stacks to go to the code that generated the error.

Otherwise, to use the script directly:

import './webgpu-debug-helper.js';

or

import 'https://greggman.github.io/webgpu-debug-helper/dist/0.x/webgpu-debug-helper.js';

or

<script type="module" src="https://greggman.github.io/webgpu-debug-helper/dist/0.x/webgpu-debug-helper.js" crossorigin>

There is nothing else to do. The webgpu-debug-helper will wrap the WebGPU API and start generating error messages.

If you wanted to import programmatically you could do something like this

if (debug) {
  await import('./webgpu-debug-helper.js');
}

Development

Clone the repo and install it locally.

npm ci
npm run start

Now open the browser to http://localhost:8080/test/timeout=0&src=true

Testing with three.js

If you have the three.js repo install along side in a folder named three.js as in

+-somefolder
  +-webgpu-dev-extension
  +-three.js

Then npm run test-threejs will attempt to each of the three.js webgpu examples and inject the helper. Ideally there should be no errors.

You can skip the first N tests with -- --skip-count=<number> (the first -- is required).

show-errors.js

show-errors/show-errors.js is also generated by the build.

show-errors.js wraps calls to pushErrorScope and popErrorScope around every method of GPUDevice and GPUQueue. It is used in the webgpu-dev-extension.

License

MIT