Skip to content

chore(dx8fvf): Remove unused vertex_size parameter from FVFInfoClass#2615

Merged
xezon merged 2 commits intoTheSuperHackers:mainfrom
stephanmeesters:chore/cleanup-fzf-vertexsizeparam
Apr 19, 2026
Merged

chore(dx8fvf): Remove unused vertex_size parameter from FVFInfoClass#2615
xezon merged 2 commits intoTheSuperHackers:mainfrom
stephanmeesters:chore/cleanup-fzf-vertexsizeparam

Conversation

@stephanmeesters
Copy link
Copy Markdown

This removes the vertex_size parameter from FVFInfoClass which was introduced in ZH but unused.

It was added to support vertex buffer layouts not describable with existing FVF layouts, presumably to use for cube mapping or displacement mapping as the file header suggests.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 18, 2026

Greptile Summary

This PR removes the vertex_size parameter from FVFInfoClass and the VertexBufferClass/DX8VertexBufferClass constructors in the Zero Hour (GeneralsMD) codebase, replacing the old dual-condition assertion with a simpler FVF != 0 guard. The same assertion is also added to the Generals build's VertexBufferClass, which never had the vertex_size parameter to begin with. The change is correct and safe — the old fallback path (FVF==0 && vertex_size!=0) is now properly blocked at every call site by the new assertion.

Confidence Score: 5/5

Safe to merge — the only finding is a minor spacing style nit in the new assertion.

All changes are straightforward parameter removals with matching assertion guards. No logic paths are silently dropped; the FVF != 0 assertion at every call site makes the simplified fvf_size initializer safe. Only a P2 style inconsistency was found.

No files require special attention.

Important Files Changed

Filename Overview
GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8fvf.h Removes vertex_size=0 default parameter from FVFInfoClass constructor declaration — clean and correct.
GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8fvf.cpp Removes vertex_size parameter from constructor and simplifies fvf_size initializer to always call Get_FVF_Vertex_Size(FVF) directly, safe given callers now assert FVF != 0.
GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h Removes vertex_size=0 default parameter from both VertexBufferClass and DX8VertexBufferClass constructor declarations — consistent with implementation changes.
GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp Removes vertex_size parameter from VertexBufferClass and DX8VertexBufferClass constructors, replaces the dual-condition assertion with a simple FVF != 0 guard.
Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp Adds WWASSERT(FVF != 0) to the Generals version of VertexBufferClass constructor to match the invariant now enforced in ZH — the Generals build already had no vertex_size parameter.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant DX8VB as DX8VertexBufferClass
    participant VB as VertexBufferClass
    participant FVF as FVFInfoClass

    Caller->>DX8VB: DX8VertexBufferClass(FVF, count, usage)
    DX8VB->>VB: VertexBufferClass(BUFFER_TYPE_DX8, FVF, count)
    VB->>VB: WWASSERT(FVF != 0)
    VB->>FVF: FVFInfoClass(FVF)
    FVF->>FVF: fvf_size = Get_FVF_Vertex_Size(FVF)
    FVF-->>VB: fvf_info set
    VB-->>DX8VB: base constructed
    DX8VB-->>Caller: ready
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp
Line: 83-84

Comment:
**WWASSERT spacing inconsistency**

The new assertion uses `FVF != 0` with spaces around the operator, while the line immediately above (`type==BUFFER_TYPE_DX8 || type==BUFFER_TYPE_SORTING`) uses no spaces. Minor style inconsistency within the same block.

```suggestion
	WWASSERT(FVF!=0);
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (2): Last reviewed commit: "Add defensive assert" | Re-trigger Greptile

xezon
xezon previously approved these changes Apr 18, 2026
Copy link
Copy Markdown

@xezon xezon left a comment

Choose a reason for hiding this comment

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

Needs to be replicated in Generals

@xezon xezon dismissed their stale review April 18, 2026 12:43

greptile has a complaint. Please check.

@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing Gen Relates to Generals ZH Relates to Zero Hour labels Apr 18, 2026
@xezon xezon changed the title chore(ww3d2): Cleanup unused vertex_size parameter from FVFInfoClass chore(dx8fvf): Cleanup unused vertex_size parameter from FVFInfoClass Apr 18, 2026
@stephanmeesters
Copy link
Copy Markdown
Author

Needs to be replicated in Generals

No need as the code was introduced only in ZH so the current PR restores it exactly back to how it was in Generals.

The assertion is not needed anymore with vertex_size gone.

@xezon xezon added Unify Unifies code between Generals and Zero Hour and removed Gen Relates to Generals labels Apr 18, 2026
@xezon
Copy link
Copy Markdown

xezon commented Apr 18, 2026

greptile has a complaint. Please check.

@xezon xezon changed the title chore(dx8fvf): Cleanup unused vertex_size parameter from FVFInfoClass chore(dx8fvf): Remove unused vertex_size parameter from FVFInfoClass Apr 19, 2026
@xezon xezon merged commit 08933c3 into TheSuperHackers:main Apr 19, 2026
17 checks passed
@stephanmeesters stephanmeesters deleted the chore/cleanup-fzf-vertexsizeparam branch April 19, 2026 10:26
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 Unify Unifies code between Generals and Zero Hour ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants