diff --git a/gsk/gskshaderbuilder.c b/gsk/gskshaderbuilder.c index 16a0e1e3c2..5142e43ae1 100644 --- a/gsk/gskshaderbuilder.c +++ b/gsk/gskshaderbuilder.c @@ -2,6 +2,8 @@ #include "gskshaderbuilderprivate.h" +#include "gskdebugprivate.h" + #include #include @@ -194,6 +196,8 @@ gsk_shader_builder_compile_shader (GskShaderBuilder *builder, return -1; } + g_string_append_c (code, '\n'); + if (!lookup_shader_code (code, builder->resource_base_path, shader_source, error)) { g_string_free (code, TRUE); @@ -206,6 +210,16 @@ gsk_shader_builder_compile_shader (GskShaderBuilder *builder, glShaderSource (shader_id, 1, (const GLchar **) &source, NULL); glCompileShader (shader_id); +#ifdef G_ENABLE_DEBUG + if (GSK_DEBUG_CHECK (OPENGL)) + { + g_print ("*** Compiling %s shader ***\n" + "%s\n", + shader_type == GL_VERTEX_SHADER ? "vertex" : "fragment", + source); + } +#endif + g_free (source); glGetShaderiv (shader_id, GL_COMPILE_STATUS, &status); @@ -311,6 +325,30 @@ gsk_shader_builder_create_program (GskShaderBuilder *builder, builder->program_id = program_id; +#ifdef G_ENABLE_DEBUG + if (GSK_DEBUG_CHECK (OPENGL)) + { + GHashTableIter iter; + gpointer name_p, location_p; + + g_hash_table_iter_init (&iter, builder->uniform_locations); + while (g_hash_table_iter_next (&iter, &name_p, &location_p)) + { + g_print ("Uniform '%s' - location: %d\n", + g_quark_to_string (GPOINTER_TO_INT (name_p)), + GPOINTER_TO_INT (location_p)); + } + + g_hash_table_iter_init (&iter, builder->attribute_locations); + while (g_hash_table_iter_next (&iter, &name_p, &location_p)) + { + g_print ("Attribute '%s' - location: %d\n", + g_quark_to_string (GPOINTER_TO_INT (name_p)), + GPOINTER_TO_INT (location_p)); + } + } +#endif + out: glDetachShader (program_id, vertex_id); glDetachShader (program_id, fragment_id);