mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
c/client: Add renderdoc_enabled implementation for VK and EGL
Currently only used on Android platforms.
This commit is contained in:
parent
23595274ee
commit
f93d08c7f5
|
@ -582,6 +582,7 @@ xrt_gfx_provider_create_gl_egl(struct xrt_compositor_native *xcn,
|
|||
struct client_egl_compositor *ceglc = U_TYPED_CALLOC(struct client_egl_compositor);
|
||||
ceglc->current.dpy = display;
|
||||
ceglc->current.ctx = context;
|
||||
ceglc->base.renderdoc_enabled = renderdoc_enabled;
|
||||
|
||||
bool bret = client_gl_compositor_init( //
|
||||
&ceglc->base, // c
|
||||
|
|
|
@ -387,6 +387,11 @@ client_gl_compositor_layer_commit(struct xrt_compositor *xc, xrt_graphics_sync_h
|
|||
|
||||
struct client_gl_compositor *c = client_gl_compositor(xc);
|
||||
|
||||
if (c->renderdoc_enabled) {
|
||||
glDebugMessageInsert(GL_DEBUG_SOURCE_THIRD_PARTY, GL_DEBUG_TYPE_MARKER, 1,
|
||||
GL_DEBUG_SEVERITY_NOTIFICATION, -1, "vr-marker,frame_end,type,application");
|
||||
}
|
||||
|
||||
// We make the sync object, not st/oxr which is our user.
|
||||
assert(!xrt_graphics_sync_handle_is_valid(sync_handle));
|
||||
|
||||
|
|
|
@ -170,6 +170,8 @@ struct client_gl_compositor
|
|||
* know it is bound to a thread.
|
||||
*/
|
||||
struct os_mutex context_mutex;
|
||||
|
||||
bool renderdoc_enabled;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -594,6 +594,15 @@ client_vk_compositor_layer_commit(struct xrt_compositor *xc, xrt_graphics_sync_h
|
|||
|
||||
struct client_vk_compositor *c = client_vk_compositor(xc);
|
||||
|
||||
if (c->renderdoc_enabled) {
|
||||
struct vk_bundle *vk = &c->vk;
|
||||
VkResult ret = vk_cmd_pool_submit_cmd_buffer(vk, &c->pool, c->dcb);
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(vk, "vk_cmd_pool_submit_cmd_buffer: %s %u", vk_result_string(ret), ret);
|
||||
return XRT_ERROR_FAILED_TO_SUBMIT_VULKAN_COMMANDS;
|
||||
}
|
||||
}
|
||||
|
||||
xrt_result_t xret = XRT_SUCCESS;
|
||||
if (submit_handle(c, sync_handle, &xret)) {
|
||||
return xret;
|
||||
|
@ -782,6 +791,7 @@ client_vk_compositor_create(struct xrt_compositor_native *xcn,
|
|||
bool external_semaphore_fd_enabled,
|
||||
bool timeline_semaphore_enabled,
|
||||
bool debug_utils_enabled,
|
||||
bool renderdoc_enabled,
|
||||
uint32_t queueFamilyIndex,
|
||||
uint32_t queueIndex)
|
||||
{
|
||||
|
@ -817,6 +827,7 @@ client_vk_compositor_create(struct xrt_compositor_native *xcn,
|
|||
}
|
||||
|
||||
c->base.base.info.format_count = xcn->base.info.format_count;
|
||||
c->renderdoc_enabled = renderdoc_enabled;
|
||||
|
||||
// Default to info.
|
||||
enum u_logging_level log_level = debug_get_log_option_vulkan_log();
|
||||
|
@ -867,6 +878,25 @@ client_vk_compositor_create(struct xrt_compositor_native *xcn,
|
|||
c->base.base.info.max_tetxure_size = pdp.limits.maxImageDimension2D;
|
||||
}
|
||||
|
||||
if (!c->renderdoc_enabled) {
|
||||
return c;
|
||||
}
|
||||
|
||||
struct vk_bundle *vk = &c->vk;
|
||||
if (!vk->has_EXT_debug_utils) {
|
||||
c->renderdoc_enabled = false;
|
||||
return c;
|
||||
}
|
||||
|
||||
// Create a dummy VkCommandBuffer and submit it to the VkQueue, just for inserting a debug label into
|
||||
// RenderDoc for triggering the capture.
|
||||
ret = vk_cmd_pool_create_begin_insert_label_and_end_cmd_buffer_locked(
|
||||
vk, &c->pool, "vr-marker,frame_end,type,application", &c->dcb);
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(vk, "vk_cmd_pool_create_insert_debug_label_and_end_cmd_buffer: %s", vk_result_string(ret));
|
||||
goto err_pool;
|
||||
}
|
||||
|
||||
return c;
|
||||
|
||||
err_pool:
|
||||
|
|
|
@ -78,6 +78,9 @@ struct client_vk_compositor
|
|||
struct vk_bundle vk;
|
||||
|
||||
struct vk_cmd_pool pool;
|
||||
|
||||
bool renderdoc_enabled;
|
||||
VkCommandBuffer dcb;
|
||||
};
|
||||
|
||||
|
||||
|
@ -106,6 +109,7 @@ client_vk_compositor_create(struct xrt_compositor_native *xcn,
|
|||
bool external_semaphore_fd_enabled,
|
||||
bool timeline_semaphore_enabled,
|
||||
bool debug_utils_enabled,
|
||||
bool renderdoc_enabled,
|
||||
uint32_t queueFamilyIndex,
|
||||
uint32_t queueIndex);
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ xrt_gfx_vk_provider_create(struct xrt_compositor_native *xcn,
|
|||
external_semaphore_fd_enabled, //
|
||||
timeline_semaphore_enabled, //
|
||||
debug_utils_enabled, //
|
||||
renderdoc_enabled, //
|
||||
queue_family_index, //
|
||||
queue_index); //
|
||||
|
||||
|
|
Loading…
Reference in a new issue