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
2e1d5af7
Commit
2e1d5af7
authored
Oct 06, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Nov 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opengl32: Use glReserved1[0] and glReserved1[1] for draw and read DCs.
parent
8c178113
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
61 deletions
+52
-61
opengl_ext.h
dlls/opengl32/opengl_ext.h
+0
-45
unix_wgl.c
dlls/opengl32/unix_wgl.c
+48
-8
wgl.c
dlls/opengl32/wgl.c
+4
-8
No files found.
dlls/opengl32/opengl_ext.h
View file @
2e1d5af7
...
...
@@ -49,51 +49,6 @@ static inline struct opengl_funcs *get_dc_funcs( HDC hdc )
return
funcs
;
}
#define MAX_WGL_HANDLES 1024
/* handle management */
enum
wgl_handle_type
{
HANDLE_PBUFFER
=
0
<<
12
,
HANDLE_CONTEXT
=
1
<<
12
,
HANDLE_CONTEXT_V3
=
3
<<
12
,
HANDLE_TYPE_MASK
=
15
<<
12
};
struct
opengl_context
{
DWORD
tid
;
/* thread that the context is current in */
HDC
draw_dc
;
/* current drawing DC */
HDC
read_dc
;
/* current reading DC */
void
(
CALLBACK
*
debug_callback
)(
GLenum
,
GLenum
,
GLuint
,
GLenum
,
GLsizei
,
const
GLchar
*
,
const
void
*
);
/* debug callback */
const
void
*
debug_user
;
/* debug user parameter */
GLubyte
*
extensions
;
/* extension string */
GLuint
*
disabled_exts
;
/* indices of disabled extensions */
struct
wgl_context
*
drv_ctx
;
/* driver context */
};
struct
wgl_handle
{
UINT
handle
;
struct
opengl_funcs
*
funcs
;
union
{
struct
opengl_context
*
context
;
/* for HANDLE_CONTEXT */
struct
wgl_pbuffer
*
pbuffer
;
/* for HANDLE_PBUFFER */
struct
wgl_handle
*
next
;
/* for free handles */
}
u
;
};
extern
struct
wgl_handle
wgl_handles
[
MAX_WGL_HANDLES
];
/* the current context is assumed valid and doesn't need locking */
static
inline
struct
wgl_handle
*
get_current_context_ptr
(
void
)
{
if
(
!
NtCurrentTeb
()
->
glCurrentRC
)
return
NULL
;
return
&
wgl_handles
[
LOWORD
(
NtCurrentTeb
()
->
glCurrentRC
)
&
~
HANDLE_TYPE_MASK
];
}
extern
int
WINAPI
wglDescribePixelFormat
(
HDC
hdc
,
int
ipfd
,
UINT
cjpfd
,
PIXELFORMATDESCRIPTOR
*
ppfd
);
#endif
/* __DLLS_OPENGL32_OPENGL_EXT_H */
dlls/opengl32/unix_wgl.c
View file @
2e1d5af7
...
...
@@ -38,10 +38,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
wgl
);
struct
wgl_handle
wgl_handles
[
MAX_WGL_HANDLES
];
static
struct
wgl_handle
*
next_free
;
static
unsigned
int
handle_count
;
static
CRITICAL_SECTION
wgl_section
;
static
CRITICAL_SECTION_DEBUG
critsect_debug
=
{
...
...
@@ -51,6 +47,50 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
};
static
CRITICAL_SECTION
wgl_section
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
/* handle management */
enum
wgl_handle_type
{
HANDLE_PBUFFER
=
0
<<
12
,
HANDLE_CONTEXT
=
1
<<
12
,
HANDLE_CONTEXT_V3
=
3
<<
12
,
HANDLE_TYPE_MASK
=
15
<<
12
};
struct
opengl_context
{
DWORD
tid
;
/* thread that the context is current in */
void
(
CALLBACK
*
debug_callback
)(
GLenum
,
GLenum
,
GLuint
,
GLenum
,
GLsizei
,
const
GLchar
*
,
const
void
*
);
/* debug callback */
const
void
*
debug_user
;
/* debug user parameter */
GLubyte
*
extensions
;
/* extension string */
GLuint
*
disabled_exts
;
/* indices of disabled extensions */
struct
wgl_context
*
drv_ctx
;
/* driver context */
};
struct
wgl_handle
{
UINT
handle
;
struct
opengl_funcs
*
funcs
;
union
{
struct
opengl_context
*
context
;
/* for HANDLE_CONTEXT */
struct
wgl_pbuffer
*
pbuffer
;
/* for HANDLE_PBUFFER */
struct
wgl_handle
*
next
;
/* for free handles */
}
u
;
};
#define MAX_WGL_HANDLES 1024
static
struct
wgl_handle
wgl_handles
[
MAX_WGL_HANDLES
];
static
struct
wgl_handle
*
next_free
;
static
unsigned
int
handle_count
;
/* the current context is assumed valid and doesn't need locking */
static
inline
struct
wgl_handle
*
get_current_context_ptr
(
void
)
{
if
(
!
NtCurrentTeb
()
->
glCurrentRC
)
return
NULL
;
return
&
wgl_handles
[
LOWORD
(
NtCurrentTeb
()
->
glCurrentRC
)
&
~
HANDLE_TYPE_MASK
];
}
static
inline
HANDLE
next_handle
(
struct
wgl_handle
*
ptr
,
enum
wgl_handle_type
type
)
{
WORD
generation
=
HIWORD
(
ptr
->
handle
)
+
1
;
...
...
@@ -498,8 +538,8 @@ static BOOL wrap_wglMakeCurrent( HDC hdc, HGLRC hglrc )
{
if
(
prev
)
prev
->
u
.
context
->
tid
=
0
;
ptr
->
u
.
context
->
tid
=
GetCurrentThreadId
();
ptr
->
u
.
context
->
draw_dc
=
hdc
;
ptr
->
u
.
context
->
read_dc
=
hdc
;
NtCurrentTeb
()
->
glReserved1
[
0
]
=
hdc
;
NtCurrentTeb
()
->
glReserved1
[
1
]
=
hdc
;
NtCurrentTeb
()
->
glCurrentRC
=
hglrc
;
NtCurrentTeb
()
->
glTable
=
ptr
->
funcs
;
}
...
...
@@ -672,8 +712,8 @@ static BOOL wrap_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC hgl
{
if
(
prev
)
prev
->
u
.
context
->
tid
=
0
;
ptr
->
u
.
context
->
tid
=
GetCurrentThreadId
();
ptr
->
u
.
context
->
draw_dc
=
draw_hdc
;
ptr
->
u
.
context
->
read_dc
=
read_hdc
;
NtCurrentTeb
()
->
glReserved1
[
0
]
=
draw_hdc
;
NtCurrentTeb
()
->
glReserved1
[
1
]
=
read_hdc
;
NtCurrentTeb
()
->
glCurrentRC
=
hglrc
;
NtCurrentTeb
()
->
glTable
=
ptr
->
funcs
;
}
...
...
dlls/opengl32/wgl.c
View file @
2e1d5af7
...
...
@@ -50,10 +50,8 @@ static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
*/
HDC
WINAPI
wglGetCurrentReadDCARB
(
void
)
{
struct
wgl_handle
*
ptr
=
get_current_context_ptr
();
if
(
!
ptr
)
return
0
;
return
ptr
->
u
.
context
->
read_dc
;
if
(
!
NtCurrentTeb
()
->
glCurrentRC
)
return
0
;
return
NtCurrentTeb
()
->
glReserved1
[
1
];
}
/***********************************************************************
...
...
@@ -61,10 +59,8 @@ HDC WINAPI wglGetCurrentReadDCARB(void)
*/
HDC
WINAPI
wglGetCurrentDC
(
void
)
{
struct
wgl_handle
*
ptr
=
get_current_context_ptr
();
if
(
!
ptr
)
return
0
;
return
ptr
->
u
.
context
->
draw_dc
;
if
(
!
NtCurrentTeb
()
->
glCurrentRC
)
return
0
;
return
NtCurrentTeb
()
->
glReserved1
[
0
];
}
/***********************************************************************
...
...
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