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
daceb456
Commit
daceb456
authored
Aug 22, 2007
by
Roderick Colenbrander
Committed by
Alexandre Julliard
Aug 23, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wgl: Fix wglGetCurrentReadDCARB bugs.
parent
f5b48061
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
30 deletions
+57
-30
opengl.c
dlls/opengl32/tests/opengl.c
+42
-0
opengl.c
dlls/winex11.drv/opengl.c
+15
-30
No files found.
dlls/opengl32/tests/opengl.c
View file @
daceb456
...
@@ -29,6 +29,10 @@ typedef void* HPBUFFERARB;
...
@@ -29,6 +29,10 @@ typedef void* HPBUFFERARB;
static
const
char
*
(
WINAPI
*
pwglGetExtensionsStringARB
)(
HDC
);
static
const
char
*
(
WINAPI
*
pwglGetExtensionsStringARB
)(
HDC
);
static
int
(
WINAPI
*
pwglReleasePbufferDCARB
)(
HPBUFFERARB
,
HDC
);
static
int
(
WINAPI
*
pwglReleasePbufferDCARB
)(
HPBUFFERARB
,
HDC
);
/* WGL_ARB_make_current_read */
static
BOOL
(
WINAPI
*
pwglMakeContextCurrentARB
)(
HDC
hdraw
,
HDC
hread
,
HGLRC
hglrc
);
static
HDC
(
WINAPI
*
pwglGetCurrentReadDCARB
)();
/* WGL_ARB_pixel_format */
/* WGL_ARB_pixel_format */
#define WGL_COLOR_BITS_ARB 0x2014
#define WGL_COLOR_BITS_ARB 0x2014
#define WGL_RED_BITS_ARB 0x2015
#define WGL_RED_BITS_ARB 0x2015
...
@@ -58,6 +62,10 @@ static void init_functions(void)
...
@@ -58,6 +62,10 @@ static void init_functions(void)
/* WGL_ARB_extensions_string */
/* WGL_ARB_extensions_string */
GET_PROC
(
wglGetExtensionsStringARB
)
GET_PROC
(
wglGetExtensionsStringARB
)
/* WGL_ARB_make_current_read */
GET_PROC
(
wglMakeContextCurrentARB
);
GET_PROC
(
wglGetCurrentReadDCARB
);
/* WGL_ARB_pixel_format */
/* WGL_ARB_pixel_format */
GET_PROC
(
wglChoosePixelFormatARB
)
GET_PROC
(
wglChoosePixelFormatARB
)
GET_PROC
(
wglGetPixelFormatAttribivARB
)
GET_PROC
(
wglGetPixelFormatAttribivARB
)
...
@@ -257,6 +265,35 @@ static void test_gdi_dbuf(HDC hdc)
...
@@ -257,6 +265,35 @@ static void test_gdi_dbuf(HDC hdc)
}
}
}
}
static
void
test_make_current_read
(
HDC
hdc
)
{
int
res
;
HDC
hread
;
HGLRC
hglrc
=
wglCreateContext
(
hdc
);
if
(
!
hglrc
)
{
skip
(
"wglCreateContext failed!
\n
"
);
return
;
}
res
=
wglMakeCurrent
(
hdc
,
hglrc
);
if
(
!
res
)
{
skip
(
"wglMakeCurrent failed!
\n
"
);
return
;
}
/* Test what wglGetCurrentReadDCARB does for wglMakeCurrent as the spec doesn't mention it */
hread
=
pwglGetCurrentReadDCARB
();
trace
(
"hread %p, hdc %p
\n
"
,
hread
,
hdc
);
ok
(
hread
==
hdc
,
"wglGetCurrentReadDCARB failed for standard wglMakeCurrent
\n
"
);
pwglMakeContextCurrentARB
(
hdc
,
hdc
,
hglrc
);
hread
=
pwglGetCurrentReadDCARB
();
ok
(
hread
==
hdc
,
"wglGetCurrentReadDCARB failed for wglMakeContextCurrent
\n
"
);
}
START_TEST
(
opengl
)
START_TEST
(
opengl
)
{
{
HWND
hwnd
;
HWND
hwnd
;
...
@@ -311,6 +348,11 @@ START_TEST(opengl)
...
@@ -311,6 +348,11 @@ START_TEST(opengl)
wgl_extensions
=
pwglGetExtensionsStringARB
(
hdc
);
wgl_extensions
=
pwglGetExtensionsStringARB
(
hdc
);
if
(
wgl_extensions
==
NULL
)
skip
(
"Skipping opengl32 tests because this OpenGL implementation doesn't support WGL extensions!
\n
"
);
if
(
wgl_extensions
==
NULL
)
skip
(
"Skipping opengl32 tests because this OpenGL implementation doesn't support WGL extensions!
\n
"
);
if
(
strstr
(
wgl_extensions
,
"WGL_ARB_make_current_read"
))
test_make_current_read
(
hdc
);
else
trace
(
"WGL_ARB_make_current_read not supported, skipping test
\n
"
);
if
(
strstr
(
wgl_extensions
,
"WGL_ARB_pbuffer"
))
if
(
strstr
(
wgl_extensions
,
"WGL_ARB_pbuffer"
))
test_pbuffers
(
hdc
);
test_pbuffers
(
hdc
);
else
else
...
...
dlls/winex11.drv/opengl.c
View file @
daceb456
...
@@ -110,6 +110,7 @@ typedef struct wine_glcontext {
...
@@ -110,6 +110,7 @@ typedef struct wine_glcontext {
GLXContext
ctx
;
GLXContext
ctx
;
BOOL
do_escape
;
BOOL
do_escape
;
X11DRV_PDEVICE
*
physDev
;
X11DRV_PDEVICE
*
physDev
;
X11DRV_PDEVICE
*
pReadDev
;
RECT
viewport
;
RECT
viewport
;
RECT
scissor
;
RECT
scissor
;
BOOL
scissor_enabled
;
BOOL
scissor_enabled
;
...
@@ -554,22 +555,6 @@ static inline Wine_GLContext *get_context_from_GLXContext(GLXContext ctx)
...
@@ -554,22 +555,6 @@ static inline Wine_GLContext *get_context_from_GLXContext(GLXContext ctx)
return
ret
;
return
ret
;
}
}
/**
* get_hdc_from_Drawable (internal)
*
* For use by wglGetCurrentReadDCARB.
*/
static
inline
HDC
get_hdc_from_Drawable
(
GLXDrawable
d
)
{
Wine_GLContext
*
ret
;
for
(
ret
=
context_list
;
ret
;
ret
=
ret
->
next
)
{
if
(
d
==
ret
->
physDev
->
drawable
)
{
return
ret
->
hdc
;
}
}
return
NULL
;
}
static
inline
BOOL
is_valid_context
(
Wine_GLContext
*
ctx
)
static
inline
BOOL
is_valid_context
(
Wine_GLContext
*
ctx
)
{
{
Wine_GLContext
*
ptr
;
Wine_GLContext
*
ptr
;
...
@@ -1532,17 +1517,14 @@ BOOL X11DRV_wglDeleteContext(HGLRC hglrc)
...
@@ -1532,17 +1517,14 @@ BOOL X11DRV_wglDeleteContext(HGLRC hglrc)
*/
*/
static
HDC
WINAPI
X11DRV_wglGetCurrentReadDCARB
(
void
)
static
HDC
WINAPI
X11DRV_wglGetCurrentReadDCARB
(
void
)
{
{
GLXDrawable
gl_d
;
HDC
ret
=
0
;
HDC
ret
;
Wine_GLContext
*
ctx
=
NtCurrentTeb
()
->
glContext
;
X11DRV_PDEVICE
*
physDev
=
ctx
?
ctx
->
pReadDev
:
NULL
;
TRACE
(
"()
\n
"
);
if
(
physDev
)
ret
=
physDev
->
hdc
;
wine_tsx11_lock
();
gl_d
=
pglXGetCurrentReadDrawable
();
ret
=
get_hdc_from_Drawable
(
gl_d
);
wine_tsx11_unlock
();
TRACE
(
" returning %p (GL drawable %lu)
\n
"
,
ret
,
gl_d
);
TRACE
(
" returning %p (GL drawable %lu)
\n
"
,
ret
,
physDev
?
physDev
->
drawable
:
0
);
return
ret
;
return
ret
;
}
}
...
@@ -1681,6 +1663,7 @@ BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
...
@@ -1681,6 +1663,7 @@ BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
if
(
ret
)
if
(
ret
)
{
{
ctx
->
physDev
=
physDev
;
ctx
->
physDev
=
physDev
;
ctx
->
pReadDev
=
physDev
;
if
(
type
==
OBJ_MEMDC
)
if
(
type
==
OBJ_MEMDC
)
{
{
...
@@ -1703,10 +1686,10 @@ BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
...
@@ -1703,10 +1686,10 @@ BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
*
*
* For OpenGL32 wglMakeContextCurrentARB
* For OpenGL32 wglMakeContextCurrentARB
*/
*/
BOOL
X11DRV_wglMakeContextCurrentARB
(
X11DRV_PDEVICE
*
hDrawDev
,
X11DRV_PDEVICE
*
hReadDev
,
HGLRC
hglrc
)
BOOL
X11DRV_wglMakeContextCurrentARB
(
X11DRV_PDEVICE
*
pDrawDev
,
X11DRV_PDEVICE
*
pReadDev
,
HGLRC
hglrc
)
{
{
BOOL
ret
;
BOOL
ret
;
TRACE
(
"(%p,%p,%p)
\n
"
,
hDrawDev
,
h
ReadDev
,
hglrc
);
TRACE
(
"(%p,%p,%p)
\n
"
,
pDrawDev
,
p
ReadDev
,
hglrc
);
if
(
!
has_opengl
())
{
if
(
!
has_opengl
())
{
ERR
(
"No libGL on this box - disabling OpenGL support !
\n
"
);
ERR
(
"No libGL on this box - disabling OpenGL support !
\n
"
);
...
@@ -1722,13 +1705,15 @@ BOOL X11DRV_wglMakeContextCurrentARB(X11DRV_PDEVICE* hDrawDev, X11DRV_PDEVICE* h
...
@@ -1722,13 +1705,15 @@ BOOL X11DRV_wglMakeContextCurrentARB(X11DRV_PDEVICE* hDrawDev, X11DRV_PDEVICE* h
ret
=
FALSE
;
ret
=
FALSE
;
}
else
{
}
else
{
Wine_GLContext
*
ctx
=
(
Wine_GLContext
*
)
hglrc
;
Wine_GLContext
*
ctx
=
(
Wine_GLContext
*
)
hglrc
;
Drawable
d_draw
=
get_glxdrawable
(
h
DrawDev
);
Drawable
d_draw
=
get_glxdrawable
(
p
DrawDev
);
Drawable
d_read
=
get_glxdrawable
(
h
ReadDev
);
Drawable
d_read
=
get_glxdrawable
(
p
ReadDev
);
if
(
ctx
->
ctx
==
NULL
)
{
if
(
ctx
->
ctx
==
NULL
)
{
ctx
->
ctx
=
pglXCreateContext
(
gdi_display
,
ctx
->
vis
,
NULL
,
GetObjectType
(
h
DrawDev
->
hdc
)
==
OBJ_MEMDC
?
False
:
True
);
ctx
->
ctx
=
pglXCreateContext
(
gdi_display
,
ctx
->
vis
,
NULL
,
GetObjectType
(
p
DrawDev
->
hdc
)
==
OBJ_MEMDC
?
False
:
True
);
TRACE
(
" created a delayed OpenGL context (%p)
\n
"
,
ctx
->
ctx
);
TRACE
(
" created a delayed OpenGL context (%p)
\n
"
,
ctx
->
ctx
);
}
}
ctx
->
physDev
=
pDrawDev
;
ctx
->
pReadDev
=
pReadDev
;
ret
=
pglXMakeContextCurrent
(
gdi_display
,
d_draw
,
d_read
,
ctx
->
ctx
);
ret
=
pglXMakeContextCurrent
(
gdi_display
,
d_draw
,
d_read
,
ctx
->
ctx
);
NtCurrentTeb
()
->
glContext
=
ctx
;
NtCurrentTeb
()
->
glContext
=
ctx
;
}
}
...
...
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