diff --git a/clutter/cogl/cogl/cogl-pipeline-fragend-glsl.c b/clutter/cogl/cogl/cogl-pipeline-fragend-glsl.c index 3622cea2a..619c67a9e 100644 --- a/clutter/cogl/cogl/cogl-pipeline-fragend-glsl.c +++ b/clutter/cogl/cogl/cogl-pipeline-fragend-glsl.c @@ -790,11 +790,6 @@ _cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline, g_string_append (glsl_shader_state->source, "}\n"); - if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_SHOW_SOURCE)) - g_message ("pipeline fragment shader:\n%s%s", - glsl_shader_state->header->str, - glsl_shader_state->source->str); - GE_RET( shader, glCreateShader (GL_FRAGMENT_SHADER) ); lengths[0] = glsl_shader_state->header->len; diff --git a/clutter/cogl/cogl/cogl-pipeline-vertend-glsl.c b/clutter/cogl/cogl/cogl-pipeline-vertend-glsl.c index 7e5ae291f..f863f1552 100644 --- a/clutter/cogl/cogl/cogl-pipeline-vertend-glsl.c +++ b/clutter/cogl/cogl/cogl-pipeline-vertend-glsl.c @@ -303,11 +303,6 @@ _cogl_pipeline_vertend_glsl_end (CoglPipeline *pipeline, " cogl_color_out = cogl_color_in;\n" "}\n"); - if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_SHOW_SOURCE)) - g_message ("pipeline vertex shader:\n%s%s", - priv->header->str, - priv->source->str); - GE_RET( shader, glCreateShader (GL_VERTEX_SHADER) ); lengths[0] = priv->header->len; diff --git a/clutter/cogl/cogl/cogl-shader.c b/clutter/cogl/cogl/cogl-shader.c index 8bc7c1f60..530e293c7 100644 --- a/clutter/cogl/cogl/cogl-shader.c +++ b/clutter/cogl/cogl/cogl-shader.c @@ -257,6 +257,26 @@ _cogl_shader_set_source_with_boilerplate (GLuint shader_gl_handle, } count += count_in; + if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_SHOW_SOURCE)) + { + GString *buf = g_string_new (NULL); + int i; + + g_string_append_printf (buf, + "%s shader:\n", + shader_gl_type == GL_VERTEX_SHADER ? + "vertex" : "fragment"); + for (i = 0; i < count; i++) + if (lengths[i] != -1) + g_string_append_len (buf, strings[i], lengths[i]); + else + g_string_append (buf, strings[i]); + + g_message ("%s", buf->str); + + g_string_free (buf, TRUE); + } + GE( glShaderSource (shader_gl_handle, count, (const char **) strings, lengths) ); @@ -287,6 +307,9 @@ _cogl_shader_compile_real (CoglHandle handle, GE (glBindProgram (GL_FRAGMENT_PROGRAM_ARB, shader->gl_handle)); + if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_SHOW_SOURCE)) + g_message ("user ARBfp program:\n%s", shader->source); + #ifdef COGL_GL_DEBUG while ((gl_error = glGetError ()) != GL_NO_ERROR) ;