The open source OpenXR runtime
0
fork

Configure Feed

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

c/client: Follow style of using vk variable for vk_bundle interactions

authored by

Jakob Bornecrantz and committed by
Ryan Pavlik
3af65d60 28a29f81

+27 -24
+27 -24
src/xrt/compositor/client/comp_vk_client.c
··· 49 49 { 50 50 struct client_vk_swapchain *sc = client_vk_swapchain(xsc); 51 51 struct client_vk_compositor *c = sc->c; 52 + struct vk_bundle *vk = &c->vk; 52 53 53 54 for (uint32_t i = 0; i < sc->base.base.num_images; i++) { 54 55 if (sc->base.images[i] != VK_NULL_HANDLE) { 55 - c->vk.vkDestroyImage(c->vk.device, sc->base.images[i], NULL); 56 + vk->vkDestroyImage(vk->device, sc->base.images[i], NULL); 56 57 sc->base.images[i] = VK_NULL_HANDLE; 57 58 } 58 59 59 60 if (sc->mems[i] != VK_NULL_HANDLE) { 60 - c->vk.vkFreeMemory(c->vk.device, sc->mems[i], NULL); 61 + vk->vkFreeMemory(vk->device, sc->mems[i], NULL); 61 62 sc->mems[i] = VK_NULL_HANDLE; 62 63 } 63 64 } ··· 148 149 client_vk_compositor_destroy(struct xrt_compositor *xc) 149 150 { 150 151 struct client_vk_compositor *c = client_vk_compositor(xc); 152 + struct vk_bundle *vk = &c->vk; 151 153 152 - if (c->vk.cmd_pool != VK_NULL_HANDLE) { 154 + if (vk->cmd_pool != VK_NULL_HANDLE) { 153 155 // Make sure that any of the command buffers from this command 154 156 // pool are n used here, this pleases the validation layer. 155 - os_mutex_lock(&c->vk.queue_mutex); 156 - c->vk.vkDeviceWaitIdle(c->vk.device); 157 - os_mutex_unlock(&c->vk.queue_mutex); 157 + os_mutex_lock(&vk->queue_mutex); 158 + vk->vkDeviceWaitIdle(vk->device); 159 + os_mutex_unlock(&vk->queue_mutex); 158 160 159 - c->vk.vkDestroyCommandPool(c->vk.device, c->vk.cmd_pool, NULL); 160 - c->vk.cmd_pool = VK_NULL_HANDLE; 161 + vk->vkDestroyCommandPool(vk->device, vk->cmd_pool, NULL); 162 + vk->cmd_pool = VK_NULL_HANDLE; 161 163 } 162 - vk_deinit_mutex(&c->vk); 164 + vk_deinit_mutex(vk); 163 165 164 166 free(c); 165 167 } ··· 361 363 struct xrt_swapchain **out_xsc) 362 364 { 363 365 struct client_vk_compositor *c = client_vk_compositor(xc); 366 + struct vk_bundle *vk = &c->vk; 364 367 VkCommandBuffer cmd_buffer; 365 368 VkResult ret; 366 369 xrt_result_t xret; ··· 375 378 376 379 struct xrt_swapchain *xsc = &xscn->base; 377 380 378 - ret = vk_init_cmd_buffer(&c->vk, &cmd_buffer); 381 + ret = vk_init_cmd_buffer(vk, &cmd_buffer); 379 382 if (ret != VK_SUCCESS) { 380 383 return XRT_ERROR_VULKAN; 381 384 } ··· 399 402 sc->xscn = xscn; 400 403 401 404 for (uint32_t i = 0; i < xsc->num_images; i++) { 402 - ret = vk_create_image_from_native(&c->vk, info, &xscn->images[i], &sc->base.images[i], &sc->mems[i]); 405 + ret = vk_create_image_from_native(vk, info, &xscn->images[i], &sc->base.images[i], &sc->mems[i]); 403 406 404 407 405 408 if (ret != VK_SUCCESS) { ··· 411 414 * not be a bug in the validation layer. That may or may not be 412 415 * fixed in the future version of the validation layer. 413 416 */ 414 - vk_set_image_layout(&c->vk, cmd_buffer, sc->base.images[i], 0, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, 417 + vk_set_image_layout(vk, cmd_buffer, sc->base.images[i], 0, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, 415 418 VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, subresource_range); 416 419 } 417 420 418 - ret = vk_submit_cmd_buffer(&c->vk, cmd_buffer); 421 + ret = vk_submit_cmd_buffer(vk, cmd_buffer); 419 422 if (ret != VK_SUCCESS) { 420 423 return XRT_ERROR_FAILED_TO_SUBMIT_VULKAN_COMMANDS; 421 424 } ··· 423 426 // Prerecord command buffers for swapchain image ownership/layout 424 427 // transitions 425 428 for (uint32_t i = 0; i < xsc->num_images; i++) { 426 - ret = vk_init_cmd_buffer(&c->vk, &sc->acquire[i]); 429 + ret = vk_init_cmd_buffer(vk, &sc->acquire[i]); 427 430 if (ret != VK_SUCCESS) { 428 431 return XRT_ERROR_VULKAN; 429 432 } 430 - ret = vk_init_cmd_buffer(&c->vk, &sc->release[i]); 433 + ret = vk_init_cmd_buffer(vk, &sc->release[i]); 431 434 if (ret != VK_SUCCESS) { 432 435 return XRT_ERROR_VULKAN; 433 436 } ··· 474 477 .dstAccessMask = 0, 475 478 .oldLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, 476 479 .newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, 477 - .srcQueueFamilyIndex = c->vk.queue_family_index, 480 + .srcQueueFamilyIndex = vk->queue_family_index, 478 481 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_EXTERNAL, 479 482 .image = sc->base.images[i], 480 483 .subresourceRange = subresource_range, 481 484 }; 482 485 483 486 //! @todo less conservative pipeline stage masks based on usage 484 - c->vk.vkCmdPipelineBarrier(sc->acquire[i], VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 485 - VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, 0, NULL, 0, NULL, 1, &acquire); 486 - c->vk.vkCmdPipelineBarrier(sc->release[i], VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 487 - VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 1, &release); 487 + vk->vkCmdPipelineBarrier(sc->acquire[i], VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 488 + VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, 0, NULL, 0, NULL, 1, &acquire); 489 + vk->vkCmdPipelineBarrier(sc->release[i], VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 490 + VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 1, &release); 488 491 489 - ret = c->vk.vkEndCommandBuffer(sc->acquire[i]); 492 + ret = vk->vkEndCommandBuffer(sc->acquire[i]); 490 493 if (ret != VK_SUCCESS) { 491 - VK_ERROR((&c->vk), "vkEndCommandBuffer: %s", vk_result_string(ret)); 494 + VK_ERROR(vk, "vkEndCommandBuffer: %s", vk_result_string(ret)); 492 495 return XRT_ERROR_VULKAN; 493 496 } 494 - ret = c->vk.vkEndCommandBuffer(sc->release[i]); 497 + ret = vk->vkEndCommandBuffer(sc->release[i]); 495 498 if (ret != VK_SUCCESS) { 496 - VK_ERROR((&c->vk), "vkEndCommandBuffer: %s", vk_result_string(ret)); 499 + VK_ERROR(vk, "vkEndCommandBuffer: %s", vk_result_string(ret)); 497 500 return XRT_ERROR_VULKAN; 498 501 } 499 502 }