Skip to content

refactor: Replace D3DXGetErrorStringA and D3DXGetFVFVertexSize with local implementations - #3649

Merged
xezon merged 5 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/d3dx-error-string-fvf-size
Nov 7, 2026
Merged

xezon merged 5 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/d3dx-error-string-fvf-size

Conversation

@bobtista

@bobtista bobtista commented Nov 3, 2026 •

Copy link
Copy Markdown

Log_DX8_ErrorCode and Non_Fatal_Log_DX8_ErrorCode use D3DXGetErrorStringA to describe a failed call, and FVFInfoClass uses D3DXGetFVFVertexSize for the vertex size. Both pull in D3DX, which MinGW does not provide.

Now a local lookup logs the error code by name and hex value. It also replaces the hand-written switch after ValidateDevice in DX8Wrapper::Draw. The static FVFInfoClass::Get_FVF_Vertex_Size computes the size from the FVF bits. The two PRE_TRANSFORM_VERTEX calls in HeightMap.cpp, which are compiled out, call it directly.

Todo:

  • Build win32 and vc6

@coderabbitai

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

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 changes add FVF-based vertex-size calculation and use it in two HeightMap stream setups. They also map selected DX8 error codes to symbolic names for error logging and debug draw validation.

Changes

FVF Vertex Sizing

Layer / File(s) Summary
Calculate and use FVF vertex sizes
Core/Libraries/Source/WWVegas/WW3D2/dx8fvf.h, Core/Libraries/Source/WWVegas/WW3D2/dx8fvf.cpp, Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp
FVFInfoClass::Get_FVF_Vertex_Size calculates vertex size from FVF flags. Two HeightMap stream setups use this method instead of D3DXGetFVFVertexSize. The related D3DX includes and helper are removed.

DX8 HRESULT Logging

Layer / File(s) Summary
Map and log HRESULT names
Core/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp
A helper maps selected Direct3D and HRESULT values to symbolic names and returns "Unknown" for other values. Error loggers emit the name and hexadecimal result. Debug draw validation uses the helper for ValidateDevice results.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related PRs

Suggested reviewers: cryotherenegade

Merge Risk: Minimal · up to b49a8

No actionable merge-blocking defect was identified in the D3DX lookup replacements. Merge after normal build checks.

Pre-merge checks: Passed 4

Check name Status Explanation
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.
Description check Passed The description ties directly to the changeset. It names the error-logging functions (Log_DX8_ErrorCode and Non_Fatal_Log_DX8_ErrorCode) and the FVF vertex-size change in FVFInfoClass. It also covers …
Title check Passed The title identifies both D3DX functions replaced by local implementations.
Full details: Description check

Explanation

The description ties directly to the changeset. It names the error-logging functions (Log_DX8_ErrorCode and Non_Fatal_Log_DX8_ErrorCode) and the FVF vertex-size change in FVFInfoClass. It also covers the ValidateDevice switch replacement in DX8Wrapper::Draw and the two PRE_TRANSFORM_VERTEX calls in HeightMap.cpp. It explains the motivation, which is removing D3DX dependencies that MinGW does not provide. The build status (Win32 and VC6) is also noted. The description is specific enough to pass.

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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: 7009e8f3-c045-414c-8880-1cfb98372fe0
Commits

Reviewing files that changed from the base of the PR and between 2c8b933 and b49a8aa.

Files selected for processing: 3

  • Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/dx8fvf.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/dx8fvf.h

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

@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The changes since the previous review appear safe to merge.

Summary

The PR replaces two D3DX helpers with local code.

  • The renderer calculates vertex sizes from FVF bits.
  • DX8 errors now show a name and their hex value.

No new actionable issues or repository-rule violations were found. No previous review threads were supplied.

Reviews (4) · Last reviewed commit: "refactor(dx8): Use a CASE_LABEL macro fo..." · Reviewed by Greptile

@xezon xezon 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.

Looks reasonable. I assume Get_FVF_Vertex_Size is complete, but do not know.

@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing Rendering Is Rendering related labels Nov 3, 2026
@xezon

xezon commented Nov 4, 2026

Copy link
Copy Markdown

Do you want to have this merged as 3 commits or squashed? Maybe the title needs some polishing?

@bobtista bobtista changed the title refactor(dx8): Replace D3DX error string and FVF size lookups refactor(dx8): Replace D3DXGetErrorStringA and D3DXGetFVFVertexSize with local implementations Nov 5, 2026
@bobtista

bobtista commented Nov 5, 2026

Copy link
Copy Markdown
Author

Squash is fine, the last two commits are review fixups.

@xezon xezon changed the title refactor(dx8): Replace D3DXGetErrorStringA and D3DXGetFVFVertexSize with local implementations refactor: Replace D3DXGetErrorStringA and D3DXGetFVFVertexSize with local implementations Nov 7, 2026
@xezon
xezon merged commit 0e52122 into TheSuperHackers:main Nov 7, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Minor Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing Rendering Is Rendering related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants