Skip to content

Commit

Permalink
Not call CDS_SetMode if the resolution matches the Display (Win). fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
tx00100xt committed Oct 30, 2023
1 parent f774817 commit 9f66ce0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
22 changes: 14 additions & 8 deletions SamTFE/Sources/Engine/Graphics/GfxLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1532,15 +1532,21 @@ BOOL CGfxLibrary::StartDisplayMode( enum GfxAPIType eAPI, INDEX iAdapter, PIX pi
#ifdef SE1_VULKAN
else if (eAPI == GAT_VK)
{
// disable multimonitor support if it can interfere with Vulkan
MonitorsOff();
if( bFullScreen) {
// set windows mode to fit same size
bSuccess = CDS_SetMode( pixSizeI, pixSizeJ, eColorDepth);
if( !bSuccess) return FALSE;
PIX pixCurrentSizeI = ::GetSystemMetrics(SM_CXSCREEN);
PIX pixCurrentSizeJ = ::GetSystemMetrics(SM_CYSCREEN);
if ( (pixCurrentSizeI == pixSizeI) && (pixCurrentSizeJ == pixSizeJ) ) {
// Nothing, because the resolution does not need to be changed
} else {
// reset windows mode
CDS_ResetMode();
// disable multimonitor support if it can interfere with Vulkan
MonitorsOff();
if( bFullScreen) {
// set windows mode to fit same size
bSuccess = CDS_SetMode( pixSizeI, pixSizeJ, eColorDepth);
if( !bSuccess) return FALSE;
} else {
// reset windows mode
CDS_ResetMode();
}
}
// startup Vulkan

Expand Down
22 changes: 14 additions & 8 deletions SamTSE/Sources/Engine/Graphics/GfxLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1532,15 +1532,21 @@ BOOL CGfxLibrary::StartDisplayMode( enum GfxAPIType eAPI, INDEX iAdapter, PIX pi
#ifdef SE1_VULKAN
else if (eAPI == GAT_VK)
{
// disable multimonitor support if it can interfere with Vulkan
MonitorsOff();
if( bFullScreen) {
// set windows mode to fit same size
bSuccess = CDS_SetMode( pixSizeI, pixSizeJ, eColorDepth);
if( !bSuccess) return FALSE;
PIX pixCurrentSizeI = ::GetSystemMetrics(SM_CXSCREEN);
PIX pixCurrentSizeJ = ::GetSystemMetrics(SM_CYSCREEN);
if ( (pixCurrentSizeI == pixSizeI) && (pixCurrentSizeJ == pixSizeJ) ) {
// Nothing, because the resolution does not need to be changed
} else {
// reset windows mode
CDS_ResetMode();
// disable multimonitor support if it can interfere with Vulkan
MonitorsOff();
if( bFullScreen) {
// set windows mode to fit same size
bSuccess = CDS_SetMode( pixSizeI, pixSizeJ, eColorDepth);
if( !bSuccess) return FALSE;
} else {
// reset windows mode
CDS_ResetMode();
}
}
// startup Vulkan

Expand Down

0 comments on commit 9f66ce0

Please sign in to comment.