Path: blob/21.2-virgl/src/gallium/frontends/lavapipe/lvp_util.c
4565 views
/*1* Copyright © 2019 Red Hat.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#include "lvp_private.h"24#include "vk_enum_to_str.h"25void lvp_printflike(3, 4)26__lvp_finishme(const char *file, int line, const char *format, ...)27{28va_list ap;29char buffer[256];3031va_start(ap, format);32vsnprintf(buffer, sizeof(buffer), format, ap);33va_end(ap);3435fprintf(stderr, "%s:%d: FINISHME: %s\n", file, line, buffer);36}3738VkResult39__vk_errorf(struct lvp_instance *instance, VkResult error, const char *file, int line, const char *format, ...)40{41va_list ap;42char buffer[256];4344const char *error_str = vk_Result_to_str(error);4546if (format) {47va_start(ap, format);48vsnprintf(buffer, sizeof(buffer), format, ap);49va_end(ap);5051fprintf(stderr, "%s:%d: %s (%s)\n", file, line, buffer, error_str);52} else {53fprintf(stderr, "%s:%d: %s\n", file, line, error_str);54}5556return error;57}585960