Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
cf1f02e2
Commit
cf1f02e2
authored
Oct 07, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Oct 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opengl32: Split is_extension_supported helper.
parent
fc636b7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
23 deletions
+30
-23
wgl.c
dlls/opengl32/wgl.c
+30
-23
No files found.
dlls/opengl32/wgl.c
View file @
cf1f02e2
...
...
@@ -803,57 +803,45 @@ static int compar(const void *elt_a, const void *elt_b) {
}
/* Check if a GL extension is supported */
static
BOOL
is_extension_supported
(
const
char
*
extension
)
static
BOOL
check_extension_support
(
const
char
*
extension
,
const
char
*
available_extensions
)
{
enum
wgl_handle_type
type
=
get_current_context_type
();
const
struct
opengl_funcs
*
funcs
=
NtCurrentTeb
()
->
glTable
;
const
char
*
gl_ext_string
=
NULL
;
size_t
len
;
TRACE
(
"Checking for extension '%s'
\n
"
,
extension
);
if
(
type
==
HANDLE_CONTEXT
)
{
gl_ext_string
=
(
const
char
*
)
glGetString
(
GL_EXTENSIONS
);
if
(
!
gl_ext_string
)
{
ERR
(
"No OpenGL extensions found, check if your OpenGL setup is correct!
\n
"
);
return
FALSE
;
}
}
/* We use the GetProcAddress function from the display driver to retrieve function pointers
* for OpenGL and WGL extensions. In case of winex11.drv the OpenGL extension lookup is done
* using glXGetProcAddress. This function is quite unreliable in the sense that its specs don't
* require the function to return NULL when an extension isn't found. For this reason we check
* if the OpenGL extension required for the function we are looking up is supported. */
while
((
len
=
strcspn
(
extension
,
" "
))
!=
0
)
while
((
len
=
strcspn
(
extension
,
" "
))
)
{
/* Check if the extension is part of the GL extension string to see if it is supported. */
if
(
has_extension
(
gl_ext_string
,
extension
,
len
))
return
TRUE
;
if
(
has_extension
(
available_extensions
,
extension
,
len
))
return
TRUE
;
/* In general an OpenGL function starts as an ARB/EXT extension and at some stage
* it becomes part of the core OpenGL library and can be reached without the ARB/EXT
* suffix as well. In the extension table, these functions contain GL_VERSION_major_minor.
* Check if we are searching for a core GL function */
if
(
strncmp
(
extension
,
"GL_VERSION_"
,
11
)
==
0
)
if
(
!
strncmp
(
extension
,
"GL_VERSION_"
,
11
)
)
{
const
GLubyte
*
gl_version
=
funcs
->
gl
.
p_glGetString
(
GL_VERSION
);
const
char
*
version
=
extension
+
11
;
/* Move past 'GL_VERSION_' */
if
(
!
gl_version
)
{
ERR
(
"No OpenGL version found!
\n
"
);
if
(
!
gl_version
)
{
ERR
(
"No OpenGL version found!
\n
"
);
return
FALSE
;
}
/* Compare the major/minor version numbers of the native OpenGL library and what is required by the function.
* The gl_version string is guaranteed to have at least a major/minor and sometimes it has a release number as well. */
if
(
(
gl_version
[
0
]
>
version
[
0
])
||
((
gl_version
[
0
]
==
version
[
0
])
&&
(
gl_version
[
2
]
>=
version
[
2
]))
)
{
return
TRUE
;
}
WARN
(
"The function requires OpenGL version '%c.%c' while your drivers only provide '%c.%c'
\n
"
,
version
[
0
],
version
[
2
],
gl_version
[
0
],
gl_version
[
2
]
);
if
((
gl_version
[
0
]
>
version
[
0
])
||
((
gl_version
[
0
]
==
version
[
0
])
&&
(
gl_version
[
2
]
>=
version
[
2
])))
return
TRUE
;
WARN
(
"The function requires OpenGL version '%c.%c' while your drivers only provide '%c.%c'
\n
"
,
version
[
0
],
version
[
2
],
gl_version
[
0
],
gl_version
[
2
]
);
}
if
(
extension
[
len
]
==
' '
)
len
++
;
...
...
@@ -863,6 +851,25 @@ static BOOL is_extension_supported(const char* extension)
return
FALSE
;
}
/* Check if a GL extension is supported */
static
BOOL
is_extension_supported
(
const
char
*
extension
)
{
enum
wgl_handle_type
type
=
get_current_context_type
();
const
char
*
gl_ext_string
=
NULL
;
if
(
type
==
HANDLE_CONTEXT
)
{
gl_ext_string
=
(
const
char
*
)
glGetString
(
GL_EXTENSIONS
);
if
(
!
gl_ext_string
)
{
ERR
(
"No OpenGL extensions found, check if your OpenGL setup is correct!
\n
"
);
return
FALSE
;
}
}
return
check_extension_support
(
extension
,
gl_ext_string
);
}
/***********************************************************************
* wglGetProcAddress (OPENGL32.@)
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment