From 063386c1e286f511917824eef3c4400672eb7704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Thu, 10 Jan 2008 09:55:44 +0000 Subject: [PATCH] Added COGLhandleARB since the underlying type on OSX is void*, patch from Tommi Komulainen , (#694) * clutter/cogl/gl/cogl-defines.h.in: Added COGLhandleARB typedef. * clutter/cogl/cogl.h: * clutter/cogl/gl/cogl.c: * clutter/clutter-shader.c: Use COGLhandleARB instead of COGLint when referring to program or shader handles. --- ChangeLog | 11 +++++++++ clutter/clutter-shader.c | 18 +++++++------- clutter/cogl/cogl.h | 38 ++++++++++++++--------------- clutter/cogl/gl/cogl-defines.h.in | 1 + clutter/cogl/gl/cogl.c | 40 +++++++++++++++---------------- 5 files changed, 60 insertions(+), 48 deletions(-) diff --git a/ChangeLog b/ChangeLog index 02d1a8ee6..d8b5a4ee8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-01-10 Øyvind Kolås + + Added COGLhandleARB since the underlying type on OSX is void*, + patch from Tommi Komulainen , (#694) + + * clutter/cogl/gl/cogl-defines.h.in: Added COGLhandleARB typedef. + * clutter/cogl/cogl.h: + * clutter/cogl/gl/cogl.c: + * clutter/clutter-shader.c: Use COGLhandleARB instead of COGLint when + referring to program or shader handles. + 2008-01-09 Emmanuele Bassi * clutter/Makefile.am: diff --git a/clutter/clutter-shader.c b/clutter/clutter-shader.c index f06b7e161..183549206 100644 --- a/clutter/clutter-shader.c +++ b/clutter/clutter-shader.c @@ -68,19 +68,19 @@ typedef enum { struct _ClutterShaderPrivate { - guint bound : 1; /* The shader is bound to the GL context */ - guint is_enabled : 1; + guint bound : 1; /* Shader is bound to the GL context */ + guint is_enabled : 1; - guint vertex_is_glsl : 1; - guint fragment_is_glsl : 1; + guint vertex_is_glsl : 1; + guint fragment_is_glsl : 1; - gchar *vertex_source; /* source (or asm) for vertex shader */ - gchar *fragment_source; /* source (or asm) for fragment shader */ + gchar *vertex_source; /* GLSL source for vertex shader */ + gchar *fragment_source; /* GLSL source for fragment shader */ - COGLint program; + COGLhandleARB program; - COGLint vertex_shader; - COGLint fragment_shader; + COGLhandleARB vertex_shader; + COGLhandleARB fragment_shader; }; enum diff --git a/clutter/cogl/cogl.h b/clutter/cogl/cogl.h index 7bc5d0dc9..fe2bbe2a6 100644 --- a/clutter/cogl/cogl.h +++ b/clutter/cogl/cogl.h @@ -214,50 +214,50 @@ cogl_fog_set (const ClutterColor *fog_color, ClutterFixed z_far); -COGLint +COGLhandleARB cogl_create_shader (COGLenum shaderType); void -cogl_shader_destroy (COGLint handle); +cogl_shader_destroy (COGLhandleARB handle); void -cogl_shader_source (COGLint shader, - const gchar *source); +cogl_shader_source (COGLhandleARB shader, + const gchar *source); void -cogl_shader_compile (COGLint shader_handle); +cogl_shader_compile (COGLhandleARB shader_handle); void -cogl_shader_get_info_log (COGLint handle, - guint size, - gchar *buffer); +cogl_shader_get_info_log (COGLhandleARB handle, + guint size, + gchar *buffer); void -cogl_shader_get_parameteriv (COGLint handle, - COGLenum pname, - COGLint *dest); +cogl_shader_get_parameteriv (COGLhandleARB handle, + COGLenum pname, + COGLint *dest); -COGLint +COGLhandleARB cogl_create_program (void); void -cogl_program_destroy (COGLint handle); +cogl_program_destroy (COGLhandleARB handle); void -cogl_program_attach_shader (COGLint program_handle, - COGLint shader_handle); +cogl_program_attach_shader (COGLhandleARB program_handle, + COGLhandleARB shader_handle); /* 0 to use none */ void -cogl_program_link (COGLint program_handle); +cogl_program_link (COGLhandleARB program_handle); void -cogl_program_use (COGLint program_handle); +cogl_program_use (COGLhandleARB program_handle); COGLint -cogl_program_get_uniform_location (COGLint program_int, - const gchar *uniform_name); +cogl_program_get_uniform_location (COGLhandleARB program_int, + const gchar *uniform_name); void diff --git a/clutter/cogl/gl/cogl-defines.h.in b/clutter/cogl/gl/cogl-defines.h.in index b3a61e1a0..dd7e4ef4d 100644 --- a/clutter/cogl/gl/cogl-defines.h.in +++ b/clutter/cogl/gl/cogl-defines.h.in @@ -42,6 +42,7 @@ G_BEGIN_DECLS typedef GLenum COGLenum; typedef GLint COGLint; typedef GLuint COGLuint; +typedef GLhandleARB COGLhandleARB; /* FIXME + DOCUMENT */ diff --git a/clutter/cogl/gl/cogl.c b/clutter/cogl/gl/cogl.c index 7cf7b1f15..222e74258 100644 --- a/clutter/cogl/gl/cogl.c +++ b/clutter/cogl/gl/cogl.c @@ -785,14 +785,14 @@ cogl_fog_set (const ClutterColor *fog_color, #endif -COGLint +COGLhandleARB cogl_create_program (void) { PROC (GLhandleARB, 0, glCreateProgramObjectARB, void); return proc (); } -COGLint +COGLhandleARB cogl_create_shader (COGLenum shaderType) { PROC (GLhandleARB, 0, glCreateShaderObjectARB, GLenum); @@ -800,79 +800,79 @@ cogl_create_shader (COGLenum shaderType) } void -cogl_shader_source (COGLint shader, - const gchar *source) +cogl_shader_source (COGLhandleARB shader, + const gchar *source) { PROC (GLvoid,, glShaderSourceARB, GLhandleARB, GLsizei, const GLcharARB **, const GLint *) proc (shader, 1, &source, NULL); } void -cogl_shader_compile (COGLint shader_handle) +cogl_shader_compile (COGLhandleARB shader_handle) { PROC (GLvoid,, glCompileShaderARB, GLhandleARB); proc (shader_handle); } void -cogl_program_attach_shader (COGLint program_handle, - COGLint shader_handle) +cogl_program_attach_shader (COGLhandleARB program_handle, + COGLhandleARB shader_handle) { PROC (GLvoid,, glAttachObjectARB, GLhandleARB, GLhandleARB); proc (program_handle, shader_handle); } void -cogl_program_link (COGLint program_handle) +cogl_program_link (COGLhandleARB program_handle) { PROC (GLvoid,, glLinkProgramARB, GLhandleARB); proc (program_handle); } void -cogl_program_use (COGLint program_handle) +cogl_program_use (COGLhandleARB program_handle) { PROC (GLvoid,, glUseProgramObjectARB, GLhandleARB); proc (program_handle); } COGLint -cogl_program_get_uniform_location (COGLint program_handle, - const gchar *uniform_name) +cogl_program_get_uniform_location (COGLhandleARB program_handle, + const gchar *uniform_name) { PROC (GLint,0, glGetUniformLocationARB, GLhandleARB, const GLcharARB *) return proc (program_handle, uniform_name); } void -cogl_program_destroy (COGLint handle) +cogl_program_destroy (COGLhandleARB handle) { PROC (GLvoid,, glDeleteObjectARB, GLhandleARB); proc (handle); } void -cogl_shader_destroy (COGLint handle) +cogl_shader_destroy (COGLhandleARB handle) { PROC (GLvoid,, glDeleteObjectARB, GLhandleARB); proc (handle); } void -cogl_shader_get_info_log (COGLint handle, - guint size, - gchar *buffer) +cogl_shader_get_info_log (COGLhandleARB handle, + guint size, + gchar *buffer) { - gint len; + COGLint len; PROC (GLvoid,, glGetInfoLogARB, GLhandleARB, GLsizei, GLsizei *, GLcharARB *); proc (handle, size-1, &len, buffer); buffer[len]='\0'; } void -cogl_shader_get_parameteriv (COGLint handle, - COGLenum pname, - COGLint *dest) +cogl_shader_get_parameteriv (COGLhandleARB handle, + COGLenum pname, + COGLint *dest) { PROC (GLvoid,, glGetObjectParameterivARB, GLhandleARB, GLenum, GLint*) proc (handle, pname, dest);