[Mesa-dev] [PATCH] mesa/es: Don't generate ES1 type conversion wrappers

2012-08-17 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

These are gradually going to get whittled away and eventually folded
into the source files with the native type functions.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
This just copies the generated code to a non-generated file.  I'm
sending this out now, and the giant series that depends on it will be
out soon.  I really want to get this one in ASAP.

 src/mesa/main/es1_conversion.c | 1508 
 src/mesa/main/es1_conversion.h |  157 +
 src/mesa/main/es_generator.py  |7 +
 src/mesa/sources.mak   |3 +-
 4 files changed, 1674 insertions(+), 1 deletions(-)
 create mode 100644 src/mesa/main/es1_conversion.c
 create mode 100644 src/mesa/main/es1_conversion.h

diff --git a/src/mesa/main/es1_conversion.c b/src/mesa/main/es1_conversion.c
new file mode 100644
index 000..a1d3b76
--- /dev/null
+++ b/src/mesa/main/es1_conversion.c
@@ -0,0 +1,1508 @@
+#include stdbool.h
+#include main/mfeatures.h
+
+#ifdef FEATURE_ES1
+
+#include api_loopback.h
+#include api_exec.h
+#include blend.h
+#include clear.h
+#include clip.h
+#include context.h
+#include depth.h
+#include fog.h
+#include imports.h
+#include light.h
+#include lines.h
+#include matrix.h
+#include multisample.h
+#include pixelstore.h
+#include points.h
+#include polygon.h
+#include readpix.h
+#include texenv.h
+#include texgen.h
+#include texobj.h
+#include texparam.h
+#include mtypes.h
+#include viewport.h
+#include main/drawtex.h
+#include vbo/vbo.h
+
+#ifndef GL_APIENTRY
+#define GL_APIENTRY GLAPIENTRY
+#endif
+
+#include main/es1_conversion.h
+
+void GL_APIENTRY
+_es_AlphaFuncx(GLenum func, GLclampx ref)
+{
+   switch(func) {
+   case GL_NEVER:
+   case GL_LESS:
+   case GL_EQUAL:
+   case GL_LEQUAL:
+   case GL_GREATER:
+   case GL_NOTEQUAL:
+   case GL_GEQUAL:
+   case GL_ALWAYS:
+  break;
+   default:
+  _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
+  glAlphaFuncx(func=0x%x), func);
+  return;
+   }
+
+   _mesa_AlphaFunc(func, (GLclampf) (ref / 65536.0f));
+}
+
+void GL_APIENTRY
+_es_ClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
+{
+   _mesa_ClearColor((GLclampf) (red / 65536.0f),
+(GLclampf) (green / 65536.0f),
+(GLclampf) (blue / 65536.0f),
+(GLclampf) (alpha / 65536.0f));
+}
+
+void GL_APIENTRY
+_es_ClearDepthx(GLclampx depth)
+{
+   _mesa_ClearDepthf((GLclampf) (depth / 65536.0f));
+}
+
+void GL_APIENTRY
+_es_ClipPlanef(GLenum plane, const GLfloat *equation)
+{
+   unsigned int i;
+   GLdouble converted_equation[4];
+
+   for (i = 0; i  Elements(converted_equation); i++) {
+  converted_equation[i] = (GLdouble) (equation[i]);
+   }
+
+   _mesa_ClipPlane(plane, converted_equation);
+}
+
+void GL_APIENTRY
+_es_ClipPlanex(GLenum plane, const GLfixed *equation)
+{
+   unsigned int i;
+   GLdouble converted_equation[4];
+
+   for (i = 0; i  Elements(converted_equation); i++) {
+  converted_equation[i] = (GLdouble) (equation[i] / 65536.0);
+   }
+
+   _mesa_ClipPlane(plane, converted_equation);
+}
+
+void GL_APIENTRY
+_es_Color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
+{
+_es_Color4f((GLfloat) (red / 255.0f),
+(GLfloat) (green / 255.0f),
+(GLfloat) (blue / 255.0f),
+(GLfloat) (alpha / 255.0f));
+}
+
+void GL_APIENTRY
+_es_Color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+{
+_es_Color4f((GLfloat) (red / 65536.0f),
+(GLfloat) (green / 65536.0f),
+(GLfloat) (blue / 65536.0f),
+(GLfloat) (alpha / 65536.0f));
+}
+
+void GL_APIENTRY
+_es_DepthRangex(GLclampx zNear, GLclampx zFar)
+{
+_mesa_DepthRangef((GLclampf) (zNear / 65536.0f),
+  (GLclampf) (zFar / 65536.0f));
+}
+
+void GL_APIENTRY
+_es_DrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h)
+{
+
+_mesa_DrawTexf((GLfloat) (x / 65536.0f),
+   (GLfloat) (y / 65536.0f),
+   (GLfloat) (z / 65536.0f),
+   (GLfloat) (w / 65536.0f),
+   (GLfloat) (h / 65536.0f));
+}
+
+void GL_APIENTRY
+_es_DrawTexxvOES(const GLfixed *coords)
+{
+unsigned int i;
+GLfloat converted_coords[5];
+
+for (i = 0; i  Elements(converted_coords); i++) {
+converted_coords[i] = (GLfloat) (coords[i] / 65536.0f);
+}
+
+_mesa_DrawTexfv(converted_coords);
+}
+
+void GL_APIENTRY
+_es_Fogx(GLenum pname, GLfixed param)
+{
+   bool convert_param_value = true;
+
+   switch(pname) {
+   case GL_FOG_MODE:
+  if (param != GL_EXP  param != GL_EXP2  param != GL_LINEAR) {
+ _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
+ glFogx(pname=0x%x), pname);
+ return;
+  }
+  convert_param_value = false;
+  break;
+   case GL_FOG_DENSITY:
+   case GL_FOG_START:
+   case GL_FOG_END:
+  

Re: [Mesa-dev] [PATCH] mesa/es: Don't generate ES1 type conversion wrappers

2012-08-17 Thread Brian Paul

On 08/17/2012 11:36 AM, Ian Romanick wrote:

From: Ian Romanickian.d.roman...@intel.com

These are gradually going to get whittled away and eventually folded
into the source files with the native type functions.

Signed-off-by: Ian Romanickian.d.roman...@intel.com
---
This just copies the generated code to a non-generated file.  I'm
sending this out now, and the giant series that depends on it will be
out soon.  I really want to get this one in ASAP.


LGTM but I think you need to add the new es1_conversion.c file to 
src/mesa/SConscript.


Reviewed-by: Brian Paul bri...@vmware.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev