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
edfc7f0d
Commit
edfc7f0d
authored
Jun 28, 2012
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opengl32: Move wglGetProcAddress to the WGL driver.
parent
8a13afed
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22 additions
and
84 deletions
+22
-84
gdi32.spec
dlls/gdi32/gdi32.spec
+0
-5
opengl.c
dlls/gdi32/opengl.c
+0
-40
wgl.c
dlls/opengl32/wgl.c
+6
-19
directx.c
dlls/wined3d/directx.c
+9
-11
wined3d_gl.h
dlls/wined3d/wined3d_gl.h
+1
-1
opengl.c
dlls/winex11.drv/opengl.c
+4
-7
gdi_driver.h
include/wine/gdi_driver.h
+2
-1
No files found.
dlls/gdi32/gdi32.spec
View file @
edfc7f0d
...
...
@@ -497,11 +497,6 @@
@ stub pstackConnect
################################################################
# Wine extensions: OpenGL support
#
@ stdcall -private wglGetProcAddress(str)
################################################################
# Wine extensions: Win16 functions that are needed by other dlls
#
@ stdcall GetDCHook(long ptr)
...
...
dlls/gdi32/opengl.c
View file @
edfc7f0d
...
...
@@ -46,46 +46,6 @@ static INT (WINAPI *wglGetPixelFormat)(HDC);
static
BOOL
(
WINAPI
*
wglSetPixelFormat
)(
HDC
,
INT
,
const
PIXELFORMATDESCRIPTOR
*
);
static
BOOL
(
WINAPI
*
wglSwapBuffers
)(
HDC
);
static
HDC
default_hdc
=
0
;
/* We route all wgl functions from opengl32.dll through gdi32.dll to
* the display driver. Various wgl calls have a hDC as one of their parameters.
* Using get_dc_ptr we get access to the functions exported by the driver.
* Some functions don't receive a hDC. This function creates a global hdc and
* if there's already a global hdc, it returns it.
*/
static
DC
*
OPENGL_GetDefaultDC
(
void
)
{
if
(
!
default_hdc
)
default_hdc
=
CreateDCA
(
"DISPLAY"
,
NULL
,
NULL
,
NULL
);
return
get_dc_ptr
(
default_hdc
);
}
/***********************************************************************
* Internal wglGetProcAddress for retrieving WGL extensions
*/
PROC
WINAPI
wglGetProcAddress
(
LPCSTR
func
)
{
PROC
ret
=
NULL
;
DC
*
dc
;
if
(
!
func
)
return
NULL
;
TRACE
(
"func: '%s'
\n
"
,
func
);
/* Retrieve the global hDC to get access to the driver. */
dc
=
OPENGL_GetDefaultDC
();
if
(
dc
)
{
PHYSDEV
physdev
=
GET_DC_PHYSDEV
(
dc
,
pwglGetProcAddress
);
ret
=
physdev
->
funcs
->
pwglGetProcAddress
(
func
);
release_dc_ptr
(
dc
);
}
return
ret
;
}
/***********************************************************************
* __wine_get_wgl_driver (GDI32.@)
*/
...
...
dlls/opengl32/wgl.c
View file @
edfc7f0d
...
...
@@ -48,8 +48,6 @@ WINE_DECLARE_DEBUG_CHANNEL(opengl);
static
struct
{
PROC
(
WINAPI
*
p_wglGetProcAddress
)(
LPCSTR
lpszProc
);
/* internal WGL functions */
void
(
WINAPI
*
p_wglFinish
)(
void
);
void
(
WINAPI
*
p_wglFlush
)(
void
);
...
...
@@ -508,7 +506,7 @@ PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) {
/* If the function name starts with a 'w', it is a WGL extension */
if
(
lpszProc
[
0
]
==
'w'
)
{
local_func
=
w
ine_wgl
.
p_wglGetProcAddress
(
lpszProc
);
local_func
=
w
gl_driver
->
p_wglGetProcAddress
(
lpszProc
);
if
(
local_func
==
(
void
*
)
1
)
/* special function that needs a wrapper */
{
ext_ret
=
bsearch
(
&
ext
,
wgl_extensions
,
sizeof
(
wgl_extensions
)
/
sizeof
(
wgl_extensions
[
0
]),
...
...
@@ -531,7 +529,7 @@ PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) {
WARN
(
"Extension '%s' required by function '%s' not supported!
\n
"
,
ext_ret
->
extension
,
lpszProc
);
}
local_func
=
w
ine_wgl
.
p_wglGetProcAddress
(
ext_ret
->
name
);
local_func
=
w
gl_driver
->
p_wglGetProcAddress
(
ext_ret
->
name
);
/* After that, look at the extensions defined in the Linux OpenGL library */
if
(
local_func
==
NULL
)
{
...
...
@@ -1113,27 +1111,16 @@ BOOL WINAPI DECLSPEC_HOTPATCH wglSwapBuffers( HDC hdc )
creating a rendering context.... */
static
BOOL
process_attach
(
void
)
{
HMODULE
mod_gdi32
;
HDC
hdc
=
GetDC
(
0
);
wgl_driver
=
__wine_get_wgl_driver
(
hdc
,
WINE_GDI_DRIVER_VERSION
);
ReleaseDC
(
0
,
hdc
);
mod_gdi32
=
GetModuleHandleA
(
"gdi32.dll"
);
if
(
!
mod_gdi32
)
{
ERR
(
"GDI32 not loaded. Cannot create default context.
\n
"
);
return
FALSE
;
}
wine_wgl
.
p_wglGetProcAddress
=
(
void
*
)
GetProcAddress
(
mod_gdi32
,
"wglGetProcAddress"
);
/* internal WGL functions */
wine_wgl
.
p_wglFinish
=
(
void
*
)
w
ine_wgl
.
p_wglGetProcAddress
(
"wglFinish"
);
wine_wgl
.
p_wglFlush
=
(
void
*
)
w
ine_wgl
.
p_wglGetProcAddress
(
"wglFlush"
);
wine_wgl
.
p_wglGetCurrentContext
=
(
void
*
)
w
ine_wgl
.
p_wglGetProcAddress
(
"wglGetCurrentContext"
);
wine_wgl
.
p_wglGetIntegerv
=
(
void
*
)
w
ine_wgl
.
p_wglGetProcAddress
(
"wglGetIntegerv"
);
wine_wgl
.
p_wglFinish
=
(
void
*
)
w
gl_driver
->
p_wglGetProcAddress
(
"wglFinish"
);
wine_wgl
.
p_wglFlush
=
(
void
*
)
w
gl_driver
->
p_wglGetProcAddress
(
"wglFlush"
);
wine_wgl
.
p_wglGetCurrentContext
=
(
void
*
)
w
gl_driver
->
p_wglGetProcAddress
(
"wglGetCurrentContext"
);
wine_wgl
.
p_wglGetIntegerv
=
(
void
*
)
w
gl_driver
->
p_wglGetProcAddress
(
"wglGetIntegerv"
);
return
TRUE
;
}
...
...
dlls/wined3d/directx.c
View file @
edfc7f0d
...
...
@@ -27,6 +27,9 @@
#include <stdio.h>
#include "wined3d_private.h"
#ifndef USE_WIN32_OPENGL
#include "wine/gdi_driver.h"
#endif
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d
);
...
...
@@ -5386,15 +5389,15 @@ static BOOL InitAdapters(struct wined3d *wined3d)
#define USE_GL_FUNC(pfn) pfn = (void*)GetProcAddress(mod_gl, #pfn);
#else
/* To bypass the opengl32 thunks load wglGetProcAddress from gdi32 instead of opengl32 */
pwglGetProcAddress
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"gdi32.dll"
),
"wglGetProcAddress"
);
{
HDC
hdc
=
GetDC
(
0
);
const
struct
wgl_funcs
*
wgl_driver
=
__wine_get_wgl_driver
(
hdc
,
WINE_GDI_DRIVER_VERSION
);
pwglGetProcAddress
=
wgl_driver
->
p_wglGetProcAddress
;
ReleaseDC
(
0
,
hdc
);
}
#define USE_GL_FUNC(pfn) pfn = (void*)pwglGetProcAddress(#pfn);
#endif
if
(
!
pwglGetProcAddress
)
{
ERR
(
"Unable to load wglGetProcAddress!
\n
"
);
goto
nogl_adapter
;
}
/* Load WGL core functions from opengl32.dll */
#define USE_WGL_FUNC(pfn) p##pfn = (void*)GetProcAddress(mod_gl, #pfn);
WGL_FUNCS_GEN
;
...
...
@@ -5407,13 +5410,8 @@ static BOOL InitAdapters(struct wined3d *wined3d)
/* Load glFinish and glFlush from opengl32.dll even if we're not using WIN32 opengl
* otherwise because we have to use winex11.drv's override
*/
#ifdef USE_WIN32_OPENGL
wglFinish
=
(
void
*
)
GetProcAddress
(
mod_gl
,
"glFinish"
);
wglFlush
=
(
void
*
)
GetProcAddress
(
mod_gl
,
"glFlush"
);
#else
wglFinish
=
(
void
*
)
pwglGetProcAddress
(
"wglFinish"
);
wglFlush
=
(
void
*
)
pwglGetProcAddress
(
"wglFlush"
);
#endif
glEnableWINE
=
glEnable
;
glDisableWINE
=
glDisable
;
...
...
dlls/wined3d/wined3d_gl.h
View file @
edfc7f0d
...
...
@@ -1369,7 +1369,7 @@ HGLRC (WINAPI *pwglCreateContext)(HDC) DECLSPEC_HIDDEN;
BOOL
(
WINAPI
*
pwglDeleteContext
)(
HGLRC
)
DECLSPEC_HIDDEN
;
HGLRC
(
WINAPI
*
pwglGetCurrentContext
)(
void
)
DECLSPEC_HIDDEN
;
HDC
(
WINAPI
*
pwglGetCurrentDC
)(
void
)
DECLSPEC_HIDDEN
;
PROC
(
WINAPI
*
pwglGetProcAddress
)(
LPCSTR
)
DECLSPEC_HIDDEN
;
PROC
(
WIN
E_GL
API
*
pwglGetProcAddress
)(
LPCSTR
)
DECLSPEC_HIDDEN
;
BOOL
(
WINAPI
*
pwglMakeCurrent
)(
HDC
,
HGLRC
)
DECLSPEC_HIDDEN
;
BOOL
(
WINAPI
*
pwglShareLists
)(
HGLRC
,
HGLRC
)
DECLSPEC_HIDDEN
;
...
...
dlls/winex11.drv/opengl.c
View file @
edfc7f0d
...
...
@@ -1521,10 +1521,8 @@ static HDC WINAPI X11DRV_wglGetCurrentReadDCARB(void)
return
ret
;
}
/**
* glxdrv_wglGetProcAddress
*
* For OpenGL32 wglGetProcAddress.
/***********************************************************************
* glxdrv_wglGetProcAddress
*/
static
PROC
glxdrv_wglGetProcAddress
(
LPCSTR
lpszProc
)
{
...
...
@@ -1535,8 +1533,6 @@ static PROC glxdrv_wglGetProcAddress(LPCSTR lpszProc)
if
(
padding
<
0
)
padding
=
0
;
if
(
!
has_opengl
())
return
NULL
;
/* Check the table of WGL extensions to see if we need to return a WGL extension
* or a function pointer to a native OpenGL function. */
if
(
strncmp
(
lpszProc
,
"wgl"
,
3
)
!=
0
)
{
...
...
@@ -3596,7 +3592,7 @@ static const struct gdi_dc_funcs glxdrv_funcs =
NULL
,
/* pWidenPath */
NULL
,
/* pwglCreateContext */
NULL
,
/* pwglCreateContextAttribsARB */
glxdrv_wglGetProcAddress
,
/* pwglGetProcAddress */
NULL
,
/* pwglGetProcAddress */
glxdrv_wine_get_wgl_driver
,
/* wine_get_wgl_driver */
GDI_PRIORITY_GRAPHICS_DRV
+
20
/* priority */
};
...
...
@@ -3609,6 +3605,7 @@ static const struct wgl_funcs glxdrv_wgl_funcs =
glxdrv_wglCreateContextAttribsARB
,
/* p_wglCreateContextAttribsARB */
glxdrv_wglDeleteContext
,
/* p_wglDeleteContext */
glxdrv_wglGetCurrentDC
,
/* p_wglGetCurrentDC */
glxdrv_wglGetProcAddress
,
/* p_wglGetProcAddress */
glxdrv_wglMakeContextCurrentARB
,
/* p_wglMakeContextCurrentARB */
glxdrv_wglMakeCurrent
,
/* p_wglMakeCurrent */
glxdrv_wglShareLists
,
/* p_wglShareLists */
...
...
include/wine/gdi_driver.h
View file @
edfc7f0d
...
...
@@ -203,7 +203,7 @@ struct gdi_dc_funcs
};
/* increment this when you change the DC function table */
#define WINE_GDI_DRIVER_VERSION 3
7
#define WINE_GDI_DRIVER_VERSION 3
8
#define GDI_PRIORITY_NULL_DRV 0
/* null driver */
#define GDI_PRIORITY_FONT_DRV 100
/* any font driver */
...
...
@@ -239,6 +239,7 @@ struct wgl_funcs
HGLRC
(
*
p_wglCreateContextAttribsARB
)(
HDC
,
HGLRC
,
const
int
*
);
BOOL
(
*
p_wglDeleteContext
)(
HGLRC
);
HDC
(
*
p_wglGetCurrentDC
)(
void
);
PROC
(
*
p_wglGetProcAddress
)(
LPCSTR
);
BOOL
(
*
p_wglMakeContextCurrentARB
)(
HDC
,
HDC
,
HGLRC
);
BOOL
(
*
p_wglMakeCurrent
)(
HDC
,
HGLRC
);
BOOL
(
*
p_wglShareLists
)(
HGLRC
,
HGLRC
);
...
...
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