mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-10-26 05:50:49 +00:00
Abstract SDL_SysWM into compat functions
This commit is contained in:
1 parent
dd2a99a96b
commit
13b2b28c2f
20 files changed
+347
-246
No files matched your search
@@ -2,18 +2,14 @@
|
||||
#include "streaming/streamutils.h"
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#include <VersionHelpers.h>
|
||||
#include "dxvsyncsource.h"
|
||||
#include <VersionHelpers.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAS_WAYLAND
|
||||
#include "waylandvsyncsource.h"
|
||||
#endif
|
||||
|
||||
#include <SDL_syswm.h>
|
||||
|
||||
// Limit the number of queued frames to prevent excessive memory consumption
|
||||
// if the V-Sync source or renderer is blocked for a while. It's important
|
||||
// that the sum of all queued frames between both pacing and rendering queues
|
||||
@@ -267,31 +263,22 @@ bool Pacer::initialize(SDL_Window* window, int maxVideoFps, bool enablePacing)
|
||||
"Frame pacing: target %d Hz with %d FPS stream",
|
||||
m_DisplayFps, m_MaxVideoFps);
|
||||
|
||||
SDL_SysWMinfo info;
|
||||
SDL_VERSION(&info.version);
|
||||
if (!SDL_GetWindowWMInfo(window, &info)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_GetWindowWMInfo() failed: %s",
|
||||
SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (info.subsystem) {
|
||||
#ifdef Q_OS_WIN32
|
||||
case SDL_SYSWM_WINDOWS:
|
||||
switch (SDLC_GetVideoDriver()) {
|
||||
case SDLC_VIDEO_WIN32:
|
||||
#ifdef Q_OS_WIN32
|
||||
// Don't use D3DKMTWaitForVerticalBlankEvent() on Windows 7, because
|
||||
// it blocks during other concurrent DX operations (like actually rendering).
|
||||
if (IsWindows8OrGreater()) {
|
||||
m_VsyncSource = new DxVsyncSource(this);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_WAYLAND) && defined(HAS_WAYLAND)
|
||||
case SDL_SYSWM_WAYLAND:
|
||||
case SDLC_VIDEO_WAYLAND:
|
||||
#if defined(SDL_VIDEO_DRIVER_WAYLAND) && defined(HAS_WAYLAND)
|
||||
m_VsyncSource = new WaylandVsyncSource(this);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
// Platforms without a VsyncSource will just render frames
|
||||
|
||||
Reference in new issue
Block a user