diff --git a/src/mesa/es/main/APIspec.xml b/src/mesa/es/main/APIspec.xml
index e48b343c93e..5311f2a83df 100644
--- a/src/mesa/es/main/APIspec.xml
+++ b/src/mesa/es/main/APIspec.xml
@@ -1201,223 +1201,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -3707,6 +3491,7 @@
+
@@ -4030,15 +3815,15 @@
-
+
-
+
-
+
@@ -4250,10 +4035,10 @@
-
+
-
-
+
+
diff --git a/src/mesa/es/main/es_generator.py b/src/mesa/es/main/es_generator.py
index 5ad9c9b1d8a..0448204fcdd 100644
--- a/src/mesa/es/main/es_generator.py
+++ b/src/mesa/es/main/es_generator.py
@@ -256,45 +256,6 @@ extern void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... );
typedef void (*_glapi_proc)(void); /* generic function pointer */
"""
-# All variant-length arrays in the GLES API are controlled by some
-# selector parameter. Almost all of those are constant length based
-# on the selector parameter (e.g., in glFogfv(), if the "pname"
-# parameter is GL_FOG_COLOR, the "params" array is considered to be
-# 4 floats long; for any other value of "pname", the "params' array
-# is considered to be 1 float long.
-#
-# There are a very few instances where the selector parameter chooses
-# a runtime-determined value:
-# glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS)
-# glGetIntegerv(GL_SHADER_BINARY_FORMATS)
-# plus the glGetBooleanv, glGetFloatv, glGetFixedv counterparts.
-#
-# The number of formats in both cases is not a constant, but is a
-# runtime-determined value (based on the return value of
-# glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS) or
-# glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS).
-#
-# Rather than hard-code some value (and risk memory errors when we
-# overshoot arrays), in these cases we'll use a constant expresssion
-# (e.g. _get_size(GL_NUM_COMPRESSED_TEXTURE_FORMATS)) to get the
-# value of the variant array. Note, though, that in these cases the
-# "vector" parameter should be set to some size large enough to hold
-# all values (and must be set for GLfixed-based conversions, which
-# need it to define an auxiliary array size).
-#
-# Here's the function itself. Although we only need a couple of values,
-# we'll make it general.
-print """
-extern void GLAPIENTRY _mesa_GetIntegerv(GLenum, GLint *);
-static INLINE unsigned int _get_size(GLenum pname)
-{
- /* In case of error, make sure the value returned is 0. */
- GLint value = 0;
- _mesa_GetIntegerv(pname, &value);
- return (unsigned int) value;
-}
-"""
-
# Finally we get to the all-important functions
print """/*************************************************************
* Generated functions begin here
diff --git a/src/mesa/es/main/get_gen.py b/src/mesa/es/main/get_gen.py
index 516facc8a31..3303c4cb5bd 100644
--- a/src/mesa/es/main/get_gen.py
+++ b/src/mesa/es/main/get_gen.py
@@ -36,6 +36,7 @@ GLfloat = 3
GLdouble = 4
GLboolean = 5
GLfloatN = 6 # A normalized value, such as a color or depth range
+GLfixed = 7
TypeStrings = {
@@ -43,7 +44,8 @@ TypeStrings = {
GLenum : "GLenum",
GLfloat : "GLfloat",
GLdouble : "GLdouble",
- GLboolean : "GLboolean"
+ GLboolean : "GLboolean",
+ GLfixed : "GLfixed"
}
@@ -566,7 +568,8 @@ def EmitGetFunction(stateVars, returnType):
"""Emit the code to implement glGetBooleanv, glGetIntegerv or glGetFloatv."""
assert (returnType == GLboolean or
returnType == GLint or
- returnType == GLfloat)
+ returnType == GLfloat or
+ returnType == GLfixed)
strType = TypeStrings[returnType]
# Capitalize first letter of return type
@@ -576,6 +579,8 @@ def EmitGetFunction(stateVars, returnType):
function = "_mesa_GetBooleanv"
elif returnType == GLfloat:
function = "_mesa_GetFloatv"
+ elif returnType == GLfixed:
+ function = "_mesa_GetFixedv"
else:
abort()
@@ -688,11 +693,20 @@ def EmitHeader():
#define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE )
+#define FLOAT_TO_FIXED(F) ( ((F) * 65536.0f > INT_MAX) ? INT_MAX : \\
+ ((F) * 65536.0f < INT_MIN) ? INT_MIN : \\
+ (GLint) ((F) * 65536.0f) )
#define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE )
+#define INT_TO_FIXED(I) ( ((I) > SHRT_MAX) ? INT_MAX : \\
+ ((I) < SHRT_MIN) ? INT_MIN : \\
+ (GLint) ((I) * 65536) )
#define BOOLEAN_TO_INT(B) ( (GLint) (B) )
#define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F )
+#define BOOLEAN_TO_FIXED(B) ( (GLint) ((B) ? 1 : 0) << 16 )
+
+#define ENUM_TO_FIXED(E) (E)
/*
@@ -753,15 +767,20 @@ static GLenum compressed_formats[] = {
#define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
+void GLAPIENTRY
+_mesa_GetFixedv( GLenum pname, GLfixed *params );
+
"""
return
-def EmitAll(stateVars):
+def EmitAll(stateVars, API):
EmitHeader()
EmitGetFunction(stateVars, GLboolean)
EmitGetFunction(stateVars, GLfloat)
EmitGetFunction(stateVars, GLint)
+ if API == 1:
+ EmitGetFunction(stateVars, GLfixed)
def main(args):
@@ -779,7 +798,7 @@ def main(args):
else:
vars = StateVars_common + StateVars_es2
- EmitAll(vars)
+ EmitAll(vars, API)
main(sys.argv)