summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2017-08-25 13:26:07 +0300
committerTapani Pälli <tapani.palli@intel.com>2017-08-28 14:14:14 +0300
commit0a3def3d99d7dd2efa97d7b42614c1ca1a2e1b13 (patch)
tree3b6ad40cd4e066d92cad3605c3cf4785998cbba4
parent5b3fe648133ade3ca7657f3e66c44f5f2ee5223d (diff)
crucible: add a test for VK_EXT_debug_reportdebug_report_test
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
-rw-r--r--Makefile.am1
-rw-r--r--src/tests/func/debug_report.c91
2 files changed, 92 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 656ee22..0e4eb71 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -98,6 +98,7 @@ bin_crucible_SOURCES = \
src/tests/func/ssbo/interleave.c \
src/tests/func/sync/semaphore-fd.c \
src/tests/func/renderpass/clear.c \
+ src/tests/func/debug_report.c \
src/tests/stress/lots-of-surface-state.c \
src/tests/stress/buffer_limit.c \
src/tests/self/concurrent-output.c \
diff --git a/src/tests/func/debug_report.c b/src/tests/func/debug_report.c
new file mode 100644
index 0000000..e0935da
--- /dev/null
+++ b/src/tests/func/debug_report.c
@@ -0,0 +1,91 @@
+// Copyright 2017 Intel Corporation
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice (including the next
+// paragraph) shall be included in all copies or substantial portions of the
+// Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+
+#include "tapi/t.h"
+
+static VkBool32 debug_cb(VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT objectType,
+ uint64_t object,
+ size_t location,
+ int32_t messageCode,
+ const char *pLayerPrefix,
+ const char *pMessage,
+ void *pUserData)
+{
+ (*(uint32_t *) pUserData) += 1;
+ return false;
+}
+
+static void
+test_debug_report(void)
+{
+ PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXT;
+ PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT;
+ PFN_vkDebugReportMessageEXT vkDebugReportMessageEXT;
+
+#define RESOLVE(func)\
+ (PFN_ ##func) vkGetInstanceProcAddr(t_instance, #func);
+ vkCreateDebugReportCallbackEXT = RESOLVE(vkCreateDebugReportCallbackEXT);
+ vkDestroyDebugReportCallbackEXT = RESOLVE(vkDestroyDebugReportCallbackEXT);
+ vkDebugReportMessageEXT = RESOLVE(vkDebugReportMessageEXT);
+#undef RESOLVE
+
+ assert(vkCreateDebugReportCallbackEXT);
+ assert(vkDestroyDebugReportCallbackEXT);
+ assert(vkDebugReportMessageEXT);
+
+ VkResult res;
+ VkDebugReportCallbackEXT callback;
+ VkDebugReportCallbackCreateInfoEXT info;
+
+ uint32_t value = 0;
+
+ info.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT;
+ info.pNext = NULL;
+ info.flags = VK_DEBUG_REPORT_INFORMATION_BIT_EXT |
+ VK_DEBUG_REPORT_WARNING_BIT_EXT |
+ VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT |
+ VK_DEBUG_REPORT_ERROR_BIT_EXT |
+ VK_DEBUG_REPORT_DEBUG_BIT_EXT;
+ info.pfnCallback = debug_cb;
+ info.pUserData = &value;
+
+ res = vkCreateDebugReportCallbackEXT(t_instance, &info, NULL,
+ &callback);
+ t_assert(res == VK_SUCCESS);
+ t_assert(callback != 0);
+
+ vkDebugReportMessageEXT(t_instance,
+ VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT,
+ 0, 0, 0, "test",
+ "VK_EXT_debug_report in use");
+
+ t_assert(value >= 1);
+
+ vkDestroyDebugReportCallbackEXT(t_instance, callback, NULL);
+}
+
+test_define {
+ .name = "func.debug_report",
+ .start = test_debug_report,
+ .no_image = true,
+};