mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-12 12:33:24 +09:00
[Perf] (MG_Backend/DirectVulkan, MG_State): stop re-deriving per-draw state
- Memoize the program content hash on ProgramObject (keyed by the backend state version + compile flags; relinking and binding changes invalidate it) and the vertex-input hash on VertexArrayObject (keyed by a new aggregate config version bumped by every attribute mutation). Full-SPIRV XXH64 hashing fell from 13.7% to 1.4% of the render thread. - ProgramObject also gains a link version and a global-UBO content version (bumped by uniform writes and on relink, wrap-safe around the backends' "never uploaded" sentinel) for backends to gate uploads and link caches. - Reuse member scratch vectors in SetupDraw, UploadAndBindVertexBuffers, GetOrCreatePipeline and BindProgramUniformBuffers instead of allocating per draw (~12% of render-thread time was in the allocator). - Replace hot-path dynamic_cast with AsMipmapTexture (storage-type tag + static_cast); TextureObjectMipmap is the only Mipmap-tagged branch. - Register/prune texture aliases only when a new (texture, lifetimeId) identity appears instead of scanning the entire alive map on every sampled-texture sync. - Make the fallback VkPresentModeKHR log strings report the actual mode. Vanilla render-thread share of libMobileGL dropped from 48% to 35% on DirectVulkan (simpleperf, Adreno 830). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,8 +31,19 @@ static const char* string_VkColorSpaceKHR(VkColorSpaceKHR) {
|
||||
return "VkColorSpaceKHR(unknown)";
|
||||
}
|
||||
|
||||
static const char* string_VkPresentModeKHR(VkPresentModeKHR) {
|
||||
return "VkPresentModeKHR(unknown)";
|
||||
static const char* string_VkPresentModeKHR(VkPresentModeKHR presentMode) {
|
||||
switch (presentMode) {
|
||||
case VK_PRESENT_MODE_IMMEDIATE_KHR:
|
||||
return "VK_PRESENT_MODE_IMMEDIATE_KHR";
|
||||
case VK_PRESENT_MODE_MAILBOX_KHR:
|
||||
return "VK_PRESENT_MODE_MAILBOX_KHR";
|
||||
case VK_PRESENT_MODE_FIFO_KHR:
|
||||
return "VK_PRESENT_MODE_FIFO_KHR";
|
||||
case VK_PRESENT_MODE_FIFO_RELAXED_KHR:
|
||||
return "VK_PRESENT_MODE_FIFO_RELAXED_KHR";
|
||||
default:
|
||||
return "VkPresentModeKHR(unknown)";
|
||||
}
|
||||
}
|
||||
|
||||
static const char* string_VkSurfaceTransformFlagBitsKHR(VkSurfaceTransformFlagBitsKHR) {
|
||||
|
||||
Reference in New Issue
Block a user