Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(render): the first frame gives its swapchain image back

esengined92f6b35dac2
diff --git a/src/esengine/core/EstellaContext.cpp b/src/esengine/core/EstellaContext.cpp
index 5e65726b5..c5ceff9db 100644
--- a/src/esengine/core/EstellaContext.cpp
+++ b/src/esengine/core/EstellaContext.cpp
@@ -255,6 +255,10 @@ void EstellaContext::initSubsystems(Unique<GfxDevice> gfxDevice) {
initPass.clearColorValue[3] = state_.clear_color.a;
gfxDevicePtr->beginRenderPass(initPass);
gfxDevicePtr->endRenderPass(); // a pass never outlives its task (WebGPU submits here)
+ // ...and neither does the image it drew to. A browser expires the swapchain
+ // texture at the end of the task that acquired it, so a frame that found this
+ // one still held would reuse it and submit a destroyed texture.
+ gfxDevicePtr->endFrame();
ES_LOG_INFO("EstellaContext initialized");
}