fix(tooltips): significantly improve rendering performance#321
fix(tooltips): significantly improve rendering performance#321olisikh wants to merge 4 commits intosven-n:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on enhancing the rendering performance of ground item tooltips, especially in scenarios with high item density. By introducing a robust caching mechanism for item labels and optimizing texture upload processes, the changes aim to significantly reduce frame-time costs associated with displaying tooltips. The implementation includes progressive label building and intelligent cache management to maintain smooth performance without altering the visual fidelity or naming conventions of the tooltips. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new caching mechanism for ground item labels to optimize rendering performance. This involves refactoring the RenderItemName function to use a texture cache for item names, including logic for building label descriptors, creating textures, and pruning the cache. It also updates NewUINameWindow.cpp to set a budget for label building and modifies UIControls.cpp to use glTexSubImage2D for more efficient texture uploads. The review identified a potential buffer overflow vulnerability in string formatting, suggested replacing a magic number with a named constant for better readability, and pointed out an inefficiency in the cache pruning algorithm that could be optimized.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request significantly optimizes ground item label rendering by introducing a texture-based caching mechanism. The RenderItemName function has been refactored to build and store item label textures, reducing redundant text rendering. A per-frame budget is implemented to control new texture creation. Additionally, UploadText in UIControls.cpp was updated to use glTexSubImage2D for more efficient texture updates. Feedback suggests addressing potential thread safety and performance issues with the static std::vector in UIControls.cpp, encapsulating the new caching logic in ZzzInventory.cpp within a dedicated class for better maintainability, and using wcslen for improved string manipulation.
optimize ground item tooltip rendering with cached labels and progressive builds
result: significantly reduced ALT-tooltip frame-time cost in crowded scenes while preserving tooltip naming/styling behavior and eventual full label visibility
The performance gain is substantial on devices like Steam Deck, where spots with a lot of items had FPS reduced by 15-30, while now the hit is marginal (0-3 fps) and all tooltips are visible as before.