cwoffenden / hello-webgpu Goto Github PK
View Code? Open in Web Editor NEWCross-platform C++ example for WebGPU and Dawn
Cross-platform C++ example for WebGPU and Dawn
is it possible to run demo on iOS and Android?
is it possible to run demo on linux?
This may not be the best place to report this. The only thing that changed was Chrome Canary daily build today.
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'configureSwapChain')
at k (818984c9-28d3-4b7e-873b-6bf7bbbf543b:formatted:498)
at 455e65be:0x4d6
at 818984c9-28d3-4b7e-873b-6bf7bbbf543b:formatted:158
This is the browser code that throws:
k: function(a, b, d) {
a = H.mgrDevice.get(a);
b = H.ba.get(b);
b.width = A[d + 16 >> 2];
b.height = A[d + 20 >> 2];
b = b.getContext("gpupresent");
a = {
label: void 0,
device: a,
format: H.T[A[d + 12 >> 2]],
usage: A[d + 8 >> 2]
};
(d = z[d + 4 >> 2]) && (a.label = h(d));
d = b.configureSwapChain(a); // !!!!!!!! THROWS HERE !!!!!!!!
return H.ca.create(d)
Native Windows build works fine. libdawn has not changed. So, this is caused by some interaction between hello-webgpu, libdawn, and Chrome.
Thanks in advance.
emscripten-core/emscripten@07f9930
I am just joining the party. Does this mean I should activate an earlier Emscripten SDK? Or update Dawn?
I am willing to roll up sleeves here, as I get familiar with the tools.
Thanks in advance for any guidance.
Is it possible to run the demo using VS Code on Windows?
The triangle will not render but everything else works.
Hi, I'm trying to run the wasm/emscripten (v3.1.26) build with ninja (v1.12.0.git). I run these commands:
emcmake cmake -B out -DCMAKE_BUILD_TYPE=Release
cmake --build out
I get this output:
... success up until this point:
[4/4] Linking CXX executable hello-webgpu.html
FAILED: hello-webgpu.html
cmd.exe /C "cd . && C:\Emscripten\emsdk\upstream\emscripten\em++.bat -O3 -DNDEBUG -s DISABLE_EXCEPTION_CATCHING=1 -s ASSERTIONS=0 -s WASM=1 -s USE_WEBGPU=1 -s NO_EXIT_RUNTIME=1 -s STRICT=1 --shell-file C:/Code/HBT/ta2023-cpp-B/src/ems/shell.html -s ENVIRONMENT=web -s MINIMAL_RUNTIME=2 -s TEXTDECODER=2 -s ABORTING_MALLOC=0 -s ALLOW_MEMORY_GROWTH=0 -s SUPPORT_ERRNO=0 -s MALLOC=emmalloc -s NO_FILESYSTEM=1 --output_eol=linux CMakeFiles/hello-webgpu.dir/src/main.cpp.o CMakeFiles/hello-webgpu.dir/src/ems/glue.cpp.o CMakeFiles/hello-webgpu.dir/src/ems/webgpu.cpp.o CMakeFiles/hello-webgpu.dir/src/ems/window.cpp.o -o hello-webgpu.html && cd ."
cache:INFO: generating system asset: symbol_lists/7818d2d0bea60fefa28b6a419b314988675464c2.json... (this will be cached in "C:\Emscripten\emsdk\upstream\emscripten\cache\symbol_lists\7818d2d0bea60fefa28b6a419b314988675464c2.json" for subsequent builds)
cache:INFO: - ok
Traceback (most recent call last):
File "C:\Emscripten\emsdk\upstream\emscripten\em++.py", line 14, in
sys.exit(emcc.main(sys.argv))
File "C:\Users\Grisha\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 75, in inner
return func(*args, **kwds)
File "C:\Emscripten\emsdk\upstream\emscripten\emcc.py", line 4428, in main
ret = run(args)
File "C:\Emscripten\emsdk\upstream\emscripten\emcc.py", line 1339, in run
phase_post_link(options, state, wasm_target, wasm_target, target)
File "C:\Users\Grisha\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 75, in inner
return func(*args, **kwds)
File "C:\Emscripten\emsdk\upstream\emscripten\emcc.py", line 3151, in phase_post_link
phase_final_emitting(options, state, target, wasm_target, memfile)
File "C:\Users\Grisha\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 75, in inner
return func(*args, **kwds)
File "C:\Emscripten\emsdk\upstream\emscripten\emcc.py", line 3291, in phase_final_emitting
generate_html(target, options, js_target, target_basename,
File "C:\Emscripten\emsdk\upstream\emscripten\emcc.py", line 4153, in generate_html
generate_minimal_runtime_html(target, options, js_target, target_basename)
File "C:\Emscripten\emsdk\upstream\emscripten\tools\minimal_runtime_shell.py", line 192, in generate_minimal_runtime_html
shell = shell.replace('{{{ DOWNLOAD_JS_AND_WASM_FILES }}}', generate_minimal_runtime_load_statement(target_basename))
File "C:\Emscripten\emsdk\upstream\emscripten\tools\minimal_runtime_shell.py", line 156, in generate_minimal_runtime_load_statement
if settings.USE_PTHREADS or settings.WASM_WORKERS:
File "C:\Emscripten\emsdk\upstream\emscripten\tools\settings.py", line 184, in getattr
raise AttributeError(f"no such setting: '{attr}'")
AttributeError: no such setting: 'USE_PTHREADS'
ninja: build stopped: subcommand failed.
When I research hello-webgpu
use Emscripten
, I had met some questions:
Emscripten
to compile main.cpp
(./src/main.cpp
) will include webgpu.h
(./inc/webgpu.h
), and webgpu.h
(./inc/webgpu.h
) will also include webgpu/webgpu.h
. Where is this webgpu/webgpu.h
?CMAKE_CXX_FLAGS
? I can't found the description about -Wno-nonportable-include-path
in gcc doc-s WASM=1,-s USE_WEBGPU=1
in CMAKE_EXE_LINKER_FLAGS
shell.html
file? For what purpose? Where can I find the document?glue.h/glue.cpp
used for? Where can I find the document?WGPUDevice
? In https://www.w3.org/TR/webgpu/
the WGPUDevice
was not found in the official documentation of WebGPU
, but GPUDevice
could be found, but such as WGPUSurfaceDescriptorFromCanvasHTMLSelector
or GPUSurfaceDescriptorFromCanvasHTMLSelector
could not be found.Emscripten
?Thanks~(●'◡'●)ノ♥
Hi Carl,
I am wondering if you would be open to bump up the used version of Dawn to latest? Since this would save me some days I am willing to compensate your efforts financially. I am an experienced DX11 dev but my Dawn prototyping is dragging on for to long, hence the question.
Please let me know if you could help me out.
Thank you very much.
The example runs in VS2022 on windows but running into an error when trying to build for web:
$ ./build-web.bat
shared:INFO: (Emscripten: Running sanity checks)
src/main.cpp:182:7: error: no member named 'source' in 'WGPUShaderModuleWGSLDescriptor'
182 | wgsl.source = code;
| ~~~~ ^
1 error generated.
emcc: error: 'C:/Dev/VanLangen/Research/emsdk/upstream/bin\clang++.exe -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default --sysroot=C:\Dev\VanLangen\Research\emsdk\upstream\emscripten\cache\sysroot -Xclang -iwithsysroot/include\fakesdl -Xclang -iwithsysroot/include\compat -std=c++11 -Wall -Wextra -Werror -Wno-nonportable-include-path -fno-exceptions -fno-rtti -g0 -DNDEBUG=1 -flto -O3 -Iinc src/main.cpp -c -o C:\Users\jvanl\AppData\Local\Temp\emscripten_temp_32syw_dx\main_3.o' failed (returned 1)
I'm very new to emscripten/wasm etc.
Any ideas?
Hello, Im using WSL with Emscripten and I just cant get it to compile. I ran
cmake .
cmake --build .
and it fails with fatal error: webgpu/webgpu.h: No such file or directory
Hello! I have a problem running the webgpu example on a web page by compiling the code to wasm using the latest emscripten.
First, in main.cpp
at line 345, 346, 347 and 348, I had to change colorDesc.clearValue
to colorDesc.clearColor
. It wouldn't compile otherwise.
Then after changing those line, running the example on chrome canary (Version 104.0.5092.0 (Official Build) canary (x86_64)
).
The error is the following:
Uncaught TypeError: Failed to execute 'setVertexBuffer' on 'GPURenderPassEncoder': Value is outside the 'unsigned long long' value range.
The error look like it comes from the line 370:
wgpuRenderPassEncoderSetVertexBuffer(pass, 0, vertBuf, 0, WGPU_WHOLE_SIZE);
The argument WGPU_WHOLE_SIZE
seems to be transformed to -4294967297
in the javascript side:
Maybe this is wrong?
I tried to replace the size with a different number. The error goes away but nothing renders. A lot of warnings are generated.
em++ --version
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.0.0-git
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I fallowed the instructions in https://dawn.googlesource.com/dawn/+/HEAD/docs/building.md and it went fine, I think, but I am not getting the libs and includes that you have here in project.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.