Skip to content

refactor(ww3d2): Route shader and material state via Renderer - #3421

Draft
bobtista wants to merge 3 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/route-shader-material
Draft

bobtista wants to merge 3 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/route-shader-material

Conversation

@bobtista

@bobtista bobtista commented Oct 4, 2026 •

Copy link
Copy Markdown

Now Set_Shader, Set_Material and Apply_Render_State_Changes are on Renderer, and the remaining Invalidate_Cached_Render_States callers use the existing method. DX8Backend.cpp forwards each one to DX8Wrapper. This includes callers in the DX8 renderer classes, which are shared code and need the backend for anything other than DX8.

Many of these functions still set texture stage and render state through DX8Wrapper right after the routed calls. Those calls stay as they are.

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 →

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 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: daf78e4e-749a-4d7c-9452-02bb319045cf
📥 Commits

Reviewing files that changed from the base of the PR and between 4afd60dfc3d3ea1c6f705ecc775f7f9c9e705703 and 50974fd3fed2b0ddc6d8e1523a24ff21f619bb3d.

📒 Files selected for processing (7)
  • Core/Libraries/Source/WWVegas/WW3D2/Backend/DX8Backend.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/Renderer.h
  • Core/Libraries/Source/WWVegas/WW3D2/ww3d.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp

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

Walkthrough

This change adds a static Renderer interface with a DX8 forwarding implementation. It removes the previous backend interface and migrates selected rendering operations across WW3D2, game rendering, and tools to Renderer. The render-to-texture setup also rejects multisampled targets and releases resources if switching to a render texture fails.

Changes

Renderer interface and lifecycle

Layer / File(s) Summary
Renderer contract, DX8 forwarding, and WW3D lifecycle
Core/Libraries/Source/WWVegas/WW3D2/Renderer.h, Core/Libraries/Source/WWVegas/WW3D2/Backend/DX8Backend.cpp, Core/Libraries/Source/WWVegas/WW3D2/Backend/*, Core/Libraries/Source/WWVegas/WW3D2/IRenderBackend.h, Core/Libraries/Source/WWVegas/WW3D2/ww3d.*, Core/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt
Renderer defines rendering operations and forwards them to DX8Wrapper. WW3D delegates lifecycle, device queries, frame operations, and gamma handling to Renderer. The previous backend interface, factory, and accessor are removed.
WW3D2 and camera/render utilities
Core/Libraries/Source/WWVegas/WW3D2/*, Generals/Code/Libraries/Source/WWVegas/WW3D2/*, GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/*
Selected material, shader, transform, viewport, lighting, and render-state operations use Renderer; texture, buffer, and draw operations remain on DX8Wrapper where noted.
Game rendering call sites
Core/GameEngineDevice/Source/W3DDevice/GameClient/*, Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/*, Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/*, GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/*
Terrain, water, scene, shadow, and other game rendering paths use Renderer for selected state, transform, format and stencil queries, clears, and lighting operations.
Application and tool call sites
Core/Tools/W3DView/*, GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp
W3DView applies gamma through WW3D::Set_Gamma and uses Renderer for cursor setup. WorldBuilder uses Renderer for render state, material, shader, and transform operations.

Priority: Low

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Refactor

Suggested reviewers: cryotherenegade

Merge Risk: Minimal · previous review 50974

This refactor moves rendering calls behind a new Renderer interface, and initialization, shutdown, viewport and projection behavior match the previous code. No concrete merge-blocking risk was found.

Pre-merge checks | Passed 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly summarizes the main change: routing shader and material state through Renderer.
Description check Passed The description directly explains the Renderer refactor, DX8Backend forwarding, retained DX8Wrapper calls, validation performed, 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.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@bobtista
bobtista force-pushed the bobtista/refactor/route-shader-material branch from 49697d3 to 4afd60d Compare October 9, 2026 15:49
@bobtista bobtista changed the title refactor(ww3d2): Route shader and material state via IRenderBackend refactor(ww3d2): Route shader and material state via Renderer Oct 9, 2026
@bobtista
bobtista force-pushed the bobtista/refactor/route-shader-material branch 3 times, most recently from d0b9943 to 1fac15e Compare October 11, 2026 06:41
@bobtista
bobtista force-pushed the bobtista/refactor/route-shader-material branch 2 times, most recently from a2fa516 to 8c35ce1 Compare October 24, 2026 16:40
@bobtista
bobtista force-pushed the bobtista/refactor/route-shader-material branch from 8c35ce1 to f199b80 Compare October 28, 2026 18:06
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.

1 participant