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
e4e0ce2b
Commit
e4e0ce2b
authored
Feb 24, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winevulkan: Strip surface extensions in vkEnumerateInstanceExtensionProperties.
parent
11949950
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
4 deletions
+68
-4
make_vulkan
dlls/winevulkan/make_vulkan
+28
-0
vulkan.c
dlls/winevulkan/vulkan.c
+11
-4
vulkan_private.h
dlls/winevulkan/vulkan_private.h
+1
-0
vulkan_thunks.c
dlls/winevulkan/vulkan_thunks.c
+28
-0
No files found.
dlls/winevulkan/make_vulkan
View file @
e4e0ce2b
...
...
@@ -144,6 +144,12 @@ CORE_EXTENSIONS = [
"VK_KHR_win32_surface"
,
]
# List of surface extensions that can be exposed directly to the PE side
WIN_SURFACE_EXTENSIONS
=
[
"VK_KHR_win32_surface"
,
"VK_EXT_headless_surface"
,
]
# Some experimental extensions are used by shipping applications so their API is extremely unlikely
# to change in a backwards-incompatible way. Allow translation of those extensions with WineVulkan.
ALLOWED_X_EXTENSIONS
=
[
...
...
@@ -2771,6 +2777,13 @@ class VkGenerator(object):
f
.
write
(
"
\"
{0}
\"
,
\n
"
.
format
(
ext
[
"name"
]))
f
.
write
(
"};
\n\n
"
)
# Create array of surface extensions.
f
.
write
(
"static const char * const vk_host_surface_extensions[] =
\n
{
\n
"
)
for
ext
in
self
.
registry
.
surface_extensions
:
if
ext
[
"name"
]
not
in
WIN_SURFACE_EXTENSIONS
:
f
.
write
(
"
\"
{0}
\"
,
\n
"
.
format
(
ext
[
"name"
]))
f
.
write
(
"};
\n\n
"
)
f
.
write
(
"BOOL wine_vk_device_extension_supported(const char *name)
\n
"
)
f
.
write
(
"{
\n
"
)
f
.
write
(
" unsigned int i;
\n
"
)
...
...
@@ -2793,6 +2806,17 @@ class VkGenerator(object):
f
.
write
(
" return FALSE;
\n
"
)
f
.
write
(
"}
\n\n
"
)
f
.
write
(
"BOOL wine_vk_is_host_surface_extension(const char *name)
\n
"
)
f
.
write
(
"{
\n
"
)
f
.
write
(
" unsigned int i;
\n
"
)
f
.
write
(
" for (i = 0; i < ARRAY_SIZE(vk_host_surface_extensions); i++)
\n
"
)
f
.
write
(
" {
\n
"
)
f
.
write
(
" if (strcmp(vk_host_surface_extensions[i], name) == 0)
\n
"
)
f
.
write
(
" return TRUE;
\n
"
)
f
.
write
(
" }
\n
"
)
f
.
write
(
" return FALSE;
\n
"
)
f
.
write
(
"}
\n\n
"
)
f
.
write
(
"BOOL wine_vk_is_type_wrapped(VkObjectType type)
\n
"
)
f
.
write
(
"{
\n
"
)
f
.
write
(
" return FALSE"
)
...
...
@@ -3194,6 +3218,7 @@ class VkRegistry(object):
# We aggregate all types in here for cross-referencing.
self
.
funcs
=
{}
self
.
types
=
{}
self
.
surface_extensions
=
[]
self
.
version_regex
=
re
.
compile
(
r'^'
...
...
@@ -3471,6 +3496,9 @@ class VkRegistry(object):
def
process_ext
(
ext
,
deferred
=
False
):
ext_name
=
ext
.
attrib
[
"name"
]
if
ext_name
.
endswith
(
'_surface'
)
and
ext
.
attrib
.
get
(
'depends'
,
None
)
==
'VK_KHR_surface'
:
self
.
surface_extensions
.
append
({
"name"
:
ext_name
})
# Set extension name on any functions calls part of this extension as we
# were not aware of the name during initial parsing.
commands
=
ext
.
findall
(
"require/command"
)
...
...
dlls/winevulkan/vulkan.c
View file @
e4e0ce2b
...
...
@@ -1003,7 +1003,7 @@ VkResult wine_vkEnumerateInstanceExtensionProperties(const char *name, uint32_t
{
uint32_t
num_properties
=
0
,
num_host_properties
;
VkExtensionProperties
*
host_properties
;
unsigned
int
i
,
j
;
unsigned
int
i
,
j
,
surface
;
VkResult
res
;
res
=
vk_funcs
->
p_vkEnumerateInstanceExtensionProperties
(
NULL
,
&
num_host_properties
,
NULL
);
...
...
@@ -1025,9 +1025,10 @@ VkResult wine_vkEnumerateInstanceExtensionProperties(const char *name, uint32_t
* including extension fixup (e.g. VK_KHR_xlib_surface -> VK_KHR_win32_surface). It is
* up to us here to filter the list down to extensions for which we have thunks.
*/
for
(
i
=
0
;
i
<
num_host_properties
;
i
++
)
for
(
i
=
0
,
surface
=
0
;
i
<
num_host_properties
;
i
++
)
{
if
(
wine_vk_instance_extension_supported
(
host_properties
[
i
].
extensionName
))
if
(
wine_vk_instance_extension_supported
(
host_properties
[
i
].
extensionName
)
||
(
wine_vk_is_host_surface_extension
(
host_properties
[
i
].
extensionName
)
&&
!
surface
++
))
num_properties
++
;
else
TRACE
(
"Instance extension '%s' is not supported.
\n
"
,
host_properties
[
i
].
extensionName
);
...
...
@@ -1041,13 +1042,19 @@ VkResult wine_vkEnumerateInstanceExtensionProperties(const char *name, uint32_t
return
VK_SUCCESS
;
}
for
(
i
=
0
,
j
=
0
;
i
<
num_host_properties
&&
j
<
*
count
;
i
++
)
for
(
i
=
0
,
j
=
0
,
surface
=
0
;
i
<
num_host_properties
&&
j
<
*
count
;
i
++
)
{
if
(
wine_vk_instance_extension_supported
(
host_properties
[
i
].
extensionName
))
{
TRACE
(
"Enabling extension '%s'.
\n
"
,
host_properties
[
i
].
extensionName
);
properties
[
j
++
]
=
host_properties
[
i
];
}
else
if
(
wine_vk_is_host_surface_extension
(
host_properties
[
i
].
extensionName
)
&&
!
surface
++
)
{
VkExtensionProperties
win32_surface
=
{
VK_KHR_WIN32_SURFACE_EXTENSION_NAME
,
VK_KHR_WIN32_SURFACE_SPEC_VERSION
};
TRACE
(
"Enabling VK_KHR_win32_surface.
\n
"
);
properties
[
j
++
]
=
win32_surface
;
}
}
*
count
=
min
(
*
count
,
num_properties
);
...
...
dlls/winevulkan/vulkan_private.h
View file @
e4e0ce2b
...
...
@@ -270,6 +270,7 @@ static inline VkSwapchainKHR wine_swapchain_to_handle(struct wine_swapchain *sur
BOOL
wine_vk_device_extension_supported
(
const
char
*
name
);
BOOL
wine_vk_instance_extension_supported
(
const
char
*
name
);
BOOL
wine_vk_is_host_surface_extension
(
const
char
*
name
);
BOOL
wine_vk_is_type_wrapped
(
VkObjectType
type
);
...
...
dlls/winevulkan/vulkan_thunks.c
View file @
e4e0ce2b
...
...
@@ -46749,6 +46749,23 @@ static const char * const vk_instance_extensions[] =
"VK_KHR_win32_surface"
,
};
static
const
char
*
const
vk_host_surface_extensions
[]
=
{
"VK_KHR_xlib_surface"
,
"VK_KHR_xcb_surface"
,
"VK_KHR_wayland_surface"
,
"VK_KHR_mir_surface"
,
"VK_KHR_android_surface"
,
"VK_GGP_stream_descriptor_surface"
,
"VK_NN_vi_surface"
,
"VK_MVK_ios_surface"
,
"VK_MVK_macos_surface"
,
"VK_FUCHSIA_imagepipe_surface"
,
"VK_EXT_metal_surface"
,
"VK_EXT_directfb_surface"
,
"VK_QNX_screen_surface"
,
};
BOOL
wine_vk_device_extension_supported
(
const
char
*
name
)
{
unsigned
int
i
;
...
...
@@ -46771,6 +46788,17 @@ BOOL wine_vk_instance_extension_supported(const char *name)
return
FALSE
;
}
BOOL
wine_vk_is_host_surface_extension
(
const
char
*
name
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
vk_host_surface_extensions
);
i
++
)
{
if
(
strcmp
(
vk_host_surface_extensions
[
i
],
name
)
==
0
)
return
TRUE
;
}
return
FALSE
;
}
BOOL
wine_vk_is_type_wrapped
(
VkObjectType
type
)
{
return
FALSE
||
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