cwoffenden / hello-webgpu

Cross-platform C++ example for WebGPU and Dawn
272 stars 36 forks source link

Doesn't work anymore in latest Chrome (99, Canary) #12

Closed brainlag closed 2 years ago

brainlag commented 2 years ago

The triangle will not render but everything else works.

cwoffenden commented 2 years ago

I'll try to look at this before the end of the week.

stefan-tb commented 2 years ago

@cwoffenden, it would be cool if you could name the specific Chrome + Emscripten version that you used to run your experiments somewhere in the README.md. With the ever changing (well, at least for now) API and tooling state that could help people to clone your setup.

cwoffenden commented 2 years ago

@brainlag I took a quick look and you can get Chrome working again from the code in the tint-and-api-changes branch. Once I've updated the native builds I'll merge this.

@stefan-tb Yep, you're right, I should document this. Once I've built and tested the latest versions I'll add it.

The issue Peter brought up in Chrome 99 is WGPU_WHOLE_SIZE now needs passing when specifying the whole buffer rather than zero, which was how this worked previously. More fun is to be had with Chrome 100 because the WGSL decorators changed from [[decorator]] to @decorator, needing multiple changes (and guesswork to make @group(0) @binding(0) work). I made both changes and tested than everything works again. But only in Chrome 100, since it's not possible to support both without branching the WGSL.

brainlag commented 2 years ago

This WGPU_WHOLE_SIZE is still super broken for me. With current Chrome Canary Version 100.0.4851.0 (Official Build) canary (64-bit) I get following error:

Failed to execute 'setIndexBuffer' on 'GPURenderPassEncoder': Value is outside the 'unsigned long long' value range.

And WGPU_WHOLE_SIZE is defined as #define WGPU_WHOLE_SIZE (0xffffffffffffffffULL) . But I got it working by setting the actual size values instead of WGPU_WHOLE_SIZE.

cwoffenden commented 2 years ago

Hmm, that’s odd. I’ll let you know the the exact Chrome and Emscripten versions I used tomorrow.

cwoffenden commented 2 years ago

Here's what I just built with Emscripten 3.1.2:

https://wip.numfum.com/cw/2022-01-26/index.html

Testing on Windows with Chrome 100.0.4853.0 (Official Build) canary (64-bit).

Something I've not seen before is this needs HTTPS to run (otherwise WebGPU isn't supported). Running on localhost works fine, just regular HTTP appears affected.

brainlag commented 2 years ago

I updated emscripten and the problem went away. It's never the compiler ... until it is. Yes, you need HTTPS for alot of features these days.