diff options
Diffstat (limited to 'source/creator/creator_args.c')
-rw-r--r-- | source/creator/creator_args.c | 81 |
1 files changed, 74 insertions, 7 deletions
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index b3f5d24ee8c..2ebdcdb35ba 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -42,6 +42,8 @@ # include "BKE_scene.h" # include "BKE_sound.h" +# include "GPU_context.h" + # ifdef WITH_FFMPEG # include "IMB_imbuf.h" # endif @@ -579,6 +581,7 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo BLI_args_print_arg_doc(ba, "--debug-wintab"); BLI_args_print_arg_doc(ba, "--debug-gpu"); BLI_args_print_arg_doc(ba, "--debug-gpu-force-workarounds"); + BLI_args_print_arg_doc(ba, "--debug-gpu-disable-ssbo"); BLI_args_print_arg_doc(ba, "--debug-wm"); # ifdef WITH_XR_OPENXR BLI_args_print_arg_doc(ba, "--debug-xr"); @@ -655,12 +658,18 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo printf("\t...works as expected.\n\n"); printf("Environment Variables:\n"); - printf(" $BLENDER_USER_CONFIG Directory for user configuration files.\n"); - printf(" $BLENDER_USER_SCRIPTS Directory for user scripts.\n"); - printf(" $BLENDER_SYSTEM_SCRIPTS Directory for system wide scripts.\n"); - printf(" $BLENDER_USER_DATAFILES Directory for user data files (icons, translations, ..).\n"); - printf(" $BLENDER_SYSTEM_DATAFILES Directory for system wide data files.\n"); - printf(" $BLENDER_SYSTEM_PYTHON Directory for system Python libraries.\n"); + printf(" $BLENDER_USER_RESOURCES Top level directory for user files.\n"); + printf(" (other 'BLENDER_USER_*' variables override when set).\n"); + printf(" $BLENDER_USER_CONFIG Directory for user configuration files.\n"); + printf(" $BLENDER_USER_SCRIPTS Directory for user scripts.\n"); + printf(" $BLENDER_USER_DATAFILES Directory for user data files (icons, translations, ..).\n"); + printf("\n"); + printf(" $BLENDER_SYSTEM_RESOURCES Top level directory for system files.\n"); + printf(" (other 'BLENDER_SYSTEM_*' variables override when set).\n"); + printf(" $BLENDER_SYSTEM_SCRIPTS Directory for system wide scripts.\n"); + printf(" $BLENDER_SYSTEM_DATAFILES Directory for system wide data files.\n"); + printf(" $BLENDER_SYSTEM_PYTHON Directory for system Python libraries.\n"); + # ifdef WITH_OCIO printf(" $OCIO Path to override the OpenColorIO config file.\n"); # endif @@ -990,6 +999,9 @@ static const char arg_handle_debug_mode_generic_set_doc_depsgraph_uuid[] = 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."; +static const char arg_handle_debug_mode_generic_set_doc_gpu_disable_ssbo[] = + "\n\t" + "Disable usage of shader storage buffer objects."; static int arg_handle_debug_mode_generic_set(int UNUSED(argc), const char **UNUSED(argv), @@ -1101,6 +1113,52 @@ static int arg_handle_debug_gpu_set(int UNUSED(argc), return 0; } +static const char arg_handle_gpu_backend_set_doc[] = + "\n" + "\tForce to use a specific GPU backend. Valid options: " +# ifdef WITH_VULKAN_BACKEND + "'vulkan', " +# endif +# ifdef WITH_METAL_BACKEND + "'metal', " +# endif + "'opengl'."; +static int arg_handle_gpu_backend_set(int argc, const char **argv, void *UNUSED(data)) +{ + if (argc == 0) { + printf("\nError: GPU backend must follow '--gpu-backend'.\n"); + return 0; + } + + eGPUBackendType gpu_backend = GPU_BACKEND_NONE; + + if (STREQ(argv[1], "opengl")) { + gpu_backend = GPU_BACKEND_OPENGL; + } +# ifdef WITH_VULKAN_BACKEND + else if (STREQ(argv[1], "vulkan")) { + gpu_backend = GPU_BACKEND_VULKAN; + } +# endif +# ifdef WITH_METAL_BACKEND + else if (STREQ(argv[1], "metal")) { + gpu_backend = GPU_BACKEND_METAL; + } +# endif + else { + printf("\nError: Unrecognized GPU backend for '--gpu-backend'.\n"); + return 0; + } + + GPU_backend_type_selection_set(gpu_backend); + if (!GPU_backend_supported()) { + printf("\nError: GPU backend not supported.\n"); + return 0; + } + + return 1; +} + static const char arg_handle_debug_fpe_set_doc[] = "\n\t" "Enable floating-point exceptions."; @@ -1901,7 +1959,7 @@ static int arg_handle_python_exit_code_set(int argc, const char **argv, void *UN return 1; } - app_state.exit_code_on_error.python = (unsigned char)exit_code; + app_state.exit_code_on_error.python = (uchar)exit_code; return 1; } printf("\nError: you must specify an exit code number '%s'.\n", arg_id); @@ -2064,6 +2122,10 @@ void main_args_setup(bContext *C, bArgs *ba) BLI_args_add(ba, NULL, "--log-show-timestamp", CB(arg_handle_log_show_timestamp_set), ba); BLI_args_add(ba, NULL, "--log-file", CB(arg_handle_log_file_set), ba); + /* GPU backend selection should be part of ARG_PASS_ENVIRONMENT for correct GPU context selection + * for anim player. */ + BLI_args_add(ba, NULL, "--gpu-backend", CB(arg_handle_gpu_backend_set), NULL); + /* Pass: Background Mode & Settings * * Also and commands that exit after usage. */ @@ -2212,6 +2274,11 @@ void main_args_setup(bContext *C, bArgs *ba) "--debug-gpu-force-workarounds", CB_EX(arg_handle_debug_mode_generic_set, gpu_force_workarounds), (void *)G_DEBUG_GPU_FORCE_WORKAROUNDS); + BLI_args_add(ba, + NULL, + "--debug-gpu-disable-ssbo", + CB_EX(arg_handle_debug_mode_generic_set, gpu_disable_ssbo), + (void *)G_DEBUG_GPU_FORCE_DISABLE_SSBO); BLI_args_add(ba, NULL, "--debug-exit-on-error", CB(arg_handle_debug_exit_on_error), NULL); BLI_args_add(ba, NULL, "--verbose", CB(arg_handle_verbosity_set), NULL); |