[Mesa-dev] [PATCH 1/9] glsl: consolidate code
nobled
nobled at dreamwidth.org
Sun Apr 15 03:20:51 PDT 2012
On Fri, Apr 13, 2012 at 3:15 PM, Ian Romanick <idr at freedesktop.org> wrote:
> On 04/13/2012 08:51 AM, nobled wrote:
>
> This just occurred to me... Wouldn't it be easier to push all the compiler /
> linker error messages into the debug log in one shot *after* compilation (or
> linking) is done? Since the messages all start with either warning: or
> error: and end with a \n, they would be trivial to parse.
That would make it impossible to add something I was planning after
this got in; sorting warnings into the specific categories of
GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB,
GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB, GL_DEBUG_TYPE_PORTABILITY_ARB,
and GL_DEBUG_TYPE_PERFORMANCE_ARB.
>
> That would have a couple advantages:
>
> 1. Less churn in the patch series.
>
> 2. Less headaches trying to push gl_context deeper into the compiler. We
> intentionally tried to keep gl_context out of the compiler as much as
> possible.
It's already using the "&ctx->Extensions" struct in the exact same
places. It's definitely not any worse than the status quo, it's just a
pointer to a mesa struct of a different type.
By the way, is the long term plan to break the circular dependency
between libglsl and libmesa? mesa creates _mesa_glsl_parse_state
objects, and glsl needs structures defined in mesa headers and the
functions defined standalone_scaffolding.cpp.
>
> Just a thought...
>
>
>> This function is about to get longer.
>> ---
>> src/glsl/glsl_parser_extras.cpp | 29 +++++++++++++++--------------
>> 1 files changed, 15 insertions(+), 14 deletions(-)
>>
>> diff --git a/src/glsl/glsl_parser_extras.cpp
>> b/src/glsl/glsl_parser_extras.cpp
>> index ae7a365..d14124f 100644
>> --- a/src/glsl/glsl_parser_extras.cpp
>> +++ b/src/glsl/glsl_parser_extras.cpp
>> @@ -134,6 +134,19 @@ _mesa_glsl_shader_target_name(enum
>> _mesa_glsl_parser_targets target)
>> return "unknown";
>> }
>>
>> +static void
>> +_mesa_glsl_msg(const YYLTYPE *locp, _mesa_glsl_parse_state *state,
>> + bool error, const char *fmt, va_list ap)
>> +{
>> + assert(state->info_log != NULL);
>> + ralloc_asprintf_append(&state->info_log, "%u:%u(%u): %s: ",
>> + locp->source,
>> + locp->first_line,
>> + locp->first_column,
>> + error ? "error" : "warning");
>> + ralloc_vasprintf_append(&state->info_log, fmt, ap);
>> + ralloc_strcat(&state->info_log, "\n");
>> +}
>>
>> void
>> _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state,
>> @@ -143,15 +156,9 @@ _mesa_glsl_error(YYLTYPE *locp,
>> _mesa_glsl_parse_state *state,
>>
>> state->error = true;
>>
>> - assert(state->info_log != NULL);
>> - ralloc_asprintf_append(&state->info_log, "%u:%u(%u): error: ",
>> - locp->source,
>> - locp->first_line,
>> - locp->first_column);
>> va_start(ap, fmt);
>> - ralloc_vasprintf_append(&state->info_log, fmt, ap);
>> + _mesa_glsl_msg(locp, state, true, fmt, ap);
>> va_end(ap);
>> - ralloc_strcat(&state->info_log, "\n");
>> }
>>
>>
>> @@ -161,15 +168,9 @@ _mesa_glsl_warning(const YYLTYPE *locp,
>> _mesa_glsl_parse_state *state,
>> {
>> va_list ap;
>>
>> - assert(state->info_log != NULL);
>> - ralloc_asprintf_append(&state->info_log, "%u:%u(%u): warning: ",
>> - locp->source,
>> - locp->first_line,
>> - locp->first_column);
>> va_start(ap, fmt);
>> - ralloc_vasprintf_append(&state->info_log, fmt, ap);
>> + _mesa_glsl_msg(locp, state, false, fmt, ap);
>> va_end(ap);
>> - ralloc_strcat(&state->info_log, "\n");
>> }
>>
>>
>
More information about the mesa-dev
mailing list