Giter Club home page Giter Club logo

hello-webgpu's People

Contributors

cwoffenden avatar huningxin avatar juj avatar stefan-tb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hello-webgpu's Issues

configureSwapChain error in browser for emcc build

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.

Python error on building emscripten with Ninja

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.

Some questions about hello-webgpu

When I research hello-webgpu use Emscripten, I had met some questions:

  1. Using 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?
  2. Where can I found the documents for the various flags set in CMAKE_CXX_FLAGS? I can't found the description about -Wno-nonportable-include-path in gcc doc
  3. Where can I find documents such as -s WASM=1,-s USE_WEBGPU=1 in CMAKE_EXE_LINKER_FLAGS
  4. Why would there be a shell.html file? For what purpose? Where can I find the document?
  5. What is glue.h/glue.cpp used for? Where can I find the document?
  6. Where are documents such as 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.
  7. Where is the WebGPU document for Emscripten?

Thanks~(●'◡'●)ノ♥

Upgrade to latest Dawn

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.

error: no member named 'source' in 'WGPUShaderModuleWGSLDescriptor'

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?

Compile with Linux Subsystem for the web

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

Compilation error and runtime error with emscripten 3.0.0

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.

Screen Shot 2022-05-30 at 12 28 22 PM

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:

Screen Shot 2022-05-30 at 12 30 43 PM

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.