Skip to content

refactor(ww3d2): Route fill mode and color write mask via Renderer - #3703

Draft
bobtista wants to merge 19 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/route-fill-color-write
Draft

bobtista wants to merge 19 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/route-fill-color-write

Conversation

@bobtista

Copy link
Copy Markdown

Follow up for #2613
Merge after #3700

This change routes the fill mode and color write mask through Renderer.

Renderer.h gets RenderFillMode and RenderColorWrite enums. The DX8 backend translates each value to its D3D constant.

The save and restore blocks in W3DScene and W3DVolumetricShadow read the color write mask from the device. They stay as they are and move with the stencil shadow change.

Testing

@coderabbitai

coderabbitai Bot commented Nov 20, 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

The change expands the Renderer interface and adds DX8 backend implementations. Engine, library, and tool code routes selected rendering operations and capability checks through Renderer. The shader manager also changes render-target handling for multisampled targets and failed target selection.

Changes

Renderer Interface Migration

Layer / File(s) Summary
Renderer contract and DX8 backend
Core/Libraries/Source/WWVegas/WW3D2/Renderer.h, Core/Libraries/Source/WWVegas/WW3D2/Backend/DX8Backend.cpp
Adds Renderer capability queries and rendering methods. The DX8 backend forwards operations to DX8Wrapper and converts fill modes, color masks, and draw parameters.
Capability and format queries
Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp, Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp, Core/Libraries/Source/WWVegas/WW3D2/{texture.cpp,textureloader.cpp,ww3dformat.cpp,dx8renderer.cpp,meshmdl.cpp,statistics.cpp}, Generals/Code/Libraries/Source/WWVegas/WW3D2/{decalmsh.cpp,meshmatdesc.cpp}, GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp
Capability and format checks use Renderer queries. Existing format fallback orders and stated conditions remain unchanged.
WW3D rendering and state submission
Core/Libraries/Source/WWVegas/WW3D2/*, Generals/Code/Libraries/Source/WWVegas/WW3D2/*, GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/*
Rendering code uses Renderer for selected state, texture, buffer, transform, lighting, and draw operations. Existing sorting paths remain in place where described.
Game rendering paths
Core/GameEngineDevice/Source/W3DDevice/GameClient/*, Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/*, GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/*
Terrain, water, effects, shadows, and scene rendering use Renderer for selected operations. The shader manager changes render-target initialization behavior for multisampled targets and target-selection failures.
Rendering in tools
Core/Tools/W3DView/ScreenCursor.cpp, Generals/Code/Tools/WorldBuilder/src/{DrawObject.cpp,ObjectPreview.cpp}, GeneralsMD/Code/Tools/WorldBuilder/src/{DrawObject.cpp,ObjectPreview.cpp}
W3DView and WorldBuilder route selected rendering operations and preview render-target selection through Renderer.

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

Change: Refactor

Suggested reviewers: xezon

Merge Risk: Minimal · previous review f8f1e

This refactor routes rendering state and draw calls through the Renderer interface with a DX8 backend that forwards to the existing wrapper. No concrete defect was found. The author reports a pixel-identical replay render.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: fill mode and color write mask are now routed through the Renderer abstraction in the ww3d2 library. The changeset adds Renderer::Set_Fill_Mode and Renderer::Set_Color…
Description check Passed The description is related to the changeset. It states that the PR routes fill mode and color write mask through Renderer, adds RenderFillMode and a color-write enum to Renderer.h, and explains that t…
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: fill mode and color write mask are now routed through the Renderer abstraction in the ww3d2 library. The changeset adds Renderer::Set_Fill_Mode and Renderer::Set_Color_Write_Mask and migrates call sites from DX8Wrapper to Renderer. The title is specific and matches the core objective, though the changeset also covers many other Renderer migrations (textures, buffers, draws, capability queries) that the title does not mention, which is acceptable because a title need not cover every detail.

Full details: Description check

Explanation

The description is related to the changeset. It states that the PR routes fill mode and color write mask through Renderer, adds RenderFillMode and a color-write enum to Renderer.h, and explains that the DX8 backend maps each value to its D3D constant. It also describes the save/restore blocks in W3DScene and W3DVolumetricShadow and lists build and replay testing. It does not mention the many other Renderer migrations in the changeset, but the check is lenient and only requires relation to the changeset.

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: bd53cd85-4f08-4685-9606-dc9bc65ed472
Commits

Reviewing files that changed from the base of the PR and between b9e8616 and f8f1e09.

Files selected for processing: 2

  • Core/Libraries/Source/WWVegas/WW3D2/Backend/DX8Backend.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/Renderer.h

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

@bobtista
bobtista force-pushed the bobtista/refactor/route-fill-color-write branch from 7699e22 to b9e8616 Compare November 20, 2026 01:16
static void Apply_Render_State_Changes();

static void Set_Fill_Mode(RenderFillMode mode);
static void Set_Color_Write_Mask(unsigned int mask);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Make the mask type a typedef so we know what flags it takes.

For reference see:

typedef UnsignedInt CursorCaptureMode;
enum CursorCaptureMode_ CPP_11(: CursorCaptureMode)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done, added a RenderColorWriteMask typedef with the enum following the CursorCaptureMode pattern, and Set_Color_Write_Mask takes it now.

@bobtista
bobtista force-pushed the bobtista/refactor/route-fill-color-write branch from f8f1e09 to a376c6d Compare November 22, 2026 14:24
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.

2 participants