Skip to content

Potential issues in dx8renderer, dx8rendererdebugger #2610

@stephanmeesters

Description

@stephanmeesters

As reported by Greptile:

  1. Core/Libraries/Source/WWVegas/WW3D2/dx8rendererdebugger.cpp, line 28-31 (link)

    P1 Enable ignores its parameter — debugger can never be disabled

    The enable argument is silently dropped; the function unconditionally assigns true, so calling Enable(false) keeps the debugger active. Any call-site that tries to toggle the debugger off will have no effect, leaving it permanently on once activated.

  2. Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp, line 1862-1937 (link)

    P1 D3DRS_NORMALIZENORMALS state leak when debugger skips a mesh

    D3DRS_NORMALIZENORMALS is set to TRUE (line 1864) before the debugger guard, but restored to FALSE (line 1931) inside it. When the debugger is enabled and a mesh is disabled via Set_Debugger_Disable, the restore is never reached, leaving D3DRS_NORMALIZENORMALS=TRUE for all subsequent meshes in the frame. This causes incorrect normal-length-dependent lighting on every mesh rendered afterward.

    The fix is to move the restore outside the debugger if block (after the closing } at line 1937):

            }   // end debugger check
    
    //--------------------------------------------------------------------
            if (mesh->Get_ObjectScale() != 1.0f)
                DX8Wrapper::Set_DX8_Render_State(D3DRS_NORMALIZENORMALS, FALSE);
    //--------------------------------------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions