Skip to content

Merge the shell backends into one Shell library - #53

Merged
mcdubhghlas merged 1 commit into
Redot-Engine:masterfrom
jayrulez:shell
Jul 14, 2026
Merged

Merge the shell backends into one Shell library#53
mcdubhghlas merged 1 commit into
Redot-Engine:masterfrom
jayrulez:shell

Conversation

@jayrulez

@jayrulez jayrulez commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Fold both backends into a single Shell library (folder-separated only: Desktop/ = SDL3, Null/ = headless), so Shell is the only shell library and SDL3 is a fully internal PRIVATE dependency.

  • The two per-backend factory units collapse into one Shell.cpp bridge that dispatches createShell()/destroyShell() to the backend chosen at compile time via DRACO_SHELL_SDL3.
  • Both backend modules (shell.desktop, shell.null) compile into the one library, so both stay independently testable in every build.
  • Runtime links only Shell; the sample links only Runtime. SDL propagates through Shell's PRIVATE link, so nothing downstream links SDL directly. The SDL whole-archive force-load stays on the executable (not Shell) so it does not force a full SDL copy into the intermediate Runtime library.

Both shell tests pass and RenderSample builds and runs.

Summary by CodeRabbit

  • New Features

    • Added unified shell backend support, automatically selecting the desktop or null implementation as configured.
    • Improved SDL3 integration for rendering applications, including reliable inclusion of required drivers.
  • Tests

    • Added dedicated validation for both desktop and null shell backends, with test report generation.

Fold both backends into a single Shell library (folder-separated only:
Desktop/ = SDL3, Null/ = headless), so Shell is the only shell library
and SDL3 is a fully internal PRIVATE dependency.

- The two per-backend factory units collapse into one Shell.cpp bridge
  that dispatches createShell()/destroyShell() to the backend chosen at
  compile time via DRACO_SHELL_SDL3.
- Both backend modules (shell.desktop, shell.null) compile into the one
  library, so both stay independently testable in every build.
- Runtime links only Shell; the sample links only Runtime. SDL propagates
  through Shell's PRIVATE link, so nothing downstream links SDL directly.
  The SDL whole-archive force-load stays on the executable (not Shell) so
  it does not force a full SDL copy into the intermediate Runtime library.

Both shell tests pass and RenderSample builds and runs.
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 48a06a87-e49a-4913-bbcd-d705706025a8

📥 Commits

Reviewing files that changed from the base of the PR and between da9ea3c and 8092382.

📒 Files selected for processing (6)
  • Engine/cpp/CMakeLists.txt
  • Engine/cpp/Runtime/CMakeLists.txt
  • Engine/cpp/Runtime/Shell/Desktop/SDL3ShellFactory.cpp
  • Engine/cpp/Runtime/Shell/Null/NullShellFactory.cpp
  • Engine/cpp/Runtime/Shell/Shell.cpp
  • Samples/cpp/Render/CMakeLists.txt
💤 Files with no reviewable changes (2)
  • Engine/cpp/Runtime/Shell/Desktop/SDL3ShellFactory.cpp
  • Engine/cpp/Runtime/Shell/Null/NullShellFactory.cpp

📝 Walkthrough

Walkthrough

The shell build is consolidated into one Shell module library containing SDL3 and Null backends. A compile-time factory selects the backend, Runtime links Shell, backend tests are added, and RenderSample comments are updated for SDL3 linkage behavior.

Changes

Shell unification

Layer / File(s) Summary
Unified shell factory
Engine/cpp/Runtime/Shell/Shell.cpp, Engine/cpp/Runtime/Shell/{Null,Desktop}/*Factory.cpp
A shared shell module selects SDL3Shell or NullShell at compile time and provides the exported createShell and destroyShell functions; backend-specific factories are removed.
Unified Shell build and tests
Engine/cpp/Runtime/CMakeLists.txt
Separate backend targets are replaced by one Shell target containing both implementations, SDL3 linkage, compile-time selection, and dedicated Null and SDL3 tests.
Runtime linkage and SDL3 documentation
Engine/cpp/CMakeLists.txt, Samples/cpp/Render/CMakeLists.txt
Runtime links Shell, while comments document SDL3 dependency propagation and whole-archive handling in the final sample executable.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Runtime
  participant Shell
  participant Backend
  Runtime->>Shell: createShell(settings)
  Shell->>Backend: construct selected shell backend
  Backend-->>Shell: IShell instance
  Shell-->>Runtime: return IShell*
Loading

Possibly related PRs

Suggested reviewers: olddev78, joltedjon, mcdubhghlas, arctis-fireblight

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: consolidating the Desktop and Null shell backends into one Shell library.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Shakai-Dev

This comment was marked as resolved.

@Shakai-Dev Shakai-Dev left a comment

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.

LGTM

@mcdubhghlas
mcdubhghlas enabled auto-merge (squash) July 14, 2026 14:59
// the bridge decides which one createShell() builds.
module shell;

#if DRACO_SHELL_SDL3

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.

I know you defined DRACO_SHELL_SDL3 as 1 in the cmake file but it would probably make more sense to use #ifdef here since we don't care about the value we care if it is defined. Technically the same thing in this case but the #if relies on the value of the macro being truthy instead of it simply existing.

@mcdubhghlas
mcdubhghlas merged commit a7c2724 into Redot-Engine:master Jul 14, 2026
2 checks passed
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.

4 participants