Skip to content

feat(upscaling): improve ui and diagnostics#1229

Merged
alandtse merged 1 commit into
community-shaders:devfrom
alandtse:upscaling_ui
Jul 3, 2025
Merged

feat(upscaling): improve ui and diagnostics#1229
alandtse merged 1 commit into
community-shaders:devfrom
alandtse:upscaling_ui

Conversation

@alandtse
Copy link
Copy Markdown
Collaborator

@alandtse alandtse commented Jul 2, 2025

  • Display DLL versions for Streamline and FidelityFX in diagnostics UI
  • Display active Frame Generation backend
  • Add Streamline log level selection to Backend Diagnostics menu
  • Pass cleaned up Streamline SDK log output
  • Only show frame generation menu if backend is truly available
  • Add feature flags for FSR3 Frame Generation availability

Summary by CodeRabbit

  • New Features

    • Added a "Backend Diagnostics" section to the UI, including sortable tables that display DLL names and versions for AMD FidelityFX and NVIDIA Streamline backends.
    • Introduced a logging verbosity setting for Streamline, selectable via the UI.
    • Enhanced the "Frame Generation" UI with detailed backend availability, warnings, and dynamic labeling.
    • Added clickable entries to open plugin directories from the UI.
    • Frame generation status indicators added for FidelityFX and Streamline features.
    • DLL version caching implemented for FidelityFX and Streamline plugins to improve diagnostics.
  • Improvements

    • UI tables now support sorting by columns, including specialized version string sorting for better diagnostics visibility.
    • Streamline SDK log messages are now preprocessed for clearer formatting and better readability.
    • Streamline log level is dynamically set based on user settings instead of being hardcoded.
  • Bug Fixes

    • Improved log message formatting for Streamline SDK logs, making them clearer and easier to interpret.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 2, 2025

"""

Walkthrough

This update introduces DLL version caching and diagnostics for both the FidelityFX and Streamline backends. It adds static members to store DLL version info, dynamically constructs plugin paths, and enhances the UI with backend diagnostics, including sortable tables of DLL versions and logging level controls. Frame generation status tracking is also improved.

Changes

File(s) Change Summary
src/FidelityFX.cpp, src/FidelityFX.h Added static member for DLL version caching, dynamic DLL path construction, and frame generation status flags.
src/Streamline.cpp, src/Streamline.h Added DLL version caching, dynamic plugin path construction, frame generation status flag, and log level control.
src/Upscaling.cpp, src/Upscaling.h Enhanced settings struct and UI with frame generation diagnostics, logging level selection, and DLL version tables.
src/Utils/FileSystem.h Added function to enumerate DLL versions in a directory.
src/Utils/UI.cpp, src/Utils/UI.h Introduced utilities for sortable tables, including version string comparison and ImGui table rendering.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant Upscaling
    participant FidelityFX
    participant Streamline
    participant Util

    User->>UI: Open Settings
    UI->>Upscaling: DrawSettings()
    Upscaling->>FidelityFX: Access dllVersions
    Upscaling->>Streamline: Access dllVersions
    Upscaling->>UI: Show DLL version tables
    UI->>User: Display diagnostics, log level controls, and DLL versions
Loading

Possibly related PRs

Poem

A hop through the code, a DLL in the grass,
Now rabbits can see which versions will pass.
With tables that sort and log levels to choose,
Diagnostics abound—no version to lose!
Backend bunnies rejoice, for the plugins are clear,
Every frame generation tracked—let’s all cheer!
🐇✨
"""

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 2, 2025

Using provided base ref: 8e061f6
Using base ref: 8e061f6
Base commit date: 2025-07-01T23:23:02-07:00 (Tuesday, July 01, 2025 11:23 PM)
No actionable suggestions for changed features.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e061f6 and e78eb3e.

