Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/broadcom/vulkan/v3dv_util.c
4560 views
1
/*
2
* Copyright © 2019 Raspberry Pi
3
*
4
* based in part on anv driver which is:
5
* Copyright © 2015 Intel Corporation
6
*
7
* based in part on radv driver which is:
8
* Copyright © 2016 Red Hat.
9
* Copyright © 2016 Bas Nieuwenhuizen
10
*
11
* Permission is hereby granted, free of charge, to any person obtaining a
12
* copy of this software and associated documentation files (the "Software"),
13
* to deal in the Software without restriction, including without limitation
14
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
15
* and/or sell copies of the Software, and to permit persons to whom the
16
* Software is furnished to do so, subject to the following conditions:
17
*
18
* The above copyright notice and this permission notice (including the next
19
* paragraph) shall be included in all copies or substantial portions of the
20
* Software.
21
*
22
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
28
* IN THE SOFTWARE.
29
*/
30
31
#include <stdarg.h>
32
#include <stdio.h>
33
#include <stdlib.h>
34
#include <string.h>
35
#include <errno.h>
36
#include <assert.h>
37
38
#include "vk_enum_to_str.h"
39
#include "v3dv_private.h"
40
41
VkResult
42
__vk_errorf(struct v3dv_instance *instance, VkResult error, const char *file,
43
int line, const char *format, ...)
44
{
45
va_list ap;
46
char buffer[256];
47
48
#ifndef DEBUG
49
return error;
50
#endif
51
52
const char *error_str = vk_Result_to_str(error);
53
54
if (format) {
55
va_start(ap, format);
56
vsnprintf(buffer, sizeof(buffer), format, ap);
57
va_end(ap);
58
59
fprintf(stderr, "%s:%d: %s (%s)\n", file, line, buffer, error_str);
60
} else {
61
fprintf(stderr, "%s:%d: %s\n", file, line, error_str);
62
}
63
64
return error;
65
}
66
67