c/client: Implement excplicit transitions in Vulkan and D3D12

This commit is contained in:
Jakob Bornecrantz 2023-03-24 20:21:00 +00:00
parent 45fe1d6ed0
commit 7147e47508
2 changed files with 22 additions and 22 deletions

View file

@ -357,10 +357,6 @@ client_d3d12_swapchain_wait_image(struct xrt_swapchain *xsc, uint64_t timeout_ns
// OK, we got the image in the native compositor, now need the keyed mutex in d3d11.
xret = sc->data->keyed_mutex_collection.waitKeyedMutex(index, timeout_ns);
}
if (xret == XRT_SUCCESS) {
// OK, we got the image in the native compositor, now need the transition in d3d12.
xret = client_d3d12_swapchain_barrier_to_app(sc, index);
}
//! @todo discard old contents?
return xret;
@ -369,7 +365,16 @@ client_d3d12_swapchain_wait_image(struct xrt_swapchain *xsc, uint64_t timeout_ns
static xrt_result_t
client_d3d12_swapchain_barrier_image(struct xrt_swapchain *xsc, enum xrt_barrier_direction direction, uint32_t index)
{
return XRT_SUCCESS;
struct client_d3d12_swapchain *sc = as_client_d3d12_swapchain(xsc);
xrt_result_t xret;
switch (direction) {
case XRT_BARRIER_TO_APP: xret = client_d3d12_swapchain_barrier_to_app(sc, index); break;
case XRT_BARRIER_TO_COMP: xret = client_d3d12_swapchain_barrier_to_compositor(sc, index); break;
default: assert(false);
}
return xret;
}
static xrt_result_t
@ -385,9 +390,6 @@ client_d3d12_swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index)
xret = sc->data->keyed_mutex_collection.releaseKeyedMutex(index);
}
if (xret == XRT_SUCCESS) {
xret = client_d3d12_swapchain_barrier_to_compositor(sc, index);
}
return xret;
}

View file

@ -289,11 +289,6 @@ client_vk_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *out_index
return xret;
}
xret = submit_image_barrier(sc, sc->acquire[index]);
if (xret != XRT_SUCCESS) {
return xret;
}
// Finally done.
*out_index = index;
@ -314,7 +309,18 @@ client_vk_swapchain_wait_image(struct xrt_swapchain *xsc, uint64_t timeout_ns, u
static xrt_result_t
client_vk_swapchain_barrier_image(struct xrt_swapchain *xsc, enum xrt_barrier_direction direction, uint32_t index)
{
return XRT_SUCCESS;
COMP_TRACE_MARKER();
struct client_vk_swapchain *sc = client_vk_swapchain(xsc);
VkCommandBuffer cmd_buffer = VK_NULL_HANDLE;
switch (direction) {
case XRT_BARRIER_TO_APP: cmd_buffer = sc->acquire[index]; break;
case XRT_BARRIER_TO_COMP: cmd_buffer = sc->release[index]; break;
default: assert(false);
}
return submit_image_barrier(sc, cmd_buffer);
}
static xrt_result_t
@ -323,14 +329,6 @@ client_vk_swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index)
COMP_TRACE_MARKER();
struct client_vk_swapchain *sc = client_vk_swapchain(xsc);
xrt_result_t xret;
xret = submit_image_barrier(sc, sc->release[index]);
if (xret != XRT_SUCCESS) {
return xret;
}
COMP_TRACE_IDENT(release_image);
// Pipe down call into native swapchain.
return xrt_swapchain_release_image(&sc->xscn->base, index);