📒 Files selected for processing (9)
  • src/FidelityFX.cpp (5 hunks)
  • src/FidelityFX.h (2 hunks)
  • src/Streamline.cpp (4 hunks)
  • src/Streamline.h (3 hunks)
  • src/Upscaling.cpp (3 hunks)
  • src/Upscaling.h (1 hunks)
  • src/Utils/FileSystem.h (2 hunks)
  • src/Utils/UI.cpp (2 hunks)
  • src/Utils/UI.h (2 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-06-24T07:17:36.604Z
Learning: When reviewing PRs, always clarify the scope if there are multiple related features or dependencies. WeatherPicker was a separate PR that was already merged, while this PR focuses specifically on WetnessEffects climate preset system enhancements.
src/Upscaling.h (2)
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#577
File: src/Features/WetnessEffects.h:36-36
Timestamp: 2025-06-08T11:25:14.536Z
Learning: In the skyrim-community-shaders project, boolean flags in C++ structs that interface with HLSL shaders use `uint` type instead of `bool` for compatibility reasons. This ensures consistent size, alignment, and cross-platform compatibility when passing data to shader constant buffers.
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#577
File: src/Features/WetnessEffects.h:36-36
Timestamp: 2025-06-08T11:25:14.536Z
Learning: In the skyrim-community-shaders project, boolean flags in C++ structs that interface with HLSL shaders use `uint` type instead of `bool` for compatibility reasons. This ensures consistent 4-byte size, proper 16-byte alignment in constant buffers, and cross-platform compatibility when passing data between C++ and HLSL shaders.
src/FidelityFX.h (1)
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-07-01T18:01:07.034Z
Learning: In the skyrim-community-shaders project, simple scalar constants in HLSL shaders use #define (e.g., #define NTHREADS 128), while more complex constants use static const within namespaces (e.g., Math namespace in Math.hlsli). For epsilon standardization, #define is the appropriate choice since epsilon values are simple scalar constants.
src/Upscaling.cpp (1)
Learnt from: davo0411
PR: doodlum/skyrim-community-shaders#1070
File: src/State.cpp:79-83
Timestamp: 2025-05-30T11:44:15.542Z
Learning: In the Skyrim Community Shaders project, the `smoothDrawCalls` array in the `State` class is declared as type `double` in `src/State.h`, which is the correct floating-point type for performing exponential moving average smoothing calculations.
🧬 Code Graph Analysis (2)
src/FidelityFX.cpp (2)
src/Utils/FileSystem.h (2)
  • EnumerateDllVersions (81-94)
  • EnumerateDllVersions (81-81)
src/FidelityFX.h (1)
  • a_useFrameGeneration (46-46)
src/Utils/UI.cpp (1)
src/Utils/UI.h (1)
  • VersionStringLess (265-265)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build plugin and addons
🔇 Additional comments (21)
src/Upscaling.h (1)

44-44: LGTM: Clean addition of Streamline log level control.

The streamlineLogLevel member provides the necessary control for Streamline SDK logging verbosity, aligning with the PR objectives. The use of uint is consistent with the project's pattern for shader compatibility.

src/Streamline.h (1)

95-96: LGTM: Well-structured additions for diagnostics and status tracking.

The three new members effectively support the PR objectives:

  • PluginDir provides consistent path management
  • isFrameGenActive enables runtime frame generation status tracking
  • dllVersions supports the diagnostic UI functionality

The implementation maintains consistency with the FidelityFX counterpart.

Also applies to: 113-114, 160-161

src/FidelityFX.cpp (4)

2-2: LGTM: Clean addition of filesystem utilities and static member definition.

The inclusion of Utils/FileSystem.h and static member definition properly support the DLL version enumeration feature.

Also applies to: 12-13


35-40: LGTM: Excellent improvement to dynamic path construction and DLL enumeration.

The changes improve maintainability by:

  • Using the static PluginDir constant for consistent path management
  • Automatically enumerating all DLL versions in the plugin directory
  • Caching version information for diagnostic purposes

This aligns perfectly with the PR objectives for enhanced diagnostics.


60-64: LGTM: Proper feature flag management based on context creation result.

The featureFSR3FG flag is correctly set based on the success/failure of frame generation context creation, providing accurate feature availability information.


200-201: LGTM: Accurate frame generation status tracking.

The isFrameGenActive flag correctly reflects the runtime state of frame generation, providing valuable information for diagnostics and UI display.

src/FidelityFX.h (1)

19-19: LGTM: Consistent and well-structured additions for enhanced diagnostics.

The four new members provide excellent support for the PR objectives:

  • PluginDir enables consistent path management
  • featureFSR3FG tracks feature availability (configured at setup)
  • isFrameGenActive tracks runtime status (updated per frame)
  • dllVersions supports diagnostic UI functionality

The implementation maintains consistency with the Streamline backend, ensuring a unified approach to diagnostics across both upscaling technologies.

Also applies to: 34-37, 39-40

src/Utils/UI.cpp (4)

557-564: LGTM!

The sorting implementation correctly handles out-of-bounds column indices by returning false, preventing crashes.


566-596: Well-implemented version string comparator!

The function correctly handles version strings with different numbers of components and includes proper error handling for non-numeric parts.


598-600: LGTM!

Clean lambda wrapper for version string comparison.


602-649: Comprehensive sortable table implementation!

The function properly handles ImGui's table sorting API and correctly falls back to default string comparison when custom sorters aren't provided.

src/Streamline.cpp (5)

16-66: Excellent log message preprocessing!

The implementation properly handles trailing newlines, bracketed metadata removal, and edge cases like empty or bracket-only messages.


69-69: LGTM!

Proper static member initialization.


75-100: Well-implemented DLL version enumeration!

The code properly constructs the interposer path dynamically and systematically enumerates all DLLs in the plugin directory with appropriate error handling.


113-124: LGTM!

The log level mapping correctly handles all cases with a sensible default.


396-398: LGTM!

Clear status tracking for frame generation.

src/Upscaling.cpp (4)

6-6: LGTM!

Windows.h is required for ShellExecuteW used in the backend diagnostics UI.


19-19: LGTM!

Correctly added streamlineLogLevel to the serialization macro.


93-159: Comprehensive frame generation UI implementation!

The code properly checks for feature availability and provides clear user feedback. Good use of dynamic backend labels.


162-195: Excellent backend diagnostics implementation!

The UI properly uses the new table sorting utilities with version comparators and provides convenient folder access via ShellExecuteW.

src/Utils/UI.h (1)

2-6: Well-structured UI utilities extension!

The new table sorting utilities are properly declared with comprehensive documentation. The TableSortFunc type alias provides good flexibility for custom sorting implementations.

Also applies to: 221-270

Comment thread src/Utils/FileSystem.h
Comment thread src/Utils/UI.cpp Outdated
Comment on lines +12 to +13
#include "Menu.h"
#include "UI.h"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove duplicate includes.

These headers are already included at the beginning of the file (lines 2 and 1).

Apply this diff to remove the duplicate includes:

-#include "Menu.h"
-#include "UI.h"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#include "Menu.h"
#include "UI.h"
🤖 Prompt for AI Agents
In src/Utils/UI.cpp at lines 12 to 13, remove the duplicate #include directives
for "Menu.h" and "UI.h" since they are already included at the beginning of the
file on lines 1 and 2. This will clean up the code and avoid redundant includes.

Comment thread src/Upscaling.cpp Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 2, 2025

✅ A pre-release build is available for this PR:
Download

- Display DLL versions for Streamline and FidelityFX in diagnostics UI
- Display active Frame Generation backend
- Add Streamline log level selection to Backend Diagnostics menu
- Pass cleaned up Streamline SDK log output
- Only show frame generation menu if backend is truly available
- Add feature flags for FSR3 Frame Generation availability
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
src/Upscaling.cpp (1)

118-126: Warning messages have been correctly fixed.

The warning messages that were previously swapped have been properly corrected:

  • streamlineMissing now correctly shows "Warning: Streamline is not loaded"
  • fidelityFXMissing now correctly shows "Warning: amd_fidelityfx_dx12.dll is not loaded"

This resolves the issue identified in the previous review.

🧹 Nitpick comments (2)
src/Upscaling.cpp (2)

93-160: Excellent conditional UI implementation with minor organization suggestion.

The Frame Generation UI enhancements are well-implemented:

  • Correctly checks backend availability before showing options
  • Proper warning system for various configuration issues
  • Dynamic backend labeling shows active Frame Generation technology
  • Proper UI tree structure with matching TreePop() calls

Consider refactoring this large conditional block into separate helper methods for improved maintainability.

+	void DrawFrameGenerationAvailable();
+	void DrawFrameGenerationUnavailable();
+
 	if (frameGenAvailable) {
-		if (ImGui::TreeNodeEx("Frame Generation", ImGuiTreeNodeFlags_DefaultOpen)) {
-			// ... existing content ...
-			ImGui::TreePop();
-		}
+		DrawFrameGenerationAvailable();
 	} else {
-		if (ImGui::TreeNodeEx("Frame Generation", ImGuiTreeNodeFlags_DefaultOpen)) {
-			ImGui::Text("Frame Generation is not available on your system.\nThis requires either NVIDIA DLSS-G or AMD FSR 3.1 Frame Generation support and D3D12 interop.");
-			ImGui::TreePop();
-		}
+		DrawFrameGenerationUnavailable();
 	}

162-195: Well-implemented diagnostics section with minor enhancement suggestions.

The Backend Diagnostics section provides valuable functionality:

  • Streamline log level control with proper restart notification
  • Convenient folder access via clickable entries
  • Sortable DLL version tables with proper version comparison

Consider these minor enhancements:

Error handling for folder operations:

 if (ImGui::Selectable("AMD FidelityFX DLLs (click to open folder)")) {
-	ShellExecuteW(nullptr, L"open", FidelityFX::PluginDir, nullptr, nullptr, SW_SHOWNORMAL);
+	if (ShellExecuteW(nullptr, L"open", FidelityFX::PluginDir, nullptr, nullptr, SW_SHOWNORMAL) <= (HINSTANCE)32) {
+		logger::warn("Failed to open FidelityFX plugin directory");
+	}
 }

Organization improvement:
Consider extracting this section into a separate DrawBackendDiagnostics() method for better code organization.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e78eb3e and 8d3cb20.

📒 Files selected for processing (9)
  • src/FidelityFX.cpp (5 hunks)
  • src/FidelityFX.h (2 hunks)
  • src/Streamline.cpp (4 hunks)
  • src/Streamline.h (3 hunks)
  • src/Upscaling.cpp (3 hunks)
  • src/Upscaling.h (1 hunks)
  • src/Utils/FileSystem.h (2 hunks)
  • src/Utils/UI.cpp (2 hunks)
  • src/Utils/UI.h (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • src/Upscaling.h
  • src/Streamline.h
  • src/FidelityFX.cpp
  • src/Utils/FileSystem.h
  • src/Utils/UI.cpp
  • src/FidelityFX.h
  • src/Utils/UI.h
  • src/Streamline.cpp
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-06-24T07:17:36.604Z
Learning: When reviewing PRs, always clarify the scope if there are multiple related features or dependencies. WeatherPicker was a separate PR that was already merged, while this PR focuses specifically on WetnessEffects climate preset system enhancements.
src/Upscaling.cpp (1)
Learnt from: davo0411
PR: doodlum/skyrim-community-shaders#1070
File: src/State.cpp:79-83
Timestamp: 2025-05-30T11:44:15.542Z
Learning: In the Skyrim Community Shaders project, the `smoothDrawCalls` array in the `State` class is declared as type `double` in `src/State.h`, which is the correct floating-point type for performing exponential moving average smoothing calculations.
🧬 Code Graph Analysis (1)
src/Upscaling.cpp (2)
src/Utils/UI.h (3)
  • HoverTooltipWrapper (31-31)
  • HoverTooltipWrapper (32-32)
  • ShowSortedStringTable (250-256)
src/Utils/UI.cpp (4)
  • HoverTooltipWrapper (23-30)
  • HoverTooltipWrapper (32-38)
  • ShowSortedStringTable (600-647)
  • ShowSortedStringTable (600-606)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build plugin and addons
🔇 Additional comments (3)
src/Upscaling.cpp (3)

6-6: LGTM - Necessary include for folder opening functionality.

The Windows.h include is needed to support the ShellExecuteW calls in the Backend Diagnostics section.


18-19: LGTM - Proper settings field addition.

The new streamlineLogLevel field is correctly added to the JSON serialization macro, ensuring proper persistence of the setting.


21-195: Excellent implementation of PR objectives.

This update successfully delivers the stated goals:

  • ✅ Enhanced UI with backend diagnostics and DLL version visibility
  • ✅ Conditional Frame Generation menu display based on actual availability
  • ✅ Streamline log level control with proper user guidance
  • ✅ Improved transparency into active backends and system status

The code is well-structured, handles edge cases appropriately, and provides a significantly improved user experience for upscaling diagnostics and configuration.

@alandtse alandtse merged commit b225568 into community-shaders:dev Jul 3, 2025
15 checks passed
alandtse added a commit to alandtse/open-shaders that referenced this pull request Jul 20, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants