Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-02-06 01:07:53 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-02-06 01:07:53 +0300
commit6f531aba9486c93e0cfca8c3170a3522a0a29820 (patch)
treec7d7b875fc7de80aa7afa0cb0784248c8e266397
parent5c9ce9d066cbfa12e01e411fd5c46bd7043a74b2 (diff)
GPU: Debug: Avoid double printing of compilation issues
To avoid that, we simply filter using a debug group.
-rw-r--r--source/blender/gpu/GPU_debug.h2
-rw-r--r--source/blender/gpu/intern/gpu_shader.cc5
-rw-r--r--source/blender/gpu/opengl/gl_debug.cc5
3 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_debug.h b/source/blender/gpu/GPU_debug.h
index 9796ac63272..18a35f9c71a 100644
--- a/source/blender/gpu/GPU_debug.h
+++ b/source/blender/gpu/GPU_debug.h
@@ -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);
/**
diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc
index c3842ae2995..b670b240a03 100644
--- a/source/blender/gpu/intern/gpu_shader.cc
+++ b/source/blender/gpu/intern/gpu_shader.cc
@@ -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"
@@ -273,6 +274,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()) {
@@ -393,9 +396,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);
}
diff --git a/source/blender/gpu/opengl/gl_debug.cc b/source/blender/gpu/opengl/gl_debug.cc
index 4b78f20824b..fe558677f56 100644
--- a/source/blender/gpu/opengl/gl_debug.cc
+++ b/source/blender/gpu/opengl/gl_debug.cc
@@ -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: