GPU: Validate All Statically Defined Shaders As Argument
This PR adds a new command line argument to validate all statically defined shaders. It is useful for platform support to understand what isn't working. It only checks statically defined shaders. Dynamic shaders (EEVEE/Compositor) can still be fail. The report is printed to console. After checking with windows platform and triaging we could also add it to gpu debug script. There is a risk of adding it there as it might crash and don't store any output. Pull Request: https://projects.blender.org/blender/blender/pulls/117326
This commit is contained in:
@@ -216,12 +216,13 @@ enum {
|
||||
G_DEBUG_GPU = (1 << 16), /* gpu debug */
|
||||
G_DEBUG_IO = (1 << 17), /* IO Debugging (for Collada, ...). */
|
||||
G_DEBUG_GPU_FORCE_WORKAROUNDS = (1 << 18), /* force gpu workarounds bypassing detections. */
|
||||
G_DEBUG_GPU_RENDERDOC = (1 << 19), /* Enable RenderDoc integration. */
|
||||
G_DEBUG_XR = (1 << 20), /* XR/OpenXR messages */
|
||||
G_DEBUG_XR_TIME = (1 << 21), /* XR/OpenXR timing messages */
|
||||
G_DEBUG_GPU_COMPILE_SHADERS = (1 << 19), /* Compile all statically defined shaders. . */
|
||||
G_DEBUG_GPU_RENDERDOC = (1 << 20), /* Enable RenderDoc integration. */
|
||||
G_DEBUG_XR = (1 << 21), /* XR/OpenXR messages */
|
||||
G_DEBUG_XR_TIME = (1 << 22), /* XR/OpenXR timing messages */
|
||||
|
||||
G_DEBUG_GHOST = (1 << 22), /* Debug GHOST module. */
|
||||
G_DEBUG_WINTAB = (1 << 23), /* Debug Wintab. */
|
||||
G_DEBUG_GHOST = (1 << 23), /* Debug GHOST module. */
|
||||
G_DEBUG_WINTAB = (1 << 24), /* Debug Wintab. */
|
||||
};
|
||||
|
||||
#define G_DEBUG_ALL \
|
||||
|
||||
@@ -332,6 +332,13 @@ typedef enum {
|
||||
*/
|
||||
int GPU_shader_get_builtin_uniform(GPUShader *shader, int builtin);
|
||||
|
||||
/**
|
||||
* Compile all staticly defined shaders and print a report to the console.
|
||||
*
|
||||
* This is used for platform support, where bug reports can list all failing shaders.
|
||||
*/
|
||||
void GPU_shader_compile_static();
|
||||
|
||||
/** DEPRECATED: Use hardcoded buffer location instead. */
|
||||
typedef enum {
|
||||
GPU_UNIFORM_BLOCK_VIEW = 0, /* viewBlock */
|
||||
|
||||
@@ -447,6 +447,12 @@ GPUShader *GPU_shader_create_from_python(const char *vertcode,
|
||||
return sh;
|
||||
}
|
||||
|
||||
void GPU_shader_compile_static()
|
||||
{
|
||||
printf("Compiling all static GPU shaders. This process takes a while.\n");
|
||||
gpu_shader_create_info_compile("");
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
@@ -167,6 +167,10 @@ void WM_init_gpu()
|
||||
|
||||
GPU_pass_cache_init();
|
||||
|
||||
if (G.debug & G_DEBUG_GPU_COMPILE_SHADERS) {
|
||||
GPU_shader_compile_static();
|
||||
}
|
||||
|
||||
gpu_is_init = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -664,6 +664,7 @@ static void print_help(bArgs *ba, bool all)
|
||||
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-compile-shaders");
|
||||
if (defs.with_renderdoc) {
|
||||
BLI_args_print_arg_doc(ba, "--debug-gpu-renderdoc");
|
||||
}
|
||||
@@ -1209,6 +1210,17 @@ static int arg_handle_debug_gpu_set(int /*argc*/, const char ** /*argv*/, void *
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char arg_handle_debug_gpu_compile_shaders_set_doc[] =
|
||||
"\n"
|
||||
"\tCompile all staticly defined shaders to test platform compatibility.";
|
||||
static int arg_handle_debug_gpu_compile_shaders_set(int /*argc*/,
|
||||
const char ** /*argv*/,
|
||||
void * /*data*/)
|
||||
{
|
||||
G.debug |= G_DEBUG_GPU_COMPILE_SHADERS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char arg_handle_debug_gpu_renderdoc_set_doc[] =
|
||||
"\n"
|
||||
"\tEnable Renderdoc integration for GPU frame grabbing and debugging.";
|
||||
@@ -2418,6 +2430,11 @@ void main_args_setup(bContext *C, bArgs *ba, bool all)
|
||||
CB_EX(arg_handle_debug_mode_generic_set, jobs),
|
||||
(void *)G_DEBUG_JOBS);
|
||||
BLI_args_add(ba, nullptr, "--debug-gpu", CB(arg_handle_debug_gpu_set), nullptr);
|
||||
BLI_args_add(ba,
|
||||
nullptr,
|
||||
"--debug-gpu-compile-shaders",
|
||||
CB(arg_handle_debug_gpu_compile_shaders_set),
|
||||
nullptr);
|
||||
if (defs.with_renderdoc) {
|
||||
BLI_args_add(
|
||||
ba, nullptr, "--debug-gpu-renderdoc", CB(arg_handle_debug_gpu_renderdoc_set), nullptr);
|
||||
|
||||
Reference in New Issue
Block a user