Skip to content

Commit bc9ff45

Browse files
committed
Disable DirectDrawSurface render MultiSampling
Only uses the Direct3D9 surface emulation when AntiAliasing is enabled from the config file
1 parent a05227e commit bc9ff45

6 files changed

Lines changed: 9 additions & 6 deletions

File tree

Dllmain/BuildNo.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define BUILD_NUMBER 8064
1+
#define BUILD_NUMBER 8065

d3d9/IDirect3DDevice9Ex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,7 @@ HRESULT m_IDirect3DDevice9Ex::SetSamplerState(THIS_ DWORD Sampler, D3DSAMPLERSTA
15611561
Logging::LogDebug() << __FUNCTION__ << " (" << this << ")";
15621562

15631563
// Disable AntiAliasing when using point filtering
1564-
if (SHARED.DeviceMultiSampleType)
1564+
if (SHARED.DeviceMultiSampleFlag)
15651565
{
15661566
if (Type == D3DSAMP_MINFILTER || Type == D3DSAMP_MAGFILTER)
15671567
{

d3d9/IDirect3DDevice9Ex.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ class m_IDirect3DDevice9Ex : public IDirect3DDevice9Ex, public AddressLookupTabl
349349
AddressLookupTableD3d9* GetLookupTable() const { return &SHARED.ProxyAddressLookupTable9; }
350350
StateBlockCache* GetStateBlockTable() const { return &SHARED.StateBlockTable; }
351351
StateBlockCache* GetDeletedStateBlock() const { return &SHARED.DeletedStateBlocks; }
352+
bool GetDeviceMultiSampleFlag() const { return SHARED.DeviceMultiSampleFlag; }
352353
DWORD GetClientDXVersion() const { return SHARED.ClientDirectXVersion; }
353354
REFIID GetIID() { return WrapperID; }
354355

d3d9/IDirect3DSurface9.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ void m_IDirect3DSurface9::InitInterface(m_IDirect3DDevice9Ex* Device, REFIID, vo
262262
{
263263
LOG_LIMIT(3, __FUNCTION__ << " Failed to GetDesc()!" << this << ")");
264264
}
265+
DeviceMultiSampleFlag = m_pDeviceEx->GetDeviceMultiSampleFlag();
265266

266267
if (Emu.pSurface)
267268
{

d3d9/IDirect3DSurface9.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class m_IDirect3DSurface9 : public IDirect3DSurface9, public AddressLookupTableD
88
const IID WrapperID = IID_IDirect3DSurface9;
99

1010
// For fake emulated locking
11+
bool DeviceMultiSampleFlag = false;
1112
D3DSURFACE_DESC Desc = {};
1213
struct {
1314
bool ReadOnly = false;
@@ -65,7 +66,7 @@ class m_IDirect3DSurface9 : public IDirect3DSurface9, public AddressLookupTableD
6566

6667
// Information functions
6768
LPDIRECT3DSURFACE9 GetProxyInterface() const { return ProxyInterface; }
68-
bool IsEmulatedSurface() const { return (Desc.MultiSampleType && !(Desc.Usage & D3DUSAGE_DEPTHSTENCIL)); };
69+
bool IsEmulatedSurface() const { return (Desc.MultiSampleType && DeviceMultiSampleFlag && !(Desc.Usage & D3DUSAGE_DEPTHSTENCIL)); };
6970

7071
// Helper functions
7172
void InitInterface(m_IDirect3DDevice9Ex* Device, REFIID, void*);

ddraw/IDirectDrawSurfaceX.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4375,8 +4375,8 @@ HRESULT m_IDirectDrawSurfaceX::CreateD9Surface()
43754375
// Set lockable
43764376
surface.IsLockable = true;
43774377

4378-
// Anti-aliasing
4379-
if (IsRenderTarget())
4378+
// Anti-aliasing (enabling this causes Lock to fail on some games with the Primary/Backbuffer surfaces)
4379+
/*if (IsRenderTarget())
43804380
{
43814381
bool AntiAliasing = (surfaceDesc2.ddsCaps.dwCaps2 & DDSCAPS2_HINTANTIALIASING) || (surfaceDesc2.ddsCaps.dwCaps3 & DDSCAPS3_MULTISAMPLE_MASK);
43824382
if (AntiAliasing && !surface.MultiSampleType)
@@ -4397,7 +4397,7 @@ HRESULT m_IDirectDrawSurfaceX::CreateD9Surface()
43974397
// Default to 8 samples as some games have issues with more samples
43984398
surface.MultiSampleType = ddrawParent->GetMultiSampleTypeQuality(Format, MaxSamples ? MaxSamples : D3DMULTISAMPLE_8_SAMPLES, surface.MultiSampleQuality);
43994399
}
4400-
}
4400+
}*/
44014401

44024402
// Set created by
44034403
ShouldEmulate = (ShouldEmulate == SC_NOT_CREATED) ? SC_DONT_FORCE : ShouldEmulate;

0 commit comments

Comments
 (0)