GPU: Debug: Avoid double printing of compilation issues

To avoid that, we simply filter using a debug group.
This commit is contained in:
Clément Foucault 2022-02-05 23:07:53 +01:00
parent f2087dfc69
commit 3a90f93507
3 changed files with 12 additions and 0 deletions

View File

@ -31,6 +31,8 @@
extern "C" {
#endif
#define GPU_DEBUG_SHADER_COMPILATION_GROUP "Shader Compilation"
void GPU_debug_group_begin(const char *name);
void GPU_debug_group_end(void);
/**

View File

@ -26,6 +26,7 @@
#include "BLI_string_utils.h"
#include "GPU_capabilities.h"
#include "GPU_debug.h"
#include "GPU_matrix.h"
#include "GPU_platform.h"
@ -268,6 +269,8 @@ GPUShader *GPU_shader_create_from_info(const GPUShaderCreateInfo *_info)
const_cast<ShaderCreateInfo &>(info).finalize();
GPU_debug_group_begin(GPU_DEBUG_SHADER_COMPILATION_GROUP);
/* At least a vertex shader and a fragment shader are required, or only a compute shader. */
if (info.compute_source_.is_empty()) {
if (info.vertex_source_.is_empty()) {
@ -425,9 +428,11 @@ GPUShader *GPU_shader_create_from_info(const GPUShaderCreateInfo *_info)
if (!shader->finalize(&info)) {
delete shader;
GPU_debug_group_end();
return nullptr;
}
GPU_debug_group_end();
return wrap(shader);
}

View File

@ -108,6 +108,11 @@ static void APIENTRY debug_callback(GLenum UNUSED(source),
GPU_debug_get_groups_names(sizeof(debug_groups), debug_groups);
CLG_Severity clog_severity;
if (GPU_debug_group_match(GPU_DEBUG_SHADER_COMPILATION_GROUP)) {
/** Do not duplicate shader compilation error/warnings. */
return;
}
switch (type) {
case GL_DEBUG_TYPE_ERROR:
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: