feat(UI): add shader cache duration#1408
Conversation
Added an a_elapsedOnly argument to GetStatsString to easily allow the addition of the feature without doing any formatting on the original one to remove the estimated part. Also improved wording for a tooltip.
WalkthroughUpdated shader stats formatting to support an “elapsed-only” mode by adding a new optional parameter across ShaderCache APIs and implementations. Adjusted UI to display the last shader cache build duration when tasks exist and refined the Shaders tab tooltip text. No other logic paths were changed. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI as SettingsTabRenderer
participant Cache as ShaderCache
participant Set as CompilationSet
User->>UI: Open Shaders tab
UI->>Cache: GetShaderStatsString(a_timeOnly=true, a_elapsedOnly=true)
Cache->>Set: GetStatsString(true, true)
Set-->>Cache: "elapsed time"
Cache-->>UI: "elapsed time"
UI-->>User: Display "Last shader cache build duration: <elapsed>"
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (5)
src/ShaderCache.h (2)
263-263: API extension looks good; consider clarifying param semantics inline.Defaults keep existing call sites source-compatible. a_elapsedOnly is only meaningful when a_timeOnly is true; documenting that at the declaration helps avoid misuse.
Apply this diff to add a brief note:
- std::string GetStatsString(bool a_timeOnly = false, bool a_elapsedOnly = false); + std::string GetStatsString(bool a_timeOnly = false, bool a_elapsedOnly = false); // when a_timeOnly is true, a_elapsedOnly controls whether to omit ETA
399-399: Forward declaration updated correctly; add a short note mirroring CompilationSet.Same reasoning as above; tiny comment improves self-documentation at the API surface.
- std::string GetShaderStatsString(bool a_timeOnly = false, bool a_elapsedOnly = false); + std::string GetShaderStatsString(bool a_timeOnly = false, bool a_elapsedOnly = false); // if a_timeOnly, a_elapsedOnly toggles ETAsrc/Menu/SettingsTabRenderer.cpp (2)
41-41: Tooltip wording nit: describe both enabled and disabled states.Clearer phrasing reduces ambiguity when hovering the “Enable Disk Cache” option.
- ImGui::Text("Disables loading shaders from disk and prevents saving compiled shaders to disk cache."); + ImGui::Text("When enabled: loads shaders from disk and saves compiled shaders to the disk cache.\nWhen disabled: prevents both loading from and saving to the disk cache.");
52-55: Prefer showing duration only after at least one completion; also avoid c_str() on a temporary.
- Using GetCompletedTasks() avoids showing 00:00:00 before any task completes.
- Storing the stats string is safer and slightly clearer.
- if (shaderCache->GetTotalTasks() > 0) { - ImGui::Text("Last shader cache build duration: %s", - shaderCache->GetShaderStatsString(true, true).c_str()); - } + if (shaderCache->GetCompletedTasks() > 0) { + const std::string stats = shaderCache->GetShaderStatsString(true, true); + ImGui::Text("Last shader cache build duration: %s", stats.c_str()); + }src/ShaderCache.cpp (1)
2617-2640: Elapsed-only mode implemented as intended; minor clarity suggestion.Logic matches the PR intent: elapsed-only when both flags are true; elapsed+ETA otherwise; detailed stats when a_timeOnly is false. Consider noting in the header that a_elapsedOnly is ignored unless a_timeOnly is true (see suggested header comments).
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
src/Menu/SettingsTabRenderer.cpp(2 hunks)src/ShaderCache.cpp(2 hunks)src/ShaderCache.h(2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{cpp,cxx,cc,c,h,hpp,hxx,hlsl,hlsli,fx,fxh,py}
📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)
Do not include TODO/FIXME placeholders; provide complete, working solutions
Files:
src/Menu/SettingsTabRenderer.cppsrc/ShaderCache.hsrc/ShaderCache.cpp
src/**/*.{cpp,cxx,cc,h,hpp,hxx}
📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)
src/**/*.{cpp,cxx,cc,h,hpp,hxx}: Ensure SE/AE/VR runtime compatibility; use runtime detection patterns (e.g., REL::RelocateMember())
Include robust error handling and resource management with graceful degradation in the plugin code
Files:
src/Menu/SettingsTabRenderer.cppsrc/ShaderCache.hsrc/ShaderCache.cpp
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build plugin and addons
🔇 Additional comments (1)
src/ShaderCache.cpp (1)
2060-2063: LGTM: API forwards the new flag correctly.The new GetShaderStatsString overload cleanly delegates both flags to the underlying formatter.
|
✅ A pre-release build is available for this PR: |
|
@coderabbitai please provide an appropriate conventional commit given user impact. |
|
Tip For best results, initiate chat on the files or code changes. @alandtse Based on the PR changes, here's an appropriate conventional commit message given the user impact: This follows the conventional commit format with |
|
@coderabbitai I thought this PR was adding a toggle to a function. Is the indicator actually new for the user? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 336 🏁 Script executed: Length of output: 514 🏁 Script executed: Length of output: 513 🏁 Script executed: Length of output: 1037 🏁 Script executed: Length of output: 256 @alandtse You're right to question this! Let me clarify based on the information available: Looking at the AI summary more carefully, this is actually a new user-facing feature. The key evidence:
So you're correct that there's a function parameter addition (the toggle), but that toggle specifically enables a new user-facing shader cache duration indicator in the UI. The conventional commit I suggested is appropriate - this is indeed a The function signature changes are the implementation detail that enables the new feature, but the user impact is the new duration indicator they'll see during shader compilation. |
Added an a_elapsedOnly argument to GetStatsString to easily allow the addition of the feature without doing any formatting on the original one to remove the estimated part. Also improved wording for a tooltip.