Skip to content

Commit

Permalink
Use Scratch pool for OffscreenSurface
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
elishacloud committed Aug 21, 2019
1 parent 375f5ef commit 24fcdde
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion source/d3d8to9_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down
10 changes: 2 additions & 8 deletions source/d3d8types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 24fcdde

Please sign in to comment.