mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-21 13:29:26 +01:00
[d3d8] Improve handling of FullScreen_PresentationInterval
This commit is contained in:
parent
e40f03b96a
commit
d846e89a4b
@ -78,33 +78,25 @@ namespace dxvk {
|
|||||||
// MultiSampleQuality is only used with D3DMULTISAMPLE_NONMASKABLE, which is not available in D3D8
|
// MultiSampleQuality is only used with D3DMULTISAMPLE_NONMASKABLE, which is not available in D3D8
|
||||||
params.MultiSampleQuality = 0;
|
params.MultiSampleQuality = 0;
|
||||||
|
|
||||||
|
// If an application passes multiple D3DPRESENT_INTERVAL flags, this will be
|
||||||
|
// validated appropriately by D3D9. Simply copy the values here.
|
||||||
UINT PresentationInterval = pParams->FullScreen_PresentationInterval;
|
UINT PresentationInterval = pParams->FullScreen_PresentationInterval;
|
||||||
|
|
||||||
if (pParams->Windowed) {
|
if (pParams->Windowed) {
|
||||||
|
|
||||||
if (unlikely(PresentationInterval != D3DPRESENT_INTERVAL_DEFAULT)) {
|
|
||||||
// TODO: what does dx8 do if windowed app sets FullScreen_PresentationInterval?
|
|
||||||
Logger::warn(str::format(
|
|
||||||
"D3D8: Application is windowed yet requested FullScreen_PresentationInterval ", PresentationInterval,
|
|
||||||
" (should be D3DPRESENT_INTERVAL_DEFAULT). This will be ignored."));
|
|
||||||
}
|
|
||||||
|
|
||||||
// D3D8: For windowed swap chain, the back buffer is copied to the window immediately.
|
// D3D8: For windowed swap chain, the back buffer is copied to the window immediately.
|
||||||
PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
D3DSWAPEFFECT SwapEffect = pParams->SwapEffect;
|
D3DSWAPEFFECT SwapEffect = pParams->SwapEffect;
|
||||||
|
|
||||||
// D3DSWAPEFFECT_COPY_VSYNC has been removed
|
|
||||||
if (SwapEffect == D3DSWAPEFFECT_COPY_VSYNC) {
|
if (SwapEffect == D3DSWAPEFFECT_COPY_VSYNC) {
|
||||||
|
// D3DSWAPEFFECT_COPY_VSYNC has been removed from D3D9, use D3DSWAPEFFECT_COPY
|
||||||
SwapEffect = D3DSWAPEFFECT_COPY;
|
SwapEffect = D3DSWAPEFFECT_COPY;
|
||||||
|
|
||||||
// D3D8: In windowed mode, D3DSWAPEFFECT_COPY_VSYNC enables VSYNC.
|
// D3D8: In windowed mode, D3DSWAPEFFECT_COPY_VSYNC enables VSYNC.
|
||||||
// In fullscreen, D3DPRESENT_INTERVAL_IMMEDIATE is meaningless.
|
// In fullscreen, D3DPRESENT_INTERVAL_IMMEDIATE is meaningless.
|
||||||
if (pParams->Windowed || (PresentationInterval & D3DPRESENT_INTERVAL_IMMEDIATE) != 0) {
|
if (pParams->Windowed || PresentationInterval == D3DPRESENT_INTERVAL_IMMEDIATE) {
|
||||||
PresentationInterval = D3DPRESENT_INTERVAL_ONE;
|
PresentationInterval = D3DPRESENT_INTERVAL_ONE;
|
||||||
// TODO: what does dx8 do if multiple D3DPRESENT_INTERVAL flags are set?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,6 +237,12 @@ namespace dxvk {
|
|||||||
&& pPresentationParameters->BackBufferCount > 1))
|
&& pPresentationParameters->BackBufferCount > 1))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
|
// In D3D8 nothing except D3DPRESENT_INTERVAL_DEFAULT can be used
|
||||||
|
// as a flag for windowed presentation.
|
||||||
|
if (unlikely(pPresentationParameters->Windowed
|
||||||
|
&& pPresentationParameters->FullScreen_PresentationInterval != D3DPRESENT_INTERVAL_DEFAULT))
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
m_presentParams = *pPresentationParameters;
|
m_presentParams = *pPresentationParameters;
|
||||||
ResetState();
|
ResetState();
|
||||||
|
|
||||||
|
@ -129,6 +129,12 @@ namespace dxvk {
|
|||||||
&& pPresentationParameters->BackBufferCount > 1))
|
&& pPresentationParameters->BackBufferCount > 1))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
|
// In D3D8 nothing except D3DPRESENT_INTERVAL_DEFAULT can be used
|
||||||
|
// as a flag for windowed presentation.
|
||||||
|
if (unlikely(pPresentationParameters->Windowed
|
||||||
|
&& pPresentationParameters->FullScreen_PresentationInterval != D3DPRESENT_INTERVAL_DEFAULT))
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
Com<d3d9::IDirect3DDevice9> pDevice9 = nullptr;
|
Com<d3d9::IDirect3DDevice9> pDevice9 = nullptr;
|
||||||
d3d9::D3DPRESENT_PARAMETERS params = ConvertPresentParameters9(pPresentationParameters);
|
d3d9::D3DPRESENT_PARAMETERS params = ConvertPresentParameters9(pPresentationParameters);
|
||||||
HRESULT res = m_d3d9->CreateDevice(
|
HRESULT res = m_d3d9->CreateDevice(
|
||||||
|
@ -457,6 +457,13 @@ namespace dxvk {
|
|||||||
|| pPresentationParameters->PresentationInterval == D3DPRESENT_INTERVAL_IMMEDIATE)))
|
|| pPresentationParameters->PresentationInterval == D3DPRESENT_INTERVAL_IMMEDIATE)))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
|
// In windowed mode, only a subset of the presentation interval flags can be used.
|
||||||
|
if (unlikely(pPresentationParameters->Windowed
|
||||||
|
&& !(pPresentationParameters->PresentationInterval == D3DPRESENT_INTERVAL_DEFAULT
|
||||||
|
|| pPresentationParameters->PresentationInterval == D3DPRESENT_INTERVAL_ONE
|
||||||
|
|| pPresentationParameters->PresentationInterval == D3DPRESENT_INTERVAL_IMMEDIATE)))
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user