Skip to content

Comment to WIP: renderer.6 branch doesn't build on macOS #6636

@metayan

Description

@metayan

The tweak to get a better OpenGL version than 2.1 on macOS doesn't work on renderer.6.

Edit:
Fix is in #6637 .

My attempts at fixing it got me too tangled up in the dependencies - window, display, screen, texture... ;)

An option is to just disable it for now and wait to see if something is done with libsdl-org/SDL#12788 , which would probably allow for a much easier solution.

Otherwise, if it's too much of a hassle to get it to work again, then maybe it's alright to just remove it and rely on metal for macOS.

The relevant places:

scrcpy/app/src/texture.h

Lines 14 to 17 in c2e9aa8

#ifdef __APPLE__
# define SC_DISPLAY_FORCE_OPENGL_CORE_PROFILE
#endif

scrcpy/app/src/texture.c

Lines 17 to 20 in c2e9aa8

#ifdef SC_DISPLAY_FORCE_OPENGL_CORE_PROFILE
display->gl_context = NULL;
#endif

scrcpy/app/src/texture.c

Lines 25 to 41 in c2e9aa8

#ifdef SC_DISPLAY_FORCE_OPENGL_CORE_PROFILE
// Persuade macOS to give us something better than OpenGL 2.1.
// If we create a Core Profile context, we get the best OpenGL version.
bool ok = SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_CONTEXT_PROFILE_CORE);
if (!ok) {
LOGW("Could not set a GL Core Profile Context");
}
LOGD("Creating OpenGL Core Profile context");
display->gl_context = SDL_GL_CreateContext(window);
if (!display->gl_context) {
LOGE("Could not create OpenGL context: %s", SDL_GetError());
return false;
}
#endif

scrcpy/app/src/texture.c

Lines 72 to 74 in c2e9aa8

#ifdef SC_DISPLAY_FORCE_OPENGL_CORE_PROFILE
SDL_GL_DestroyContext(tex->gl_context);
#endif

Feel free to let me know if there is a better place to put comments such as this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions