Browse Source

gpu: fix OpenGL context creation and shader patching on macOS Catalina.

legacy
Sam Hocevar 4 years ago
parent
commit
fd1c5f5cd4
2 changed files with 8 additions and 0 deletions
  1. +3
    -0
      src/application/sdl-app.cpp
  2. +5
    -0
      src/gpu/shader.cpp

+ 3
- 0
src/application/sdl-app.cpp View File

@@ -56,6 +56,9 @@ sdl::app_display::app_display(char const *title, ivec2 res)
// Ask for GL 3.2 at least // Ask for GL 3.2 at least
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
#if __APPLE__
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
#endif


#if LOL_BUILD_DEBUG #if LOL_BUILD_DEBUG
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG); SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);


+ 5
- 0
src/gpu/shader.cpp View File

@@ -653,6 +653,10 @@ std::string ShaderData::Patch(std::string const &code, ShaderType type)
/* Perform small replaces */ /* Perform small replaces */
char const * const fast_replaces[] = char const * const fast_replaces[] =
{ {
#if __APPLE__
"#version 130", "#version 150",
"texture2D", "texture",
#else
"#version 130", "#version 120", "#version 130", "#version 120",
"out vec4 out_color;", " ", "out vec4 out_color;", " ",
"out_color =", "gl_FragColor =", "out_color =", "gl_FragColor =",
@@ -664,6 +668,7 @@ std::string ShaderData::Patch(std::string const &code, ShaderType type)
"out vec3", "varying vec3", "out vec3", "varying vec3",
"out vec4", "varying vec4", "out vec4", "varying vec4",
"out mat4", "varying mat4", "out mat4", "varying mat4",
#endif
nullptr nullptr
}; };




Loading…
Cancel
Save