mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
cogl: Move COGL_DEBUG=show-source into cogl-shader.c
The code to display the source when the show-source debug option is given has been moved to _cogl_shader_set_source_with_boilerplate so that it will show both user shaders and generated shaders. It also shows the code with the full boilerplate. To make it the same for ARBfp, cogl_shader_compile_real now also dumps user ARBfp shaders.
This commit is contained in:
parent
8764a0d487
commit
3c5fa0cf90
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user