Do not log INFO and DEBUG messages by default
authorPyry Haulos <phaulos@google.com>
Thu, 14 Apr 2016 18:40:50 +0000 (11:40 -0700)
committerPyry Haulos <phaulos@google.com>
Thu, 14 Apr 2016 21:07:09 +0000 (14:07 -0700)
Validation layers produce a lot of INFORMATION and DEBUG messages that
are not useful most of the time, and just bloat the log. Ignore these
message types by default.

Documented Validation layer usage in Vulkan CTS README.

Bug: 28175931
Change-Id: I0f56d0373e0eb5d7e2849670b4284c457eab8c04

external/vulkancts/README.md
external/vulkancts/modules/vulkan/vktTestPackage.cpp

index 7985148..8e854bf 100644 (file)
@@ -304,6 +304,24 @@ vkNullDriver.cpp. To use that, implement `vk::Platform::createLibrary()` with
 `vk::createNullDriver()`.
 
 
+Validation Layers
+-----------------
+
+Vulkan CTS framework includes first-party support for validation layers, that
+can be turned on with `--deqp-validation=enable` command line option.
+
+When validation is turned on, default instance and device will be created with
+validation layers enabled and debug callback is registered to record any
+messages. Debug messages collected during test execution will be included at
+the end of the test case log.
+
+If any validation errors are found, test result will be set to `InternalError`.
+
+By default `VK_DEBUG_REPORT_INFORMATION_BIT_EXT` and `_DEBUG_BIT_EXT` messages
+are excluded from the log, but that can be customized by modifying
+`vkt::TestCaseExecutor::deinit()` in `vktTestPackage.cpp`.
+
+
 Cherry GUI
 ----------
 
index 69d51fc..f654e67 100644 (file)
@@ -247,6 +247,12 @@ void TestCaseExecutor::deinit (tcu::TestCase*)
        // Collect and report any debug messages
        if (m_debugReportRecorder)
        {
+               // \note We are not logging INFORMATION and DEBUG messages
+               static const vk::VkDebugReportFlagsEXT                  errorFlags              = vk::VK_DEBUG_REPORT_ERROR_BIT_EXT;
+               static const vk::VkDebugReportFlagsEXT                  logFlags                = errorFlags
+                                                                                                                                               | vk::VK_DEBUG_REPORT_WARNING_BIT_EXT
+                                                                                                                                               | vk::VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT;
+
                typedef vk::DebugReportRecorder::MessageList    DebugMessages;
 
                const DebugMessages&    messages        = m_debugReportRecorder->getMessages();
@@ -255,20 +261,21 @@ void TestCaseExecutor::deinit (tcu::TestCase*)
                if (messages.begin() != messages.end())
                {
                        const tcu::ScopedLogSection     section         (log, "DebugMessages", "Debug Messages");
-                       bool                                            anyErrors       = false;
+                       int                                                     numErrors       = 0;
 
                        for (DebugMessages::const_iterator curMsg = messages.begin(); curMsg != messages.end(); ++curMsg)
                        {
-                               log << tcu::TestLog::Message << *curMsg << tcu::TestLog::EndMessage;
+                               if ((curMsg->flags & logFlags) != 0)
+                                       log << tcu::TestLog::Message << *curMsg << tcu::TestLog::EndMessage;
 
-                               if ((curMsg->flags & vk::VK_DEBUG_REPORT_ERROR_BIT_EXT) != 0)
-                                       anyErrors = true;
+                               if ((curMsg->flags & errorFlags) != 0)
+                                       numErrors += 1;
                        }
 
                        m_debugReportRecorder->clearMessages();
 
-                       if (anyErrors)
-                               m_context.getTestContext().setTestResult(QP_TEST_RESULT_INTERNAL_ERROR, "API usage error found");
+                       if (numErrors > 0)
+                               m_context.getTestContext().setTestResult(QP_TEST_RESULT_INTERNAL_ERROR, (de::toString(numErrors) + " API usage errors found").c_str());
                }
        }
 }