diff options
author | Chia-I Wu <[email protected]> | 2009-11-23 11:22:19 +0800 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-01-04 14:15:15 -0700 |
commit | e0ab739c063885784e858060d749e2937e622da2 (patch) | |
tree | 840e38c51006ab0459ad494d13f2439a119c8f06 /src/mesa/es/main/get_gen.py | |
parent | c3bd85791766e4a6f3896ea724e18640e56c6808 (diff) |
mesa/es: Generate _mesa_GetFixedv.
Have get_gen.py generate _mesa_GetFixedv. The generated function does
all the checkings and thus simplifies APIspec.xml a bit.
Signed-off-by: Chia-I Wu <[email protected]>
Diffstat (limited to 'src/mesa/es/main/get_gen.py')
-rw-r--r-- | src/mesa/es/main/get_gen.py | 27 |
1 files changed, 23 insertions, 4 deletions
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) |