fix(textureloader): Simplify and fix faulty implementations of texture reduction (2)#2814
fix(textureloader): Simplify and fix faulty implementations of texture reduction (2)#2814xezon wants to merge 1 commit into
Conversation
|
| Filename | Overview |
|---|---|
| Core/Libraries/Source/WWVegas/WW3D2/textureloader.cpp | Simplifies Begin_Compressed_Load (2D, cube, volume) to write reduced dimensions directly into Width/Height/Depth, removes redundant Validate_Texture_Size calls, drops manual pre-loop reduction shifts in Load_Compressed_Mipmap, and replaces silent mip-count underflow recovery with WWASSERT. Logic is correct given Validate_Reduction guarantees the asserted preconditions; minor conservative behaviour in max_mip_level_count for non-square textures is pre-existing. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Begin_Compressed_Load] --> B[Get_Texture_Information]
B --> C[Get_Valid_Texture_Format]
C --> D[Validate_Reduction]
D --> E[Apply_Dim_Reduction
Width/Height = reduced dims]
E --> F[Apply_Mip_Reduction
MipLevelCount capped by max_mip_level_count]
F --> G[_Create_DX8_Texture
Width, Height, MipLevelCount]
G --> H[Load_Compressed_Mipmap]
H --> I[DDSFileClass opened with Get_Reduction]
I --> J{for level 0..MipLevelCount-1}
J --> K[WWASSERT width >= MinTextureDim]
K --> L[Copy_Level_To_Surface]
L --> M[width >>= 1 / height >>= 1]
M --> J
J --> N[return true]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Begin_Compressed_Load] --> B[Get_Texture_Information]
B --> C[Get_Valid_Texture_Format]
C --> D[Validate_Reduction]
D --> E[Apply_Dim_Reduction
Width/Height = reduced dims]
E --> F[Apply_Mip_Reduction
MipLevelCount capped by max_mip_level_count]
F --> G[_Create_DX8_Texture
Width, Height, MipLevelCount]
G --> H[Load_Compressed_Mipmap]
H --> I[DDSFileClass opened with Get_Reduction]
I --> J{for level 0..MipLevelCount-1}
J --> K[WWASSERT width >= MinTextureDim]
K --> L[Copy_Level_To_Surface]
L --> M[width >>= 1 / height >>= 1]
M --> J
J --> N[return true]
Reviews (1): Last reviewed commit: "fix(textureloader): Simplify and fix fau..." | Re-trigger Greptile
This change further simplifies and fixes the implementations of texture reduction.
I tested retail vs patched game with different texture reduction levels and it looked identical.