[fixed-to-float.sh] Use float names for the GLES2 wrappers

For example cogl_wrap_glFrustumx -> cogl_wrap_glFrustumf.

The wrappers get #defined to the float versions anyway but it helps
avoid some confusion.

The conversion is done using a regular expression in the upgrade
script. Some of the patches had to be updated to apply cleanly.
This commit is contained in:
Neil Roberts 2009-01-16 12:16:28 +00:00
parent 52d7b7be73
commit 18378fe180
5 changed files with 42 additions and 44 deletions

View File

@ -22,7 +22,7 @@ index b2e19eb..a7800c5 100644
} }
void void
-cogl_wrap_glColor4x (GLclampx r, GLclampx g, GLclampx b, GLclampx a) -cogl_wrap_glColor4f (GLclampx r, GLclampx g, GLclampx b, GLclampx a)
+cogl_wrap_glColor4f (GLclampf r, GLclampf g, GLclampf b, GLclampf a) +cogl_wrap_glColor4f (GLclampf r, GLclampf g, GLclampf b, GLclampf a)
{ {
- glVertexAttrib4f (COGL_GLES2_WRAPPER_COLOR_ATTRIB, - glVertexAttrib4f (COGL_GLES2_WRAPPER_COLOR_ATTRIB,

View File

@ -1,5 +1,5 @@
diff --git a/clutter/cogl/gles/cogl-gles2-wrapper.h b/clutter/cogl/gles/cogl-gles2-wrapper.h diff --git a/clutter/cogl/gles/cogl-gles2-wrapper.h b/clutter/cogl/gles/cogl-gles2-wrapper.h
index ad741be..561cb66 100644 index cb700cc..f126993 100644
--- a/clutter/cogl/gles/cogl-gles2-wrapper.h --- a/clutter/cogl/gles/cogl-gles2-wrapper.h
+++ b/clutter/cogl/gles/cogl-gles2-wrapper.h +++ b/clutter/cogl/gles/cogl-gles2-wrapper.h
@@ -203,8 +203,6 @@ struct _CoglGles2WrapperShader @@ -203,8 +203,6 @@ struct _CoglGles2WrapperShader
@ -15,17 +15,17 @@ index ad741be..561cb66 100644
void cogl_wrap_glAlphaFunc (GLenum func, GLclampf ref); void cogl_wrap_glAlphaFunc (GLenum func, GLclampf ref);
-void cogl_wrap_glColor4x (GLclampx r, GLclampx g, GLclampx b, GLclampx a); -void cogl_wrap_glColor4f (GLclampx r, GLclampx g, GLclampx b, GLclampx a);
+void cogl_wrap_glColor4f (GLclampf r, GLclampf g, GLclampf b, GLclampf a); +void cogl_wrap_glColor4f (GLclampf r, GLclampf g, GLclampf b, GLclampf a);
void cogl_wrap_glClipPlanex (GLenum plane, GLfloat *equation); void cogl_wrap_glClipPlanef (GLenum plane, GLfloat *equation);
void cogl_wrap_glGetIntegerv (GLenum pname, GLint *params); void cogl_wrap_glGetIntegerv (GLenum pname, GLint *params);
-void cogl_wrap_glGetFixedv (GLenum pname, GLfloat *params); -void cogl_wrap_glGetFixedv (GLenum pname, GLfloat *params);
+void cogl_wrap_glGetFloatv (GLenum pname, GLfloat *params); +void cogl_wrap_glGetFloatv (GLenum pname, GLfloat *params);
void cogl_wrap_glFogx (GLenum pname, GLfloat param); void cogl_wrap_glFogf (GLenum pname, GLfloat param);
void cogl_wrap_glFogxv (GLenum pname, const GLfloat *params); void cogl_wrap_glFogfv (GLenum pname, const GLfloat *params);
@@ -273,35 +271,34 @@ void _cogl_gles2_clear_cache_for_program (CoglHandle program); @@ -273,35 +271,34 @@ void _cogl_gles2_clear_cache_for_program (CoglHandle program);
/* If we're not using GL ES 2 then just use the GL functions /* If we're not using GL ES 2 then just use the GL functions
directly */ directly */
@ -37,40 +37,40 @@ index ad741be..561cb66 100644
#define cogl_wrap_glPopMatrix glPopMatrix #define cogl_wrap_glPopMatrix glPopMatrix
#define cogl_wrap_glMatrixMode glMatrixMode #define cogl_wrap_glMatrixMode glMatrixMode
#define cogl_wrap_glLoadIdentity glLoadIdentity #define cogl_wrap_glLoadIdentity glLoadIdentity
-#define cogl_wrap_glMultMatrixx glMultMatrixx -#define cogl_wrap_glMultMatrixf glMultMatrixx
-#define cogl_wrap_glFrustumx glFrustumx -#define cogl_wrap_glFrustumf glFrustumx
-#define cogl_wrap_glScalex glScalex -#define cogl_wrap_glScalef glScalex
-#define cogl_wrap_glTranslatex glTranslatex -#define cogl_wrap_glTranslatef glTranslatex
-#define cogl_wrap_glRotatex glRotatex -#define cogl_wrap_glRotatef glRotatex
-#define cogl_wrap_glOrthox glOrthox -#define cogl_wrap_glOrthof glOrthox
+#define cogl_wrap_glMultMatrixx glMultMatrixf +#define cogl_wrap_glMultMatrixf glMultMatrixf
+#define cogl_wrap_glFrustumx glFrustumf +#define cogl_wrap_glFrustumf glFrustumf
+#define cogl_wrap_glScalex glScalef +#define cogl_wrap_glScalef glScalef
+#define cogl_wrap_glTranslatex glTranslatef +#define cogl_wrap_glTranslatef glTranslatef
+#define cogl_wrap_glRotatex glRotatef +#define cogl_wrap_glRotatef glRotatef
+#define cogl_wrap_glOrthox glOrthof +#define cogl_wrap_glOrthof glOrthof
#define cogl_wrap_glEnable glEnable #define cogl_wrap_glEnable glEnable
#define cogl_wrap_glDisable glDisable #define cogl_wrap_glDisable glDisable
#define cogl_wrap_glTexCoordPointer glTexCoordPointer #define cogl_wrap_glTexCoordPointer glTexCoordPointer
#define cogl_wrap_glVertexPointer glVertexPointer #define cogl_wrap_glVertexPointer glVertexPointer
#define cogl_wrap_glColorPointer glColorPointer #define cogl_wrap_glColorPointer glColorPointer
#define cogl_wrap_glNormalPointer glNormalPointer #define cogl_wrap_glNormalPointer glNormalPointer
-#define cogl_wrap_glTexEnvx glTexEnvx -#define cogl_wrap_glTexEnvf glTexEnvx
+#define cogl_wrap_glTexEnvx glTexEnvf +#define cogl_wrap_glTexEnvf glTexEnvf
#define cogl_wrap_glEnableClientState glEnableClientState #define cogl_wrap_glEnableClientState glEnableClientState
#define cogl_wrap_glDisableClientState glDisableClientState #define cogl_wrap_glDisableClientState glDisableClientState
#define cogl_wrap_glAlphaFunc glAlphaFunc #define cogl_wrap_glAlphaFunc glAlphaFunc
-#define cogl_wrap_glColor4x glColor4x -#define cogl_wrap_glColor4f glColor4x
-#define cogl_wrap_glClipPlanex glClipPlanex -#define cogl_wrap_glClipPlanef glClipPlanex
+#define cogl_wrap_glColor4f glColor4f +#define cogl_wrap_glColor4f glColor4f
+#define cogl_wrap_glClipPlanex glClipPlanef +#define cogl_wrap_glClipPlanef glClipPlanef
#define cogl_wrap_glGetIntegerv glGetIntegerv #define cogl_wrap_glGetIntegerv glGetIntegerv
-#define cogl_wrap_glGetFixedv glGetFixedv -#define cogl_wrap_glGetFixedv glGetFixedv
-#define cogl_wrap_glFogx glFogx -#define cogl_wrap_glFogf glFogx
-#define cogl_wrap_glFogxv glFogxv -#define cogl_wrap_glFogfv glFogxv
+#define cogl_wrap_glGetFloatv glGetFloatv +#define cogl_wrap_glGetFloatv glGetFloatv
+#define cogl_wrap_glFogx glFogf +#define cogl_wrap_glFogf glFogf
+#define cogl_wrap_glFogxv glFogfv +#define cogl_wrap_glFogfv glFogfv
#define cogl_wrap_glTexParameteri glTexParameteri #define cogl_wrap_glTexParameteri glTexParameteri
/* The extra third parameter of the bind texture wrapper isn't needed /* The extra third parameter of the bind texture wrapper isn't needed

View File

@ -25,15 +25,6 @@ index 422d8b6..cb7aa8e 100644
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
cogl_wrap_glDisable (GL_LIGHTING); cogl_wrap_glDisable (GL_LIGHTING);
@@ -315,7 +316,7 @@ cogl_set_source_color (const CoglColor *color)
#else
/* conversion can cause issues with picking on some gles implementations */
- GE( cogl_wrap_glColor4x (cogl_color_get_red (color),
+ GE( cogl_wrap_glColor4f (cogl_color_get_red (color),
cogl_color_get_green (color),
cogl_color_get_blue (color),
cogl_color_get_alpha (color)) );
@@ -365,9 +366,8 @@ set_clip_plane (GLint plane_num, @@ -365,9 +366,8 @@ set_clip_plane (GLint plane_num,
/* Calculate the angle between the axes and the line crossing the /* Calculate the angle between the axes and the line crossing the
@ -87,11 +78,11 @@ index 422d8b6..cb7aa8e 100644
} }
- GE( cogl_wrap_glTranslatex (-1 << 15, -1 << 15, -z_camera) ); - GE( cogl_wrap_glTranslatef (-1 << 15, -1 << 15, -z_camera) );
+ +
+ GE( cogl_wrap_glTranslatex (-0.5f, -0.5f, -z_camera) ); + GE( cogl_wrap_glTranslatef (-0.5f, -0.5f, -z_camera) );
GE( cogl_wrap_glScalex ( 1.0 / width, GE( cogl_wrap_glScalef ( 1.0 / width,
-1.0 / height, -1.0 / height,
@@ -737,13 +735,13 @@ cogl_features_available (CoglFeatureFlags features) @@ -737,13 +735,13 @@ cogl_features_available (CoglFeatureFlags features)
void void

View File

@ -522,14 +522,14 @@ index aa4e4fc..e835085 100644
-cogl_translatex (float x, float y, float z) -cogl_translatex (float x, float y, float z)
+cogl_translate (float x, float y, float z) +cogl_translate (float x, float y, float z)
{ {
GE( cogl_wrap_glTranslatex (x, y, z) ); GE( cogl_wrap_glTranslatef (x, y, z) );
} }
void void
-cogl_translate (gint x, gint y, gint z) -cogl_translate (gint x, gint y, gint z)
+cogl_rotate (float angle, float x, float y, float z) +cogl_rotate (float angle, float x, float y, float z)
{ {
- GE( cogl_wrap_glTranslatex ((float)(x), - GE( cogl_wrap_glTranslatef ((float)(x),
- (float)(y), - (float)(y),
- (float)(z)) ); - (float)(z)) );
-} -}
@ -540,17 +540,17 @@ index aa4e4fc..e835085 100644
- float y, - float y,
- float z) - float z)
-{ -{
- GE( cogl_wrap_glRotatex (angle,x,y,z) ); - GE( cogl_wrap_glRotatef (angle,x,y,z) );
-} -}
- -
-void -void
-cogl_rotate (gint angle, gint x, gint y, gint z) -cogl_rotate (gint angle, gint x, gint y, gint z)
-{ -{
- GE( cogl_wrap_glRotatex ((float)(angle), - GE( cogl_wrap_glRotatef ((float)(angle),
- (float)(x), - (float)(x),
- (float)(y), - (float)(y),
- (float)(z)) ); - (float)(z)) );
+ GE( cogl_wrap_glRotatex (angle, x, y, z) ); + GE( cogl_wrap_glRotatef (angle, x, y, z) );
} }
static inline gboolean static inline gboolean

View File

@ -118,6 +118,13 @@ git-checkout clutter/cogl/cogl-fixed.h clutter/cogl/common/cogl-fixed.c
find ./clutter -iname '*.[ch]' ! -iname 'clutter-fixed.h' -exec sed -i 's/ClutterAngle/float/g' {} \; find ./clutter -iname '*.[ch]' ! -iname 'clutter-fixed.h' -exec sed -i 's/ClutterAngle/float/g' {} \;
# use the floating point names for GL ES functions instead of the
# fixed. These get #define'd to the float versions in one of the
# patches anyway but the names should be fixed up to avoid confusion
find ./clutter/cogl -iname '*.[ch]' -exec perl -p -i -e \
's/\b(cogl_wrap_(?:glMultMatrix|glFrustum|glScale|glTranslate
|glRotate|glOrtho|glTexEnv|glClipPlane|glFog|glColor4))x(v?)\b/$1f$2/gx' {} \;
echo "Cogl API to remove/replace with float versions:" echo "Cogl API to remove/replace with float versions:"
find ./clutter/ -iname '*.c' -exec grep '^cogl_[a-zA-Z_]*x ' {} \; | cut -d' ' -f1|grep -v 'box$'|grep -v 'matrix$' find ./clutter/ -iname '*.c' -exec grep '^cogl_[a-zA-Z_]*x ' {} \; | cut -d' ' -f1|grep -v 'box$'|grep -v 'matrix$'
echo "Clutter API to remove/replace with float versions:" echo "Clutter API to remove/replace with float versions:"