Skip to content

Commit 2bc4fe4

Browse files
committed
webgpu: don't immediately reacquire swapchain texture;
lovr.graphics.present does gpu_surface_present but then immediately acquire the next swapchain image with gpu_surface_acquire. This is good on Vulkan because it reduces input latency, but on WebGPU it doesn't make sense because it will immediately re-acquire the swapchain image for the current frame, since swapchain images are tied to the requestAnimationFrame. Then, on the next frame, we won't re-acquire the swapchain texture because it's already been acquired, and we'll render to the swapchain image from the previous frame and submit that, which is invalid.
1 parent 0029121 commit 2bc4fe4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/modules/graphics/graphics.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,7 +2034,9 @@ bool lovrGraphicsPresent(void) {
20342034
bool success = gpu_surface_present();
20352035
mtx_unlock(&state.lock);
20362036
lovrAssert(success, "Failed to present: %s", gpu_get_error());
2037+
#ifndef EMSCRIPTEN
20372038
lovrGraphicsGetWindowTexture(NULL); // Takes lock
2039+
#endif
20382040
mtx_lock(&state.lock);
20392041
}
20402042

0 commit comments

Comments
 (0)