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
feat(renderer): a late compile is named by the key that had to be built
esengine6a9809108bcb
diff --git a/src/esengine/renderer/plugins/MeshPlugin.cpp b/src/esengine/renderer/plugins/MeshPlugin.cppindex 4a33bfa50..699ff8741 100644--- a/src/esengine/renderer/plugins/MeshPlugin.cpp+++ b/src/esengine/renderer/plugins/MeshPlugin.cpp@@ -281,8 +281,10 @@ u32 MeshPlugin::meshProgram(RenderFrameContext& ctx, u32 variant) {mesh_compiled_[variant] = true;// Counted because the cost of this function is entirely the times it does// NOT return above: every frame asks once per mesh, and only the first frame- // that needs a variant pays for it.+ // that needs a variant pays for it. WHICH one is the other half — a readiness+ // that missed a requirement is named by the key that had to be built late.++compiled_this_frame_;+ last_compiled_variant_ = variant;std::vector<std::string> features;if (normals) features.emplace_back("MESH_NORMALS");@@ -692,6 +694,9 @@ void MeshPlugin::collect(RenderCollectContext& collect_ctx) {ES_PROFILE_COUNTER("render.mesh.lodGathers", lodGathers);ES_PROFILE_COUNTER("render.mesh.programAsks", programAsks);ES_PROFILE_COUNTER("render.mesh.programCompiles", compiled_this_frame_);+ if (compiled_this_frame_ > 0) {+ ES_PROFILE_COUNTER("render.mesh.compiledKey", last_compiled_variant_);+ }compiled_this_frame_ = 0;}diff --git a/src/esengine/renderer/plugins/MeshPlugin.hpp b/src/esengine/renderer/plugins/MeshPlugin.hppindex ae5fd1d05..fd33bc06b 100644--- a/src/esengine/renderer/plugins/MeshPlugin.hpp+++ b/src/esengine/renderer/plugins/MeshPlugin.hpp@@ -38,6 +38,8 @@ public:private:/** Shader variants compiled during the current collect — see meshProgram. */u32 compiled_this_frame_ = 0;+ /** The last one built, so a late compile can be named rather than counted. */+ u32 last_compiled_variant_ = 0;std::vector<BatchVertex> scratch_; ///< Reused per mesh; amortizes the transform buffer./// Resident-geometry programs, indexed by {has normals, lit, normal-mapped,/// skinned, depth-only, environment-mapped}: what the geometry carries and what