Fixed Vulkan issue when attachment size does not match framebuffer size.

The main part of the fix is to specify app's DPI awareness. It is done by specifying Windows DPI awareness in manifest file.
Additionally the test was added to ensure that selected r_mode does not exceed current desktop size.
This commit is contained in:
Artem Kharytoniuk 2017-10-07 18:02:36 +03:00
parent 364453310f
commit 089104f677
3 changed files with 29 additions and 0 deletions

View File

@ -538,6 +538,22 @@ static void SetMode(int mode, qboolean fullscreen) {
ri.Printf( PRINT_ALL, " invalid mode\n" );
ri.Error(ERR_FATAL, "SetMode - could not set the given mode (%d)\n", mode);
}
// Ensure that window size does not exceed desktop size.
// CreateWindow Win32 API does not allow to create windows larger than desktop.
int desktop_width = GetDesktopWidth();
int desktop_height = GetDesktopHeight();
if (glConfig.vidWidth > desktop_width || glConfig.vidHeight > desktop_height) {
int default_mode = 4;
ri.Printf(PRINT_WARNING, "\nMode %d specifies width that is larger than desktop width: using default mode %d\n", mode, default_mode);
ri.Printf( PRINT_ALL, "...setting mode %d:", default_mode );
if (!R_GetModeInfo(&glConfig.vidWidth, &glConfig.vidHeight, &glConfig.windowAspect, default_mode)) {
ri.Printf( PRINT_ALL, " invalid mode\n" );
ri.Error(ERR_FATAL, "SetMode - could not set the given mode (%d)\n", default_mode);
}
}
}
glConfig.isFullscreen = fullscreen;
ri.Printf( PRINT_ALL, " %d %d %s\n", glConfig.vidWidth, glConfig.vidHeight, fullscreen ? "FS" : "W");

View File

@ -0,0 +1,7 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true/pm</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>

View File

@ -91,6 +91,9 @@
</OutputFile>
</Bscmake>
<PostBuildEvent />
<Manifest>
<AdditionalManifestFiles>DeclareDPIAware.manifest</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
@ -127,6 +130,9 @@
<OutputFile>
</OutputFile>
</Bscmake>
<Manifest>
<AdditionalManifestFiles>DeclareDPIAware.manifest</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\src\engine\server\sv_bot.c">