return fromStr + "_TO_" + toStr | return fromStr + "_TO_" + toStr | ||||
def EmitGetFunction(stateVars, returnType): | |||||
def EmitGetFunction(stateVars, returnType, API): | |||||
"""Emit the code to implement glGetBooleanv, glGetIntegerv or glGetFloatv.""" | """Emit the code to implement glGetBooleanv, glGetIntegerv or glGetFloatv.""" | ||||
assert (returnType == GLboolean or | assert (returnType == GLboolean or | ||||
returnType == GLint or | returnType == GLint or | ||||
strType = TypeStrings[returnType] | strType = TypeStrings[returnType] | ||||
# Capitalize first letter of return type | # Capitalize first letter of return type | ||||
if returnType == GLint: | if returnType == GLint: | ||||
function = "_mesa_GetIntegerv" | |||||
function = "_es%d_GetIntegerv" % API | |||||
elif returnType == GLboolean: | elif returnType == GLboolean: | ||||
function = "_mesa_GetBooleanv" | |||||
function = "_es%d_GetBooleanv" % API | |||||
elif returnType == GLfloat: | elif returnType == GLfloat: | ||||
function = "_mesa_GetFloatv" | |||||
function = "_es%d_GetFloatv" % API | |||||
elif returnType == GLfixed: | elif returnType == GLfixed: | ||||
function = "_mesa_GetFixedv" | |||||
function = "_es%d_GetFixedv" % API | |||||
else: | else: | ||||
abort() | abort() | ||||
#define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0])) | #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0])) | ||||
void GLAPIENTRY | |||||
_mesa_GetFixedv( GLenum pname, GLfixed *params ); | |||||
""" | """ | ||||
return | return | ||||
def EmitAll(stateVars, API): | def EmitAll(stateVars, API): | ||||
EmitHeader() | EmitHeader() | ||||
EmitGetFunction(stateVars, GLboolean) | |||||
EmitGetFunction(stateVars, GLfloat) | |||||
EmitGetFunction(stateVars, GLint) | |||||
EmitGetFunction(stateVars, GLboolean, API) | |||||
EmitGetFunction(stateVars, GLfloat, API) | |||||
EmitGetFunction(stateVars, GLint, API) | |||||
if API == 1: | if API == 1: | ||||
EmitGetFunction(stateVars, GLfixed) | |||||
EmitGetFunction(stateVars, GLfixed, API) | |||||
def main(args): | def main(args): |
<function name="PixelStorei" template="PixelStore" gltype="GLint"/> | <function name="PixelStorei" template="PixelStore" gltype="GLint"/> | ||||
<function name="ReadPixels" template="ReadPixels"/> | <function name="ReadPixels" template="ReadPixels"/> | ||||
<function name="GetBooleanv" template="GetState" gltype="GLboolean"/> | |||||
<function name="GetBooleanv" default_prefix="_es1_" template="GetState" gltype="GLboolean"/> | |||||
<function name="GetClipPlanef" template="GetClipPlane" gltype="GLfloat"/> | <function name="GetClipPlanef" template="GetClipPlane" gltype="GLfloat"/> | ||||
<function name="GetClipPlanex" template="GetClipPlane" gltype="GLfixed"/> | <function name="GetClipPlanex" template="GetClipPlane" gltype="GLfixed"/> | ||||
<function name="GetError" template="GetError"/> | <function name="GetError" template="GetError"/> | ||||
<function name="GetFloatv" template="GetState" gltype="GLfloat"/> | |||||
<function name="GetFixedv" template="GetState" gltype="GLfixed"/> | |||||
<function name="GetIntegerv" template="GetState" gltype="GLint"/> | |||||
<function name="GetFloatv" default_prefix="_es1_" template="GetState" gltype="GLfloat"/> | |||||
<function name="GetFixedv" default_prefix="_es1_" template="GetState" gltype="GLfixed"/> | |||||
<function name="GetIntegerv" default_prefix="_es1_" template="GetState" gltype="GLint"/> | |||||
<function name="GetLightfv" template="GetLight" gltype="GLfloat"/> | <function name="GetLightfv" template="GetLight" gltype="GLfloat"/> | ||||
<function name="GetLightxv" template="GetLight" gltype="GLfixed"/> | <function name="GetLightxv" template="GetLight" gltype="GLfixed"/> | ||||
<function name="PixelStorei" template="PixelStore" gltype="GLint"/> | <function name="PixelStorei" template="PixelStore" gltype="GLint"/> | ||||
<function name="ReadPixels" template="ReadPixels"/> | <function name="ReadPixels" template="ReadPixels"/> | ||||
<function name="GetBooleanv" template="GetState" gltype="GLboolean"/> | |||||
<function name="GetBooleanv" default_prefix="_es2_" template="GetState" gltype="GLboolean"/> | |||||
<function name="GetError" template="GetError"/> | <function name="GetError" template="GetError"/> | ||||
<function name="GetFloatv" template="GetState" gltype="GLfloat"/> | |||||
<function name="GetIntegerv" template="GetState" gltype="GLint"/> | |||||
<function name="GetFloatv" default_prefix="_es2_" template="GetState" gltype="GLfloat"/> | |||||
<function name="GetIntegerv" default_prefix="_es2_" template="GetState" gltype="GLint"/> | |||||
<function name="GetString" template="GetString"/> | <function name="GetString" template="GetString"/> | ||||
return params | return params | ||||
def FunctionPrefix(funcname): | |||||
"""Return function specific prefix.""" | |||||
func = __functions[funcname] | |||||
return func.prefix | |||||
def FindParamIndex(params, paramname): | def FindParamIndex(params, paramname): | ||||
"""Find the index of a named parameter.""" | """Find the index of a named parameter.""" | ||||
for i in xrange(len(params)): | for i in xrange(len(params)): |
passthroughFuncName = "" | passthroughFuncName = "" | ||||
passthroughDeclarationString = "" | passthroughDeclarationString = "" | ||||
passthroughCallString = "" | passthroughCallString = "" | ||||
prefixOverride = None | |||||
variables = [] | variables = [] | ||||
conversionCodeOutgoing = [] | conversionCodeOutgoing = [] | ||||
conversionCodeIncoming = [] | conversionCodeIncoming = [] | ||||
funcPrefix = "_es_" | funcPrefix = "_es_" | ||||
aliasprefix = apiutil.AliasPrefix(funcName) | aliasprefix = apiutil.AliasPrefix(funcName) | ||||
alias = apiutil.ConversionFunction(funcName) | alias = apiutil.ConversionFunction(funcName) | ||||
prefixOverride = apiutil.FunctionPrefix(funcName) | |||||
if prefixOverride != "_mesa_": | |||||
aliasprefix = apiutil.FunctionPrefix(funcName) | |||||
if not alias: | if not alias: | ||||
# There may still be a Mesa alias for the function | # There may still be a Mesa alias for the function | ||||
if apiutil.Alias(funcName): | if apiutil.Alias(funcName): |
extern GLenum GLAPIENTRY | extern GLenum GLAPIENTRY | ||||
_mesa_GetError( void ); | _mesa_GetError( void ); | ||||
extern void GLAPIENTRY | |||||
_es1_GetBooleanv( GLenum pname, GLboolean *params ); | |||||
extern void GLAPIENTRY | |||||
_es1_GetFloatv( GLenum pname, GLfloat *params ); | |||||
extern void GLAPIENTRY | |||||
_es1_GetIntegerv( GLenum pname, GLint *params ); | |||||
extern void GLAPIENTRY | |||||
_es1_GetFixedv( GLenum pname, GLfixed *params ); | |||||
extern void GLAPIENTRY | |||||
_es2_GetBooleanv( GLenum pname, GLboolean *params ); | |||||
extern void GLAPIENTRY | |||||
_es2_GetFloatv( GLenum pname, GLfloat *params ); | |||||
extern void GLAPIENTRY | |||||
_es2_GetIntegerv( GLenum pname, GLint *params ); | |||||
#endif | #endif |