Skip to content

Commit 2df62c2

Browse files
committed
feat(dx8wrapper): Add check for MSAA support before device creation
1 parent e44f0a5 commit 2df62c2

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,25 @@ bool DX8Wrapper::Set_Render_Device(int dev, int width, int height, int bits, int
10181018
//must be either resetting existing device or creating a new one.
10191019
WWASSERT(reset_device || D3DDevice == nullptr);
10201020

1021+
//Check that we support the requested MSAA mode
1022+
if (MultiSampleAntiAliasing > DEFAULT_MSAA) {
1023+
1024+
HRESULT hr = D3DInterface->CheckDeviceMultiSampleType(
1025+
CurRenderDevice,
1026+
D3DDEVTYPE_HAL,
1027+
D3DFMT_A8R8G8B8,
1028+
TRUE,
1029+
MultiSampleAntiAliasing
1030+
);
1031+
1032+
if (FAILED(hr)) {
1033+
// IF we fail then disable MSAA entirely.
1034+
// External code needs to get the set MSAA mode after device creation
1035+
WWDEBUG_SAY(("Requested MSAA Mode Not Supported"));
1036+
MultiSampleAntiAliasing = DEFAULT_MSAA;
1037+
}
1038+
}
1039+
10211040
/*
10221041
** Initialize values for D3DPRESENT_PARAMETERS members.
10231042
*/

0 commit comments

Comments
 (0)