|
| 1 | +#include <SDL_stdinc.h> |
| 2 | +#include <SDL_vulkan.h> |
1 | 3 | #include <base/detect.h>
|
2 | 4 |
|
3 | 5 | #ifndef CONF_BACKEND_OPENGL_ES
|
@@ -987,9 +989,13 @@ void CGraphicsBackend_SDL_GL::GetCurrentVideoMode(CVideoMode &CurMode, float HiD
|
987 | 989 | {
|
988 | 990 | int Width = 0;
|
989 | 991 | int Height = 0;
|
990 |
| - SDL_GL_GetDrawableSize(m_pWindow, &Width, &Height); |
991 |
| - DpMode.w = Width; |
992 |
| - DpMode.h = Height; |
| 992 | + if(m_BackendType != EBackendType::BACKEND_TYPE_VULKAN) |
| 993 | + SDL_GL_GetDrawableSize(m_pWindow, &Width, &Height); |
| 994 | + else |
| 995 | + SDL_Vulkan_GetDrawableSize(m_pWindow, &Width, &Height); |
| 996 | + // SDL video modes are in screen space which are logical pixels |
| 997 | + DpMode.w = Width / HiDPIScale; |
| 998 | + DpMode.h = Height / HiDPIScale; |
993 | 999 | }
|
994 | 1000 | }
|
995 | 1001 | DisplayToVideoMode(&CurMode, &DpMode, HiDPIScale, DpMode.refresh_rate);
|
@@ -1243,8 +1249,13 @@ int CGraphicsBackend_SDL_GL::Init(const char *pName, int *pScreen, int *pWidth,
|
1243 | 1249 | InitError = IsVersionSupportedGlew(m_BackendType, g_Config.m_GfxGLMajor, g_Config.m_GfxGLMinor, g_Config.m_GfxGLPatch, GlewMajor, GlewMinor, GlewPatch);
|
1244 | 1250 |
|
1245 | 1251 | // SDL_GL_GetDrawableSize reports HiDPI resolution even with SDL_WINDOW_ALLOW_HIGHDPI not set, which is wrong
|
1246 |
| - if(SdlFlags & SDL_WINDOW_ALLOW_HIGHDPI && IsOpenGLFamilyBackend) |
1247 |
| - SDL_GL_GetDrawableSize(m_pWindow, pCurrentWidth, pCurrentHeight); |
| 1252 | + if(SdlFlags & SDL_WINDOW_ALLOW_HIGHDPI) |
| 1253 | + { |
| 1254 | + if(IsOpenGLFamilyBackend) |
| 1255 | + SDL_GL_GetDrawableSize(m_pWindow, pCurrentWidth, pCurrentHeight); |
| 1256 | + else |
| 1257 | + SDL_Vulkan_GetDrawableSize(m_pWindow, pCurrentWidth, pCurrentHeight); |
| 1258 | + } |
1248 | 1259 | else
|
1249 | 1260 | SDL_GetWindowSize(m_pWindow, pCurrentWidth, pCurrentHeight);
|
1250 | 1261 | SDL_GetWindowSize(m_pWindow, pWidth, pHeight);
|
@@ -1616,7 +1627,10 @@ bool CGraphicsBackend_SDL_GL::ResizeWindow(int w, int h, int RefreshRate)
|
1616 | 1627 |
|
1617 | 1628 | void CGraphicsBackend_SDL_GL::GetViewportSize(int &w, int &h)
|
1618 | 1629 | {
|
1619 |
| - SDL_GL_GetDrawableSize(m_pWindow, &w, &h); |
| 1630 | + if(m_BackendType != EBackendType::BACKEND_TYPE_VULKAN) |
| 1631 | + SDL_GL_GetDrawableSize(m_pWindow, &w, &h); |
| 1632 | + else |
| 1633 | + SDL_Vulkan_GetDrawableSize(m_pWindow, &w, &h); |
1620 | 1634 | }
|
1621 | 1635 |
|
1622 | 1636 | void CGraphicsBackend_SDL_GL::NotifyWindow()
|
|
0 commit comments