diff options
Diffstat (limited to 'source/blender/gpu/intern/gpu_shader_private.hh')
-rw-r--r-- | source/blender/gpu/intern/gpu_shader_private.hh | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_shader_private.hh b/source/blender/gpu/intern/gpu_shader_private.hh index 281f01dbc22..ebdfc3478f8 100644 --- a/source/blender/gpu/intern/gpu_shader_private.hh +++ b/source/blender/gpu/intern/gpu_shader_private.hh @@ -29,6 +29,8 @@ namespace blender { namespace gpu { +class GPULogParser; + /** * Implementation of shader compilation and uniforms handling. * Base class which is then specialized for each implementation (GL, VK, ...). @@ -74,7 +76,11 @@ class Shader { }; protected: - void print_log(Span<const char *> sources, char *log, const char *stage, const bool error); + void print_log(Span<const char *> sources, + char *log, + const char *stage, + const bool error, + GPULogParser *parser); }; /* Syntactic sugar. */ @@ -91,6 +97,37 @@ static inline const Shader *unwrap(const GPUShader *vert) return reinterpret_cast<const Shader *>(vert); } +enum class Severity { + Unknown, + Warning, + Error, +}; + +struct LogCursor { + int source = -1; + int row = -1; + int column = -1; +}; + +struct GPULogItem { + LogCursor cursor; + Severity severity = Severity::Unknown; +}; + +class GPULogParser { + public: + virtual char *parse_line(char *log_line, GPULogItem &log_item) = 0; + + protected: + char *skip_severity(char *log_line, + GPULogItem &log_item, + const char *error_msg, + const char *warning_msg) const; + char *skip_separators(char *log_line, char sep1, char sep2, char sep3) const; + + MEM_CXX_CLASS_ALLOC_FUNCS("GPULogParser"); +}; + } // namespace gpu } // namespace blender |