From 24fcdde786b5b03e7850be8eec3ff1a2f139801e Mon Sep 17 00:00:00 2001 From: Elisha Riedlinger Date: Tue, 20 Aug 2019 19:52:23 -0700 Subject: [PATCH] Use Scratch pool for OffscreenSurface - Use Scratch pool for OffscreenSurface (https://docs.microsoft.com/en-us/windows/win32/api/d3d9/nf-d3d9-idirect3ddevice9-createoffscreenplainsurface) - Disable MultiSample when Lockable Buffer is enabled --- source/d3d8to9_device.cpp | 2 +- source/d3d8types.cpp | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/source/d3d8to9_device.cpp b/source/d3d8to9_device.cpp index 1691db7..f8fd99c 100644 --- a/source/d3d8to9_device.cpp +++ b/source/d3d8to9_device.cpp @@ -481,7 +481,7 @@ HRESULT STDMETHODCALLTYPE Direct3DDevice8::CreateImageSurface(UINT Width, UINT H IDirect3DSurface9 *SurfaceInterface = nullptr; - const HRESULT hr = ProxyInterface->CreateOffscreenPlainSurface(Width, Height, Format, D3DPOOL_SYSTEMMEM, &SurfaceInterface, nullptr); + const HRESULT hr = ProxyInterface->CreateOffscreenPlainSurface(Width, Height, Format, D3DPOOL_SCRATCH, &SurfaceInterface, nullptr); if (FAILED(hr)) { diff --git a/source/d3d8types.cpp b/source/d3d8types.cpp index d28f2ef..a51293d 100644 --- a/source/d3d8types.cpp +++ b/source/d3d8types.cpp @@ -129,18 +129,12 @@ void ConvertPresentParameters(D3DPRESENT_PARAMETERS8 &Input, D3DPRESENT_PARAMETE Output.FullScreen_RefreshRateInHz = Input.FullScreen_RefreshRateInHz; Output.PresentationInterval = Input.FullScreen_PresentationInterval; - // MultiSampleType must be D3DMULTISAMPLE_NONE unless SwapEffect has been set to D3DSWAPEFFECT_DISCARD - if (Output.SwapEffect != D3DSWAPEFFECT_DISCARD) + // MultiSampleType must be D3DMULTISAMPLE_NONE unless SwapEffect has been set to D3DSWAPEFFECT_DISCARD or if there is a lockable backbuffer + if (Output.SwapEffect != D3DSWAPEFFECT_DISCARD || (Output.Flags & D3DPRESENTFLAG_LOCKABLE_BACKBUFFER)) { Output.MultiSampleType = D3DMULTISAMPLE_NONE; } - // Remove Flags that are not compatible with multisampling - if (Output.MultiSampleType != D3DMULTISAMPLE_NONE) - { - Output.Flags &= ~D3DPRESENTFLAG_LOCKABLE_BACKBUFFER; - } - // D3DPRESENT_RATE_UNLIMITED is no longer supported in D3D9 if (Output.PresentationInterval == D3DPRESENT_RATE_UNLIMITED) {