Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
cc3c23c3
Commit
cc3c23c3
authored
Apr 14, 2021
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winevulkan: Move wine_vk_init to loader.c.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2d3309d8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
47 deletions
+81
-47
loader.c
dlls/winevulkan/loader.c
+67
-0
vulkan.c
dlls/winevulkan/vulkan.c
+6
-47
vulkan_private.h
dlls/winevulkan/vulkan_private.h
+8
-0
No files found.
dlls/winevulkan/loader.c
View file @
cc3c23c3
...
...
@@ -206,6 +206,73 @@ VkResult WINAPI wine_vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *supporte
return
VK_SUCCESS
;
}
static
BOOL
WINAPI
wine_vk_init
(
INIT_ONCE
*
once
,
void
*
param
,
void
**
context
)
{
const
struct
vulkan_funcs
*
driver
;
HDC
hdc
;
hdc
=
GetDC
(
0
);
driver
=
__wine_get_vulkan_driver
(
hdc
,
WINE_VULKAN_DRIVER_VERSION
);
ReleaseDC
(
0
,
hdc
);
if
(
!
driver
)
ERR
(
"Failed to load Wine graphics driver supporting Vulkan.
\n
"
);
else
unix_vk_init
(
driver
);
return
driver
!=
NULL
;
}
static
BOOL
wine_vk_init_once
(
void
)
{
static
INIT_ONCE
init_once
=
INIT_ONCE_STATIC_INIT
;
return
InitOnceExecuteOnce
(
&
init_once
,
wine_vk_init
,
NULL
,
NULL
);
}
VkResult
WINAPI
wine_vkCreateInstance
(
const
VkInstanceCreateInfo
*
create_info
,
const
VkAllocationCallbacks
*
allocator
,
VkInstance
*
instance
)
{
TRACE
(
"create_info %p, allocator %p, instance %p
\n
"
,
create_info
,
allocator
,
instance
);
if
(
!
wine_vk_init_once
())
return
VK_ERROR_INITIALIZATION_FAILED
;
return
unix_vkCreateInstance
(
create_info
,
allocator
,
instance
);
}
VkResult
WINAPI
wine_vkEnumerateInstanceExtensionProperties
(
const
char
*
layer_name
,
uint32_t
*
count
,
VkExtensionProperties
*
properties
)
{
TRACE
(
"%p, %p, %p
\n
"
,
layer_name
,
count
,
properties
);
if
(
layer_name
)
{
WARN
(
"Layer enumeration not supported from ICD.
\n
"
);
return
VK_ERROR_LAYER_NOT_PRESENT
;
}
if
(
!
wine_vk_init_once
())
{
*
count
=
0
;
return
VK_SUCCESS
;
}
return
unix_vkEnumerateInstanceExtensionProperties
(
layer_name
,
count
,
properties
);
}
VkResult
WINAPI
wine_vkEnumerateInstanceVersion
(
uint32_t
*
version
)
{
TRACE
(
"%p
\n
"
,
version
);
if
(
!
wine_vk_init_once
())
{
*
version
=
VK_API_VERSION_1_0
;
return
VK_SUCCESS
;
}
return
unix_vkEnumerateInstanceVersion
(
version
);
}
static
HANDLE
get_display_device_init_mutex
(
void
)
{
static
const
WCHAR
init_mutexW
[]
=
{
'd'
,
'i'
,
's'
,
'p'
,
'l'
,
'a'
,
'y'
,
'_'
,
'd'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
'_'
,
'i'
,
'n'
,
'i'
,
't'
,
0
};
...
...
dlls/winevulkan/vulkan.c
View file @
cc3c23c3
...
...
@@ -450,26 +450,10 @@ static void wine_vk_device_free(struct VkDevice_T *device)
free
(
device
);
}
static
BOOL
WINAPI
wine_vk_init
(
INIT_ONCE
*
once
,
void
*
param
,
void
**
context
)
void
unix_vk_init
(
const
struct
vulkan_funcs
*
driver
)
{
HDC
hdc
;
hdc
=
GetDC
(
0
);
vk_funcs
=
__wine_get_vulkan_driver
(
hdc
,
WINE_VULKAN_DRIVER_VERSION
);
ReleaseDC
(
0
,
hdc
);
if
(
!
vk_funcs
)
ERR
(
"Failed to load Wine graphics driver supporting Vulkan.
\n
"
);
else
p_vkEnumerateInstanceVersion
=
vk_funcs
->
p_vkGetInstanceProcAddr
(
NULL
,
"vkEnumerateInstanceVersion"
);
return
TRUE
;
}
static
void
wine_vk_init_once
(
void
)
{
static
INIT_ONCE
init_once
=
INIT_ONCE_STATIC_INIT
;
InitOnceExecuteOnce
(
&
init_once
,
wine_vk_init
,
NULL
,
NULL
);
vk_funcs
=
driver
;
p_vkEnumerateInstanceVersion
=
vk_funcs
->
p_vkGetInstanceProcAddr
(
NULL
,
"vkEnumerateInstanceVersion"
);
}
/* Helper function for converting between win32 and host compatible VkInstanceCreateInfo.
...
...
@@ -845,7 +829,7 @@ fail:
return
res
;
}
VkResult
WINAPI
wine
_vkCreateInstance
(
const
VkInstanceCreateInfo
*
create_info
,
VkResult
WINAPI
unix
_vkCreateInstance
(
const
VkInstanceCreateInfo
*
create_info
,
const
VkAllocationCallbacks
*
allocator
,
VkInstance
*
instance
)
{
VkInstanceCreateInfo
create_info_host
;
...
...
@@ -853,12 +837,6 @@ VkResult WINAPI wine_vkCreateInstance(const VkInstanceCreateInfo *create_info,
struct
VkInstance_T
*
object
;
VkResult
res
;
TRACE
(
"create_info %p, allocator %p, instance %p
\n
"
,
create_info
,
allocator
,
instance
);
wine_vk_init_once
();
if
(
!
vk_funcs
)
return
VK_ERROR_INITIALIZATION_FAILED
;
if
(
allocator
)
FIXME
(
"Support for allocation callbacks not implemented yet
\n
"
);
...
...
@@ -975,7 +953,7 @@ VkResult WINAPI wine_vkEnumerateDeviceExtensionProperties(VkPhysicalDevice phys_
return
*
count
<
phys_dev
->
extension_count
?
VK_INCOMPLETE
:
VK_SUCCESS
;
}
VkResult
WINAPI
wine
_vkEnumerateInstanceExtensionProperties
(
const
char
*
layer_name
,
VkResult
WINAPI
unix
_vkEnumerateInstanceExtensionProperties
(
const
char
*
layer_name
,
uint32_t
*
count
,
VkExtensionProperties
*
properties
)
{
uint32_t
num_properties
=
0
,
num_host_properties
;
...
...
@@ -983,21 +961,6 @@ VkResult WINAPI wine_vkEnumerateInstanceExtensionProperties(const char *layer_na
unsigned
int
i
,
j
;
VkResult
res
;
TRACE
(
"%p, %p, %p
\n
"
,
layer_name
,
count
,
properties
);
if
(
layer_name
)
{
WARN
(
"Layer enumeration not supported from ICD.
\n
"
);
return
VK_ERROR_LAYER_NOT_PRESENT
;
}
wine_vk_init_once
();
if
(
!
vk_funcs
)
{
*
count
=
0
;
return
VK_SUCCESS
;
}
res
=
vk_funcs
->
p_vkEnumerateInstanceExtensionProperties
(
NULL
,
&
num_host_properties
,
NULL
);
if
(
res
!=
VK_SUCCESS
)
return
res
;
...
...
@@ -1055,14 +1018,10 @@ VkResult WINAPI wine_vkEnumerateDeviceLayerProperties(VkPhysicalDevice phys_dev,
return
VK_SUCCESS
;
}
VkResult
WINAPI
wine
_vkEnumerateInstanceVersion
(
uint32_t
*
version
)
VkResult
WINAPI
unix
_vkEnumerateInstanceVersion
(
uint32_t
*
version
)
{
VkResult
res
;
TRACE
(
"%p
\n
"
,
version
);
wine_vk_init_once
();
if
(
p_vkEnumerateInstanceVersion
)
{
res
=
p_vkEnumerateInstanceVersion
(
version
);
...
...
dlls/winevulkan/vulkan_private.h
View file @
cc3c23c3
...
...
@@ -243,4 +243,12 @@ BOOL wine_vk_instance_extension_supported(const char *name) DECLSPEC_HIDDEN;
BOOL
wine_vk_is_type_wrapped
(
VkObjectType
type
)
DECLSPEC_HIDDEN
;
uint64_t
wine_vk_unwrap_handle
(
VkObjectType
type
,
uint64_t
handle
)
DECLSPEC_HIDDEN
;
void
unix_vk_init
(
const
struct
vulkan_funcs
*
driver
)
DECLSPEC_HIDDEN
;
VkResult
WINAPI
unix_vkCreateInstance
(
const
VkInstanceCreateInfo
*
create_info
,
const
VkAllocationCallbacks
*
allocator
,
VkInstance
*
instance
)
DECLSPEC_HIDDEN
;
VkResult
WINAPI
unix_vkEnumerateInstanceExtensionProperties
(
const
char
*
layer_name
,
uint32_t
*
count
,
VkExtensionProperties
*
properties
)
DECLSPEC_HIDDEN
;
VkResult
WINAPI
unix_vkEnumerateInstanceVersion
(
uint32_t
*
version
)
DECLSPEC_HIDDEN
;
#endif
/* __WINE_VULKAN_PRIVATE_H */
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