summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_util.c
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2018-05-31 01:06:41 +0200
committerBas Nieuwenhuizen <[email protected]>2018-05-31 11:51:23 +0200
commit38933c11514696505e49fd8036ebd1d1e62fa6ec (patch)
tree829a3ff8410c47d48761ce20214e94a9e07b3cb3 /src/amd/vulkan/radv_util.c
parent729f7373deaf98d860ef95be36ef8af267218bc3 (diff)
radv: Add option to print errors even in optimized builds.
Errors are not that common of a case so we can eat a slight perf hit in having to call a function and do a runtime check. In turn this makes debugging random errors happening for end users easier, because they don't have to have a debug build on hand. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_util.c')
-rw-r--r--src/amd/vulkan/radv_util.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_util.c b/src/amd/vulkan/radv_util.c
index b892eb78851..2af7da6c6cc 100644
--- a/src/amd/vulkan/radv_util.c
+++ b/src/amd/vulkan/radv_util.c
@@ -29,6 +29,7 @@
#include <assert.h>
#include "radv_private.h"
+#include "radv_debug.h"
#include "vk_enum_to_str.h"
#include "util/u_math.h"
@@ -67,13 +68,19 @@ void radv_printflike(3, 4)
}
VkResult
-__vk_errorf(VkResult error, const char *file, int line, const char *format, ...)
+__vk_errorf(struct radv_instance *instance, VkResult error, const char *file,
+ int line, const char *format, ...)
{
va_list ap;
char buffer[256];
const char *error_str = vk_Result_to_str(error);
+#ifndef DEBUG
+ if (instance && !(instance->debug_flags & RADV_DEBUG_ERRORS))
+ return error;
+#endif
+
if (format) {
va_start(ap, format);
vsnprintf(buffer, sizeof(buffer), format, ap);