Skip to content

refactor(ww3d2): Route device and display queries via Renderer - #3418

Draft
bobtista wants to merge 1 commit into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/route-device-queries
Draft

bobtista wants to merge 1 commit into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/route-device-queries

Conversation

@bobtista

@bobtista bobtista commented Oct 4, 2026 •

Copy link
Copy Markdown

Code outside DX8Wrapper reads the device, resolution, windowed state, stencil and back buffer format straight from DX8Wrapper.

Now these queries are static methods on Renderer, and the WW3D wrappers and the remaining callers use them. Renderer becomes a friend of DX8Wrapper because the device queries are protected. The back buffer query is named Get_Back_Buffer_Format to match the rest of the interface.

Device creation, resolution changes, device reset, MSAA and the registry calls stay on DX8Wrapper. So does Get_Render_Device_Desc, because RenderDeviceDescClass exposes D3DCAPS8 and D3DADAPTER_IDENTIFIER8. Is_Initted stays as well, because every caller pairs it with Get_Current_Caps.

Todo:

  • Build win32, including W3DView and WorldBuilder
  • Load two skirmish saves and the shell map, open W3DView through its device dialog, and open WorldBuilder. Same result as main
  • Replicate to Generals

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ab899957-dc3d-4b5d-86f2-7ee799e2f13c

📥 Commits

Reviewing files that changed from the base of the PR and between 9a8ada1 and 92d99b1.


📒 Files selected for processing (3)
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp
  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.



Walkthrough

Renderer adds DX8-backed queries for device and display properties, back-buffer format, and stencil availability. WW3D and game rendering call sites now use these Renderer queries instead of querying DX8Wrapper directly.

Changes

Renderer query routing

Layer / File(s) Summary
Renderer query APIs and DX8 forwarding
Core/Libraries/Source/WWVegas/WW3D2/Renderer.h, Core/Libraries/Source/WWVegas/WW3D2/Backend/DX8Backend.cpp, Core/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h
Renderer declares and implements accessors for render-device, resolution, windowing, texture bit-depth, swap-interval, stencil, and back-buffer queries. DX8Wrapper declares Renderer as a friend.
WW3D query routing
Core/Libraries/Source/WWVegas/WW3D2/ww3d.cpp
WW3D obtains device, display, resolution, swap-interval, and texture bit-depth values through Renderer. Coordinate normalization uses Renderer device dimensions.
Game rendering query routing
Core/GameEngineDevice/Source/W3DDevice/GameClient/*, GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp, GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp
Height-map, display, and water paths query back-buffer format through Renderer. Scene and shadow paths query stencil availability through Renderer. Existing conditions and rendering-state changes remain unchanged.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Suggested reviewers: stephanmeesters

Merge Risk: ⚪ Minimal · up to 92d99

The change centralizes existing DX8 device, display, and rendering queries in Renderer without changing their values or rendering conditions. No concrete user-facing regression or deployment risk is established, so it is ready for normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 9ef85

The interface refactor preserves the inspected operations and their authority. No introduced security issue was established, but incomplete coverage and outstanding runtime validation limit confidence.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected operations affect the application’s rendering device and display state. Gamma’s existing fallback can affect the desktop display, but the refactor preserves that sink and its caller inputs rather than introducing broader authority.

Trust Boundaries and Controls

  • observed — The factory selects DX8Backend directly, with no attacker-controlled backend choice in the inspected path. WW3D creates and owns the backend during initialization and deletes it during shutdown. Routed callers therefore depend on the documented initialization-to-shutdown lifecycle.

Resilience and Maintainability Implications

  • observed — The adapters preserve existing containment controls: clear retains its render-thread assertion and stencil-surface check, while gamma retains its input bounds and display-context release. Routing adds no synchronization, transaction or interruption-recovery mechanism; those guarantees remain with the existing implementation.

Pre-merge checks | Passed 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly summarizes the main change: routing WW3D2 device and display queries through Renderer.
Description check Passed The description directly explains the query-routing refactor, the DX8Wrapper boundaries, validation steps, and remaining Generals replication work.
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.

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@mirelle7 mirelle7 added Refactor Edits the code with insignificant behavior changes, is never user facing Rendering Is Rendering related labels Oct 5, 2026
@mirelle7 mirelle7 added this to the Multi platform support milestone Oct 5, 2026

@mirelle7 mirelle7 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good.

@bobtista
bobtista force-pushed the bobtista/refactor/route-device-queries branch from 9ef857e to 5e24bfb Compare October 9, 2026 15:49
@bobtista bobtista changed the title refactor(ww3d2): Route device and display queries via IRenderBackend refactor(ww3d2): Route device and display queries via Renderer Oct 9, 2026
@bobtista
bobtista force-pushed the bobtista/refactor/route-device-queries branch 2 times, most recently from 5b4d9a4 to 9a8ada1 Compare October 9, 2026 20:59
@bobtista
bobtista force-pushed the bobtista/refactor/route-device-queries branch from 9a8ada1 to 92d99b1 Compare October 11, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Edits the code with insignificant behavior changes, is never user facing Rendering Is Rendering related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants