mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-21 15:10:21 +01:00
vk/runtime,zink: only integrate renderdoc on supported platforms
It is not actually available to all the platforms mesa can be compiled
to, so let's keep an opt-in list of supported platforms instead, and
compile it out on all other platforms.
Fixes: 48a0478126 ("zink: add renderdoc handling")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39176>
This commit is contained in:
parent
f009ee9bfd
commit
93390d4b73
7 changed files with 33 additions and 2 deletions
|
|
@ -2228,6 +2228,13 @@ if get_option('android-libperfetto').enabled()
|
|||
pre_args += '-DANDROID_LIBPERFETTO'
|
||||
endif
|
||||
|
||||
# Platforms where RenderDoc integration actually works
|
||||
renderdoc_integration_supported = [
|
||||
'linux',
|
||||
'android',
|
||||
].contains(host_machine.system())
|
||||
pre_args += '-DHAVE_RENDERDOC_INTEGRATION=@0@'.format(renderdoc_integration_supported)
|
||||
|
||||
with_teflon = get_option('teflon')
|
||||
if with_teflon and with_tests
|
||||
dep_flatbuffers = dependency('flatbuffers')
|
||||
|
|
|
|||
|
|
@ -570,6 +570,7 @@ zink_start_batch(struct zink_context *ctx)
|
|||
|
||||
bs->fence.completed = false;
|
||||
|
||||
#if HAVE_RENDERDOC_INTEGRATION
|
||||
if (VKCTX(CmdInsertDebugUtilsLabelEXT) && screen->renderdoc_api) {
|
||||
VkDebugUtilsLabelEXT capture_label;
|
||||
/* Magic fallback which lets us bridge the Wine barrier over to Linux RenderDoc. */
|
||||
|
|
@ -588,6 +589,7 @@ zink_start_batch(struct zink_context *ctx)
|
|||
screen->renderdoc_api->StartFrameCapture(RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(screen->instance), NULL);
|
||||
screen->renderdoc_capturing = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* descriptor buffers must always be bound at the start of a batch */
|
||||
if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_DB && !(ctx->flags & ZINK_CONTEXT_COPY_ONLY))
|
||||
|
|
@ -940,11 +942,13 @@ zink_end_batch(struct zink_context *ctx)
|
|||
submit_queue(bs, NULL, 0);
|
||||
}
|
||||
|
||||
#if HAVE_RENDERDOC_INTEGRATION
|
||||
if (!(ctx->flags & ZINK_CONTEXT_COPY_ONLY) && screen->renderdoc_capturing && !screen->renderdoc_capture_all &&
|
||||
p_atomic_read(&screen->renderdoc_frame) > screen->renderdoc_capture_end) {
|
||||
screen->renderdoc_api->EndFrameCapture(RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(screen->instance), NULL);
|
||||
screen->renderdoc_capturing = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -116,11 +116,13 @@ zink_context_destroy(struct pipe_context *pctx)
|
|||
struct pipe_framebuffer_state fb = {0};
|
||||
pctx->set_framebuffer_state(pctx, &fb);
|
||||
|
||||
#if HAVE_RENDERDOC_INTEGRATION
|
||||
if (screen->base.num_contexts == 1 && screen->renderdoc_capturing) {
|
||||
screen->renderdoc_capture_all = false;
|
||||
ctx->bs->has_work = true;
|
||||
pctx->flush(pctx, NULL, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (util_queue_is_initialized(&screen->flush_queue))
|
||||
util_queue_finish(&screen->flush_queue);
|
||||
|
|
@ -4223,7 +4225,9 @@ zink_flush(struct pipe_context *pctx,
|
|||
}
|
||||
|
||||
if (flags & PIPE_FLUSH_END_OF_FRAME) {
|
||||
#if HAVE_RENDERDOC_INTEGRATION
|
||||
p_atomic_inc(&screen->renderdoc_frame);
|
||||
#endif
|
||||
if (ctx->needs_present && ctx->needs_present->obj->dt_idx != UINT32_MAX &&
|
||||
zink_is_swapchain(ctx->needs_present)) {
|
||||
zink_kopper_readback_update(ctx, ctx->needs_present);
|
||||
|
|
|
|||
|
|
@ -1545,8 +1545,10 @@ zink_destroy_screen(struct pipe_screen *pscreen)
|
|||
}
|
||||
}
|
||||
|
||||
#if HAVE_RENDERDOC_INTEGRATION
|
||||
if (screen->renderdoc_capture_all && p_atomic_dec_zero(&num_screens))
|
||||
screen->renderdoc_api->EndFrameCapture(RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(screen->instance), NULL);
|
||||
#endif
|
||||
|
||||
hash_table_foreach(&screen->dts, entry)
|
||||
zink_kopper_deinit_displaytarget(screen, entry->data);
|
||||
|
|
@ -2326,7 +2328,7 @@ populate_format_props(struct zink_screen *screen)
|
|||
static void
|
||||
setup_renderdoc(struct zink_screen *screen)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
#if HAVE_RENDERDOC_INTEGRATION
|
||||
const char *capture_id = debug_get_option("ZINK_RENDERDOC", NULL);
|
||||
if (!capture_id)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,9 @@
|
|||
#include "vk_dispatch_table.h"
|
||||
#include "util/perf/cpu_trace.h"
|
||||
|
||||
#if HAVE_RENDERDOC_INTEGRATION
|
||||
#include "renderdoc_app.h"
|
||||
#endif
|
||||
|
||||
/* the descriptor binding id for fbfetch/input attachment */
|
||||
#define ZINK_FBFETCH_BINDING 5
|
||||
|
|
@ -1487,12 +1489,14 @@ struct zink_screen {
|
|||
|
||||
unsigned screen_id;
|
||||
|
||||
#if HAVE_RENDERDOC_INTEGRATION
|
||||
RENDERDOC_API_1_0_0 *renderdoc_api;
|
||||
unsigned renderdoc_capture_start;
|
||||
unsigned renderdoc_capture_end;
|
||||
unsigned renderdoc_frame;
|
||||
bool renderdoc_capturing;
|
||||
bool renderdoc_capture_all;
|
||||
#endif
|
||||
|
||||
struct vk_uncompacted_dispatch_table vk;
|
||||
|
||||
|
|
|
|||
|
|
@ -210,7 +210,9 @@ vk_instance_init(struct vk_instance *instance,
|
|||
instance->trace_trigger_file = os_get_option_secure("MESA_VK_TRACE_TRIGGER");
|
||||
}
|
||||
|
||||
#if HAVE_RENDERDOC_INTEGRATION
|
||||
simple_mtx_init(&instance->renderdoc_mtx, mtx_plain);
|
||||
#endif
|
||||
|
||||
#if !VK_LITE_RUNTIME_INSTANCE
|
||||
glsl_type_singleton_init_or_ref();
|
||||
|
|
@ -238,7 +240,9 @@ vk_instance_finish(struct vk_instance *instance)
|
|||
glsl_type_singleton_decref();
|
||||
#endif
|
||||
|
||||
#if HAVE_RENDERDOC_INTEGRATION
|
||||
simple_mtx_destroy(&instance->renderdoc_mtx);
|
||||
#endif
|
||||
|
||||
if (unlikely(!list_is_empty(&instance->debug_utils.callbacks))) {
|
||||
list_for_each_entry_safe(struct vk_debug_utils_messenger, messenger,
|
||||
|
|
@ -647,7 +651,7 @@ vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *pSupportedVersion)
|
|||
void
|
||||
vk_instance_start_renderdoc_capture(struct vk_instance *instance)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
#if HAVE_RENDERDOC_INTEGRATION
|
||||
simple_mtx_lock(&instance->renderdoc_mtx);
|
||||
|
||||
if (!instance->renderdoc_api) {
|
||||
|
|
@ -669,6 +673,7 @@ vk_instance_start_renderdoc_capture(struct vk_instance *instance)
|
|||
void
|
||||
vk_instance_end_renderdoc_capture(struct vk_instance *instance)
|
||||
{
|
||||
#if HAVE_RENDERDOC_INTEGRATION
|
||||
if (!instance->renderdoc_api)
|
||||
return;
|
||||
|
||||
|
|
@ -678,4 +683,5 @@ vk_instance_end_renderdoc_capture(struct vk_instance *instance)
|
|||
instance->renderdoc_api->EndFrameCapture(NULL, NULL);
|
||||
|
||||
simple_mtx_unlock(&instance->renderdoc_mtx);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,9 @@
|
|||
#include "util/simple_mtx.h"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
#if HAVE_RENDERDOC_INTEGRATION
|
||||
#include "renderdoc_app.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -180,9 +182,11 @@ struct vk_instance {
|
|||
/** Whether the capture mode is per-submit. */
|
||||
bool trace_per_submit;
|
||||
|
||||
#if HAVE_RENDERDOC_INTEGRATION
|
||||
/** For triggering renderdoc captures from inside the driver. */
|
||||
simple_mtx_t renderdoc_mtx;
|
||||
RENDERDOC_API_1_0_0 *renderdoc_api;
|
||||
#endif
|
||||
};
|
||||
|
||||
VK_DEFINE_HANDLE_CASTS(vk_instance, base, VkInstance,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue