layers: Add bailout flag to debug report callback
Layer validation tests will deliberately induce
errors that the validation layer should catch.
In these cases we don't really want the layer to call
down the chain once it's detected a failure. We can't
know that in the layer so changing the return value
on the callback from void to VkBool32 so that the
callback can indicate if the call should continue
or not. true = bail.
That allows the call chain to execute normally,
not segfault in the driver and allow the test
to clean things up.
diff --git a/demos/cube.c b/demos/cube.c
index 83755c1..e0b0f3c 100644
--- a/demos/cube.c
+++ b/demos/cube.c
@@ -253,7 +253,7 @@
fflush(stdout);
}
-void dbgFunc(
+VkBool32 dbgFunc(
VkFlags msgFlags,
VkDbgObjectType objType,
uint64_t srcObject,
@@ -263,20 +263,22 @@
const char* pMsg,
void* pUserData)
{
+ VkBool32 bail = false;
char *message = (char *) malloc(strlen(pMsg)+100);
assert (message);
if (msgFlags & VK_DBG_REPORT_ERROR_BIT) {
sprintf(message,"ERROR: [%s] Code %d : %s", pLayerPrefix, msgCode, pMsg);
+ bail = true;
} else if (msgFlags & VK_DBG_REPORT_WARN_BIT) {
// We know that we're submitting queues without fences, ignore this warning
if (strstr(pMsg, "vkQueueSubmit parameter, VkFence fence, is null pointer")){
- return;
+ return false;
}
sprintf(message,"WARNING: [%s] Code %d : %s", pLayerPrefix, msgCode, pMsg);
} else {
- return;
+ return false;
}
#ifdef _WIN32
@@ -286,6 +288,8 @@
fflush(stdout);
#endif
free(message);
+
+ return bail;
}
typedef struct _SwapchainBuffers {