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
9a7a2ab2
Commit
9a7a2ab2
authored
Aug 31, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winevulkan: Separate PE and Unix VkInstance structs.
parent
59d13f3d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
77 additions
and
51 deletions
+77
-51
loader.c
dlls/winevulkan/loader.c
+24
-5
loader_thunks.c
dlls/winevulkan/loader_thunks.c
+0
-8
loader_thunks.h
dlls/winevulkan/loader_thunks.h
+1
-0
make_vulkan
dlls/winevulkan/make_vulkan
+5
-5
vulkan.c
dlls/winevulkan/vulkan.c
+27
-24
vulkan_loader.h
dlls/winevulkan/vulkan_loader.h
+5
-0
vulkan_private.h
dlls/winevulkan/vulkan_private.h
+11
-5
vulkan_thunks.c
dlls/winevulkan/vulkan_thunks.c
+4
-4
No files found.
dlls/winevulkan/loader.c
View file @
9a7a2ab2
...
...
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdlib.h>
#include "vulkan_loader.h"
#include "winreg.h"
#include "ntuser.h"
...
...
@@ -251,19 +252,37 @@ static BOOL wine_vk_init_once(void)
}
VkResult
WINAPI
vkCreateInstance
(
const
VkInstanceCreateInfo
*
create_info
,
const
VkAllocationCallbacks
*
allocator
,
VkInstance
*
instance
)
const
VkAllocationCallbacks
*
allocator
,
VkInstance
*
ret
)
{
struct
vkCreateInstance_params
params
;
struct
VkInstance_T
*
instance
;
VkResult
result
;
TRACE
(
"create_info %p, allocator %p, instance %p
\n
"
,
create_info
,
allocator
,
instance
);
TRACE
(
"create_info %p, allocator %p, instance %p
\n
"
,
create_info
,
allocator
,
ret
);
if
(
!
wine_vk_init_once
())
if
(
!
wine_vk_init_once
())
return
VK_ERROR_INITIALIZATION_FAILED
;
if
(
!
(
instance
=
alloc_vk_object
(
sizeof
(
*
instance
))))
return
VK_ERROR_OUT_OF_HOST_MEMORY
;
params
.
pCreateInfo
=
create_info
;
params
.
pAllocator
=
allocator
;
params
.
pInstance
=
instance
;
return
vk_unix_call
(
unix_vkCreateInstance
,
&
params
);
params
.
pInstance
=
ret
;
params
.
client_ptr
=
instance
;
result
=
vk_unix_call
(
unix_vkCreateInstance
,
&
params
);
if
(
!
instance
->
base
.
unix_handle
)
free
(
instance
);
return
result
;
}
void
WINAPI
vkDestroyInstance
(
VkInstance
instance
,
const
VkAllocationCallbacks
*
pAllocator
)
{
struct
vkDestroyInstance_params
params
;
params
.
instance
=
instance
;
params
.
pAllocator
=
pAllocator
;
vk_unix_call
(
unix_vkDestroyInstance
,
&
params
);
free
(
instance
);
}
VkResult
WINAPI
vkEnumerateInstanceExtensionProperties
(
const
char
*
layer_name
,
...
...
dlls/winevulkan/loader_thunks.c
View file @
9a7a2ab2
...
...
@@ -2585,14 +2585,6 @@ void WINAPI vkDestroyIndirectCommandsLayoutNV(VkDevice device, VkIndirectCommand
vk_unix_call
(
unix_vkDestroyIndirectCommandsLayoutNV
,
&
params
);
}
void
WINAPI
vkDestroyInstance
(
VkInstance
instance
,
const
VkAllocationCallbacks
*
pAllocator
)
{
struct
vkDestroyInstance_params
params
;
params
.
instance
=
instance
;
params
.
pAllocator
=
pAllocator
;
vk_unix_call
(
unix_vkDestroyInstance
,
&
params
);
}
void
WINAPI
vkDestroyPipeline
(
VkDevice
device
,
VkPipeline
pipeline
,
const
VkAllocationCallbacks
*
pAllocator
)
{
struct
vkDestroyPipeline_params
params
;
...
...
dlls/winevulkan/loader_thunks.h
View file @
9a7a2ab2
...
...
@@ -2221,6 +2221,7 @@ struct vkCreateInstance_params
const
VkInstanceCreateInfo
*
pCreateInfo
;
const
VkAllocationCallbacks
*
pAllocator
;
VkInstance
*
pInstance
;
void
*
client_ptr
;
};
struct
vkCreatePipelineCache_params
...
...
dlls/winevulkan/make_vulkan
View file @
9a7a2ab2
...
...
@@ -179,7 +179,7 @@ class ThunkType(Enum):
# - loader_thunk sets whether to create a thunk for unix funcs.
FUNCTION_OVERRIDES
=
{
# Global functions
"vkCreateInstance"
:
{
"dispatch"
:
False
,
"driver"
:
True
,
"thunk"
:
ThunkType
.
NONE
,
"loader_thunk"
:
ThunkType
.
PRIVATE
},
"vkCreateInstance"
:
{
"dispatch"
:
False
,
"driver"
:
True
,
"thunk"
:
ThunkType
.
NONE
,
"loader_thunk"
:
ThunkType
.
PRIVATE
,
"extra_param"
:
"client_ptr"
},
"vkEnumerateInstanceExtensionProperties"
:
{
"dispatch"
:
False
,
"driver"
:
True
,
"thunk"
:
ThunkType
.
NONE
,
"loader_thunk"
:
ThunkType
.
PRIVATE
},
"vkEnumerateInstanceLayerProperties"
:
{
"dispatch"
:
False
,
"driver"
:
False
,
"thunk"
:
ThunkType
.
NONE
,
"loader_thunk"
:
ThunkType
.
NONE
},
"vkEnumerateInstanceVersion"
:
{
"dispatch"
:
False
,
"driver"
:
False
,
"thunk"
:
ThunkType
.
NONE
,
"loader_thunk"
:
ThunkType
.
PRIVATE
},
...
...
@@ -187,7 +187,7 @@ FUNCTION_OVERRIDES = {
# Instance functions
"vkCreateDevice"
:
{
"dispatch"
:
True
,
"driver"
:
False
,
"thunk"
:
ThunkType
.
NONE
,
"loader_thunk"
:
ThunkType
.
PRIVATE
,
"extra_param"
:
"client_ptr"
},
"vkDestroyInstance"
:
{
"dispatch"
:
False
,
"driver"
:
True
,
"thunk"
:
ThunkType
.
NONE
},
"vkDestroyInstance"
:
{
"dispatch"
:
False
,
"driver"
:
True
,
"thunk"
:
ThunkType
.
NONE
,
"loader_thunk"
:
ThunkType
.
PRIVATE
},
"vkEnumerateDeviceExtensionProperties"
:
{
"dispatch"
:
True
,
"driver"
:
False
,
"thunk"
:
ThunkType
.
NONE
},
"vkEnumerateDeviceLayerProperties"
:
{
"dispatch"
:
True
,
"driver"
:
False
,
"thunk"
:
ThunkType
.
NONE
},
"vkEnumeratePhysicalDeviceGroups"
:
{
"dispatch"
:
True
,
"driver"
:
False
,
"thunk"
:
ThunkType
.
NONE
},
...
...
@@ -1060,7 +1060,7 @@ class VkHandle(object):
if
self
.
parent
is
None
:
# Should only happen for VkInstance
return
"
{0}
->funcs"
.
format
(
param
)
return
"
wine_instance_from_handle({0})
->funcs"
.
format
(
param
)
elif
self
.
name
==
"VkDevice"
:
return
"wine_device_from_handle({0})->funcs"
.
format
(
param
)
elif
self
.
name
==
"VkQueue"
:
...
...
@@ -1104,6 +1104,8 @@ class VkHandle(object):
return
"wine_debug_report_callback_from_handle({0})->debug_callback"
.
format
(
name
)
if
self
.
name
==
"VkDevice"
:
return
"wine_device_from_handle({0})->device"
.
format
(
name
)
if
self
.
name
==
"VkInstance"
:
return
"wine_instance_from_handle({0})->instance"
.
format
(
name
)
if
self
.
name
==
"VkQueue"
:
return
"wine_queue_from_handle({0})->queue"
.
format
(
name
)
if
self
.
name
==
"VkSurfaceKHR"
:
...
...
@@ -1113,8 +1115,6 @@ class VkHandle(object):
if
self
.
name
==
"VkCommandBuffer"
:
native_handle_name
=
"command_buffer"
if
self
.
name
==
"VkInstance"
:
native_handle_name
=
"instance"
if
self
.
name
==
"VkPhysicalDevice"
:
native_handle_name
=
"phys_dev"
...
...
dlls/winevulkan/vulkan.c
View file @
9a7a2ab2
This diff is collapsed.
Click to expand it.
dlls/winevulkan/vulkan_loader.h
View file @
9a7a2ab2
...
...
@@ -54,6 +54,11 @@ struct wine_vk_base
UINT64
unix_handle
;
};
struct
VkInstance_T
{
struct
wine_vk_base
base
;
};
struct
VkQueue_T
{
struct
wine_vk_base
base
;
...
...
dlls/winevulkan/vulkan_private.h
View file @
9a7a2ab2
...
...
@@ -76,7 +76,7 @@ struct wine_debug_utils_messenger;
struct
wine_debug_report_callback
{
struct
VkInstance_T
*
instance
;
/* parent */
struct
wine_instance
*
instance
;
/* parent */
VkDebugReportCallbackEXT
debug_callback
;
/* native callback object */
/* application callback + data */
...
...
@@ -86,10 +86,11 @@ struct wine_debug_report_callback
struct
wine_vk_mapping
mapping
;
};
struct
VkInstance_T
struct
wine_instance
{
struct
wine_vk_base
base
;
struct
vulkan_instance_funcs
funcs
;
VkInstance
handle
;
/* client instance */
VkInstance
instance
;
/* native instance */
/* We cache devices as we need to wrap them as they are
...
...
@@ -112,10 +113,15 @@ struct VkInstance_T
struct
wine_vk_mapping
mapping
;
};
static
inline
struct
wine_instance
*
wine_instance_from_handle
(
VkInstance
handle
)
{
return
(
struct
wine_instance
*
)(
uintptr_t
)
handle
->
base
.
unix_handle
;
}
struct
VkPhysicalDevice_T
{
struct
wine_vk_base
base
;
struct
VkInstance_T
*
instance
;
/* parent */
struct
wine_instance
*
instance
;
/* parent */
VkPhysicalDevice
phys_dev
;
/* native physical device */
VkExtensionProperties
*
extensions
;
...
...
@@ -164,7 +170,7 @@ static inline VkCommandPool wine_cmd_pool_to_handle(struct wine_cmd_pool *cmd_po
struct
wine_debug_utils_messenger
{
struct
VkInstance_T
*
instance
;
/* parent */
struct
wine_instance
*
instance
;
/* parent */
VkDebugUtilsMessengerEXT
debug_messenger
;
/* native messenger */
/* application callback + data */
...
...
dlls/winevulkan/vulkan_thunks.c
View file @
9a7a2ab2
...
...
@@ -7937,7 +7937,7 @@ static NTSTATUS wine_vkDebugReportMessageEXT(void *args)
{
struct
vkDebugReportMessageEXT_params
*
params
=
args
;
TRACE
(
"%p, %#x, %#x, 0x%s, 0x%s, %d, %p, %p
\n
"
,
params
->
instance
,
params
->
flags
,
params
->
objectType
,
wine_dbgstr_longlong
(
params
->
object
),
wine_dbgstr_longlong
(
params
->
location
),
params
->
messageCode
,
params
->
pLayerPrefix
,
params
->
pMessage
);
params
->
instance
->
funcs
.
p_vkDebugReportMessageEXT
(
params
->
instance
->
instance
,
params
->
flags
,
params
->
objectType
,
wine_vk_unwrap_handle
(
params
->
objectType
,
params
->
object
),
params
->
location
,
params
->
messageCode
,
params
->
pLayerPrefix
,
params
->
pMessage
);
wine_instance_from_handle
(
params
->
instance
)
->
funcs
.
p_vkDebugReportMessageEXT
(
wine_instance_from_handle
(
params
->
instance
)
->
instance
,
params
->
flags
,
params
->
objectType
,
wine_vk_unwrap_handle
(
params
->
objectType
,
params
->
object
),
params
->
location
,
params
->
messageCode
,
params
->
pLayerPrefix
,
params
->
pMessage
);
return
STATUS_SUCCESS
;
}
...
...
@@ -9922,7 +9922,7 @@ static NTSTATUS wine_vkSubmitDebugUtilsMessageEXT(void *args)
TRACE
(
"%p, %#x, %#x, %p
\n
"
,
params
->
instance
,
params
->
messageSeverity
,
params
->
messageTypes
,
params
->
pCallbackData
);
convert_VkDebugUtilsMessengerCallbackDataEXT_win_to_host
(
params
->
pCallbackData
,
&
pCallbackData_host
);
params
->
instance
->
funcs
.
p_vkSubmitDebugUtilsMessageEXT
(
params
->
instance
->
instance
,
params
->
messageSeverity
,
params
->
messageTypes
,
&
pCallbackData_host
);
wine_instance_from_handle
(
params
->
instance
)
->
funcs
.
p_vkSubmitDebugUtilsMessageEXT
(
wine_instance_from_handle
(
params
->
instance
)
->
instance
,
params
->
messageSeverity
,
params
->
messageTypes
,
&
pCallbackData_host
);
free_VkDebugUtilsMessengerCallbackDataEXT
(
&
pCallbackData_host
);
return
STATUS_SUCCESS
;
...
...
@@ -9931,7 +9931,7 @@ static NTSTATUS wine_vkSubmitDebugUtilsMessageEXT(void *args)
TRACE
(
"%p, %#x, %#x, %p
\n
"
,
params
->
instance
,
params
->
messageSeverity
,
params
->
messageTypes
,
params
->
pCallbackData
);
convert_VkDebugUtilsMessengerCallbackDataEXT_win_to_host
(
params
->
pCallbackData
,
&
pCallbackData_host
);
params
->
instance
->
funcs
.
p_vkSubmitDebugUtilsMessageEXT
(
params
->
instance
->
instance
,
params
->
messageSeverity
,
params
->
messageTypes
,
&
pCallbackData_host
);
wine_instance_from_handle
(
params
->
instance
)
->
funcs
.
p_vkSubmitDebugUtilsMessageEXT
(
wine_instance_from_handle
(
params
->
instance
)
->
instance
,
params
->
messageSeverity
,
params
->
messageTypes
,
&
pCallbackData_host
);
free_VkDebugUtilsMessengerCallbackDataEXT
(
&
pCallbackData_host
);
return
STATUS_SUCCESS
;
...
...
@@ -10337,7 +10337,7 @@ uint64_t wine_vk_unwrap_handle(VkObjectType type, uint64_t handle)
case
VK_OBJECT_TYPE_DEVICE
:
return
(
uint64_t
)
(
uintptr_t
)
wine_device_from_handle
(((
VkDevice
)
(
uintptr_t
)
handle
))
->
device
;
case
VK_OBJECT_TYPE_INSTANCE
:
return
(
uint64_t
)
(
uintptr_t
)
((
VkInstance
)
(
uintptr_t
)
handle
)
->
instance
;
return
(
uint64_t
)
(
uintptr_t
)
wine_instance_from_handle
(((
VkInstance
)
(
uintptr_t
)
handle
)
)
->
instance
;
case
VK_OBJECT_TYPE_PHYSICAL_DEVICE
:
return
(
uint64_t
)
(
uintptr_t
)
((
VkPhysicalDevice
)
(
uintptr_t
)
handle
)
->
phys_dev
;
case
VK_OBJECT_TYPE_QUEUE
:
...
...
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