summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2018-01-09 03:35:53 +0100
committerBas Nieuwenhuizen <[email protected]>2018-01-17 11:29:04 +0100
commit0b8991c0b609831cdcb255cc5e9c516657dc8703 (patch)
treefea4d108caa16fbd0783f0b84bbd614382d52dbb /src/amd
parente5b1bd6ab8f5c1d9bf6a90b7003dc336cbe3cf93 (diff)
radv: Implement VK_EXT_debug_report.
This is not hooked up to any messages yet, but useful for e.g. renderdoc if you add some messages during development. Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/vulkan/radv_device.c46
-rw-r--r--src/amd/vulkan/radv_extensions.py1
-rw-r--r--src/amd/vulkan/radv_private.h3
3 files changed, 50 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 55ffebb20ac..1d838afa3e6 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -385,6 +385,7 @@ VkResult radv_CreateInstance(
VkInstance* pInstance)
{
struct radv_instance *instance;
+ VkResult result;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO);
@@ -426,6 +427,12 @@ VkResult radv_CreateInstance(
instance->apiVersion = client_version;
instance->physicalDeviceCount = -1;
+ result = vk_debug_report_instance_init(&instance->debug_report_callbacks);
+ if (result != VK_SUCCESS) {
+ vk_free2(&default_alloc, pAllocator, instance);
+ return vk_error(result);
+ }
+
_mesa_locale_init();
VG(VALGRIND_CREATE_MEMPOOL(instance, 0, false));
@@ -468,6 +475,8 @@ void radv_DestroyInstance(
_mesa_locale_fini();
+ vk_debug_report_instance_destroy(&instance->debug_report_callbacks);
+
vk_free(&instance->alloc, instance);
}
@@ -3942,3 +3951,40 @@ void radv_GetPhysicalDeviceExternalFencePropertiesKHR(
pExternalFenceProperties->externalFenceFeatures = 0;
}
}
+
+VkResult
+radv_CreateDebugReportCallbackEXT(VkInstance _instance,
+ const VkDebugReportCallbackCreateInfoEXT* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDebugReportCallbackEXT* pCallback)
+{
+ RADV_FROM_HANDLE(radv_instance, instance, _instance);
+ return vk_create_debug_report_callback(&instance->debug_report_callbacks,
+ pCreateInfo, pAllocator, &instance->alloc,
+ pCallback);
+}
+
+void
+radv_DestroyDebugReportCallbackEXT(VkInstance _instance,
+ VkDebugReportCallbackEXT _callback,
+ const VkAllocationCallbacks* pAllocator)
+{
+ RADV_FROM_HANDLE(radv_instance, instance, _instance);
+ vk_destroy_debug_report_callback(&instance->debug_report_callbacks,
+ _callback, pAllocator, &instance->alloc);
+}
+
+void
+radv_DebugReportMessageEXT(VkInstance _instance,
+ VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT objectType,
+ uint64_t object,
+ size_t location,
+ int32_t messageCode,
+ const char* pLayerPrefix,
+ const char* pMessage)
+{
+ RADV_FROM_HANDLE(radv_instance, instance, _instance);
+ vk_debug_report(&instance->debug_report_callbacks, flags, objectType,
+ object, location, messageCode, pLayerPrefix, pMessage);
+}
diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py
index 9980cfc398b..f11540a5c96 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -81,6 +81,7 @@ EXTENSIONS = [
Extension('VK_KHR_xcb_surface', 6, 'VK_USE_PLATFORM_XCB_KHR'),
Extension('VK_KHR_xlib_surface', 6, 'VK_USE_PLATFORM_XLIB_KHR'),
Extension('VK_KHX_multiview', 1, True),
+ Extension('VK_EXT_debug_report', 9, True),
Extension('VK_EXT_discard_rectangles', 1, True),
Extension('VK_EXT_external_memory_dma_buf', 1, True),
Extension('VK_EXT_global_priority', 1, 'device->rad_info.has_ctx_priority'),
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index c39358951de..d51a669b383 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -49,6 +49,7 @@
#include "util/list.h"
#include "main/macros.h"
#include "vk_alloc.h"
+#include "vk_debug_report.h"
#include "radv_radeon_winsys.h"
#include "ac_binary.h"
@@ -296,6 +297,8 @@ struct radv_instance {
uint64_t debug_flags;
uint64_t perftest_flags;
+
+ struct vk_debug_report_instance debug_report_callbacks;
};
VkResult radv_init_wsi(struct radv_physical_device *physical_device);