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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(native): a native build asks its GPU for timestamps, so its GPU frame time reads a number instead of -1
yhh23fc5164c4b2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4cb8d615e..e4d8684ec 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -22,6 +22,8 @@ published separately; it ships inside the editor.### Fixed+- **A native build reports its GPU frame time.** The desktop and Android hosts never asked the GPU for timestamps, so the engine's GPU frame timer and the profiler's GPU track read -1 on every device. They ask for them now where the GPU has them.+- **Voxel GI costs less on mobile GPUs.** The gather, which only reads the cache, reads it as a plain array, and the per-frame ageing reads and writes each slot plainly (each invocation owns one) and leaves empty slots alone; both had gone through atomics. On a Snapdragon 8 Elite phone at 2670x1200 a frame with one ray per point went from 134 to 83 ms, and with a 4-voxel range from 32 to 17 ms. Voxel GI is still too heavy for a phone at its defaults (about 0.8 s a frame).- **Baked lighting shows on built-in meshes.** A `builtin:` cube, sphere or plane baked with `bake-scene` or the editor drew as if nothing had been baked: the bake unwrapped a lightmap UV set for its own use, but the mesh the game loaded had none, so the atlas was never read. The built-in meshes now carry that UV set, the bake lays out its charts by it, and existing bakes stay valid.- **Bounce light takes the colour of what it lands on.** Voxel GI and Screen Space GI guessed a surface's colour from the lit picture, so a wall the sun did not reach got its bounce as a dim grey: a red wall in a sunlit room received 15% of the red light a path tracer gives it. The scene pass now writes each surface's diffuse colour beside its normal, and both effects reflect the bounce by it. In the same room the red wall gets 50–75% and keeps its hue, and the ceiling went from 14% to 57–90%. A custom shader that writes the surface record keeps working and has its colour guessed as before until it also writes `fragAlbedo` (location 2).- **Baked lighting reflects light 8 times by default, not 2.** Two bounces left a room of light walls at about half the light a path tracer gives it, and a face only bounced light reaches at a tenth. Eight is within about 10% of Cycles in a measured room and cost a 252k-lumel bake 0.7 s more. The inspector now goes to 16. A scene that states its own bounces keeps them.diff --git a/native/host/Host.cpp b/native/host/Host.cppindex 5dd7d047f..5fb970cbe 100644--- a/native/host/Host.cpp+++ b/native/host/Host.cpp@@ -109,11 +109,14 @@ bool createDevice(HostState& h) {wgpuInstanceWaitAny(h.instance, 1, &af, UINT64_MAX);if (!h.adapter) { ESHOST_LOGE("no adapter"); return false; }- WGPUFeatureName compFeats[3];+ // Timestamps feed the engine's GPU frame timer (renderer_getGpuTimeMs, the+ // profiler's GPU track); without them a device reports -1 for every frame.+ WGPUFeatureName compFeats[4];size_t compCount = 0;for (WGPUFeatureName f : {WGPUFeatureName_TextureCompressionETC2,WGPUFeatureName_TextureCompressionASTC,- WGPUFeatureName_TextureCompressionBC}) {+ WGPUFeatureName_TextureCompressionBC,+ WGPUFeatureName_TimestampQuery}) {if (wgpuAdapterHasFeature(h.adapter, f)) compFeats[compCount++] = f;}auto onDevice = [](WGPURequestDeviceStatus s, WGPUDevice d, WGPUStringView, void* u, void*) {diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex b3ec3b741..0c2f37a82 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -3826,4 +3826,8 @@ export const NOTED = {{"note":"Voxel GI lights what the camera does not see, and bounces light more than once."},"feat(render): the WebGL2 Voxel GI takes what the sun lights from its shadow map and bounces light more than once, as the WebGPU one does":{"note":"Voxel GI lights what the camera does not see, and bounces light more than once."},+ "fix(native): a native build asks its GPU for timestamps, so its GPU frame time reads a number instead of -1":+ {"note":"A native build reports its GPU frame time."},+ "perf(render): Voxel GI reads its cache plainly where nothing else writes it, and skips empty slots when it ages them, so a phone spends far less on its upkeep and its rays":+ {"note":"Voxel GI costs less on mobile GPUs."},};