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
815baba0
Commit
815baba0
authored
Jun 18, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Check for matching pixel format in wglMakeCurrent.
parent
e976877f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
opengl.c
dlls/opengl32/tests/opengl.c
+28
-0
opengl.c
dlls/winex11.drv/opengl.c
+6
-1
No files found.
dlls/opengl32/tests/opengl.c
View file @
815baba0
...
...
@@ -265,6 +265,33 @@ static void test_setpixelformat(HDC winhdc)
}
}
static
void
test_makecurrent
(
HDC
winhdc
)
{
BOOL
ret
;
HGLRC
hglrc
;
HDC
hdc
;
hdc
=
GetDC
(
0
);
ok
(
hdc
!=
0
,
"GetDC(0) failed
\n
"
);
hglrc
=
wglCreateContext
(
winhdc
);
ok
(
hglrc
!=
0
,
"wglCreateContext failed
\n
"
);
ret
=
wglMakeCurrent
(
winhdc
,
hglrc
);
ok
(
ret
,
"wglMakeCurrent failed
\n
"
);
ok
(
wglGetCurrentContext
()
==
hglrc
,
"wrong context
\n
"
);
SetLastError
(
0xdeadbeef
);
ret
=
wglMakeCurrent
(
hdc
,
hglrc
);
ok
(
!
ret
,
"wglMakeCurrent succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PIXEL_FORMAT
,
"last error %u
\n
"
,
GetLastError
()
);
ok
(
wglGetCurrentContext
()
==
hglrc
,
"wrong context
\n
"
);
ReleaseDC
(
0
,
hdc
);
}
static
void
test_colorbits
(
HDC
hdc
)
{
const
int
iAttribList
[]
=
{
WGL_COLOR_BITS_ARB
,
WGL_RED_BITS_ARB
,
WGL_GREEN_BITS_ARB
,
...
...
@@ -437,6 +464,7 @@ START_TEST(opengl)
ok
(
res
,
"wglMakeCurrent failed!
\n
"
);
init_functions
();
test_makecurrent
(
hdc
);
test_setpixelformat
(
hdc
);
test_colorbits
(
hdc
);
test_gdi_dbuf
(
hdc
);
...
...
dlls/winex11.drv/opengl.c
View file @
815baba0
...
...
@@ -1754,6 +1754,7 @@ BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
BOOL
ret
;
HDC
hdc
=
physDev
->
hdc
;
DWORD
type
=
GetObjectType
(
hdc
);
Wine_GLContext
*
ctx
=
(
Wine_GLContext
*
)
hglrc
;
TRACE
(
"(%p,%p)
\n
"
,
hdc
,
hglrc
);
...
...
@@ -1766,8 +1767,12 @@ BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
if
(
hglrc
==
NULL
)
{
ret
=
pglXMakeCurrent
(
gdi_display
,
None
,
NULL
);
NtCurrentTeb
()
->
glContext
=
NULL
;
}
else
if
(
ctx
->
fmt
->
iPixelFormat
!=
physDev
->
current_pf
)
{
WARN
(
"mismatched pixel format hdc %p %u ctx %p %u
\n
"
,
hdc
,
physDev
->
current_pf
,
ctx
,
ctx
->
fmt
->
iPixelFormat
);
SetLastError
(
ERROR_INVALID_PIXEL_FORMAT
);
ret
=
FALSE
;
}
else
{
Wine_GLContext
*
ctx
=
(
Wine_GLContext
*
)
hglrc
;
Drawable
drawable
=
get_glxdrawable
(
physDev
);
if
(
ctx
->
ctx
==
NULL
)
{
/* The describe lines below are for debugging purposes only */
...
...
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