Skip to content

refactor(ww3d2): Widen Renderer draw arguments to 32 bits - #3425

Draft
bobtista wants to merge 6 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/widen-draw-arguments
Draft

bobtista wants to merge 6 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/widen-draw-arguments

Conversation

@bobtista

@bobtista bobtista commented Oct 4, 2026 •

Copy link
Copy Markdown

Draw_Triangles, Draw_Strip and Set_Index_Buffer on Renderer take 16-bit start index, counts, vertex range and index base offset, because that is what the DX8Wrapper signatures take.

Now the interface takes 32-bit values. DX8Backend.cpp narrows them to 16 bits and asserts that nothing was lost. Release builds narrow exactly as before. Debug builds now assert where a caller passes a value above 65535, which the old implicit conversion truncated silently.

Todo:

  • Build win32 and vc6, 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
  • Load two skirmish saves in a debug build. No assertion from the backend
  • 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: edff1c017348bc7d4e4c61e3173aa4739cac7086
  • Latest commit, not reviewed: 1407d16

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 adds DX8-backed operations to Renderer and replaces many direct DX8Wrapper calls across WW3D, game rendering, and tools. It also changes selected render-target and river-rendering behavior.

Changes

Renderer API migration

Layer / File(s) Summary
Renderer API and device queries
Core/Libraries/Source/WWVegas/WW3D2/Renderer.h, Core/Libraries/Source/WWVegas/WW3D2/Backend/DX8Backend.cpp, Core/Libraries/Source/WWVegas/WW3D2/ww3d.cpp
Renderer adds device and resolution queries, render-target controls, resource binding, drawing, transforms, light, and fog operations. DX8Backend forwards these operations to DX8. WW3D uses Renderer for device queries and coordinate normalization.
WW3D library rendering calls
Core/Libraries/Source/WWVegas/WW3D2/*, GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/*
WW3D rendering paths use Renderer for supported state, resource, transform, render-target, and draw operations. Sorting submissions and DX8-specific state calls remain in the affected paths.
Game-client rendering calls
Core/GameEngineDevice/Source/W3DDevice/GameClient/*, GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/*
Terrain, water, shadow, scene, and other game-client paths use Renderer for supported rendering operations.
Rendering tool integrations
Core/Tools/W3DView/ScreenCursor.cpp, GeneralsMD/Code/Tools/WorldBuilder/src/*
W3DView routes cursor state setup through Renderer. WorldBuilder uses Renderer for rendering and render-target setup.

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

Change: Refactor

Suggested reviewers: cryotherenegade

Merge Risk: Minimal · previous review edff1

No actionable merge-blocking issue is established in the reviewed changes; the identified rendering fallbacks preserve ordinary scene rendering.

Pre-merge checks | Passed 4

✅ Passed checks (4 passed)

Check name Status Explanation
Description check Passed The description clearly explains the 32-bit Renderer argument change, backend narrowing behavior, debug assertions, validation performed, and remaining Generals replication task.
Title check Passed The title clearly identifies the primary intended change: widening Renderer draw arguments to 32 bits.
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: 5d77ae2d-6a4b-4f5e-a8d8-bde316947c8a
📥 Commits

Reviewing files that changed from the base of the PR and between bf420f9d8785fcbac135cdb8965dcfa0143886bd and edff1c017348bc7d4e4c61e3173aa4739cac7086.

📒 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; 1 remain after this review.

@bobtista
bobtista force-pushed the bobtista/refactor/widen-draw-arguments branch 2 times, most recently from 6799d9d to 320de51 Compare October 9, 2026 15:49
@bobtista bobtista changed the title refactor(ww3d2): Widen IRenderBackend draw arguments to 32 bits refactor(ww3d2): Widen Renderer draw arguments to 32 bits Oct 9, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 11bcce38-79c1-42a0-960d-985839ec6db1
📥 Commits

Reviewing files that changed from the base of the PR and between 2119cc9 and 320de5106774f6cd0c22d5210f155bd03dade263.

📒 Files selected for processing (62)
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DScorch.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainBackground.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/Backend/DX8Backend.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/Backend/DX8Backend.h
  • Core/Libraries/Source/WWVegas/WW3D2/Backend/RenderBackend.h
  • Core/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt
  • Core/Libraries/Source/WWVegas/WW3D2/IRenderBackend.h
  • Core/Libraries/Source/WWVegas/WW3D2/Renderer.h
  • Core/Libraries/Source/WWVegas/WW3D2/dx8polygonrenderer.h
  • Core/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h
  • Core/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/line3d.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/matpass.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/seglinerenderer.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/streakRender.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/texproject.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/ww3d.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/ww3d.h
  • Core/Tools/W3DView/GammaDialog.cpp
  • Core/Tools/W3DView/MainFrm.cpp
  • Core/Tools/W3DView/ScreenCursor.cpp
  • Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp
  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp
  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.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/W3DScene.cpp
  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mapper.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp
  • GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp
  • GeneralsMD/Code/Tools/WorldBuilder/src/ObjectPreview.cpp
💤 Files with no reviewable changes (4)
  • Core/Libraries/Source/WWVegas/WW3D2/Backend/RenderBackend.h
  • Core/Libraries/Source/WWVegas/WW3D2/Backend/DX8Backend.h
  • Core/Libraries/Source/WWVegas/WW3D2/ww3d.h
  • Core/Libraries/Source/WWVegas/WW3D2/IRenderBackend.h

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/widen-draw-arguments branch 3 times, most recently from bf420f9 to edff1c0 Compare October 11, 2026 06:41
@bobtista
bobtista force-pushed the bobtista/refactor/widen-draw-arguments branch 2 times, most recently from c7a937b to aa83f29 Compare October 24, 2026 16:40
@bobtista
bobtista force-pushed the bobtista/refactor/widen-draw-arguments branch from aa83f29 to 5f88f96 Compare October 28, 2026 18:06
@bobtista
bobtista force-pushed the bobtista/refactor/widen-draw-arguments branch from 5f88f96 to 1407d16 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