webgpu / webgpu-debugger

MIT License
69 stars 8 forks source link

typescript #11

Closed greggman closed 2 years ago

greggman commented 2 years ago

Here's a typescript version.

I'm not sure this is correct as I don't have much typescript experience.

To use,

npm install
npm start

You'll see a ton of errors because I didn't add any types to the typescript. I'm happy to try to do that, and I started once, but it's a big changed and there are likely to be conflicts so it seemed best to leave it as is and let @Kangz add that.

Go to http://localhost:3000/src/samples/basic-hello-triangle.html and it should run.

The libraries are built to /dist/capture.js and /dist/replay.js.

If you edit the src it should be regenerated automatically.

Ideally we wouldn't expose much by importing the libraries but I didn't want refactor that area so this version just switched to using import

Another issue is things don't always work.

                                 JS       TS
-------------------------------------------------
basic-hello-triangle.html        SUCCESS  SUCCESS
babylon-simple-scene.html        FAIL     FAIL
babylon-shadow-simple-scene.html SUCCESS  SUCCESS
babylon-bones-morph-scene.html   SUCCESS  SUCCESS?
babylon-gltf-scene.html          SUCCESS  SUCCESS?

The ones with a ?, I've seen sometimes the capture doesn't appear, sometimes it does. I can only guess it's a race?

I don't know if it's expected but for me, babylon-simple-scene.html is failing with or without this PR.

Anyway, if this is not the correct way feel free to discard this PR. It's just getting harder to make progress without types between the libraries so I thought I'd try to bootstrap it.

greggman commented 2 years ago

It wasn't clear to me if having @sebavan take a look at this meant you wanted to wait to merge it or just wanted his input.

This was the smallest change I could think of to get stuff into typescript. I'm assuming we'll change it after to be better.

Should we commit and iterate?

Kangz commented 2 years ago

Sure!