Skip to content

refactor(ww3d2): Route render-target binding via Renderer - #3424

Draft
bobtista wants to merge 5 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/route-render-targets
Draft

bobtista wants to merge 5 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/route-render-targets

Conversation

@bobtista

@bobtista bobtista commented Oct 4, 2026 •

Copy link
Copy Markdown

Water reflection, texture projection and the WorldBuilder object preview render into a texture with Set_Render_Target_With_Z. They then go back to the back buffer by passing a null IDirect3DSurface8 to Set_Render_Target.

Now Renderer has Set_Render_Target_With_Z, Set_Default_Render_Target and Is_Render_To_Texture. Set_Default_Render_Target replaces the null surface call. W3DProfilerFrameCapture stays on DX8Wrapper because it renders with the D3D device directly. texproject.cpp no longer uses DX8Wrapper and drops its include.

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
  • Water reflection
  • WorldBuilder object preview
  • 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.

  • Last reviewed commit: f37c88bbaf29b931a8dcd510b0b110e4afc0b294
  • Latest commit, not reviewed: 906929f

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.

Walkthrough

The pull request expands the Renderer interface and adds DX8 forwarding implementations. Rendering code across WW3D, game clients, and tools uses Renderer for selected device queries, render state, resources, transforms, and drawing. Water rendering also scales river-vertex color by shroud level.

Changes

Renderer interface and device queries

Layer / File(s) Summary
Renderer interface and device queries
Core/Libraries/Source/WWVegas/WW3D2/Renderer.h, Core/Libraries/Source/WWVegas/WW3D2/Backend/DX8Backend.cpp, Core/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h, Core/Libraries/Source/WWVegas/WW3D2/ww3d.cpp
Renderer adds device and target queries, render-target and resource operations, buffer binding, drawing, transforms, lighting, and fog. DX8Backend forwards these operations to DX8Wrapper. Selected WW3D queries and coordinate normalization now use Renderer.

WW3D object rendering

Layer / File(s) Summary
WW3D object rendering
Core/Libraries/Source/WWVegas/WW3D2/dx8polygonrenderer.h, Core/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp, Core/Libraries/Source/WWVegas/WW3D2/{dynamesh.cpp,line3d.cpp,matpass.cpp,pointgr.cpp,ringobj.cpp,seglinerenderer.cpp,sortingrenderer.cpp,sphereobj.cpp,streakRender.cpp}, GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/{boxrobj.cpp,dazzle.cpp,decalmsh.cpp,linegrp.cpp,mapper.cpp,mesh.cpp,camera.cpp,render2d.cpp,scene.cpp}, Core/Libraries/Source/WWVegas/WW3D2/{texproject.cpp}
WW3D rendering code now uses Renderer for selected resource, state, transform, render-target, and draw operations. Existing sorting paths remain in place where described.

Game terrain and tree rendering

Layer / File(s) Summary
Game terrain and tree rendering
Core/GameEngineDevice/Source/W3DDevice/GameClient/{BaseHeightMap.cpp,FlatHeightMap.cpp,HeightMap.cpp,W3DTerrainBackground.cpp,W3DTerrainTracks.cpp,W3DTreeBuffer.cpp}
Terrain, shoreline, terrain background, terrain tracks, and tree rendering use Renderer for supported state, resource, transform, and draw operations. Existing pass conditions and draw parameters remain unchanged where described.

Game effects, shaders, and water rendering

Layer / File(s) Summary
Game effects, shaders, and water rendering
Core/GameEngineDevice/Source/W3DDevice/GameClient/{W3DDisplay.cpp,W3DShaderManager.cpp,W3DScorch.cpp,W3DSmudge.cpp,W3DSnow.cpp,W3DDebugIcons.cpp,Water/W3DWater.cpp,Water/W3DWaterTracks.cpp}
These paths now use Renderer for selected rendering operations. W3DShaderManager changes render-target setup for multisampled surfaces, disables the default screen filter’s texture redirection, and sets supplied benchmark outputs to 10.0f. River vertex RGB and alpha are scaled by shroud level.

Generals rendering paths and tools

Layer / File(s) Summary
Generals rendering paths and tools
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/{Shadow/W3DProjectedShadow.cpp,Shadow/W3DVolumetricShadow.cpp,W3DBibBuffer.cpp,W3DBridgeBuffer.cpp,W3DInGameUI.cpp,W3DRoadBuffer.cpp,W3DScene.cpp,W3DStatusCircle.cpp}, Core/Tools/W3DView/ScreenCursor.cpp, GeneralsMD/Code/Tools/WorldBuilder/src/{DrawObject.cpp,ObjectPreview.cpp}
Game scene, shadow, road, bridge, bib, status-circle, and interface rendering paths use Renderer for selected operations. W3DView and WorldBuilder use it for cursor rendering, object drawing, and preview render-target selection.

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

Change: Refactor

Suggested reviewers: cryotherenegade

Merge Risk: Minimal · previous review f37c8

The inspected changes preserve existing rendering behavior, and no actionable regression introduced by this PR was established.

Pre-merge checks | Passed 4

✅ Passed checks (4 passed)

Check name Status Explanation
Title check Passed The title clearly identifies the primary change: routing render-target binding through Renderer.
Description check Passed The description directly explains the render-target refactor, affected components, validation, and remaining test items.
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.

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

ℹ️ Recent review info

⚙️ Run configuration

  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9878ead8-8ddc-480c-8cfd-76ec70d1d795
📥 Commits

Reviewing files that changed from the base of the PR and between 88a66d106fe37d9676f42a0ef78d96702220ee68 and f37c88bbaf29b931a8dcd510b0b110e4afc0b294.

📒 Files selected for processing (8)

  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp
  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp

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

@bobtista
bobtista force-pushed the bobtista/refactor/route-render-targets branch 2 times, most recently from 5ac061d to 60913e5 Compare October 9, 2026 15:49
@bobtista bobtista changed the title refactor(ww3d2): Route render-target binding via IRenderBackend refactor(ww3d2): Route render-target binding via Renderer Oct 9, 2026
@bobtista
bobtista force-pushed the bobtista/refactor/route-render-targets branch 3 times, most recently from 88a66d1 to f37c88b Compare October 11, 2026 06:41
@bobtista
bobtista force-pushed the bobtista/refactor/route-render-targets branch 2 times, most recently from 94e42b3 to 46c0216 Compare October 24, 2026 16:40
@bobtista
bobtista force-pushed the bobtista/refactor/route-render-targets branch from 46c0216 to 9d6a4a7 Compare October 28, 2026 18:06
@bobtista
bobtista force-pushed the bobtista/refactor/route-render-targets branch from 9d6a4a7 to 906929f Compare November 9, 2026 03:05
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