MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / run

Function run

test/webgpu_basic_rendering.cpp:384–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384void run() {
385 init();
386
387 ScopedCounter scope;
388 doCopyTestMappedAtCreation(scope, false);
389 doCopyTestMappedAtCreation(scope, true);
390 doCopyTestMapAsync(scope, false);
391 doCopyTestMapAsync(scope, true);
392 doRenderTest(scope);
393
394 {
395 wgpu::EmscriptenSurfaceSourceCanvasHTMLSelector canvasDesc{};
396 canvasDesc.selector = "#canvas";
397
398 wgpu::SurfaceDescriptor surfDesc{};
399 surfDesc.nextInChain = &canvasDesc;
400 surface = instance.CreateSurface(&surfDesc);
401
402 wgpu::SurfaceCapabilities capabilities;
403 surface.GetCapabilities(adapter, &capabilities);
404
405 wgpu::SurfaceConfiguration config{
406 .device = device,
407 .format = capabilities.formats[0],
408 .usage = wgpu::TextureUsage::RenderAttachment,
409 .width = kWidth,
410 .height = kHeight,
411 .alphaMode = wgpu::CompositeAlphaMode::Auto,
412 .presentMode = wgpu::PresentMode::Fifo};
413 surface.Configure(&config);
414
415 {
416 wgpu::TextureDescriptor descriptor{};
417 descriptor.usage = wgpu::TextureUsage::RenderAttachment;
418 descriptor.size = {kWidth, kHeight, 1};
419 descriptor.format = wgpu::TextureFormat::Depth32Float;
420 canvasDepthStencilView = device.CreateTexture(&descriptor).CreateView();
421 }
422 }
423
424 emscripten_set_main_loop_arg(frame, new ScopedCounter(), 0, false);
425}
426
427int main() {
428 GetDevice(run);

Callers 1

Calls 4

doCopyTestMapAsyncFunction · 0.85
doRenderTestFunction · 0.85
initFunction · 0.70

Tested by 1