yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

yuzu-cmd: Fullscreen Improvements (#6656)

* emu_window_sdl2_vk: Use the generated SDL config

On Linux, due to the way we include SDL2 as a submodule, it makes it
difficult for us to specify which SDL_config.h we intended to include.
Before, CMake would default to the dummy one included with SDL and
ignore the generated one.

This tells CMake to use the generated one. In addition, we define
USING_GENERATED_CONFIG_H to throw an error in case the dummy config is
used by accident. Fixes Vulkan not working on Linux yuzu-cmd.

* emu_window_sdl2_vk: Specify the window manager if it should be supported

The original language "not implemented" is wrong if the implementation
exists but is not compiled. This causes a bit of a debugging headache
when it goes wrong. Log it if the window manager is known before
exiting.

* sdl_impl, emu_window: Remove clang ignore

Fixed upstream by
libsdl-org/SDL@25fc40b0bd

* Enable fullscreen support for Vulkan on yuzu-cmd

Hooked up the existing SDL2 logic for fullscreen support in the Vulkan window of yuzu-cmd.

* Change fullscreen logic to attempt desktop resolution first on yuzu-cmd

Changed the order in which we attempt to switch to fullscreen. First try desktop resolution first, if it fails fall back to streched fullscreen using windowed resolution.

Co-authored-by: lat9nq <22451773+lat9nq@users.noreply.github.com>
Co-authored-by: san <san+gitkraken@smederijmerlijn.nl>
This commit is contained in:
san 2021-07-21 20:56:42 +02:00 committed by GitHub
parent 2e93df7e48
commit 583a10fded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 9 deletions

View File

@ -122,12 +122,6 @@ void EmuWindow_SDL2::OnResize() {
} }
void EmuWindow_SDL2::Fullscreen() { void EmuWindow_SDL2::Fullscreen() {
if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) {
return;
}
LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError());
// Try a different fullscreening method // Try a different fullscreening method
LOG_INFO(Frontend, "Attempting to use borderless fullscreen..."); LOG_INFO(Frontend, "Attempting to use borderless fullscreen...");
if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) { if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) {
@ -136,6 +130,12 @@ void EmuWindow_SDL2::Fullscreen() {
LOG_ERROR(Frontend, "Borderless fullscreening failed: {}", SDL_GetError()); LOG_ERROR(Frontend, "Borderless fullscreening failed: {}", SDL_GetError());
if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) {
return;
}
LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError());
// Fallback algorithm: Maximise window. // Fallback algorithm: Maximise window.
// Works on all systems (unless something is seriously wrong), so no fallback for this one. // Works on all systems (unless something is seriously wrong), so no fallback for this one.
LOG_INFO(Frontend, "Falling back on a maximised window..."); LOG_INFO(Frontend, "Falling back on a maximised window...");

View File

@ -24,7 +24,7 @@
#include <SDL.h> #include <SDL.h>
#include <SDL_syswm.h> #include <SDL_syswm.h>
EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem) EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem, bool fullscreen)
: EmuWindow_SDL2{input_subsystem} { : EmuWindow_SDL2{input_subsystem} {
const std::string window_title = fmt::format("yuzu {} | {}-{} (Vulkan)", Common::g_build_name, const std::string window_title = fmt::format("yuzu {} | {}-{} (Vulkan)", Common::g_build_name,
Common::g_scm_branch, Common::g_scm_desc); Common::g_scm_branch, Common::g_scm_desc);
@ -42,6 +42,10 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsyste
SetWindowIcon(); SetWindowIcon();
if (fullscreen) {
Fullscreen();
}
switch (wm.subsystem) { switch (wm.subsystem) {
#ifdef SDL_VIDEO_DRIVER_WINDOWS #ifdef SDL_VIDEO_DRIVER_WINDOWS
case SDL_SYSWM_TYPE::SDL_SYSWM_WINDOWS: case SDL_SYSWM_TYPE::SDL_SYSWM_WINDOWS:

View File

@ -19,7 +19,7 @@ class InputSubsystem;
class EmuWindow_SDL2_VK final : public EmuWindow_SDL2 { class EmuWindow_SDL2_VK final : public EmuWindow_SDL2 {
public: public:
explicit EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem); explicit EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem, bool fullscreen);
~EmuWindow_SDL2_VK() override; ~EmuWindow_SDL2_VK() override;
std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override; std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override;

View File

@ -175,7 +175,7 @@ int main(int argc, char** argv) {
emu_window = std::make_unique<EmuWindow_SDL2_GL>(&input_subsystem, fullscreen); emu_window = std::make_unique<EmuWindow_SDL2_GL>(&input_subsystem, fullscreen);
break; break;
case Settings::RendererBackend::Vulkan: case Settings::RendererBackend::Vulkan:
emu_window = std::make_unique<EmuWindow_SDL2_VK>(&input_subsystem); emu_window = std::make_unique<EmuWindow_SDL2_VK>(&input_subsystem, fullscreen);
break; break;
} }