Help text: support extracting Vulkan & OpenGL args even when disabled

Support extracting arguments for all GPU backends irrespective
of the build argumetns.
This commit is contained in:
Campbell Barton
2025-08-13 09:26:02 +10:00
parent 72bda4eaee
commit 0d1bece64b

View File

@@ -90,7 +90,9 @@ struct BuildDefs {
bool with_freestyle;
bool with_libmv;
bool with_opencolorio;
bool with_opengl_backend;
bool with_renderdoc;
bool with_vulkan_backend;
bool with_xr_openxr;
};
@@ -121,12 +123,18 @@ static void build_defs_init(BuildDefs *build_defs, bool force_all)
# ifdef WITH_LIBMV
build_defs->with_libmv = true;
# endif
# ifdef WITH_OPENGL_BACKEND
build_defs->with_opengl_backend = true;
# endif
# ifdef WITH_OPENCOLORIO
build_defs->with_opencolorio = true;
# endif
# ifdef WITH_RENDERDOC
build_defs->with_renderdoc = true;
# endif
# ifdef WITH_VULKAN_BACKEND
build_defs->with_vulkan_backend = true;
# endif
# ifdef WITH_XR_OPENXR
build_defs->with_xr_openxr = true;
# endif
@@ -750,9 +758,9 @@ static void print_help(bArgs *ba, bool all)
BLI_args_print_arg_doc(ba, "--debug-gpu-scope-capture");
BLI_args_print_arg_doc(ba, "--debug-gpu-renderdoc");
}
# ifdef WITH_VULKAN_BACKEND
BLI_args_print_arg_doc(ba, "--debug-gpu-vulkan-local-read");
# endif
if (defs.with_vulkan_backend) {
BLI_args_print_arg_doc(ba, "--debug-gpu-vulkan-local-read");
}
BLI_args_print_arg_doc(ba, "--debug-wm");
if (defs.with_xr_openxr) {
BLI_args_print_arg_doc(ba, "--debug-xr");
@@ -776,9 +784,9 @@ static void print_help(bArgs *ba, bool all)
PRINT("\n");
PRINT("GPU Options:\n");
BLI_args_print_arg_doc(ba, "--gpu-backend");
# ifdef WITH_OPENGL_BACKEND
BLI_args_print_arg_doc(ba, "--gpu-compilation-subprocesses");
# endif
if (defs.with_opengl_backend) {
BLI_args_print_arg_doc(ba, "--gpu-compilation-subprocesses");
}
BLI_args_print_arg_doc(ba, "--profile-gpu");
PRINT("\n");
@@ -1379,11 +1387,9 @@ static const char arg_handle_debug_mode_generic_set_doc_depsgraph_uid[] =
static const char arg_handle_debug_mode_generic_set_doc_gpu_force_workarounds[] =
"\n\t"
"Enable workarounds for typical GPU issues and disable all GPU extensions.";
# ifdef WITH_VULKAN_BACKEND
static const char arg_handle_debug_mode_generic_set_doc_gpu_force_vulkan_local_read[] =
"\n\t"
"Force Vulkan dynamic rendering local read when supported by device.";
# endif
static int arg_handle_debug_mode_generic_set(int /*argc*/, const char ** /*argv*/, void *data)
{
@@ -1503,7 +1509,12 @@ static const char arg_handle_debug_gpu_scope_capture_set_doc[] =
static int arg_handle_debug_gpu_scope_capture_set(int argc, const char **argv, void * /*data*/)
{
if (argc > 1) {
# ifdef WITH_RENDERDOC
STRNCPY(G.gpu_debug_scope_name, argv[1]);
# else
UNUSED_VARS(argc, argv);
BLI_assert_unreachable();
# endif
return 1;
}
fprintf(stderr, "\nError: you must specify a scope name to capture.\n");
@@ -1519,6 +1530,8 @@ static int arg_handle_debug_gpu_renderdoc_set(int /*argc*/,
{
# ifdef WITH_RENDERDOC
G.debug |= G_DEBUG_GPU_RENDERDOC | G_DEBUG_GPU;
# else
BLI_assert_unreachable();
# endif
return 0;
}
@@ -1590,7 +1603,6 @@ static int arg_handle_gpu_backend_set(int argc, const char **argv, void * /*data
return 1;
}
# ifdef WITH_OPENGL_BACKEND
static const char arg_handle_gpu_compilation_subprocesses_set_doc[] =
"\n"
"\tOverride the Max Compilation Subprocesses setting (OpenGL only).";
@@ -1614,7 +1626,12 @@ static int arg_handle_gpu_compilation_subprocesses_set(int argc,
return 0;
}
# ifdef WITH_OPENGL_BACKEND
GPU_compilation_subprocess_override_set(subprocesses);
# else
UNUSED_VARS(subprocesses);
BLI_assert_unreachable();
# endif
return 1;
}
fprintf(stderr,
@@ -1624,7 +1641,6 @@ static int arg_handle_gpu_compilation_subprocesses_set(int argc,
arg_id);
return 0;
}
# endif
static const char arg_handle_debug_fpe_set_doc[] =
"\n\t"
@@ -2731,13 +2747,13 @@ void main_args_setup(bContext *C, bArgs *ba, bool all)
/* GPU backend selection should be part of #ARG_PASS_ENVIRONMENT for correct GPU context
* selection for animation player. */
BLI_args_add(ba, nullptr, "--gpu-backend", CB_ALL(arg_handle_gpu_backend_set), nullptr);
# ifdef WITH_OPENGL_BACKEND
BLI_args_add(ba,
nullptr,
"--gpu-compilation-subprocesses",
CB(arg_handle_gpu_compilation_subprocesses_set),
nullptr);
# endif
if (defs.with_opengl_backend) {
BLI_args_add(ba,
nullptr,
"--gpu-compilation-subprocesses",
CB(arg_handle_gpu_compilation_subprocesses_set),
nullptr);
}
BLI_args_add(ba, nullptr, "--profile-gpu", CB(arg_handle_profile_gpu_set), nullptr);
/* Pass: Background Mode & Settings
@@ -2917,13 +2933,13 @@ void main_args_setup(bContext *C, bArgs *ba, bool all)
"--debug-gpu-force-workarounds",
CB_EX(arg_handle_debug_mode_generic_set, gpu_force_workarounds),
(void *)G_DEBUG_GPU_FORCE_WORKAROUNDS);
# ifdef WITH_VULKAN_BACKEND
BLI_args_add(ba,
nullptr,
"--debug-gpu-vulkan-local-read",
CB_EX(arg_handle_debug_mode_generic_set, gpu_force_vulkan_local_read),
(void *)G_DEBUG_GPU_FORCE_VULKAN_LOCAL_READ);
# endif
if (defs.with_vulkan_backend) {
BLI_args_add(ba,
nullptr,
"--debug-gpu-vulkan-local-read",
CB_EX(arg_handle_debug_mode_generic_set, gpu_force_vulkan_local_read),
(void *)G_DEBUG_GPU_FORCE_VULKAN_LOCAL_READ);
}
BLI_args_add(ba, nullptr, "--debug-exit-on-error", CB(arg_handle_debug_exit_on_error), nullptr);
BLI_args_add(ba, nullptr, "--verbose", CB(arg_handle_verbosity_set), nullptr);