diff options
author | Chia-I Wu <[email protected]> | 2010-01-12 11:25:02 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2010-01-12 11:25:02 +0800 |
commit | 562c127693200822f04a145db50add1be2425d7b (patch) | |
tree | 9441774fb212b17ddf2a364f06abc43f166cc00b /src/mesa/main/get_gen.py | |
parent | e5d351dcfde58777162552cf5cd2a9cd8299f4cd (diff) | |
parent | 077d6dd7508af88509dd0499c5dfbdaa186b4015 (diff) |
Merge branch 'master' into opengl-es-v2
Conflicts:
src/mesa/main/dd.h
Diffstat (limited to 'src/mesa/main/get_gen.py')
-rw-r--r-- | src/mesa/main/get_gen.py | 106 |
1 files changed, 78 insertions, 28 deletions
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index 930c3362fae..b0beb592075 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -82,7 +82,7 @@ StateVars = [ ( "GL_AUTO_NORMAL", GLboolean, ["ctx->Eval.AutoNormal"], "", None ), ( "GL_AUX_BUFFERS", GLint, ["ctx->DrawBuffer->Visual.numAuxBuffers"], "", None ), - ( "GL_BLEND", GLboolean, ["ctx->Color.BlendEnabled"], "", None ), + ( "GL_BLEND", GLboolean, ["(ctx->Color.BlendEnabled & 1)"], "", None ), ( "GL_BLEND_DST", GLenum, ["ctx->Color.BlendDstRGB"], "", None ), ( "GL_BLEND_SRC", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ), ( "GL_BLEND_SRC_RGB_EXT", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ), @@ -126,10 +126,10 @@ StateVars = [ ( "GL_COLOR_MATERIAL_PARAMETER", GLenum, ["ctx->Light.ColorMaterialMode"], "", None ), ( "GL_COLOR_WRITEMASK", GLint, - [ "ctx->Color.ColorMask[RCOMP] ? 1 : 0", - "ctx->Color.ColorMask[GCOMP] ? 1 : 0", - "ctx->Color.ColorMask[BCOMP] ? 1 : 0", - "ctx->Color.ColorMask[ACOMP] ? 1 : 0" ], "", None ), + [ "ctx->Color.ColorMask[0][RCOMP] ? 1 : 0", + "ctx->Color.ColorMask[0][GCOMP] ? 1 : 0", + "ctx->Color.ColorMask[0][BCOMP] ? 1 : 0", + "ctx->Color.ColorMask[0][ACOMP] ? 1 : 0" ], "", None ), ( "GL_CULL_FACE", GLboolean, ["ctx->Polygon.CullFlag"], "", None ), ( "GL_CULL_FACE_MODE", GLenum, ["ctx->Polygon.CullFaceMode"], "", None ), ( "GL_CURRENT_COLOR", GLfloatN, @@ -942,9 +942,9 @@ StateVars = [ # GL_OES_read_format ( "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", GLint, - ["ctx->Const.ColorReadType"], "", ["OES_read_format"] ), + ["_mesa_get_color_read_type(ctx)"], "", ["OES_read_format"] ), ( "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", GLint, - ["ctx->Const.ColorReadFormat"], "", ["OES_read_format"] ), + ["_mesa_get_color_read_format(ctx)"], "", ["OES_read_format"] ), # GL_ATI_fragment_shader ( "GL_NUM_FRAGMENT_REGISTERS_ATI", GLint, ["6"], "", ["ATI_fragment_shader"] ), @@ -1006,7 +1006,7 @@ StateVars = [ ( "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", GLint, ["ctx->Const.MaxVertexTextureImageUnits"], "", ["ARB_vertex_shader"] ), ( "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", GLint, - ["MAX_COMBINED_TEXTURE_IMAGE_UNITS"], "", ["ARB_vertex_shader"] ), + ["ctx->Const.MaxCombinedTextureImageUnits"], "", ["ARB_vertex_shader"] ), # GL_ARB_shader_objects # Actually, this token isn't part of GL_ARB_shader_objects, but is @@ -1030,9 +1030,29 @@ StateVars = [ # GL_ARB_sync ( "GL_MAX_SERVER_WAIT_TIMEOUT", GLint64, ["ctx->Const.MaxServerWaitTimeout"], "", ["ARB_sync"] ), + + # GL3 + ( "GL_NUM_EXTENSIONS", GLint, ["_mesa_get_extension_count(ctx)"], "", None ), + ( "GL_MAJOR_VERSION", GLint, ["ctx->VersionMajor"], "", None ), + ( "GL_MINOR_VERSION", GLint, ["ctx->VersionMinor"], "", None ) +] + + +# These are queried via glGetIntegetIndexdvEXT() or glGetIntegeri_v() +IndexedStateVars = [ + ( "GL_BLEND", GLint, ["((ctx->Color.BlendEnabled >> index) & 1)"], + "ctx->Const.MaxDrawBuffers", ["EXT_draw_buffers2"] ), + ( "GL_COLOR_WRITEMASK", GLint, + [ "ctx->Color.ColorMask[index][RCOMP] ? 1 : 0", + "ctx->Color.ColorMask[index][GCOMP] ? 1 : 0", + "ctx->Color.ColorMask[index][BCOMP] ? 1 : 0", + "ctx->Color.ColorMask[index][ACOMP] ? 1 : 0" ], + "ctx->Const.MaxDrawBuffers", ["EXT_draw_buffers2"] ), + # XXX more to come... ] + def ConversionFunc(fromType, toType): """Return the name of the macro to convert between two data types.""" if fromType == toType: @@ -1059,7 +1079,7 @@ def ConversionFunc(fromType, toType): return fromStr + "_TO_" + toStr -def EmitGetFunction(stateVars, returnType): +def EmitGetFunction(stateVars, returnType, indexed): """Emit the code to implement glGetBooleanv, glGetIntegerv or glGetFloatv.""" assert (returnType == GLboolean or returnType == GLint or @@ -1068,22 +1088,35 @@ def EmitGetFunction(stateVars, returnType): strType = TypeStrings[returnType] # Capitalize first letter of return type - if returnType == GLint: - function = "GetIntegerv" - elif returnType == GLboolean: - function = "GetBooleanv" - elif returnType == GLfloat: - function = "GetFloatv" - elif returnType == GLint64: - function = "GetInteger64v" + if indexed: + if returnType == GLint: + function = "GetIntegerIndexedv" + elif returnType == GLboolean: + function = "GetBooleanIndexedv" + elif returnType == GLint64: + function = "GetInteger64Indexedv" + else: + function = "Foo" else: - abort() + if returnType == GLint: + function = "GetIntegerv" + elif returnType == GLboolean: + 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) + if indexed: + print "_mesa_%s( GLenum pname, GLuint index, %s *params )" % (function, strType) + else: + print "_mesa_%s( GLenum pname, %s *params )" % (function, strType) print "{" print " GET_CURRENT_CONTEXT(ctx);" print " ASSERT_OUTSIDE_BEGIN_END(ctx);" @@ -1094,13 +1127,20 @@ def EmitGetFunction(stateVars, returnType): print " if (ctx->NewState)" print " _mesa_update_state(ctx);" print "" - print " if (ctx->Driver.%s &&" % function - print " ctx->Driver.%s(ctx, pname, params))" % function - print " return;" - print "" + if indexed == 0: + print " if (ctx->Driver.%s &&" % function + print " ctx->Driver.%s(ctx, pname, params))" % function + print " return;" + print "" print " switch (pname) {" - for (name, varType, state, optionalCode, extensions) in stateVars: + for state in stateVars: + if indexed: + (name, varType, state, indexMax, extensions) = state + optionalCode = 0 + else: + (name, varType, state, optionalCode, extensions) = state + indexMax = 0 print " case " + name + ":" if extensions: if len(extensions) == 1: @@ -1116,6 +1156,11 @@ def EmitGetFunction(stateVars, returnType): assert len(extensions) == 4 print (' CHECK_EXT4(%s, %s, %s, %s, "%s");' % (extensions[0], extensions[1], extensions[2], extensions[3], function)) + if indexMax: + print (' if (index >= %s) {' % indexMax) + print (' _mesa_error(ctx, GL_INVALID_VALUE, "gl%s(index=%%u), index", pname);' % function) + print (' }') + conversion = ConversionFunc(varType, returnType) if optionalCode: optionalCode = string.replace(optionalCode, "CONVERSION", conversion); @@ -1159,6 +1204,7 @@ def EmitHeader(): #include "mtypes.h" #include "state.h" #include "texcompress.h" +#include "framebuffer.h" #define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE ) @@ -1248,9 +1294,13 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) EmitHeader() # XXX Maybe sort the StateVars list -EmitGetFunction(StateVars, GLboolean) -EmitGetFunction(StateVars, GLfloat) -EmitGetFunction(StateVars, GLint) -EmitGetFunction(StateVars, GLint64) +EmitGetFunction(StateVars, GLboolean, 0) +EmitGetFunction(StateVars, GLfloat, 0) +EmitGetFunction(StateVars, GLint, 0) +EmitGetFunction(StateVars, GLint64, 0) EmitGetDoublev() +EmitGetFunction(IndexedStateVars, GLboolean, 1) +EmitGetFunction(IndexedStateVars, GLint, 1) +EmitGetFunction(IndexedStateVars, GLint64, 1) + |