dbgFunc(VkFlags msgFlags, VkDebugReportObjectTypeEXT objType,
uint64_t srcObject, size_t location, int32_t msgCode,
const char *pLayerPrefix, const char *pMsg, void *pUserData) {
+
+ // clang-format off
char *message = (char *)malloc(strlen(pMsg) + 100);
assert(message);
- if (msgFlags & VK_DEBUG_REPORT_ERROR_BIT_EXT) {
- sprintf(message, "ERROR: [%s] Code %d : %s", pLayerPrefix, msgCode,
- pMsg);
+ // We know we're submitting queues without fences, ignore this
+ if (strstr(pMsg, "vkQueueSubmit parameter, VkFence fence, is null pointer"))
+ return false;
+
+ if (msgFlags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT) {
+ sprintf(message, "INFORMATION: [%s] Code %d : %s", pLayerPrefix, msgCode, pMsg);
validation_error = 1;
} else if (msgFlags & VK_DEBUG_REPORT_WARNING_BIT_EXT) {
- // We know that we're submitting queues without fences, ignore this
- // warning
- if (strstr(pMsg,
- "vkQueueSubmit parameter, VkFence fence, is null pointer")) {
- return false;
- }
- sprintf(message, "WARNING: [%s] Code %d : %s", pLayerPrefix, msgCode,
- pMsg);
+ sprintf(message, "WARNING: [%s] Code %d : %s", pLayerPrefix, msgCode, pMsg);
+ validation_error = 1;
+ } else if (msgFlags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT) {
+ sprintf(message, "PERFOERMANCE WARNING: [%s] Code %d : %s", pLayerPrefix, msgCode, pMsg);
+ validation_error = 1;
+ } else if (msgFlags & VK_DEBUG_REPORT_ERROR_BIT_EXT) {
+ sprintf(message, "ERROR: [%s] Code %d : %s", pLayerPrefix, msgCode, pMsg);
+ validation_error = 1;
+ } else if (msgFlags & VK_DEBUG_REPORT_DEBUG_BIT_EXT) {
+ sprintf(message, "DEBUG: [%s] Code %d : %s", pLayerPrefix, msgCode, pMsg);
validation_error = 1;
} else {
+ sprintf(message, "INFORMATION: [%s] Code %d : %s", pLayerPrefix, msgCode, pMsg);
validation_error = 1;
- return false;
}
#ifdef _WIN32
+
in_callback = true;
struct demo *demo = (struct demo*) pUserData;
if (!demo->suppress_popups)
MessageBox(NULL, message, "Alert", MB_OK);
in_callback = false;
+
#elif defined(ANDROID)
+
if (msgFlags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT) {
- __android_log_print(ANDROID_LOG_INFO, "Cube", "%s", message);
+ __android_log_print(ANDROID_LOG_INFO, APP_SHORT_NAME, "%s", message);
} else if (msgFlags & VK_DEBUG_REPORT_WARNING_BIT_EXT) {
- __android_log_print(ANDROID_LOG_WARN, "Cube", "%s", message);
+ __android_log_print(ANDROID_LOG_WARN, APP_SHORT_NAME, "%s", message);
} else if (msgFlags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT) {
- __android_log_print(ANDROID_LOG_WARN, "Cube", "%s", message);
+ __android_log_print(ANDROID_LOG_WARN, APP_SHORT_NAME, "%s", message);
} else if (msgFlags & VK_DEBUG_REPORT_ERROR_BIT_EXT) {
- __android_log_print(ANDROID_LOG_ERROR, "Cube", "%s", message);
+ __android_log_print(ANDROID_LOG_ERROR, APP_SHORT_NAME, "%s", message);
} else if (msgFlags & VK_DEBUG_REPORT_DEBUG_BIT_EXT) {
- __android_log_print(ANDROID_LOG_DEBUG, "Cube", "%s", message);
+ __android_log_print(ANDROID_LOG_DEBUG, APP_SHORT_NAME, "%s", message);
} else {
- __android_log_print(ANDROID_LOG_INFO, "Cube", "%s", message);
+ __android_log_print(ANDROID_LOG_INFO, APP_SHORT_NAME, "%s", message);
}
+
#else
+
printf("%s\n", message);
fflush(stdout);
+
#endif
+
free(message);
+ //clang-format on
+
/*
* false indicates that layer should not bail-out of an
* API call that had validation failures. This may mean that the
continue;
}
+#if defined(ANDROID)
+ ERR_EXIT("Usage: cube [--validate]\n", "Usage");
+#else
fprintf(stderr, "Usage:\n %s [--use_staging] [--validate] [--break] "
#if defined(VK_USE_PLATFORM_XLIB_KHR)
"[--xlib] "
APP_SHORT_NAME);
fflush(stderr);
exit(1);
+#endif
}
if (!demo->use_xlib)
// Use the following key to send arguments, i.e.
// --es args "--validate"
const char key[] = "args";
- char* appTag = (char*) "Cube";
+ char* appTag = (char*) APP_SHORT_NAME;
int argc = 0;
char** argv = get_args(app, key, appTag, &argc);