Commit 965ab444 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Introduce a debug helper for Vulkan return values.

parent 0ee017f2
...@@ -240,7 +240,7 @@ static HRESULT adapter_vk_create_device(struct wined3d *wined3d, const struct wi ...@@ -240,7 +240,7 @@ static HRESULT adapter_vk_create_device(struct wined3d *wined3d, const struct wi
if ((vr = VK_CALL(vkCreateDevice(physical_device, &device_info, NULL, &vk_device))) < 0) if ((vr = VK_CALL(vkCreateDevice(physical_device, &device_info, NULL, &vk_device))) < 0)
{ {
WARN("Failed to create Vulkan device, vr %d.\n", vr); WARN("Failed to create Vulkan device, vr %s.\n", wined3d_debug_vkresult(vr));
vk_device = VK_NULL_HANDLE; vk_device = VK_NULL_HANDLE;
hr = hresult_from_vk_result(vr); hr = hresult_from_vk_result(vr);
goto fail; goto fail;
...@@ -455,7 +455,7 @@ static BOOL enable_vulkan_instance_extensions(uint32_t *extension_count, ...@@ -455,7 +455,7 @@ static BOOL enable_vulkan_instance_extensions(uint32_t *extension_count,
if ((vr = pfn_vkEnumerateInstanceExtensionProperties(NULL, &count, NULL)) < 0) if ((vr = pfn_vkEnumerateInstanceExtensionProperties(NULL, &count, NULL)) < 0)
{ {
WARN("Failed to count instance extensions, vr %d.\n", vr); WARN("Failed to count instance extensions, vr %s.\n", wined3d_debug_vkresult(vr));
goto done; goto done;
} }
if (!(extensions = heap_calloc(count, sizeof(*extensions)))) if (!(extensions = heap_calloc(count, sizeof(*extensions))))
...@@ -465,7 +465,7 @@ static BOOL enable_vulkan_instance_extensions(uint32_t *extension_count, ...@@ -465,7 +465,7 @@ static BOOL enable_vulkan_instance_extensions(uint32_t *extension_count,
} }
if ((vr = pfn_vkEnumerateInstanceExtensionProperties(NULL, &count, extensions)) < 0) if ((vr = pfn_vkEnumerateInstanceExtensionProperties(NULL, &count, extensions)) < 0)
{ {
WARN("Failed to enumerate extensions, vr %d.\n", vr); WARN("Failed to enumerate extensions, vr %s.\n", wined3d_debug_vkresult(vr));
goto done; goto done;
} }
...@@ -548,7 +548,7 @@ static BOOL wined3d_init_vulkan(struct wined3d_vk_info *vk_info) ...@@ -548,7 +548,7 @@ static BOOL wined3d_init_vulkan(struct wined3d_vk_info *vk_info)
if ((vr = VK_CALL(vkCreateInstance(&instance_info, NULL, &instance))) < 0) if ((vr = VK_CALL(vkCreateInstance(&instance_info, NULL, &instance))) < 0)
{ {
WARN("Failed to create Vulkan instance, vr %d.\n", vr); WARN("Failed to create Vulkan instance, vr %s.\n", wined3d_debug_vkresult(vr));
goto fail; goto fail;
} }
...@@ -596,7 +596,7 @@ static VkPhysicalDevice get_vulkan_physical_device(struct wined3d_vk_info *vk_in ...@@ -596,7 +596,7 @@ static VkPhysicalDevice get_vulkan_physical_device(struct wined3d_vk_info *vk_in
if ((vr = VK_CALL(vkEnumeratePhysicalDevices(vk_info->instance, &count, NULL))) < 0) if ((vr = VK_CALL(vkEnumeratePhysicalDevices(vk_info->instance, &count, NULL))) < 0)
{ {
WARN("Failed to enumerate physical devices, vr %d.\n", vr); WARN("Failed to enumerate physical devices, vr %s.\n", wined3d_debug_vkresult(vr));
return VK_NULL_HANDLE; return VK_NULL_HANDLE;
} }
if (!count) if (!count)
...@@ -613,7 +613,7 @@ static VkPhysicalDevice get_vulkan_physical_device(struct wined3d_vk_info *vk_in ...@@ -613,7 +613,7 @@ static VkPhysicalDevice get_vulkan_physical_device(struct wined3d_vk_info *vk_in
if ((vr = VK_CALL(vkEnumeratePhysicalDevices(vk_info->instance, &count, physical_devices))) < 0) if ((vr = VK_CALL(vkEnumeratePhysicalDevices(vk_info->instance, &count, physical_devices))) < 0)
{ {
WARN("Failed to get physical devices, vr %d.\n", vr); WARN("Failed to get physical devices, vr %s.\n", wined3d_debug_vkresult(vr));
return VK_NULL_HANDLE; return VK_NULL_HANDLE;
} }
......
...@@ -5261,6 +5261,45 @@ const char *debug_glerror(GLenum error) { ...@@ -5261,6 +5261,45 @@ const char *debug_glerror(GLenum error) {
} }
} }
const char *wined3d_debug_vkresult(VkResult vr)
{
switch (vr)
{
#define WINED3D_TO_STR(x) case x: return #x
WINED3D_TO_STR(VK_ERROR_INVALID_DEVICE_ADDRESS_EXT);
WINED3D_TO_STR(VK_ERROR_NOT_PERMITTED_EXT);
WINED3D_TO_STR(VK_ERROR_FRAGMENTATION_EXT);
WINED3D_TO_STR(VK_ERROR_INVALID_EXTERNAL_HANDLE);
WINED3D_TO_STR(VK_ERROR_OUT_OF_POOL_MEMORY);
WINED3D_TO_STR(VK_ERROR_INVALID_SHADER_NV);
WINED3D_TO_STR(VK_ERROR_OUT_OF_DATE_KHR);
WINED3D_TO_STR(VK_ERROR_NATIVE_WINDOW_IN_USE_KHR);
WINED3D_TO_STR(VK_ERROR_SURFACE_LOST_KHR);
WINED3D_TO_STR(VK_ERROR_FRAGMENTED_POOL);
WINED3D_TO_STR(VK_ERROR_FORMAT_NOT_SUPPORTED);
WINED3D_TO_STR(VK_ERROR_TOO_MANY_OBJECTS);
WINED3D_TO_STR(VK_ERROR_INCOMPATIBLE_DRIVER);
WINED3D_TO_STR(VK_ERROR_FEATURE_NOT_PRESENT);
WINED3D_TO_STR(VK_ERROR_EXTENSION_NOT_PRESENT);
WINED3D_TO_STR(VK_ERROR_LAYER_NOT_PRESENT);
WINED3D_TO_STR(VK_ERROR_MEMORY_MAP_FAILED);
WINED3D_TO_STR(VK_ERROR_DEVICE_LOST);
WINED3D_TO_STR(VK_ERROR_INITIALIZATION_FAILED);
WINED3D_TO_STR(VK_ERROR_OUT_OF_DEVICE_MEMORY);
WINED3D_TO_STR(VK_ERROR_OUT_OF_HOST_MEMORY);
WINED3D_TO_STR(VK_SUCCESS);
WINED3D_TO_STR(VK_NOT_READY);
WINED3D_TO_STR(VK_TIMEOUT);
WINED3D_TO_STR(VK_EVENT_SET);
WINED3D_TO_STR(VK_EVENT_RESET);
WINED3D_TO_STR(VK_INCOMPLETE);
WINED3D_TO_STR(VK_SUBOPTIMAL_KHR);
#undef WINED3D_TO_STR
default:
return wine_dbg_sprintf("unrecognised(%d)", vr);
}
}
static const char *debug_fixup_channel_source(enum fixup_channel_source source) static const char *debug_fixup_channel_source(enum fixup_channel_source source)
{ {
switch(source) switch(source)
......
...@@ -3222,6 +3222,7 @@ const char *wined3d_debug_resource_access(DWORD access) DECLSPEC_HIDDEN; ...@@ -3222,6 +3222,7 @@ const char *wined3d_debug_resource_access(DWORD access) DECLSPEC_HIDDEN;
const char *wined3d_debug_bind_flags(DWORD bind_flags) DECLSPEC_HIDDEN; const char *wined3d_debug_bind_flags(DWORD bind_flags) DECLSPEC_HIDDEN;
const char *wined3d_debug_view_desc(const struct wined3d_view_desc *d, const char *wined3d_debug_view_desc(const struct wined3d_view_desc *d,
const struct wined3d_resource *resource) DECLSPEC_HIDDEN; const struct wined3d_resource *resource) DECLSPEC_HIDDEN;
const char *wined3d_debug_vkresult(VkResult vr) DECLSPEC_HIDDEN;
static inline BOOL wined3d_resource_access_is_managed(unsigned int access) static inline BOOL wined3d_resource_access_is_managed(unsigned int access)
{ {
......
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