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
aed0c822
Commit
aed0c822
authored
Feb 23, 2024
by
Alexandros Frantzis
Committed by
Alexandre Julliard
Mar 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winewayland.drv: Implement wglSwapBuffers.
parent
075a0e26
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
2 deletions
+84
-2
opengl.c
dlls/winewayland.drv/opengl.c
+84
-2
No files found.
dlls/winewayland.drv/opengl.c
View file @
aed0c822
...
@@ -67,6 +67,7 @@ DECL_FUNCPTR(eglGetProcAddress);
...
@@ -67,6 +67,7 @@ DECL_FUNCPTR(eglGetProcAddress);
DECL_FUNCPTR
(
eglInitialize
);
DECL_FUNCPTR
(
eglInitialize
);
DECL_FUNCPTR
(
eglMakeCurrent
);
DECL_FUNCPTR
(
eglMakeCurrent
);
DECL_FUNCPTR
(
eglQueryString
);
DECL_FUNCPTR
(
eglQueryString
);
DECL_FUNCPTR
(
eglSwapBuffers
);
#undef DECL_FUNCPTR
#undef DECL_FUNCPTR
static
pthread_mutex_t
gl_object_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
static
pthread_mutex_t
gl_object_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
...
@@ -88,7 +89,7 @@ struct wgl_context
...
@@ -88,7 +89,7 @@ struct wgl_context
struct
list
entry
;
struct
list
entry
;
EGLConfig
config
;
EGLConfig
config
;
EGLContext
context
;
EGLContext
context
;
struct
wayland_gl_drawable
*
draw
,
*
read
;
struct
wayland_gl_drawable
*
draw
,
*
read
,
*
new_draw
,
*
new_read
;
};
};
/* lookup the existing drawable for a window, gl_object_mutex must be held */
/* lookup the existing drawable for a window, gl_object_mutex must be held */
...
@@ -200,6 +201,18 @@ err:
...
@@ -200,6 +201,18 @@ err:
return
NULL
;
return
NULL
;
}
}
static
void
update_context_drawables
(
struct
wayland_gl_drawable
*
new
,
struct
wayland_gl_drawable
*
old
)
{
struct
wgl_context
*
ctx
;
LIST_FOR_EACH_ENTRY
(
ctx
,
&
gl_contexts
,
struct
wgl_context
,
entry
)
{
if
(
ctx
->
draw
==
old
||
ctx
->
new_draw
==
old
)
ctx
->
new_draw
=
new
;
if
(
ctx
->
read
==
old
||
ctx
->
new_read
==
old
)
ctx
->
new_read
=
new
;
}
}
static
void
wayland_update_gl_drawable
(
HWND
hwnd
,
struct
wayland_gl_drawable
*
new
)
static
void
wayland_update_gl_drawable
(
HWND
hwnd
,
struct
wayland_gl_drawable
*
new
)
{
{
struct
wayland_gl_drawable
*
old
;
struct
wayland_gl_drawable
*
old
;
...
@@ -208,13 +221,33 @@ static void wayland_update_gl_drawable(HWND hwnd, struct wayland_gl_drawable *ne
...
@@ -208,13 +221,33 @@ static void wayland_update_gl_drawable(HWND hwnd, struct wayland_gl_drawable *ne
if
((
old
=
find_drawable_for_hwnd
(
hwnd
)))
list_remove
(
&
old
->
entry
);
if
((
old
=
find_drawable_for_hwnd
(
hwnd
)))
list_remove
(
&
old
->
entry
);
if
(
new
)
list_add_head
(
&
gl_drawables
,
&
new
->
entry
);
if
(
new
)
list_add_head
(
&
gl_drawables
,
&
new
->
entry
);
/* TODO: Update context drawables */
if
(
old
&&
new
)
update_context_drawables
(
new
,
old
);
pthread_mutex_unlock
(
&
gl_object_mutex
);
pthread_mutex_unlock
(
&
gl_object_mutex
);
if
(
old
)
wayland_gl_drawable_release
(
old
);
if
(
old
)
wayland_gl_drawable_release
(
old
);
}
}
static
void
wayland_gl_drawable_sync_surface_state
(
struct
wayland_gl_drawable
*
gl
)
{
struct
wayland_surface
*
wayland_surface
;
if
(
!
(
wayland_surface
=
wayland_surface_lock_hwnd
(
gl
->
hwnd
)))
return
;
wayland_surface_ensure_contents
(
wayland_surface
);
/* Handle any processed configure request, to ensure the related
* surface state is applied by the compositor. */
if
(
wayland_surface
->
processing
.
serial
&&
wayland_surface
->
processing
.
processed
&&
wayland_surface_reconfigure
(
wayland_surface
))
{
wl_surface_commit
(
wayland_surface
->
wl_surface
);
}
pthread_mutex_unlock
(
&
wayland_surface
->
mutex
);
}
static
BOOL
wgl_context_make_current
(
struct
wgl_context
*
ctx
,
HWND
draw_hwnd
,
static
BOOL
wgl_context_make_current
(
struct
wgl_context
*
ctx
,
HWND
draw_hwnd
,
HWND
read_hwnd
)
HWND
read_hwnd
)
{
{
...
@@ -242,6 +275,7 @@ static BOOL wgl_context_make_current(struct wgl_context *ctx, HWND draw_hwnd,
...
@@ -242,6 +275,7 @@ static BOOL wgl_context_make_current(struct wgl_context *ctx, HWND draw_hwnd,
old_read
=
ctx
->
read
;
old_read
=
ctx
->
read
;
ctx
->
draw
=
draw
;
ctx
->
draw
=
draw
;
ctx
->
read
=
read
;
ctx
->
read
=
read
;
ctx
->
new_draw
=
ctx
->
new_read
=
NULL
;
NtCurrentTeb
()
->
glContext
=
ctx
;
NtCurrentTeb
()
->
glContext
=
ctx
;
}
}
else
else
...
@@ -258,6 +292,35 @@ static BOOL wgl_context_make_current(struct wgl_context *ctx, HWND draw_hwnd,
...
@@ -258,6 +292,35 @@ static BOOL wgl_context_make_current(struct wgl_context *ctx, HWND draw_hwnd,
return
ret
;
return
ret
;
}
}
static
void
wgl_context_refresh
(
struct
wgl_context
*
ctx
)
{
BOOL
refresh
=
FALSE
;
struct
wayland_gl_drawable
*
old_draw
=
NULL
,
*
old_read
=
NULL
;
pthread_mutex_lock
(
&
gl_object_mutex
);
if
(
ctx
->
new_draw
)
{
old_draw
=
ctx
->
draw
;
ctx
->
draw
=
wayland_gl_drawable_acquire
(
ctx
->
new_draw
);
ctx
->
new_draw
=
NULL
;
refresh
=
TRUE
;
}
if
(
ctx
->
new_read
)
{
old_read
=
ctx
->
read
;
ctx
->
read
=
wayland_gl_drawable_acquire
(
ctx
->
new_read
);
ctx
->
new_read
=
NULL
;
refresh
=
TRUE
;
}
if
(
refresh
)
p_eglMakeCurrent
(
egl_display
,
ctx
->
draw
,
ctx
->
read
,
ctx
->
context
);
pthread_mutex_unlock
(
&
gl_object_mutex
);
if
(
old_draw
)
wayland_gl_drawable_release
(
old_draw
);
if
(
old_read
)
wayland_gl_drawable_release
(
old_read
);
}
static
BOOL
set_pixel_format
(
HDC
hdc
,
int
format
,
BOOL
internal
)
static
BOOL
set_pixel_format
(
HDC
hdc
,
int
format
,
BOOL
internal
)
{
{
HWND
hwnd
=
NtUserWindowFromDC
(
hdc
);
HWND
hwnd
=
NtUserWindowFromDC
(
hdc
);
...
@@ -454,6 +517,23 @@ static BOOL wayland_wglSetPixelFormatWINE(HDC hdc, int format)
...
@@ -454,6 +517,23 @@ static BOOL wayland_wglSetPixelFormatWINE(HDC hdc, int format)
return
set_pixel_format
(
hdc
,
format
,
TRUE
);
return
set_pixel_format
(
hdc
,
format
,
TRUE
);
}
}
static
BOOL
wayland_wglSwapBuffers
(
HDC
hdc
)
{
struct
wgl_context
*
ctx
=
NtCurrentTeb
()
->
glContext
;
HWND
hwnd
=
NtUserWindowFromDC
(
hdc
);
struct
wayland_gl_drawable
*
gl
;
if
(
!
(
gl
=
wayland_gl_drawable_get
(
hwnd
)))
return
FALSE
;
if
(
ctx
)
wgl_context_refresh
(
ctx
);
wayland_gl_drawable_sync_surface_state
(
gl
);
p_eglSwapBuffers
(
egl_display
,
gl
->
surface
);
wayland_gl_drawable_release
(
gl
);
return
TRUE
;
}
static
BOOL
has_extension
(
const
char
*
list
,
const
char
*
ext
)
static
BOOL
has_extension
(
const
char
*
list
,
const
char
*
ext
)
{
{
size_t
len
=
strlen
(
ext
);
size_t
len
=
strlen
(
ext
);
...
@@ -606,6 +686,7 @@ static void init_opengl(void)
...
@@ -606,6 +686,7 @@ static void init_opengl(void)
LOAD_FUNCPTR_EGL
(
eglGetPlatformDisplay
);
LOAD_FUNCPTR_EGL
(
eglGetPlatformDisplay
);
LOAD_FUNCPTR_EGL
(
eglInitialize
);
LOAD_FUNCPTR_EGL
(
eglInitialize
);
LOAD_FUNCPTR_EGL
(
eglMakeCurrent
);
LOAD_FUNCPTR_EGL
(
eglMakeCurrent
);
LOAD_FUNCPTR_EGL
(
eglSwapBuffers
);
#undef LOAD_FUNCPTR_EGL
#undef LOAD_FUNCPTR_EGL
egl_display
=
p_eglGetPlatformDisplay
(
EGL_PLATFORM_WAYLAND_KHR
,
egl_display
=
p_eglGetPlatformDisplay
(
EGL_PLATFORM_WAYLAND_KHR
,
...
@@ -660,6 +741,7 @@ static struct opengl_funcs opengl_funcs =
...
@@ -660,6 +741,7 @@ static struct opengl_funcs opengl_funcs =
.
p_wglGetProcAddress
=
wayland_wglGetProcAddress
,
.
p_wglGetProcAddress
=
wayland_wglGetProcAddress
,
.
p_wglMakeCurrent
=
wayland_wglMakeCurrent
,
.
p_wglMakeCurrent
=
wayland_wglMakeCurrent
,
.
p_wglSetPixelFormat
=
wayland_wglSetPixelFormat
,
.
p_wglSetPixelFormat
=
wayland_wglSetPixelFormat
,
.
p_wglSwapBuffers
=
wayland_wglSwapBuffers
,
}
}
};
};
...
...
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