Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
449deda6
Commit
449deda6
authored
Nov 08, 2012
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Link directly to opengl32.
parent
e40b2a1b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
62 deletions
+33
-62
Makefile.in
dlls/wined3d/Makefile.in
+1
-1
context.c
dlls/wined3d/context.c
+17
-17
directx.c
dlls/wined3d/directx.c
+15
-26
wined3d_gl.h
dlls/wined3d/wined3d_gl.h
+0
-18
No files found.
dlls/wined3d/Makefile.in
View file @
449deda6
MODULE
=
wined3d.dll
IMPORTLIB
=
wined3d
IMPORTS
=
uuid user32 gdi32 advapi32
IMPORTS
=
uuid
opengl32
user32 gdi32 advapi32
C_SRCS
=
\
arb_program_shader.c
\
...
...
dlls/wined3d/context.c
View file @
449deda6
...
...
@@ -771,7 +771,7 @@ static BOOL context_set_gl_context(struct wined3d_context *ctx)
backup
=
TRUE
;
}
if
(
backup
||
!
p
wglMakeCurrent
(
ctx
->
hdc
,
ctx
->
glCtx
))
if
(
backup
||
!
wglMakeCurrent
(
ctx
->
hdc
,
ctx
->
glCtx
))
{
HDC
dc
;
...
...
@@ -805,7 +805,7 @@ static BOOL context_set_gl_context(struct wined3d_context *ctx)
return
FALSE
;
}
if
(
!
p
wglMakeCurrent
(
dc
,
ctx
->
glCtx
))
if
(
!
wglMakeCurrent
(
dc
,
ctx
->
glCtx
))
{
ERR
(
"Fallback to backup window (dc %p) failed too, last error %#x.
\n
"
,
dc
,
GetLastError
());
...
...
@@ -825,7 +825,7 @@ static void context_restore_gl_context(const struct wined3d_gl_info *gl_info, HD
return
;
}
if
(
!
p
wglMakeCurrent
(
dc
,
gl_ctx
))
if
(
!
wglMakeCurrent
(
dc
,
gl_ctx
))
{
ERR
(
"Failed to restore GL context %p on device context %p, last error %#x.
\n
"
,
gl_ctx
,
dc
,
GetLastError
());
...
...
@@ -897,8 +897,8 @@ static void context_destroy_gl_resources(struct wined3d_context *context)
unsigned
int
i
;
int
restore_pf
;
restore_ctx
=
p
wglGetCurrentContext
();
restore_dc
=
p
wglGetCurrentDC
();
restore_ctx
=
wglGetCurrentContext
();
restore_dc
=
wglGetCurrentDC
();
restore_pf
=
GetPixelFormat
(
restore_dc
);
if
(
context
->
valid
&&
restore_ctx
!=
context
->
glCtx
)
...
...
@@ -984,14 +984,14 @@ static void context_destroy_gl_resources(struct wined3d_context *context)
{
context_restore_gl_context
(
gl_info
,
restore_dc
,
restore_ctx
,
restore_pf
);
}
else
if
(
pwglGetCurrentContext
()
&&
!
p
wglMakeCurrent
(
NULL
,
NULL
))
else
if
(
wglGetCurrentContext
()
&&
!
wglMakeCurrent
(
NULL
,
NULL
))
{
ERR
(
"Failed to disable GL context.
\n
"
);
}
ReleaseDC
(
context
->
win_handle
,
context
->
hdc
);
if
(
!
p
wglDeleteContext
(
context
->
glCtx
))
if
(
!
wglDeleteContext
(
context
->
glCtx
))
{
DWORD
err
=
GetLastError
();
ERR
(
"wglDeleteContext(%p) failed, last error %#x.
\n
"
,
context
->
glCtx
,
err
);
...
...
@@ -1052,10 +1052,10 @@ BOOL context_set_current(struct wined3d_context *ctx)
return
FALSE
;
ctx
->
current
=
1
;
}
else
if
(
p
wglGetCurrentContext
())
else
if
(
wglGetCurrentContext
())
{
TRACE
(
"Clearing current D3D context.
\n
"
);
if
(
!
p
wglMakeCurrent
(
NULL
,
NULL
))
if
(
!
wglMakeCurrent
(
NULL
,
NULL
))
{
DWORD
err
=
GetLastError
();
ERR
(
"Failed to clear current GL context, last error %#x.
\n
"
,
err
);
...
...
@@ -1095,14 +1095,14 @@ static void context_enter(struct wined3d_context *context)
if
(
!
context
->
level
++
)
{
const
struct
wined3d_context
*
current_context
=
context_get_current
();
HGLRC
current_gl
=
p
wglGetCurrentContext
();
HGLRC
current_gl
=
wglGetCurrentContext
();
if
(
current_gl
&&
(
!
current_context
||
current_context
->
glCtx
!=
current_gl
))
{
TRACE
(
"Another GL context (%p on device context %p) is already current.
\n
"
,
current_gl
,
p
wglGetCurrentDC
());
current_gl
,
wglGetCurrentDC
());
context
->
restore_ctx
=
current_gl
;
context
->
restore_dc
=
p
wglGetCurrentDC
();
context
->
restore_dc
=
wglGetCurrentDC
();
context
->
restore_pf
=
GetPixelFormat
(
context
->
restore_dc
);
}
}
...
...
@@ -1380,7 +1380,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
goto
out
;
}
if
(
!
(
ctx
=
p
wglCreateContext
(
hdc
)))
if
(
!
(
ctx
=
wglCreateContext
(
hdc
)))
{
ERR
(
"Failed to create a WGL context.
\n
"
);
context_release
(
ret
);
...
...
@@ -1389,12 +1389,12 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
if
(
device
->
context_count
)
{
if
(
!
p
wglShareLists
(
device
->
contexts
[
0
]
->
glCtx
,
ctx
))
if
(
!
wglShareLists
(
device
->
contexts
[
0
]
->
glCtx
,
ctx
))
{
ERR
(
"wglShareLists(%p, %p) failed, last error %#x.
\n
"
,
device
->
contexts
[
0
]
->
glCtx
,
ctx
,
GetLastError
());
context_release
(
ret
);
if
(
!
p
wglDeleteContext
(
ctx
))
if
(
!
wglDeleteContext
(
ctx
))
ERR
(
"wglDeleteContext(%p) failed, last error %#x.
\n
"
,
ctx
,
GetLastError
());
goto
out
;
}
...
...
@@ -1404,7 +1404,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
{
ERR
(
"Failed to add the newly created context to the context list
\n
"
);
context_release
(
ret
);
if
(
!
p
wglDeleteContext
(
ctx
))
if
(
!
wglDeleteContext
(
ctx
))
ERR
(
"wglDeleteContext(%p) failed, last error %#x.
\n
"
,
ctx
,
GetLastError
());
goto
out
;
}
...
...
@@ -1439,7 +1439,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
ERR
(
"Cannot activate context to set up defaults.
\n
"
);
device_context_remove
(
device
,
ret
);
context_release
(
ret
);
if
(
!
p
wglDeleteContext
(
ctx
))
if
(
!
wglDeleteContext
(
ctx
))
ERR
(
"wglDeleteContext(%p) failed, last error %#x.
\n
"
,
ctx
,
GetLastError
());
goto
out
;
}
...
...
dlls/wined3d/directx.c
View file @
449deda6
...
...
@@ -277,10 +277,10 @@ static void WineD3D_ReleaseFakeGLContext(const struct wined3d_fake_gl_ctx *ctx)
{
TRACE
(
"Destroying fake GL context.
\n
"
);
if
(
!
p
wglMakeCurrent
(
NULL
,
NULL
))
if
(
!
wglMakeCurrent
(
NULL
,
NULL
))
ERR
(
"Failed to disable fake GL context.
\n
"
);
if
(
!
p
wglDeleteContext
(
ctx
->
gl_ctx
))
if
(
!
wglDeleteContext
(
ctx
->
gl_ctx
))
{
DWORD
err
=
GetLastError
();
ERR
(
"wglDeleteContext(%p) failed, last error %#x.
\n
"
,
ctx
->
gl_ctx
,
err
);
...
...
@@ -289,7 +289,7 @@ static void WineD3D_ReleaseFakeGLContext(const struct wined3d_fake_gl_ctx *ctx)
ReleaseDC
(
ctx
->
wnd
,
ctx
->
dc
);
DestroyWindow
(
ctx
->
wnd
);
if
(
ctx
->
restore_gl_ctx
&&
!
p
wglMakeCurrent
(
ctx
->
restore_dc
,
ctx
->
restore_gl_ctx
))
if
(
ctx
->
restore_gl_ctx
&&
!
wglMakeCurrent
(
ctx
->
restore_dc
,
ctx
->
restore_gl_ctx
))
ERR
(
"Failed to restore previous GL context.
\n
"
);
}
...
...
@@ -301,8 +301,8 @@ static BOOL WineD3D_CreateFakeGLContext(struct wined3d_fake_gl_ctx *ctx)
TRACE
(
"getting context...
\n
"
);
ctx
->
restore_dc
=
p
wglGetCurrentDC
();
ctx
->
restore_gl_ctx
=
p
wglGetCurrentContext
();
ctx
->
restore_dc
=
wglGetCurrentDC
();
ctx
->
restore_gl_ctx
=
wglGetCurrentContext
();
/* We need a fake window as a hdc retrieved using GetDC(0) can't be used for much GL purposes. */
ctx
->
wnd
=
CreateWindowA
(
WINED3D_OPENGL_WINDOW_CLASS_NAME
,
"WineD3D fake window"
,
...
...
@@ -339,14 +339,14 @@ static BOOL WineD3D_CreateFakeGLContext(struct wined3d_fake_gl_ctx *ctx)
SetPixelFormat
(
ctx
->
dc
,
iPixelFormat
,
&
pfd
);
/* Create a GL context. */
if
(
!
(
ctx
->
gl_ctx
=
p
wglCreateContext
(
ctx
->
dc
)))
if
(
!
(
ctx
->
gl_ctx
=
wglCreateContext
(
ctx
->
dc
)))
{
WARN
(
"Failed to create default context for capabilities initialization.
\n
"
);
goto
fail
;
}
/* Make it the current GL context. */
if
(
!
p
wglMakeCurrent
(
ctx
->
dc
,
ctx
->
gl_ctx
))
if
(
!
wglMakeCurrent
(
ctx
->
dc
,
ctx
->
gl_ctx
))
{
ERR
(
"Failed to make fake GL context current.
\n
"
);
goto
fail
;
...
...
@@ -355,13 +355,13 @@ static BOOL WineD3D_CreateFakeGLContext(struct wined3d_fake_gl_ctx *ctx)
return
TRUE
;
fail:
if
(
ctx
->
gl_ctx
)
p
wglDeleteContext
(
ctx
->
gl_ctx
);
if
(
ctx
->
gl_ctx
)
wglDeleteContext
(
ctx
->
gl_ctx
);
ctx
->
gl_ctx
=
NULL
;
if
(
ctx
->
dc
)
ReleaseDC
(
ctx
->
wnd
,
ctx
->
dc
);
ctx
->
dc
=
NULL
;
if
(
ctx
->
wnd
)
DestroyWindow
(
ctx
->
wnd
);
ctx
->
wnd
=
NULL
;
if
(
ctx
->
restore_gl_ctx
&&
!
p
wglMakeCurrent
(
ctx
->
restore_dc
,
ctx
->
restore_gl_ctx
))
if
(
ctx
->
restore_gl_ctx
&&
!
wglMakeCurrent
(
ctx
->
restore_dc
,
ctx
->
restore_gl_ctx
))
ERR
(
"Failed to restore previous GL context.
\n
"
);
return
FALSE
;
...
...
@@ -2363,7 +2363,7 @@ static void parse_extension_string(struct wined3d_gl_info *gl_info, const char *
static
void
load_gl_funcs
(
struct
wined3d_gl_info
*
gl_info
)
{
#define USE_GL_FUNC(pfn) gl_info->gl_ops.ext.p_##pfn = (void *)
p
wglGetProcAddress(#pfn);
#define USE_GL_FUNC(pfn) gl_info->gl_ops.ext.p_##pfn = (void *)wglGetProcAddress(#pfn);
GL_EXT_FUNCS_GEN
;
#undef USE_GL_FUNC
...
...
@@ -2652,7 +2652,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
/* Now work out what GL support this card really has. */
load_gl_funcs
(
gl_info
);
hdc
=
p
wglGetCurrentDC
();
hdc
=
wglGetCurrentDC
();
/* Not all GL drivers might offer WGL extensions e.g. VirtualBox. */
if
(
GL_EXTCALL
(
wglGetExtensionsStringARB
))
WGL_Extensions
=
(
const
char
*
)
GL_EXTCALL
(
wglGetExtensionsStringARB
(
hdc
));
...
...
@@ -5436,7 +5436,6 @@ static BOOL InitAdapters(struct wined3d *wined3d)
{
struct
wined3d_adapter
*
adapter
=
&
wined3d
->
adapters
[
0
];
struct
wined3d_gl_info
*
gl_info
=
&
adapter
->
gl_info
;
static
HMODULE
mod_gl
;
BOOL
ret
;
int
ps_selected_mode
,
vs_selected_mode
;
...
...
@@ -5446,24 +5445,14 @@ static BOOL InitAdapters(struct wined3d *wined3d)
TRACE
(
"Initializing adapters
\n
"
);
if
(
!
mod_gl
)
{
mod_gl
=
LoadLibraryA
(
"opengl32.dll"
);
if
(
!
mod_gl
)
{
ERR
(
"Can't load opengl32.dll!
\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
;
#undef USE_WGL_FUNC
/* Dynamically load all GL core functions */
#ifdef USE_WIN32_OPENGL
{
HMODULE
mod_gl
=
GetModuleHandleA
(
"opengl32.dll"
);
#define USE_GL_FUNC(f) gl_info->gl_ops.gl.p_##f = (void *)GetProcAddress(mod_gl, #f);
ALL_WGL_FUNCS
ALL_WGL_FUNCS
#undef USE_GL_FUNC
}
#else
/* To bypass the opengl32 thunks retrieve functions from the WGL driver instead of opengl32 */
{
...
...
dlls/wined3d/wined3d_gl.h
View file @
449deda6
...
...
@@ -31,24 +31,6 @@
void
(
WINE_GLAPI
*
glDisableWINE
)(
GLenum
cap
)
DECLSPEC_HIDDEN
;
void
(
WINE_GLAPI
*
glEnableWINE
)(
GLenum
cap
)
DECLSPEC_HIDDEN
;
/* WGL functions */
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
;
BOOL
(
WINAPI
*
pwglMakeCurrent
)(
HDC
,
HGLRC
)
DECLSPEC_HIDDEN
;
BOOL
(
WINAPI
*
pwglShareLists
)(
HGLRC
,
HGLRC
)
DECLSPEC_HIDDEN
;
#define WGL_FUNCS_GEN \
USE_WGL_FUNC(wglCreateContext) \
USE_WGL_FUNC(wglDeleteContext) \
USE_WGL_FUNC(wglGetCurrentContext) \
USE_WGL_FUNC(wglGetCurrentDC) \
USE_WGL_FUNC(wglGetProcAddress) \
USE_WGL_FUNC(wglMakeCurrent) \
USE_WGL_FUNC(wglShareLists)
/* OpenGL extensions. */
enum
wined3d_gl_extension
{
...
...
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