aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2014-12-27 22:12:30 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-12-27 22:12:30 +0900
commiteb3d69a8ecf856ed9611cc6285c40d28f5954a34 (patch)
tree94c0779c5bf82e3aad50b152641beeddf4fcf169
parentImprove -clicked- detection code by accept only if the mouse do not move too ... (diff)
downloadefl-eb3d69a8ecf856ed9611cc6285c40d28f5954a34.tar.gz
test_glview: Refractored the shader/program log code.
Summary: Added a function print_glerror_log to handle both shaders and programs logs. Test Plan: elementary_test -> glview Reviewers: raster, jpeg, seoz Reviewed By: seoz Subscribers: anand.km, seoz Differential Revision: https://phab.enlightenment.org/D1826
-rw-r--r--legacy/elementary/src/bin/test_glview.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/legacy/elementary/src/bin/test_glview.c b/legacy/elementary/src/bin/test_glview.c
index c840b97ca3..fc35e488ee 100644
--- a/legacy/elementary/src/bin/test_glview.c
+++ b/legacy/elementary/src/bin/test_glview.c
@@ -341,12 +341,33 @@ static const char vertex_shader[] =
"}\n";
static void
+_print_gl_log(Evas_GL_API *gl, GLuint id)
+{
+ GLint log_len = 0;
+ char *log;
+
+ if (gl->glIsShader(id))
+ gl->glGetShaderiv(id, GL_INFO_LOG_LENGTH, &log_len);
+ else if (gl->glIsProgram(id))
+ gl->glGetProgramiv(id, GL_INFO_LOG_LENGTH, &log_len);
+
+ log = malloc(log_len * sizeof(char));
+
+ if (gl->glIsShader(id))
+ gl->glGetShaderInfoLog(id, log_len, NULL, log);
+ else if (gl->glIsProgram(id))
+ gl->glGetProgramInfoLog(id, log_len, NULL, log);
+
+ printf("%s", log);
+ free(log);
+}
+
+static void
gears_init(GLData *gld)
{
Evas_GL_API *gl = gld->glapi;
const char *p;
- char msg[512];
gl->glEnable(GL_CULL_FACE);
gl->glEnable(GL_DEPTH_TEST);
@@ -355,15 +376,13 @@ gears_init(GLData *gld)
gld->vtx_shader = gl->glCreateShader(GL_VERTEX_SHADER);
gl->glShaderSource(gld->vtx_shader, 1, &p, NULL);
gl->glCompileShader(gld->vtx_shader);
- gl->glGetShaderInfoLog(gld->vtx_shader, sizeof msg, NULL, msg);
- printf("vertex shader info: %s\n", msg);
+ _print_gl_log(gl, gld->vtx_shader);
p = fragment_shader;
gld->fgmt_shader = gl->glCreateShader(GL_FRAGMENT_SHADER);
gl->glShaderSource(gld->fgmt_shader, 1, &p, NULL);
gl->glCompileShader(gld->fgmt_shader);
- gl->glGetShaderInfoLog(gld->fgmt_shader, sizeof msg, NULL, msg);
- printf("fragment shader info: %s\n", msg);
+ _print_gl_log(gl, gld->fgmt_shader);
gld->program = gl->glCreateProgram();
gl->glAttachShader(gld->program, gld->vtx_shader);
@@ -372,8 +391,7 @@ gears_init(GLData *gld)
gl->glBindAttribLocation(gld->program, 1, "normal");
gl->glLinkProgram(gld->program);
- gl->glGetProgramInfoLog(gld->program, sizeof msg, NULL, msg);
- printf("info: %s\n", msg);
+ _print_gl_log(gl, gld->program);
gl->glUseProgram(gld->program);
gld->proj_location = gl->glGetUniformLocation(gld->program, "proj");