Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
cfc41868
Commit
cfc41868
authored
4 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Rework SDL context init to not explode on intel gpus
parent
dbe7ad5c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llwindow/llwindowsdl.cpp
+49
-41
49 additions, 41 deletions
indra/llwindow/llwindowsdl.cpp
with
49 additions
and
41 deletions
indra/llwindow/llwindowsdl.cpp
+
49
−
41
View file @
cfc41868
...
...
@@ -522,12 +522,6 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_PROFILE_MASK
,
SDL_GL_CONTEXT_PROFILE_CORE
);
LLGLSLShader
::
sNoFixedFunction
=
true
;
}
#if !LL_DARWIN
else
{
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_PROFILE_MASK
,
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY
);
}
#endif
U32
context_flags
=
0
;
if
(
gDebugGL
)
...
...
@@ -672,45 +666,51 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
}
}
U32
major_gl_version
=
4
;
U32
minor_gl_version
=
6
;
// Create the context
if
(
LLRender
::
sGLCoreProfile
)
{
U32
major_gl_version
=
4
;
U32
minor_gl_version
=
6
;
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MAJOR_VERSION
,
major_gl_version
);
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MINOR_VERSION
,
minor_gl_version
);
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MAJOR_VERSION
,
major_gl_version
);
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MINOR_VERSION
,
minor_gl_version
);
bool
done
=
false
;
while
(
!
done
)
{
mGLContext
=
SDL_GL_CreateContext
(
mWindow
);
bool
done
=
false
;
while
(
!
done
)
{
mGLContext
=
SDL_GL_CreateContext
(
mWindow
);
if
(
!
mGLContext
)
{
if
(
minor_gl_version
>
0
)
{
//decrement minor version
minor_gl_version
--
;
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MINOR_VERSION
,
minor_gl_version
);
}
else
if
(
major_gl_version
>
3
)
{
//decrement major version and start minor version over at 3
major_gl_version
--
;
minor_gl_version
=
3
;
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MAJOR_VERSION
,
major_gl_version
);
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MINOR_VERSION
,
minor_gl_version
);
}
else
{
//we reached 3.0 and still failed, bail out
done
=
true
;
}
}
else
{
LL_INFOS
()
<<
"Created OpenGL "
<<
llformat
(
"%d.%d"
,
major_gl_version
,
minor_gl_version
)
<<
(
LLRender
::
sGLCoreProfile
?
" core"
:
" compatibility"
)
<<
" context."
<<
LL_ENDL
;
done
=
true
;
}
}
if
(
!
mGLContext
)
{
if
(
minor_gl_version
>
0
)
{
//decrement minor version
minor_gl_version
--
;
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MINOR_VERSION
,
minor_gl_version
);
}
else
if
(
major_gl_version
>
3
)
{
//decrement major version and start minor version over at 3
major_gl_version
--
;
minor_gl_version
=
3
;
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MAJOR_VERSION
,
major_gl_version
);
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MINOR_VERSION
,
minor_gl_version
);
}
else
{
//we reached 3.0 and still failed, bail out
done
=
true
;
}
}
else
{
done
=
true
;
}
}
}
else
{
mGLContext
=
SDL_GL_CreateContext
(
mWindow
);
}
if
(
!
mGLContext
)
if
(
!
mGLContext
)
{
LL_WARNS
()
<<
"OpenGL context creation failure. SDL: "
<<
SDL_GetError
()
<<
LL_ENDL
;
setupFailure
(
"Context creation error"
,
"Error"
,
OSMB_OK
);
...
...
@@ -722,6 +722,14 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
setupFailure
(
"Context current failure"
,
"Error"
,
OSMB_OK
);
return
FALSE
;
}
int
major_gl_version
=
0
;
int
minor_gl_version
=
0
;
SDL_GL_GetAttribute
(
SDL_GL_CONTEXT_MAJOR_VERSION
,
&
major_gl_version
);
SDL_GL_GetAttribute
(
SDL_GL_CONTEXT_MINOR_VERSION
,
&
minor_gl_version
);
LL_INFOS
()
<<
"Created OpenGL "
<<
llformat
(
"%d.%d"
,
major_gl_version
,
minor_gl_version
)
<<
(
LLRender
::
sGLCoreProfile
?
" core"
:
" compatibility"
)
<<
" context."
<<
LL_ENDL
;
int
vsync_enable
=
1
;
if
(
disable_vsync
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment