wg_engine: Enable premultiplied canvas on browser

Emscripten 3.1.66 includes support for WebGPU's premultiplied canvas.

Surface configurations have been updated with premultiplied alpha mode to support this feature.

see: c82a307c61
This commit is contained in:
Jinny You 2024-09-12 17:43:41 +09:00 committed by Hermet Park
parent 9f43039403
commit fbe6d59c04

View file

@ -322,12 +322,15 @@ bool WgRenderer::target(WGPUSurface surface, uint32_t w, uint32_t h) {
.device = mContext.device,
.format = mContext.preferredFormat,
.usage = WGPUTextureUsage_RenderAttachment,
#ifdef __EMSCRIPTEN__
.alphaMode = WGPUCompositeAlphaMode_Premultiplied,
#endif
.width = w, .height = h,
#ifdef __EMSCRIPTEN__
#ifdef __EMSCRIPTEN__
.presentMode = WGPUPresentMode_Fifo,
#else
#else
.presentMode = WGPUPresentMode_Immediate
#endif
#endif
};
wgpuSurfaceConfigure(surface, &surfaceConfiguration);