-
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); | ||
|
Comment on lines
+713
to
+721
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. No hardware capability check before setting MSAA type
The fix should reset Prompt To Fix With AIThis is a comment left during a code review.
Path: GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
Line: 713-721
Comment:
**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 via `IDirect3D8::CheckDeviceMultiSampleType`. On hardware that doesn't support (for example) 8× MSAA, this will cause every call to `Set_Render_Device` to fail. Critically, the three-attempt fallback retry loop below (attempts 0-2) only changes the resolution and bit-depth — it never resets `MultiSampleType` back to `D3DMULTISAMPLE_NONE`. This means all three attempts will fail with the same unsupported MSAA type, causing the game to abort with `ERROR_INVALID_D3D` on startup for any user whose hardware doesn't support their configured MSAA level.
The fix should reset `MultiSampleType` to `D3DMULTISAMPLE_NONE` inside the retry loop when device creation fails, or validate the sample count against `D3DInterface->CheckDeviceMultiSampleType` before using it.
How can I resolve this? If you propose a fix, please make it concise. |
||
|
|
||
| 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) | ||
| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
You need to be more robust with the user options, if you check #1500 where i added scroll anchor options it will give you a good idea.
Using the aformentioned method then allows the new options to be automatically added to the options.ini when a player uses the options menu.
it also makes them available in the future for use in the options menu.