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
85026ab2
Commit
85026ab2
authored
Dec 05, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Dec 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winevulkan: Unwrap to driver or host depending on the function.
parent
f6febfda
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
14 deletions
+32
-14
make_vulkan
dlls/winevulkan/make_vulkan
+24
-6
vulkan_thunks.c
dlls/winevulkan/vulkan_thunks.c
+8
-8
No files found.
dlls/winevulkan/make_vulkan
View file @
85026ab2
...
...
@@ -325,6 +325,7 @@ class Direction(Enum):
class
Unwrap
(
Enum
):
NONE
=
0
HOST
=
1
DRIVER
=
2
def
api_is_vulkan
(
obj
):
...
...
@@ -337,12 +338,16 @@ def convert_suffix(direction, win_type, unwrap, is_wrapped):
return
"host_to_{0}"
.
format
(
win_type
)
if
unwrap
==
Unwrap
.
NONE
:
return
"unwrapped_host_to_{0}"
.
format
(
win_type
)
if
unwrap
==
Unwrap
.
DRIVER
:
return
"driver_to_{0}"
.
format
(
win_type
)
return
"host_to_{0}"
.
format
(
win_type
)
else
:
if
not
is_wrapped
:
return
"{0}_to_host"
.
format
(
win_type
)
if
unwrap
==
Unwrap
.
NONE
:
return
"{0}_to_unwrapped_host"
.
format
(
win_type
)
if
unwrap
==
Unwrap
.
DRIVER
:
return
"{0}_to_driver"
.
format
(
win_type
)
return
"{0}_to_host"
.
format
(
win_type
)
...
...
@@ -628,6 +633,8 @@ class VkFunction(object):
if
self
.
name
in
MANUAL_UNIX_THUNKS
:
self
.
unwrap
=
Unwrap
.
NONE
elif
self
.
name
in
USER_DRIVER_FUNCS
:
self
.
unwrap
=
Unwrap
.
DRIVER
else
:
self
.
unwrap
=
Unwrap
.
HOST
...
...
@@ -1190,6 +1197,14 @@ class VkHandle(object):
return
self
.
host_handle
(
name
)
def
unwrap_handle
(
self
,
name
,
unwrap
):
if
unwrap
==
Unwrap
.
DRIVER
:
return
self
.
driver_handle
(
name
)
if
unwrap
==
Unwrap
.
HOST
:
return
self
.
host_handle
(
name
)
assert
unwrap
!=
Unwrap
.
NONE
return
None
def
is_wrapped
(
self
):
return
self
.
host_handle
(
"test"
)
is
not
None
...
...
@@ -1549,15 +1564,16 @@ class VkMember(VkVariable):
LOGGER
.
err
(
"OUTPUT parameter {0}.{1} cannot be unwrapped"
.
format
(
self
.
type
,
self
.
name
))
elif
self
.
optional
:
return
"{0}{1} = {2} ? {3} : 0;
\n
"
.
format
(
output
,
self
.
name
,
self
.
value
(
input
,
conv
),
handle
.
driver_handle
(
self
.
value
(
input
,
conv
)
))
handle
.
unwrap_handle
(
self
.
value
(
input
,
conv
),
unwrap
))
else
:
return
"{0}{1} = {2};
\n
"
.
format
(
output
,
self
.
name
,
handle
.
driver_handle
(
self
.
value
(
input
,
conv
)
))
handle
.
unwrap_handle
(
self
.
value
(
input
,
conv
),
unwrap
))
elif
self
.
is_generic_handle
():
if
direction
==
Direction
.
OUTPUT
:
LOGGER
.
err
(
"OUTPUT parameter {0}.{1} cannot be unwrapped"
.
format
(
self
.
type
,
self
.
name
))
else
:
return
"{0}{1} = wine_vk_unwrap_handle({2}{3}, {2}{1});
\n
"
.
format
(
output
,
self
.
name
,
input
,
self
.
object_type
)
if
unwrap
==
Unwrap
.
DRIVER
and
self
.
is_wrapped
(
Unwrap
.
DRIVER
):
LOGGER
.
err
(
"DRIVER unwrapping of {0}.{1} not implemented"
.
format
(
self
.
type
,
self
.
name
))
return
"{0}{1} = wine_vk_unwrap_handle({2}{3}, {2}{1});
\n
"
.
format
(
output
,
self
.
name
,
input
,
self
.
object_type
)
else
:
selector_part
=
", {0}{1}"
.
format
(
input
,
self
.
selector
)
if
self
.
selector
else
""
if
direction
==
Direction
.
OUTPUT
:
...
...
@@ -1951,13 +1967,15 @@ class VkParam(VkVariable):
if
unwrap
!=
Unwrap
.
NONE
:
unwrap_handle
=
None
if
self
.
object_type
!=
None
and
self
.
type
==
"uint64_t"
:
if
unwrap
==
Unwrap
.
DRIVER
and
self
.
is_wrapped
(
Unwrap
.
DRIVER
):
LOGGER
.
err
(
"DRIVER unwrapping of {0}.{1} not implemented"
.
format
(
self
.
type
,
self
.
name
))
unwrap_handle
=
"wine_vk_unwrap_handle({0}{1}, {0}{2})"
.
format
(
params_prefix
,
self
.
object_type
,
self
.
name
)
elif
self
.
is_handle
():
# We need to pass the host handle to the host Vulkan calls and
# the wine driver's handle to calls which are wrapped by the driver.
unwrap_handle
=
self
.
handle
.
driver_handle
(
p
)
unwrap_handle
=
self
.
handle
.
unwrap_handle
(
p
,
unwra
p
)
if
unwrap_handle
:
if
self
.
optional
:
unwrap_handle
=
"{0}{1} ? {2} : 0"
.
format
(
params_prefix
,
self
.
name
,
unwrap_handle
)
...
...
@@ -2612,7 +2630,7 @@ class ArrayConversionFunction(object):
if
self
.
unwrap
==
Unwrap
.
NONE
or
not
handle
.
is_wrapped
():
body
+=
" out[i] = {0};
\n
"
.
format
(
input
)
elif
self
.
direction
==
Direction
.
INPUT
:
body
+=
" out[i] =
"
+
handle
.
driver_handle
(
input
)
+
";
\n
"
body
+=
" out[i] =
{0};
\n
"
.
format
(
handle
.
unwrap_handle
(
input
,
self
.
unwrap
))
else
:
LOGGER
.
warning
(
"Unhandled handle output conversion"
)
elif
self
.
array
.
pointer_array
:
...
...
dlls/winevulkan/vulkan_thunks.c
View file @
85026ab2
...
...
@@ -17914,7 +17914,7 @@ static inline const VkShaderCreateInfoEXT *convert_VkShaderCreateInfoEXT_array_w
}
#ifdef _WIN64
static
inline
void
convert_VkSwapchainCreateInfoKHR_win64_to_
host
(
const
VkSwapchainCreateInfoKHR
*
in
,
VkSwapchainCreateInfoKHR
*
out
)
static
inline
void
convert_VkSwapchainCreateInfoKHR_win64_to_
driver
(
const
VkSwapchainCreateInfoKHR
*
in
,
VkSwapchainCreateInfoKHR
*
out
)
{
if
(
!
in
)
return
;
...
...
@@ -17939,7 +17939,7 @@ static inline void convert_VkSwapchainCreateInfoKHR_win64_to_host(const VkSwapch
}
#endif
/* _WIN64 */
static
inline
void
convert_VkSwapchainCreateInfoKHR_win32_to_
host
(
struct
conversion_context
*
ctx
,
const
VkSwapchainCreateInfoKHR32
*
in
,
VkSwapchainCreateInfoKHR
*
out
)
static
inline
void
convert_VkSwapchainCreateInfoKHR_win32_to_
driver
(
struct
conversion_context
*
ctx
,
const
VkSwapchainCreateInfoKHR32
*
in
,
VkSwapchainCreateInfoKHR
*
out
)
{
const
VkBaseInStructure32
*
in_header
;
VkBaseOutStructure
*
out_header
=
(
void
*
)
out
;
...
...
@@ -26448,7 +26448,7 @@ static inline void convert_VkSurfaceCapabilities2KHR_host_to_win32(const VkSurfa
}
#ifdef _WIN64
static
inline
void
convert_VkPhysicalDeviceSurfaceInfo2KHR_win64_to_
host
(
const
VkPhysicalDeviceSurfaceInfo2KHR
*
in
,
VkPhysicalDeviceSurfaceInfo2KHR
*
out
)
static
inline
void
convert_VkPhysicalDeviceSurfaceInfo2KHR_win64_to_
driver
(
const
VkPhysicalDeviceSurfaceInfo2KHR
*
in
,
VkPhysicalDeviceSurfaceInfo2KHR
*
out
)
{
if
(
!
in
)
return
;
...
...
@@ -26458,7 +26458,7 @@ static inline void convert_VkPhysicalDeviceSurfaceInfo2KHR_win64_to_host(const V
}
#endif
/* _WIN64 */
static
inline
void
convert_VkPhysicalDeviceSurfaceInfo2KHR_win32_to_
host
(
struct
conversion_context
*
ctx
,
const
VkPhysicalDeviceSurfaceInfo2KHR32
*
in
,
VkPhysicalDeviceSurfaceInfo2KHR
*
out
)
static
inline
void
convert_VkPhysicalDeviceSurfaceInfo2KHR_win32_to_
driver
(
struct
conversion_context
*
ctx
,
const
VkPhysicalDeviceSurfaceInfo2KHR32
*
in
,
VkPhysicalDeviceSurfaceInfo2KHR
*
out
)
{
const
VkBaseInStructure32
*
in_header
;
VkBaseOutStructure
*
out_header
=
(
void
*
)
out
;
...
...
@@ -36113,7 +36113,7 @@ static NTSTATUS thunk64_vkCreateSwapchainKHR(void *args)
TRACE
(
"%p, %p, %p, %p
\n
"
,
params
->
device
,
params
->
pCreateInfo
,
params
->
pAllocator
,
params
->
pSwapchain
);
convert_VkSwapchainCreateInfoKHR_win64_to_
host
(
params
->
pCreateInfo
,
&
pCreateInfo_host
);
convert_VkSwapchainCreateInfoKHR_win64_to_
driver
(
params
->
pCreateInfo
,
&
pCreateInfo_host
);
params
->
result
=
wine_device_from_handle
(
params
->
device
)
->
funcs
.
p_vkCreateSwapchainKHR
(
wine_device_from_handle
(
params
->
device
)
->
host_device
,
&
pCreateInfo_host
,
NULL
,
params
->
pSwapchain
);
return
STATUS_SUCCESS
;
}
...
...
@@ -36136,7 +36136,7 @@ static NTSTATUS thunk32_vkCreateSwapchainKHR(void *args)
TRACE
(
"%#x, %#x, %#x, %#x
\n
"
,
params
->
device
,
params
->
pCreateInfo
,
params
->
pAllocator
,
params
->
pSwapchain
);
init_conversion_context
(
ctx
);
convert_VkSwapchainCreateInfoKHR_win32_to_
host
(
ctx
,
(
const
VkSwapchainCreateInfoKHR32
*
)
UlongToPtr
(
params
->
pCreateInfo
),
&
pCreateInfo_host
);
convert_VkSwapchainCreateInfoKHR_win32_to_
driver
(
ctx
,
(
const
VkSwapchainCreateInfoKHR32
*
)
UlongToPtr
(
params
->
pCreateInfo
),
&
pCreateInfo_host
);
params
->
result
=
wine_device_from_handle
((
VkDevice
)
UlongToPtr
(
params
->
device
))
->
funcs
.
p_vkCreateSwapchainKHR
(
wine_device_from_handle
((
VkDevice
)
UlongToPtr
(
params
->
device
))
->
host_device
,
&
pCreateInfo_host
,
NULL
,
(
VkSwapchainKHR
*
)
UlongToPtr
(
params
->
pSwapchain
));
free_conversion_context
(
ctx
);
return
STATUS_SUCCESS
;
...
...
@@ -41232,7 +41232,7 @@ static NTSTATUS thunk64_vkGetPhysicalDeviceSurfaceFormats2KHR(void *args)
TRACE
(
"%p, %p, %p, %p
\n
"
,
params
->
physicalDevice
,
params
->
pSurfaceInfo
,
params
->
pSurfaceFormatCount
,
params
->
pSurfaceFormats
);
convert_VkPhysicalDeviceSurfaceInfo2KHR_win64_to_
host
(
params
->
pSurfaceInfo
,
&
pSurfaceInfo_host
);
convert_VkPhysicalDeviceSurfaceInfo2KHR_win64_to_
driver
(
params
->
pSurfaceInfo
,
&
pSurfaceInfo_host
);
params
->
result
=
wine_phys_dev_from_handle
(
params
->
physicalDevice
)
->
instance
->
funcs
.
p_vkGetPhysicalDeviceSurfaceFormats2KHR
(
wine_phys_dev_from_handle
(
params
->
physicalDevice
)
->
host_physical_device
,
&
pSurfaceInfo_host
,
params
->
pSurfaceFormatCount
,
params
->
pSurfaceFormats
);
return
STATUS_SUCCESS
;
}
...
...
@@ -41256,7 +41256,7 @@ static NTSTATUS thunk32_vkGetPhysicalDeviceSurfaceFormats2KHR(void *args)
TRACE
(
"%#x, %#x, %#x, %#x
\n
"
,
params
->
physicalDevice
,
params
->
pSurfaceInfo
,
params
->
pSurfaceFormatCount
,
params
->
pSurfaceFormats
);
init_conversion_context
(
ctx
);
convert_VkPhysicalDeviceSurfaceInfo2KHR_win32_to_
host
(
ctx
,
(
const
VkPhysicalDeviceSurfaceInfo2KHR32
*
)
UlongToPtr
(
params
->
pSurfaceInfo
),
&
pSurfaceInfo_host
);
convert_VkPhysicalDeviceSurfaceInfo2KHR_win32_to_
driver
(
ctx
,
(
const
VkPhysicalDeviceSurfaceInfo2KHR32
*
)
UlongToPtr
(
params
->
pSurfaceInfo
),
&
pSurfaceInfo_host
);
pSurfaceFormats_host
=
convert_VkSurfaceFormat2KHR_array_win32_to_host
(
ctx
,
(
VkSurfaceFormat2KHR32
*
)
UlongToPtr
(
params
->
pSurfaceFormats
),
*
(
uint32_t
*
)
UlongToPtr
(
params
->
pSurfaceFormatCount
));
params
->
result
=
wine_phys_dev_from_handle
((
VkPhysicalDevice
)
UlongToPtr
(
params
->
physicalDevice
))
->
instance
->
funcs
.
p_vkGetPhysicalDeviceSurfaceFormats2KHR
(
wine_phys_dev_from_handle
((
VkPhysicalDevice
)
UlongToPtr
(
params
->
physicalDevice
))
->
host_physical_device
,
&
pSurfaceInfo_host
,
(
uint32_t
*
)
UlongToPtr
(
params
->
pSurfaceFormatCount
),
pSurfaceFormats_host
);
convert_VkSurfaceFormat2KHR_array_host_to_win32
(
pSurfaceFormats_host
,
(
VkSurfaceFormat2KHR32
*
)
UlongToPtr
(
params
->
pSurfaceFormats
),
*
(
uint32_t
*
)
UlongToPtr
(
params
->
pSurfaceFormatCount
));
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