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 #56

Open Roy23011 opened 4 hours ago

Roy23011 commented 4 hours 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, getting error 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?

WebAssemblyIssue
eliemichel commented 2 hours ago

Hello ! We now need to specify a depthSlice in the WGPURenderPassColorAttachment object. This branch is a bit outdated, let me know if it is the only issue in there, I'll update then!

Roy23011 commented 1 hour ago

@eliemichel Thanks It's working now after adding depthSlice in the WGPURenderPassColorAttachment object.