Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for Vulkan or Metal request and don't force OpenGL #666

Merged
merged 6 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions libs/sdl/sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#if defined(_WIN32) || defined(__ANDROID__) || defined(HL_IOS) || defined(HL_TVOS)
# include <SDL.h>
# include <SDL_vulkan.h>
# include <SDL_syswm.h>
#else
# include <SDL2/SDL.h>
Expand Down Expand Up @@ -515,12 +516,20 @@ DEFINE_PRIM(_BOOL, hint_value, _BYTES _BYTES);

HL_PRIM SDL_Window *HL_NAME(win_create_ex)(int x, int y, int width, int height, int sdlFlags) {
// force window to match device resolution on mobile
if (sdlFlags & (
#ifdef HL_MAC
SDL_WINDOW_METAL |
#endif
SDL_WINDOW_VULKAN ) == 0) {
sdlFlags |= SDL_WINDOW_OPENGL;
}

#ifdef HL_MOBILE
SDL_DisplayMode displayMode;
SDL_GetDesktopDisplayMode(0, &displayMode);
SDL_Window* win = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | sdlFlags);
SDL_Window* win = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_BORDERLESS | sdlFlags);
#else
SDL_Window* win = SDL_CreateWindow("", x, y, width, height, SDL_WINDOW_OPENGL | sdlFlags);
SDL_Window* win = SDL_CreateWindow("", x, y, width, height, sdlFlags);
#endif
# ifdef HL_WIN
// force window to show even if the debugger force process windows to be hidden
Expand Down
1 change: 1 addition & 0 deletions libs/sdl/sdl/Window.hx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Window {
public static inline var SDL_WINDOW_TOOLTIP = 0x00040000;
public static inline var SDL_WINDOW_POPUP_MENU = 0x00080000;
public static inline var SDL_WINDOW_VULKAN = 0x10000000;
public static inline var SDL_WINDOW_METAL = 0x20000000;

var win : WinPtr;
var glctx : GLContext;
Expand Down
Loading