diff options
author | Brian <[email protected]> | 2007-02-26 16:32:00 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2007-02-26 16:32:00 -0700 |
commit | 4b8d75e2e6ba72bbf772a75d7167c537c6e630f7 (patch) | |
tree | 63e15edf47fad1a58ee0a71302fb0e73456b2695 /src/mesa/shader/slang/slang_compile.c | |
parent | f446e58e45d7317173497eddbd8b26ea6c28fcb4 (diff) |
fix logic for reporting errors
Diffstat (limited to 'src/mesa/shader/slang/slang_compile.c')
-rw-r--r-- | src/mesa/shader/slang/slang_compile.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index dc2e680e991..4609de684a0 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -1898,6 +1898,17 @@ compile_with_grammar(grammar id, const char *source, slang_code_unit * unit, grammar_get_last_error((byte *) (buf), sizeof(buf), &pos); slang_info_log_error(infolog, buf); /* syntax error (possibly in library code) */ +#if 0 + { + int line, col; + char *s; + s = (char *) _mesa_find_line_column((const GLubyte *) source, + (const GLubyte *) source + pos, + &line, &col); + printf("Error on line %d, col %d: %s\n", line, col, s); + } +#endif + return GL_FALSE; } slang_string_free(&preprocessed); @@ -2070,16 +2081,19 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) success = compile_shader(ctx, &obj, type, &info_log, shader); - if (!success || info_log.error_flag) { - success = GL_FALSE; + /* free shader's prev info log */ + if (shader->InfoLog) { + _mesa_free(shader->InfoLog); + shader->InfoLog = NULL; + } + + if (info_log.text) { /* copy info-log string to shader object */ - if (info_log.text) { - if (shader->InfoLog) { - free(shader->InfoLog); - shader->InfoLog = NULL; - } - shader->InfoLog = strdup(info_log.text); - } + shader->InfoLog = _mesa_strdup(info_log.text); + } + + if (info_log.error_flag) { + success = GL_FALSE; } slang_info_log_destruct(&info_log); |