v3dv: move error string definition to debug path
authorIago Toral Quiroga <itoral@igalia.com>
Tue, 1 Dec 2020 10:51:02 +0000 (11:51 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 1 Dec 2020 12:10:11 +0000 (12:10 +0000)
No point in computing this if debug is disabled.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7848>

src/broadcom/vulkan/v3dv_util.c

index a1fe59e99b69a865cd9624fae69f5bff762d690d..d26369f9f56cce9511d876f5469de4c6ba0b2099 100644 (file)
@@ -45,12 +45,12 @@ __vk_errorf(struct v3dv_instance *instance, VkResult error, const char *file,
    va_list ap;
    char buffer[256];
 
-   const char *error_str = vk_Result_to_str(error);
-
 #ifndef DEBUG
       return error;
 #endif
 
+   const char *error_str = vk_Result_to_str(error);
+
    if (format) {
       va_start(ap, format);
       vsnprintf(buffer, sizeof(buffer), format, ap);