-
Notifications
You must be signed in to change notification settings - Fork 167
feat: Add Anti-Aliasing and Anisotropic Filtering support to options.ini #2375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,11 +88,13 @@ static void drawFramerateBar(); | |
| #include "WW3D2/part_emt.h" | ||
| #include "WW3D2/part_ldr.h" | ||
| #include "WW3D2/dx8caps.h" | ||
| #include "WW3D2/dx8wrapper.h" | ||
| #include "WW3D2/ww3dformat.h" | ||
| #include "WW3D2/agg_def.h" | ||
| #include "WW3D2/render2dsentence.h" | ||
| #include "WW3D2/sortingrenderer.h" | ||
| #include "WW3D2/textureloader.h" | ||
| #include "WW3D2/texturefilter.h" | ||
| #include "WW3D2/dx8webbrowser.h" | ||
| #include "WW3D2/mesh.h" | ||
| #include "WW3D2/hlod.h" | ||
|
|
@@ -708,6 +710,16 @@ void W3DDisplay::init() | |
| WW3D::Set_Screen_UV_Bias( TRUE ); ///< this makes text look good :) | ||
| WW3D::Set_Texture_Bitdepth(32); | ||
|
|
||
| D3DMULTISAMPLE_TYPE msType = D3DMULTISAMPLE_NONE; | ||
| switch (TheGlobalData->m_antiAliasBoxValue) | ||
| { | ||
| case 1: msType = D3DMULTISAMPLE_2_SAMPLES; break; | ||
| case 2: msType = D3DMULTISAMPLE_4_SAMPLES; break; | ||
| case 3: msType = D3DMULTISAMPLE_8_SAMPLES; break; | ||
| default: msType = D3DMULTISAMPLE_NONE; break; | ||
| } | ||
| DX8Wrapper::Set_MultiSample_Type(msType); | ||
|
|
||
| setWindowed( TheGlobalData->m_windowed ); | ||
|
Comment on lines
+713
to
723
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MSAA set before windowed mode is determined
The MSAA type should either be forced to Prompt To Fix With AIThis is a comment left during a code review.
Path: GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
Line: 713-723
Comment:
**MSAA set before windowed mode is determined**
`DX8Wrapper::Set_MultiSample_Type(msType)` is called before `setWindowed(TheGlobalData->m_windowed)`. In DirectX 8, MSAA in windowed mode is unsupported on most hardware (the API requires full-screen exclusive mode for `MultiSampleType != D3DMULTISAMPLE_NONE`). Setting a non-zero MSAA type and then requesting a windowed device will almost certainly cause `CreateDevice`/`Reset` to return `D3DERR_INVALIDCALL`.
The MSAA type should either be forced to `D3DMULTISAMPLE_NONE` when windowed mode is active, or the windowed state must be resolved before the multisampling type is set.
How can I resolve this? If you propose a fix, please make it concise. |
||
|
|
||
| // create a 2D renderer helper | ||
|
|
@@ -782,6 +794,11 @@ void W3DDisplay::init() | |
| return; | ||
| } | ||
|
|
||
| if (TheGlobalData->m_anisotropicFiltering) | ||
| { | ||
| WW3D::Set_Texture_Filter(TextureFilterClass::TEXTURE_FILTER_ANISOTROPIC); | ||
| } | ||
|
|
||
| //Check if level was never set and default to setting most suitable for system. | ||
| if (TheGameLODManager->getStaticLODLevel() == STATIC_GAME_LOD_UNKNOWN) | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No hardware capability check before setting MSAA type
DX8Wrapper::Set_MultiSample_Type(msType)is called unconditionally without first verifying the hardware supports the requested sample count viaIDirect3D8::CheckDeviceMultiSampleType. On hardware that doesn't support (for example) 8× MSAA, this will cause every call toSet_Render_Deviceto fail. Critically, the three-attempt fallback retry loop below (attempts 0-2) only changes the resolution and bit-depth — it never resetsMultiSampleTypeback toD3DMULTISAMPLE_NONE. This means all three attempts will fail with the same unsupported MSAA type, causing the game to abort withERROR_INVALID_D3Don startup for any user whose hardware doesn't support their configured MSAA level.The fix should reset
MultiSampleTypetoD3DMULTISAMPLE_NONEinside the retry loop when device creation fails, or validate the sample count againstD3DInterface->CheckDeviceMultiSampleTypebefore using it.Prompt To Fix With AI