Commit fc8dcb53 authored by Georg Lehmann's avatar Georg Lehmann Committed by Alexandre Julliard

winevulkan: Return NULL for unavailable device functions.

parent 11cfbe5c
...@@ -147,9 +147,12 @@ PFN_vkVoidFunction WINAPI vkGetDeviceProcAddr(VkDevice device, const char *name) ...@@ -147,9 +147,12 @@ PFN_vkVoidFunction WINAPI vkGetDeviceProcAddr(VkDevice device, const char *name)
* vkCommandBuffer or vkQueue. * vkCommandBuffer or vkQueue.
* Loader takes care of filtering of extensions which are enabled or not. * Loader takes care of filtering of extensions which are enabled or not.
*/ */
func = wine_vk_get_device_proc_addr(name); if (unix_funcs->p_is_available_device_function(device, name))
if (func) {
return func; func = wine_vk_get_device_proc_addr(name);
if (func)
return func;
}
/* vkGetDeviceProcAddr was intended for loading device and subdevice functions. /* vkGetDeviceProcAddr was intended for loading device and subdevice functions.
* idTech 6 titles such as Doom and Wolfenstein II, however use it also for * idTech 6 titles such as Doom and Wolfenstein II, however use it also for
......
...@@ -422,6 +422,7 @@ struct unix_funcs ...@@ -422,6 +422,7 @@ struct unix_funcs
/* winevulkan specific functions */ /* winevulkan specific functions */
BOOL (WINAPI *p_is_available_instance_function)(VkInstance, const char *); BOOL (WINAPI *p_is_available_instance_function)(VkInstance, const char *);
BOOL (WINAPI *p_is_available_device_function)(VkDevice, const char *);
}; };
#endif /* __WINE_VULKAN_LOADER_THUNKS_H */ #endif /* __WINE_VULKAN_LOADER_THUNKS_H */
...@@ -2789,6 +2789,7 @@ class VkGenerator(object): ...@@ -2789,6 +2789,7 @@ class VkGenerator(object):
f.write(" &{1}{0},\n".format(vk_func.name, prefix)) f.write(" &{1}{0},\n".format(vk_func.name, prefix))
f.write(" &wine_vk_is_available_instance_function,\n") f.write(" &wine_vk_is_available_instance_function,\n")
f.write(" &wine_vk_is_available_device_function,\n")
f.write("};\n") f.write("};\n")
def generate_thunks_h(self, f, prefix): def generate_thunks_h(self, f, prefix):
...@@ -2992,6 +2993,7 @@ class VkGenerator(object): ...@@ -2992,6 +2993,7 @@ class VkGenerator(object):
f.write("\n") f.write("\n")
f.write(" /* winevulkan specific functions */\n") f.write(" /* winevulkan specific functions */\n")
f.write(" BOOL (WINAPI *p_is_available_instance_function)(VkInstance, const char *);\n") f.write(" BOOL (WINAPI *p_is_available_instance_function)(VkInstance, const char *);\n")
f.write(" BOOL (WINAPI *p_is_available_device_function)(VkDevice, const char *);\n")
f.write("};\n\n") f.write("};\n\n")
f.write("#endif /* __WINE_VULKAN_LOADER_THUNKS_H */\n") f.write("#endif /* __WINE_VULKAN_LOADER_THUNKS_H */\n")
......
...@@ -1610,3 +1610,8 @@ BOOL WINAPI wine_vk_is_available_instance_function(VkInstance instance, const ch ...@@ -1610,3 +1610,8 @@ BOOL WINAPI wine_vk_is_available_instance_function(VkInstance instance, const ch
{ {
return !!vk_funcs->p_vkGetInstanceProcAddr(instance->instance, name); return !!vk_funcs->p_vkGetInstanceProcAddr(instance->instance, name);
} }
BOOL WINAPI wine_vk_is_available_device_function(VkDevice device, const char *name)
{
return !!vk_funcs->p_vkGetDeviceProcAddr(device->device, name);
}
...@@ -213,5 +213,6 @@ uint64_t wine_vk_unwrap_handle(VkObjectType type, uint64_t handle) DECLSPEC_HIDD ...@@ -213,5 +213,6 @@ uint64_t wine_vk_unwrap_handle(VkObjectType type, uint64_t handle) DECLSPEC_HIDD
extern const struct unix_funcs loader_funcs; extern const struct unix_funcs loader_funcs;
BOOL WINAPI wine_vk_is_available_instance_function(VkInstance instance, const char *name) DECLSPEC_HIDDEN; BOOL WINAPI wine_vk_is_available_instance_function(VkInstance instance, const char *name) DECLSPEC_HIDDEN;
BOOL WINAPI wine_vk_is_available_device_function(VkDevice device, const char *name) DECLSPEC_HIDDEN;
#endif /* __WINE_VULKAN_PRIVATE_H */ #endif /* __WINE_VULKAN_PRIVATE_H */
...@@ -8720,4 +8720,5 @@ const struct unix_funcs loader_funcs = ...@@ -8720,4 +8720,5 @@ const struct unix_funcs loader_funcs =
&wine_vkWaitSemaphoresKHR, &wine_vkWaitSemaphoresKHR,
&wine_vkWriteAccelerationStructuresPropertiesKHR, &wine_vkWriteAccelerationStructuresPropertiesKHR,
&wine_vk_is_available_instance_function, &wine_vk_is_available_instance_function,
&wine_vk_is_available_device_function,
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment