ARB sync: Add infrastructure for glGetInteger64v

This commit is contained in:
Ian Romanick
2009-08-28 15:37:25 -07:00
parent d75a99edd6
commit 10067e4641
6 changed files with 1862 additions and 1 deletions
+2
View File
@@ -766,6 +766,8 @@ struct dd_function_table {
/** Return the value or values of a selected parameter */
GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result);
/** Return the value or values of a selected parameter */
GLboolean (*GetInteger64v)(GLcontext *ctx, GLenum pname, GLint64 *result);
/** Return the value or values of a selected parameter */
GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result);
/*@}*/
+1832
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -47,6 +47,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params );
extern void GLAPIENTRY
_mesa_GetIntegerv( GLenum pname, GLint *params );
extern void GLAPIENTRY
_mesa_GetInteger64v( GLenum pname, GLint64 *params );
extern void GLAPIENTRY
_mesa_GetPointerv( GLenum pname, GLvoid **params );
+21 -1
View File
@@ -35,6 +35,7 @@ GLfloat = 3
GLdouble = 4
GLboolean = 5
GLfloatN = 6 # A normalized value, such as a color or depth range
GLint64 = 7
TypeStrings = {
@@ -42,7 +43,8 @@ TypeStrings = {
GLenum : "GLenum",
GLfloat : "GLfloat",
GLdouble : "GLdouble",
GLboolean : "GLboolean"
GLboolean : "GLboolean",
GLint64 : "GLint64"
}
@@ -1029,10 +1031,16 @@ def ConversionFunc(fromType, toType):
return ""
elif fromType == GLfloat and toType == GLint:
return "IROUND"
elif fromType == GLfloat and toType == GLint64:
return "IROUND64"
elif fromType == GLfloatN and toType == GLfloat:
return ""
elif fromType == GLint and toType == GLfloat: # but not GLfloatN!
return "(GLfloat)"
elif fromType == GLint and toType == GLint64:
return ""
elif fromType == GLint64 and toType == GLfloat: # but not GLfloatN!
return "(GLfloat)"
else:
if fromType == GLfloatN:
fromType = GLfloat
@@ -1047,6 +1055,7 @@ def EmitGetFunction(stateVars, returnType):
"""Emit the code to implement glGetBooleanv, glGetIntegerv or glGetFloatv."""
assert (returnType == GLboolean or
returnType == GLint or
returnType == GLint64 or
returnType == GLfloat)
strType = TypeStrings[returnType]
@@ -1057,9 +1066,14 @@ def EmitGetFunction(stateVars, returnType):
function = "GetBooleanv"
elif returnType == GLfloat:
function = "GetFloatv"
elif returnType == GLint64:
function = "GetInteger64v"
else:
abort()
if returnType == GLint64:
print "#if FEATURE_ARB_sync"
print "void GLAPIENTRY"
print "_mesa_%s( GLenum pname, %s *params )" % (function, strType)
print "{"
@@ -1113,6 +1127,8 @@ def EmitGetFunction(stateVars, returnType):
print ' _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(pname=0x%%x)", pname);' % function
print " }"
print "}"
if returnType == GLint64:
print "#endif /* FEATURE_ARB_sync */"
print ""
return
@@ -1142,8 +1158,11 @@ def EmitHeader():
#define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE )
#define BOOLEAN_TO_INT(B) ( (GLint) (B) )
#define BOOLEAN_TO_INT64(B) ( (GLint64) (B) )
#define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F )
#define ENUM_TO_INT64(E) ( (GLint64) (E) )
/*
* Check if named extension is enabled, if not generate error and return.
@@ -1221,5 +1240,6 @@ EmitHeader()
EmitGetFunction(StateVars, GLboolean)
EmitGetFunction(StateVars, GLfloat)
EmitGetFunction(StateVars, GLint)
EmitGetFunction(StateVars, GLint64)
EmitGetDoublev()
+1
View File
@@ -291,6 +291,7 @@ long iround(float f);
#define IROUND(f) ((int) (((f) >= 0.0F) ? ((f) + 0.5F) : ((f) - 0.5F)))
#endif
#define IROUND64(f) ((GLint64) (((f) >= 0.0F) ? ((f) + 0.5F) : ((f) - 0.5F)))
/***
*** IROUND_POS: return (as an integer) positive float rounded to nearest int
+3
View File
@@ -99,6 +99,9 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
/* a close approximation: */
#define FLOAT_TO_INT(X) ( (GLint) (2147483647.0 * (X)) )
/** Convert GLfloat in [-1.0,1.0] to GLint64 in [-(1<<63),(1 << 63) -1] */
#define FLOAT_TO_INT64(X) ( (GLint64) (9223372036854775807.0 * (double)(X)) )
/** Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0], texture/fb data */
#define INT_TO_FLOAT_TEX(I) ((I) == -2147483648 ? -1.0F : (I) * (1.0F/2147483647.0))