[magma] More compact logging for gpu tests.
Change-Id: If5300269c82b50488c23b461adf58fcca7d32376
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/443694
Reviewed-by: Craig Stout <cstout@google.com>
Testability-Review: Craig Stout <cstout@google.com>
Commit-Queue: John Rosasco <rosasco@google.com>
diff --git a/src/graphics/tests/common/utils.h b/src/graphics/tests/common/utils.h
index dbe6be0..cba11e0 100644
--- a/src/graphics/tests/common/utils.h
+++ b/src/graphics/tests/common/utils.h
@@ -10,6 +10,8 @@
#include "vulkan/vulkan_core.h"
+#include "vulkan/vulkan.hpp"
+
#define RTN_MSG(err, ...) \
{ \
fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
@@ -18,6 +20,25 @@
return err; \
}
+#define RTN_MSG_VK(err, r, ...) \
+ if (r != VK_SUCCESS) { \
+ fprintf(stderr, "%s:%d:\n\t(vk::Result::e%s) ", __FILE__, __LINE__, \
+ vk::to_string(vk::Result(r)).c_str()); \
+ fprintf(stderr, __VA_ARGS__); \
+ fprintf(stderr, "\n"); \
+ fflush(stderr); \
+ return err; \
+ }
+
+#define RTN_MSG_VKH(err, r, ...) \
+ if (r != vk::Result::eSuccess) { \
+ fprintf(stderr, "%s:%d:\n\t(vk::Result::e%s) ", __FILE__, __LINE__, vk::to_string(r).c_str()); \
+ fprintf(stderr, __VA_ARGS__); \
+ fprintf(stderr, "\n"); \
+ fflush(stderr); \
+ return err; \
+ }
+
//
// DebugUtilsTestCallback will fail an EXPECT_TRUE() test if validation errors should
// not be ignored and the message severity is of type ::eError. It directs errors to stderr