The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

aux/vk: Port to u_logging.

Fix log calls where no valid state struct was provided.

authored by

Lubosz Sarnecki and committed by
Jakob Bornecrantz
ba1d966f 58ecf675

+17 -28
+6 -8
src/xrt/auxiliary/vk/vk_helpers.c
··· 151 151 vk_has_error(VkResult res, const char *fun, const char *file, int line) 152 152 { 153 153 if (res != VK_SUCCESS) { 154 - fprintf(stderr, "ERROR: %s failed with %s in %s:%d\n", fun, 154 + U_LOG_E("%s failed with %s in %s:%d", fun, 155 155 vk_result_string(res), file, line); 156 156 return true; 157 157 } ··· 216 216 if (!vk_get_memory_type(vk, memory_requirements.memoryTypeBits, 217 217 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, 218 218 &memory_type_index)) { 219 - VK_ERROR(c, "vk_get_memory_type failed!"); 219 + VK_ERROR(vk, "vk_get_memory_type failed!"); 220 220 return VK_ERROR_OUT_OF_DEVICE_MEMORY; 221 221 } 222 222 ··· 527 527 528 528 ret = vk->vkCreateImageView(vk->device, &imageView, NULL, &view); 529 529 if (ret != VK_SUCCESS) { 530 - VK_ERROR(c, "vkCreateImageView: %s", vk_result_string(ret)); 530 + VK_ERROR(vk, "vkCreateImageView: %s", vk_result_string(ret)); 531 531 return ret; 532 532 } 533 533 ··· 1140 1140 return VK_ACCESS_TRANSFER_WRITE_BIT; 1141 1141 case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL: 1142 1142 return VK_ACCESS_SHADER_READ_BIT; 1143 - default: 1144 - fprintf(stderr, "Unhandled access mask case for layout %d.\n", 1145 - layout); 1143 + default: U_LOG_E("Unhandled access mask case for layout %d.", layout); 1146 1144 } 1147 1145 return 0; 1148 1146 } ··· 1333 1331 1334 1332 if (!vk_get_memory_type(vk, requirements.memoryTypeBits, properties, 1335 1333 &alloc_info.memoryTypeIndex)) { 1336 - fprintf(stderr, 1337 - "Failed to find matching memoryTypeIndex for buffer\n"); 1334 + VK_ERROR(vk, 1335 + "Failed to find matching memoryTypeIndex for buffer"); 1338 1336 return false; 1339 1337 } 1340 1338
+7 -16
src/xrt/auxiliary/vk/vk_helpers.h
··· 13 13 #include "xrt/xrt_compositor.h" 14 14 #include "xrt/xrt_vulkan_includes.h" 15 15 #include "xrt/xrt_handles.h" 16 + #include "util/u_logging.h" 16 17 17 18 #ifdef __cplusplus 18 19 extern "C" { ··· 34 35 */ 35 36 struct vk_bundle 36 37 { 37 - bool print; 38 + enum u_logging_level ll; 38 39 39 40 VkInstance instance; 40 41 VkPhysicalDevice physical_device; ··· 247 248 * 248 249 */ 249 250 250 - #define VK_DEBUG(vk, ...) \ 251 - do { \ 252 - if (vk->print) { \ 253 - fprintf(stderr, "%s - ", __func__); \ 254 - fprintf(stderr, __VA_ARGS__); \ 255 - fprintf(stderr, "\n"); \ 256 - } \ 257 - } while (false) 258 - 259 - #define VK_ERROR(vk, ...) \ 260 - do { \ 261 - fprintf(stderr, "%s - ", __func__); \ 262 - fprintf(stderr, __VA_ARGS__); \ 263 - fprintf(stderr, "\n"); \ 264 - } while (false) 251 + #define VK_TRACE(d, ...) U_LOG_IFL_T(d->ll, __VA_ARGS__) 252 + #define VK_DEBUG(d, ...) U_LOG_IFL_D(d->ll, __VA_ARGS__) 253 + #define VK_INFO(d, ...) U_LOG_IFL_I(d->ll, __VA_ARGS__) 254 + #define VK_WARN(d, ...) U_LOG_IFL_W(d->ll, __VA_ARGS__) 255 + #define VK_ERROR(d, ...) U_LOG_IFL_E(d->ll, __VA_ARGS__) 265 256 266 257 bool 267 258 vk_has_error(VkResult res, const char *fun, const char *file, int line);
+2 -2
src/xrt/compositor/client/comp_vk_client.c
··· 512 512 513 513 ret = c->vk.vkEndCommandBuffer(sc->acquire[i]); 514 514 if (ret != VK_SUCCESS) { 515 - VK_ERROR(vk, "vkEndCommandBuffer: %s", 515 + VK_ERROR((&c->vk), "vkEndCommandBuffer: %s", 516 516 vk_result_string(ret)); 517 517 return XRT_ERROR_VULKAN; 518 518 } 519 519 ret = c->vk.vkEndCommandBuffer(sc->release[i]); 520 520 if (ret != VK_SUCCESS) { 521 - VK_ERROR(vk, "vkEndCommandBuffer: %s", 521 + VK_ERROR((&c->vk), "vkEndCommandBuffer: %s", 522 522 vk_result_string(ret)); 523 523 return XRT_ERROR_VULKAN; 524 524 }
+1 -1
src/xrt/compositor/main/comp_compositor.c
··· 893 893 894 894 VkResult ret; 895 895 896 - c->vk.print = c->settings.log_level <= U_LOGGING_DEBUG; 896 + c->vk.ll = c->settings.log_level; 897 897 898 898 ret = find_get_instance_proc_addr(c); 899 899 if (ret != VK_SUCCESS) {
+1 -1
src/xrt/compositor/render/comp_rendering.c
··· 220 220 &cmd_buffer_info, // 221 221 &cmd); // 222 222 if (ret != VK_SUCCESS) { 223 - VK_ERROR(r->c, "vkCreateFramebuffer failed: %s", 223 + VK_ERROR(vk, "vkCreateFramebuffer failed: %s", 224 224 vk_result_string(ret)); 225 225 return ret; 226 226 }