eliemichel / LearnWebGPU-Code

The accompanying code of the Learn WebGPU C++ programming guide
https://eliemichel.github.io/LearnWebGPU
MIT License
102 stars 28 forks source link

Step095-emscripten Webassembly Issue #55

Open Roy23011 opened 1 day ago

Roy23011 commented 1 day ago

Hello,

I downloaded the code from the following GitHub repository: LearnWebGPU-Code (step095-emscripten) https://github.com/eliemichel/LearnWebGPU-Code/tree/step095-emscripten.

int main(int, char**) {
    Application app;
    app.onInit();
    std::cout<<"After onInit function :: "<<std::endl;

#ifdef __EMSCRIPTEN__
    std::cout<<"Inside emcripten condition :: "<<std::endl;
    emscripten_set_main_loop_arg(
        [](void *userData) {
            Application& app = *reinterpret_cast<Application*>(userData);
            std::cout<<"Before calling onFrame function :: "<<std::endl;
            app.onFrame();
            std::cout<<"After calling onFrame function :: "<<std::endl;
        },
        (void*)&app,
        0, true
    );
    std::cout<<"After emscripten_set_main_loop_arg function :: "<<std::endl;
#endif

    return 0;
}

After building the WebGPU project in WebAssembly, I encountered an error after printing “After calling onFrame function” cout message from the above code, as shown on the screen while browsing to http://localhost:8000/App.html. How can I fix this error? Could anyone please help me with this?

eliemichel commented 17 hours ago

Hi, could you give more information about the error message that you are getting?