From d67cfcbd010d184d607df597e97fba1c4b213507 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 14 Jun 2021 11:30:33 -0700 Subject: [PATCH] vkr: add a meson option to enable the validation layer With -Dvenus-validation=true, vkr will enable the validation layer by setting ctx->validate_level = VKR_CONTEXT_VALIDATE_ON; ctx->validate_fatal = false; We would like to set ctx->validate_fatal to true, but even vulkaninfo has validation errors. We should create a list of VUIDs that are considered non-fatal before we can set ctx->validate_fatal to true. Signed-off-by: Chia-I Wu Reviewed-by: Yiwei Zhang --- config.h.meson | 1 + meson.build | 5 +++++ meson_options.txt | 7 +++++++ src/vkr_renderer.c | 11 +++++++++-- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/config.h.meson b/config.h.meson index def3150..a16796f 100644 --- a/config.h.meson +++ b/config.h.meson @@ -5,6 +5,7 @@ #mesondefine HAVE_EPOXY_GLX_H #mesondefine ENABLE_MINIGBM_ALLOCATION #mesondefine ENABLE_VENUS +#mesondefine ENABLE_VENUS_VALIDATE #mesondefine HAVE_FUNC_ATTRIBUTE_VISIBILITY #mesondefine HAVE_EVENTFD_H #mesondefine HAVE_DLFCN_H diff --git a/meson.build b/meson.build index 2ccc20a..9c878bd 100644 --- a/meson.build +++ b/meson.build @@ -203,9 +203,14 @@ if with_glx endif with_venus = get_option('venus-experimental') +with_venus_validate = get_option('venus-validate') if with_venus venus_dep = dependency('vulkan') conf_data.set('ENABLE_VENUS', 1) + + if with_venus_validate + conf_data.set('ENABLE_VENUS_VALIDATE', 1) + endif endif if cc.compiles('void __attribute__((hidden)) func() {}') diff --git a/meson_options.txt b/meson_options.txt index ddcd44b..52b8df4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -45,6 +45,13 @@ option( description : 'enable support for venus' ) +option( + 'venus-validate', + type : 'boolean', + value : 'false', + description : 'enable the validation layer for venus' +) + option( 'tests', type : 'boolean', diff --git a/src/vkr_renderer.c b/src/vkr_renderer.c index 040b6a9..9138e8f 100644 --- a/src/vkr_renderer.c +++ b/src/vkr_renderer.c @@ -4742,8 +4742,15 @@ vkr_context_create(size_t debug_len, const char *debug_name) memcpy(ctx->debug_name, debug_name, debug_len); ctx->debug_name[debug_len] = '\0'; - ctx->validate_level = - VKR_DEBUG(VALIDATE) ? VKR_CONTEXT_VALIDATE_FULL : VKR_CONTEXT_VALIDATE_NONE; +#ifdef ENABLE_VENUS_VALIDATE + ctx->validate_level = VKR_CONTEXT_VALIDATE_ON; + ctx->validate_fatal = false; /* TODO set this to true */ +#else + ctx->validate_level = VKR_CONTEXT_VALIDATE_NONE; + ctx->validate_fatal = false; +#endif + if (VKR_DEBUG(VALIDATE)) + ctx->validate_level = VKR_CONTEXT_VALIDATE_FULL; if (mtx_init(&ctx->mutex, mtx_plain) != thrd_success) { free(ctx->debug_name);