mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-02-03 12:28:07 +00:00
aux/vk: Port to u_logging.
Fix log calls where no valid state struct was provided.
This commit is contained in:
parent
58ecf67515
commit
ba1d966f9f
src/xrt
auxiliary/vk
compositor
|
@ -151,7 +151,7 @@ bool
|
|||
vk_has_error(VkResult res, const char *fun, const char *file, int line)
|
||||
{
|
||||
if (res != VK_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: %s failed with %s in %s:%d\n", fun,
|
||||
U_LOG_E("%s failed with %s in %s:%d", fun,
|
||||
vk_result_string(res), file, line);
|
||||
return true;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ vk_alloc_and_bind_image_memory(struct vk_bundle *vk,
|
|||
if (!vk_get_memory_type(vk, memory_requirements.memoryTypeBits,
|
||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
||||
&memory_type_index)) {
|
||||
VK_ERROR(c, "vk_get_memory_type failed!");
|
||||
VK_ERROR(vk, "vk_get_memory_type failed!");
|
||||
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
}
|
||||
|
||||
|
@ -527,7 +527,7 @@ vk_create_view_swizzle(struct vk_bundle *vk,
|
|||
|
||||
ret = vk->vkCreateImageView(vk->device, &imageView, NULL, &view);
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(c, "vkCreateImageView: %s", vk_result_string(ret));
|
||||
VK_ERROR(vk, "vkCreateImageView: %s", vk_result_string(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1140,9 +1140,7 @@ vk_get_access_flags(VkImageLayout layout)
|
|||
return VK_ACCESS_TRANSFER_WRITE_BIT;
|
||||
case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:
|
||||
return VK_ACCESS_SHADER_READ_BIT;
|
||||
default:
|
||||
fprintf(stderr, "Unhandled access mask case for layout %d.\n",
|
||||
layout);
|
||||
default: U_LOG_E("Unhandled access mask case for layout %d.", layout);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1333,8 +1331,8 @@ vk_buffer_init(struct vk_bundle *vk,
|
|||
|
||||
if (!vk_get_memory_type(vk, requirements.memoryTypeBits, properties,
|
||||
&alloc_info.memoryTypeIndex)) {
|
||||
fprintf(stderr,
|
||||
"Failed to find matching memoryTypeIndex for buffer\n");
|
||||
VK_ERROR(vk,
|
||||
"Failed to find matching memoryTypeIndex for buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "xrt/xrt_compositor.h"
|
||||
#include "xrt/xrt_vulkan_includes.h"
|
||||
#include "xrt/xrt_handles.h"
|
||||
#include "util/u_logging.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -34,7 +35,7 @@ extern "C" {
|
|||
*/
|
||||
struct vk_bundle
|
||||
{
|
||||
bool print;
|
||||
enum u_logging_level ll;
|
||||
|
||||
VkInstance instance;
|
||||
VkPhysicalDevice physical_device;
|
||||
|
@ -247,21 +248,11 @@ vk_color_space_string(VkColorSpaceKHR code);
|
|||
*
|
||||
*/
|
||||
|
||||
#define VK_DEBUG(vk, ...) \
|
||||
do { \
|
||||
if (vk->print) { \
|
||||
fprintf(stderr, "%s - ", __func__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define VK_ERROR(vk, ...) \
|
||||
do { \
|
||||
fprintf(stderr, "%s - ", __func__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
} while (false)
|
||||
#define VK_TRACE(d, ...) U_LOG_IFL_T(d->ll, __VA_ARGS__)
|
||||
#define VK_DEBUG(d, ...) U_LOG_IFL_D(d->ll, __VA_ARGS__)
|
||||
#define VK_INFO(d, ...) U_LOG_IFL_I(d->ll, __VA_ARGS__)
|
||||
#define VK_WARN(d, ...) U_LOG_IFL_W(d->ll, __VA_ARGS__)
|
||||
#define VK_ERROR(d, ...) U_LOG_IFL_E(d->ll, __VA_ARGS__)
|
||||
|
||||
bool
|
||||
vk_has_error(VkResult res, const char *fun, const char *file, int line);
|
||||
|
|
|
@ -512,13 +512,13 @@ client_vk_swapchain_create(struct xrt_compositor *xc,
|
|||
|
||||
ret = c->vk.vkEndCommandBuffer(sc->acquire[i]);
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(vk, "vkEndCommandBuffer: %s",
|
||||
VK_ERROR((&c->vk), "vkEndCommandBuffer: %s",
|
||||
vk_result_string(ret));
|
||||
return XRT_ERROR_VULKAN;
|
||||
}
|
||||
ret = c->vk.vkEndCommandBuffer(sc->release[i]);
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(vk, "vkEndCommandBuffer: %s",
|
||||
VK_ERROR((&c->vk), "vkEndCommandBuffer: %s",
|
||||
vk_result_string(ret));
|
||||
return XRT_ERROR_VULKAN;
|
||||
}
|
||||
|
|
|
@ -893,7 +893,7 @@ compositor_init_vulkan(struct comp_compositor *c)
|
|||
|
||||
VkResult ret;
|
||||
|
||||
c->vk.print = c->settings.log_level <= U_LOGGING_DEBUG;
|
||||
c->vk.ll = c->settings.log_level;
|
||||
|
||||
ret = find_get_instance_proc_addr(c);
|
||||
if (ret != VK_SUCCESS) {
|
||||
|
|
|
@ -220,7 +220,7 @@ create_command_buffer(struct vk_bundle *vk, VkCommandBuffer *out_cmd)
|
|||
&cmd_buffer_info, //
|
||||
&cmd); //
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(r->c, "vkCreateFramebuffer failed: %s",
|
||||
VK_ERROR(vk, "vkCreateFramebuffer failed: %s",
|
||||
vk_result_string(ret));
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue