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
34d288a9
Commit
34d288a9
authored
Apr 24, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Apr 25, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Pass HWND directly to vulkan surface creation driver callback.
And to destroy, it'll be useful later.
parent
334a100a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
33 deletions
+30
-33
vulkan.c
dlls/win32u/vulkan.c
+4
-4
vulkan.c
dlls/winemac.drv/vulkan.c
+8
-9
vulkan.c
dlls/winewayland.drv/vulkan.c
+7
-9
vulkan.c
dlls/winex11.drv/vulkan.c
+8
-8
vulkan_driver.h
include/wine/vulkan_driver.h
+3
-3
No files found.
dlls/win32u/vulkan.c
View file @
34d288a9
...
...
@@ -75,7 +75,7 @@ static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance instance, const VkWin
if
(
allocator
)
FIXME
(
"Support for allocation callbacks not implemented yet
\n
"
);
if
(
!
(
surface
=
calloc
(
1
,
sizeof
(
*
surface
)
)))
return
VK_ERROR_OUT_OF_HOST_MEMORY
;
if
((
res
=
driver_funcs
->
p_vulkan_surface_create
(
in
stance
,
info
,
&
surface
->
driver_surface
)))
if
((
res
=
driver_funcs
->
p_vulkan_surface_create
(
in
fo
->
hwnd
,
instance
,
&
surface
->
driver_surface
)))
{
free
(
surface
);
return
res
;
...
...
@@ -94,7 +94,7 @@ static void win32u_vkDestroySurfaceKHR( VkInstance instance, VkSurfaceKHR handle
TRACE
(
"instance %p, handle 0x%s, allocator %p
\n
"
,
instance
,
wine_dbgstr_longlong
(
handle
),
allocator
);
if
(
allocator
)
FIXME
(
"Support for allocation callbacks not implemented yet
\n
"
);
driver_funcs
->
p_vulkan_surface_destroy
(
instance
,
surface
->
driver_surface
);
driver_funcs
->
p_vulkan_surface_destroy
(
surface
->
hwnd
,
instance
,
surface
->
driver_surface
);
free
(
surface
);
}
...
...
@@ -162,13 +162,13 @@ static struct vulkan_funcs vulkan_funcs =
.
p_wine_get_host_surface
=
win32u_wine_get_host_surface
,
};
static
VkResult
nulldrv_vulkan_surface_create
(
VkInstance
instance
,
const
VkWin32SurfaceCreateInfoKHR
*
info
,
VkSurfaceKHR
*
surface
)
static
VkResult
nulldrv_vulkan_surface_create
(
HWND
hwnd
,
VkInstance
instance
,
VkSurfaceKHR
*
surface
)
{
FIXME
(
"stub!
\n
"
);
return
VK_ERROR_INCOMPATIBLE_DRIVER
;
}
static
void
nulldrv_vulkan_surface_destroy
(
VkInstance
instance
,
VkSurfaceKHR
surface
)
static
void
nulldrv_vulkan_surface_destroy
(
HWND
hwnd
,
VkInstance
instance
,
VkSurfaceKHR
surface
)
{
}
...
...
dlls/winemac.drv/vulkan.c
View file @
34d288a9
...
...
@@ -100,18 +100,17 @@ static void wine_vk_surface_destroy(VkInstance instance, struct wine_vk_surface
free
(
surface
);
}
static
VkResult
macdrv_vulkan_surface_create
(
VkInstance
instance
,
const
VkWin32SurfaceCreateInfoKHR
*
create_info
,
VkSurfaceKHR
*
surface
)
static
VkResult
macdrv_vulkan_surface_create
(
HWND
hwnd
,
VkInstance
instance
,
VkSurfaceKHR
*
surface
)
{
VkResult
res
;
struct
wine_vk_surface
*
mac_surface
;
struct
macdrv_win_data
*
data
;
TRACE
(
"%p %p %p
\n
"
,
instance
,
create_info
,
surface
);
TRACE
(
"%p %p %p
\n
"
,
hwnd
,
instance
,
surface
);
if
(
!
(
data
=
get_win_data
(
create_info
->
hwnd
)))
if
(
!
(
data
=
get_win_data
(
hwnd
)))
{
FIXME
(
"DC for window %p of other process: not implemented
\n
"
,
create_info
->
hwnd
);
FIXME
(
"DC for window %p of other process: not implemented
\n
"
,
hwnd
);
return
VK_ERROR_INCOMPATIBLE_DRIVER
;
}
...
...
@@ -125,7 +124,7 @@ static VkResult macdrv_vulkan_surface_create(VkInstance instance,
mac_surface
->
device
=
macdrv_create_metal_device
();
if
(
!
mac_surface
->
device
)
{
ERR
(
"Failed to allocate Metal device for hwnd=%p
\n
"
,
create_info
->
hwnd
);
ERR
(
"Failed to allocate Metal device for hwnd=%p
\n
"
,
hwnd
);
res
=
VK_ERROR_OUT_OF_HOST_MEMORY
;
goto
err
;
}
...
...
@@ -133,7 +132,7 @@ static VkResult macdrv_vulkan_surface_create(VkInstance instance,
mac_surface
->
view
=
macdrv_view_create_metal_view
(
data
->
client_cocoa_view
,
mac_surface
->
device
);
if
(
!
mac_surface
->
view
)
{
ERR
(
"Failed to allocate Metal view for hwnd=%p
\n
"
,
create_info
->
hwnd
);
ERR
(
"Failed to allocate Metal view for hwnd=%p
\n
"
,
hwnd
);
/* VK_KHR_win32_surface only allows out of host and device memory as errors. */
res
=
VK_ERROR_OUT_OF_HOST_MEMORY
;
...
...
@@ -179,11 +178,11 @@ err:
return
res
;
}
static
void
macdrv_vulkan_surface_destroy
(
VkInstance
instance
,
VkSurfaceKHR
surface
)
static
void
macdrv_vulkan_surface_destroy
(
HWND
hwnd
,
VkInstance
instance
,
VkSurfaceKHR
surface
)
{
struct
wine_vk_surface
*
mac_surface
=
surface_from_handle
(
surface
);
TRACE
(
"%p
0x%s
\n
"
,
instance
,
wine_dbgstr_longlong
(
surface
));
TRACE
(
"%p
%p 0x%s
\n
"
,
hwnd
,
instance
,
wine_dbgstr_longlong
(
surface
));
wine_vk_surface_destroy
(
instance
,
mac_surface
);
}
...
...
dlls/winewayland.drv/vulkan.c
View file @
34d288a9
...
...
@@ -94,16 +94,14 @@ static void wine_vk_surface_destroy(struct wine_vk_surface *wine_vk_surface)
free
(
wine_vk_surface
);
}
static
VkResult
wayland_vulkan_surface_create
(
VkInstance
instance
,
const
VkWin32SurfaceCreateInfoKHR
*
create_info
,
VkSurfaceKHR
*
vk_surface
)
static
VkResult
wayland_vulkan_surface_create
(
HWND
hwnd
,
VkInstance
instance
,
VkSurfaceKHR
*
vk_surface
)
{
VkResult
res
;
VkWaylandSurfaceCreateInfoKHR
create_info_host
;
struct
wine_vk_surface
*
wine_vk_surface
;
struct
wayland_surface
*
wayland_surface
;
TRACE
(
"%p %p %p
\n
"
,
instance
,
create_info
,
vk_surface
);
TRACE
(
"%p %p %p
\n
"
,
hwnd
,
instance
,
vk_surface
);
wine_vk_surface
=
calloc
(
1
,
sizeof
(
*
wine_vk_surface
));
if
(
!
wine_vk_surface
)
...
...
@@ -113,10 +111,10 @@ static VkResult wayland_vulkan_surface_create(VkInstance instance,
goto
err
;
}
wayland_surface
=
wayland_surface_lock_hwnd
(
create_info
->
hwnd
);
wayland_surface
=
wayland_surface_lock_hwnd
(
hwnd
);
if
(
!
wayland_surface
)
{
ERR
(
"Failed to find wayland surface for hwnd=%p
\n
"
,
create_info
->
hwnd
);
ERR
(
"Failed to find wayland surface for hwnd=%p
\n
"
,
hwnd
);
/* VK_KHR_win32_surface only allows out of host and device memory as errors. */
res
=
VK_ERROR_OUT_OF_HOST_MEMORY
;
goto
err
;
...
...
@@ -127,7 +125,7 @@ static VkResult wayland_vulkan_surface_create(VkInstance instance,
if
(
!
wine_vk_surface
->
client
)
{
ERR
(
"Failed to create client surface for hwnd=%p
\n
"
,
create_info
->
hwnd
);
ERR
(
"Failed to create client surface for hwnd=%p
\n
"
,
hwnd
);
/* VK_KHR_win32_surface only allows out of host and device memory as errors. */
res
=
VK_ERROR_OUT_OF_HOST_MEMORY
;
goto
err
;
...
...
@@ -158,11 +156,11 @@ err:
return
res
;
}
static
void
wayland_vulkan_surface_destroy
(
VkInstance
instance
,
VkSurfaceKHR
surface
)
static
void
wayland_vulkan_surface_destroy
(
HWND
hwnd
,
VkInstance
instance
,
VkSurfaceKHR
surface
)
{
struct
wine_vk_surface
*
wine_vk_surface
=
wine_vk_surface_from_handle
(
surface
);
TRACE
(
"%p
0x%s
\n
"
,
instance
,
wine_dbgstr_longlong
(
surface
));
TRACE
(
"%p
%p 0x%s
\n
"
,
hwnd
,
instance
,
wine_dbgstr_longlong
(
surface
));
pvkDestroySurfaceKHR
(
instance
,
wine_vk_surface
->
host_surface
,
NULL
/* allocator */
);
wine_vk_surface_destroy
(
wine_vk_surface
);
...
...
dlls/winex11.drv/vulkan.c
View file @
34d288a9
...
...
@@ -132,16 +132,16 @@ void vulkan_thread_detach(void)
pthread_mutex_unlock
(
&
vulkan_mutex
);
}
static
VkResult
X11DRV_vulkan_surface_create
(
VkInstance
instance
,
const
VkWin32SurfaceCreateInfoKHR
*
create_info
,
VkSurfaceKHR
*
surface
)
static
VkResult
X11DRV_vulkan_surface_create
(
HWND
hwnd
,
VkInstance
instance
,
VkSurfaceKHR
*
surface
)
{
VkResult
res
;
VkXlibSurfaceCreateInfoKHR
create_info_host
;
struct
wine_vk_surface
*
x11_surface
;
TRACE
(
"%p %p %p
\n
"
,
instance
,
create_info
,
surface
);
TRACE
(
"%p %p %p
\n
"
,
hwnd
,
instance
,
surface
);
/* TODO: support child window rendering. */
if
(
NtUserGetAncestor
(
create_info
->
hwnd
,
GA_PARENT
)
!=
NtUserGetDesktopWindow
())
if
(
NtUserGetAncestor
(
hwnd
,
GA_PARENT
)
!=
NtUserGetDesktopWindow
())
{
FIXME
(
"Application requires child window rendering, which is not implemented yet!
\n
"
);
return
VK_ERROR_INCOMPATIBLE_DRIVER
;
...
...
@@ -152,13 +152,13 @@ static VkResult X11DRV_vulkan_surface_create( VkInstance instance, const VkWin32
return
VK_ERROR_OUT_OF_HOST_MEMORY
;
x11_surface
->
ref
=
1
;
x11_surface
->
hwnd
=
create_info
->
hwnd
;
x11_surface
->
window
=
create_client_window
(
create_info
->
hwnd
,
&
default_visual
,
default_colormap
);
x11_surface
->
hwnd
=
hwnd
;
x11_surface
->
window
=
create_client_window
(
hwnd
,
&
default_visual
,
default_colormap
);
x11_surface
->
hwnd_thread_id
=
NtUserGetWindowThread
(
x11_surface
->
hwnd
,
NULL
);
if
(
!
x11_surface
->
window
)
{
ERR
(
"Failed to allocate client window for hwnd=%p
\n
"
,
create_info
->
hwnd
);
ERR
(
"Failed to allocate client window for hwnd=%p
\n
"
,
hwnd
);
/* VK_KHR_win32_surface only allows out of host and device memory as errors. */
free
(
x11_surface
);
...
...
@@ -190,11 +190,11 @@ static VkResult X11DRV_vulkan_surface_create( VkInstance instance, const VkWin32
return
VK_SUCCESS
;
}
static
void
X11DRV_vulkan_surface_destroy
(
VkInstance
instance
,
VkSurfaceKHR
surface
)
static
void
X11DRV_vulkan_surface_destroy
(
HWND
hwnd
,
VkInstance
instance
,
VkSurfaceKHR
surface
)
{
struct
wine_vk_surface
*
x11_surface
=
surface_from_handle
(
surface
);
TRACE
(
"%p
0x%s
\n
"
,
instance
,
wine_dbgstr_longlong
(
surface
)
);
TRACE
(
"%p
%p 0x%s
\n
"
,
hwnd
,
instance
,
wine_dbgstr_longlong
(
surface
)
);
pvkDestroySurfaceKHR
(
instance
,
x11_surface
->
host_surface
,
NULL
/* allocator */
);
wine_vk_surface_release
(
x11_surface
);
...
...
include/wine/vulkan_driver.h
View file @
34d288a9
...
...
@@ -21,7 +21,7 @@
#define __WINE_VULKAN_DRIVER_H
/* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */
#define WINE_VULKAN_DRIVER_VERSION 3
0
#define WINE_VULKAN_DRIVER_VERSION 3
1
struct
vulkan_funcs
{
...
...
@@ -44,8 +44,8 @@ struct vulkan_funcs
/* interface between win32u and the user drivers */
struct
vulkan_driver_funcs
{
VkResult
(
*
p_vulkan_surface_create
)(
VkInstance
,
const
VkWin32SurfaceCreateInfoKHR
*
,
VkSurfaceKHR
*
);
void
(
*
p_vulkan_surface_destroy
)(
VkInstance
,
VkSurfaceKHR
);
VkResult
(
*
p_vulkan_surface_create
)(
HWND
,
VkInstance
,
VkSurfaceKHR
*
);
void
(
*
p_vulkan_surface_destroy
)(
HWND
,
VkInstance
,
VkSurfaceKHR
);
void
(
*
p_vulkan_surface_presented
)(
HWND
,
VkResult
);
VkBool32
(
*
p_vkGetPhysicalDeviceWin32PresentationSupportKHR
)(
VkPhysicalDevice
,
uint32_t
);
...
...
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