Skip to content

refactor(ww3d2): Route capability queries via Renderer - #3699

Draft
bobtista wants to merge 16 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/route-caps-queries
Draft

bobtista wants to merge 16 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/route-caps-queries

Conversation

@bobtista

Copy link
Copy Markdown

Now the capability queries game code uses are on Renderer: Supports_Texture_Format, Supports_DXTC, Supports_Dot3, Supports_Point_Sprites, Supports_NPatches, Supports_Bump_Envmap, Supports_Bump_Envmap_Luminance, Supports_ZBias and Get_Max_Textures_Per_Pass. Each forwards to DX8Caps. shader.cpp, the DX8 buffer classes and the raw D3DCAPS8 reads stay on DX8Wrapper.

Todo:

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

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds static rendering and capability APIs to Renderer, implements them in the DX8 backend, and migrates rendering and capability call sites across WW3D, game code, and tools. Existing draw parameters and rendering branches are generally retained. The shader manager also changes render-target handling.

Changes

Renderer API and backend

Layer / File(s) Summary
Renderer interface and DX8 implementation
Core/Libraries/Source/WWVegas/WW3D2/Renderer.h, Core/Libraries/Source/WWVegas/WW3D2/Backend/DX8Backend.cpp
Renderer adds capability, render-target, state, buffer, draw, light, and fog methods. The DX8 backend forwards these calls to DX8Wrapper; draw parameters that narrow to unsigned short are checked.
WW3D rendering and capability call sites
Core/Libraries/Source/WWVegas/WW3D2/*
WW3D code uses Renderer for rendering operations and capability checks, including texture formats, compression, and N-patches. Existing sorting paths and format-selection rules remain.
Game rendering and tools
Core/GameEngineDevice/Source/W3DDevice/..., Generals/Code/..., GeneralsMD/Code/..., Core/Tools/..., Generals/Code/Tools/WorldBuilder/..., GeneralsMD/Code/Tools/WorldBuilder/...
Rendering code uses Renderer for state, buffer, texture, draw, light, fog, and render-target operations. Existing conditions, draw inputs, and ordering are retained in the summarized paths.
Shader manager render-target handling
Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp
The default screen filter no longer redirects rendering to a texture in preRender. Render-target initialization skips texture creation when the current surface is multisampled. startRenderToTexture releases render-to-texture resources and returns if setting the render target fails.

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

Change: Refactor

Suggested labels: Refactor, Rendering, Gen, ZH

Suggested reviewers: xezon, stephanmeesters, tomsons26

Merge Risk: Minimal · up to d8c97

This refactor routes capability and rendering calls through Renderer while keeping the same underlying DX8 behavior. No concrete regression was found. Running the skirmish-save and shell-map comparison noted in the PR would be a useful final check before merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the game-code capability queries (texture format, DXTC, Dot3, point sprites, N-patches, bump envmap, ZBias, max textures per pass) now go through Renderer instead of D…
Description check Passed The description names the specific capability queries moved onto Renderer, states that each forwards to DX8Caps, and lists what stays on DX8Wrapper. It also gives build and replication status and a me…
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: the game-code capability queries (texture format, DXTC, Dot3, point sprites, N-patches, bump envmap, ZBias, max textures per pass) now go through Renderer instead of DX8Wrapper. The raw summary confirms this across many WW3D2 and GameClient files, so the title is specific and accurate.

Full details: Description check

Explanation

The description names the specific capability queries moved onto Renderer, states that each forwards to DX8Caps, and lists what stays on DX8Wrapper. It also gives build and replication status and a merge dependency. The changeset matches these claims, so the description is on-topic.

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: 40eaf20d-20d9-4688-814d-4ecd1e754eab
Commits

Reviewing files that changed from the base of the PR and between ee27e89 and d8c9710.

Files selected for processing: 69

  • Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp
  • 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/W3DTerrainParticles.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.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/Renderer.h
  • Core/Libraries/Source/WWVegas/WW3D2/boxrobj.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/dx8polygonrenderer.h
  • Core/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp
  • 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/mesh.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/meshmdl.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/statistics.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/streakRender.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/texproject.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/texture.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/textureloader.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/ww3dformat.cpp
  • Core/Tools/W3DView/ScreenCursor.cpp
  • Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp
  • Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.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/W3DScene.cpp
  • Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp
  • Generals/Code/Tools/WorldBuilder/src/DrawObject.cpp
  • Generals/Code/Tools/WorldBuilder/src/ObjectPreview.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/dazzle.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.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

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

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