Skip to content

refactor(ww3d2): Route texture stage transforms via Renderer - #3700

Draft
bobtista wants to merge 7 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/route-texture-transforms
Draft

bobtista wants to merge 7 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/route-texture-transforms

Conversation

@bobtista

Copy link
Copy Markdown

Now texture stage transforms are on Renderer as Set_Texture_Transform. It forwards to DX8Wrapper::Set_Transform with D3DTS_TEXTURE0 + stage, as the mappers did before. The raw _Get_DX8_Transform and _Set_DX8_Transform calls in the terrain, water and shader manager code read the device matrix and stay as they are.

Todo:

  • Build win32, including W3DView and WorldBuilder
  • Load a skirmish save and the shell map. Same result as main

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

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.

Walkthrough

This change adds capability and rendering methods to Renderer, implements them in DX8Backend, and replaces many direct DX8Wrapper calls across WW3D, game rendering, Generals, and tools. It also adds a checked cast helper and resets debug macro definitions in Autorun.

Changes

Renderer API routing

Layer / File(s) Summary
Renderer interface and DX8 forwarding
Core/Libraries/Source/WWVegas/WW3D2/Renderer.h, Core/Libraries/Source/WWVegas/WW3D2/Backend/DX8Backend.cpp, Core/Libraries/Source/Lib/Include/Lib/BaseFunctions.h
Renderer adds capability, render-target, buffer, draw, and texture-transform methods. DX8Backend forwards these methods to DX8Wrapper. check_cast<T, U> checks that a cast preserves the input value when converted back.
Capability and texture-format routing
Core/GameEngineDevice/Source/W3DDevice/..., Core/Libraries/Source/WWVegas/WW3D2/..., Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp, GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp
Capability and texture-format checks, texture transforms, and texture-stage limits use Renderer. Existing format-selection conditions and fallback order remain.
WW3D geometry and texture rendering
Core/Libraries/Source/WWVegas/WW3D2/..., Generals/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp, GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/...
WW3D rendering paths use Renderer for texture and buffer binding, index offsets, draw submission, and render-target changes. Sorting paths and draw parameters remain in place.
Game-device terrain, shaders, and effects
Core/GameEngineDevice/Source/W3DDevice/GameClient/...
Terrain, particle, snow, tree, scorch, smudge, track, and shader paths use Renderer for capability checks and rendering calls. Existing conditions and render-state setup remain.
Water and water-track rendering
Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/...
Water rendering paths use Renderer for render-target selection, buffer and texture binding, and draw submission. Existing draw parameters remain.
Generals rendering call sites
Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/..., GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/..., Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp, GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp
Generals and GeneralsMD rendering paths use Renderer for 2D, shadow, bib, bridge, road, UI, and status-circle operations. Existing draw conditions and DirectX render-state changes remain.
WorldBuilder and W3DView rendering
Generals/Code/Tools/WorldBuilder/src/..., GeneralsMD/Code/Tools/WorldBuilder/src/..., Core/Tools/W3DView/ScreenCursor.cpp
WorldBuilder and W3DView use Renderer for object feedback, buffer and texture binding, draw submission, and preview render-target changes.

Autorun debug macros

Layer / File(s) Summary
Reset debug macro definitions
Core/Tools/Autorun/GameText.cpp
The file undefines existing DEBUG_LOG and DEBUG_ASSERTCRASH definitions before defining no-op debug macros.

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

Change: Refactor

Possibly related PRs

  • TheSuperHackers/GeneralsGameCode#3419: It adds Renderer::Set_Transform and DX8Backend mappings. This change adds Renderer::Set_Texture_Transform and routes texture-stage transforms through it.

Suggested reviewers: xezon, cryotherenegade, stephanmeesters

Merge Risk: Minimal · previous review e0d8b

This change routes rendering and capability calls through the Renderer interface, which forwards to the existing DX8 code with the same arguments. No concrete regression was found, so merge risk is minimal. A quick in-game comparison with main (skirmish save and shell map) would still be worthwhile.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: texture stage transforms are now routed through Renderer::Set_Texture_Transform in ww3d2. The changeset adds Set_Texture_Transform to Renderer.h and DX8Backend.cpp, an…
Description check Passed The description relates directly to the changeset. It explains that texture stage transforms moved to Renderer as Set_Texture_Transform, that this forwards to DX8Wrapper::Set_Transform with D3DTS_TEXT…
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.
Full details: Title check

Explanation

The title names the main change: texture stage transforms are now routed through Renderer::Set_Texture_Transform in ww3d2. The changeset adds Set_Texture_Transform to Renderer.h and DX8Backend.cpp, and mapper.cpp and matrixmapper.cpp switch to it. The title does not mention the wider renderer-routing work across many files, but it is a real and central part of the change.

Full details: Description check

Explanation

The description relates directly to the changeset. It explains that texture stage transforms moved to Renderer as Set_Texture_Transform, that this forwards to DX8Wrapper::Set_Transform with D3DTS_TEXTURE0 + stage, and that the raw _Get_DX8_Transform and _Set_DX8_Transform calls stay. It also lists build testing status.

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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1ea404c3-9b41-4cc7-8526-53857da44f5d
Commits

Reviewing files that changed from the base of the PR and between 7dee298 and e0d8b7c.

Files selected for processing: 29

  • Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DScorch.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainBackground.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/Backend/DX8Backend.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/Renderer.h
  • Core/Libraries/Source/WWVegas/WW3D2/boxrobj.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/matpass.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/seglinerenderer.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/streakRender.cpp
  • Core/Tools/W3DView/ScreenCursor.cpp
  • Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp
  • Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBibBuffer.cpp
  • Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp
  • Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
  • Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp
  • Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp
  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp
  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBibBuffer.cpp
  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp
  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp
  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp
  • GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.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.

@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour Refactor Edits the code with insignificant behavior changes, is never user facing Rendering Is Rendering related labels Nov 21, 2026
@bobtista
bobtista force-pushed the bobtista/refactor/route-texture-transforms branch 3 times, most recently from 7dee298 to e0d8b7c Compare November 27, 2026 15:40
@bobtista
bobtista force-pushed the bobtista/refactor/route-texture-transforms branch from e0d8b7c to 40d537f Compare November 27, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gen Relates to Generals Minor Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing Rendering Is Rendering related ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants