diff options
author | Brian Paul <[email protected]> | 2010-04-20 16:15:14 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-04-20 16:17:09 -0600 |
commit | 395cec966badced12c71cbf6470586f10474794a (patch) | |
tree | 6cc08bb216d143ca80a6d873943fc40ea04c73ce /src/mesa/main/get_gen.py | |
parent | f4dcb5de4e46d7b511b530375ef77e9946b89ff0 (diff) |
mesa: better, smaller error handling code for glGet*()
get.o is about 17% smaller.
Diffstat (limited to 'src/mesa/main/get_gen.py')
-rw-r--r-- | src/mesa/main/get_gen.py | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index d6a6d0b18fa..e6245e4bd86 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -1270,18 +1270,16 @@ def EmitGetFunction(stateVars, returnType, indexed): # Do extension check if extensions: if len(extensions) == 1: - print (' CHECK_EXT1(%s, "%s");' % - (extensions[0], function)) + print (' CHECK_EXT1(%s);' % extensions[0]) elif len(extensions) == 2: - print (' CHECK_EXT2(%s, %s, "%s");' % - (extensions[0], extensions[1], function)) + print (' CHECK_EXT2(%s, %s);' % (extensions[0], extensions[1])) elif len(extensions) == 3: - print (' CHECK_EXT3(%s, %s, %s, "%s");' % - (extensions[0], extensions[1], extensions[2], function)) + print (' CHECK_EXT3(%s, %s, %s);' % + (extensions[0], extensions[1], extensions[2])) else: assert len(extensions) == 4 - print (' CHECK_EXT4(%s, %s, %s, %s, "%s");' % - (extensions[0], extensions[1], extensions[2], extensions[3], function)) + print (' CHECK_EXT4(%s, %s, %s, %s);' % + (extensions[0], extensions[1], extensions[2], extensions[3])) # Do dirty state check if dirtyFlags: @@ -1314,8 +1312,12 @@ def EmitGetFunction(stateVars, returnType, indexed): print " break;" print " default:" - print ' _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(pname=0x%%x)", pname);' % function + print " goto invalid_enum_error;" print " }" + print " return;" + print "" + print "invalid_enum_error:" + print ' _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(pname=0x%%x)", pname);' % function print "}" if returnType == GLint64: print "#endif /* FEATURE_ARB_sync */" @@ -1360,39 +1362,35 @@ def EmitHeader(): /* * Check if named extension is enabled, if not generate error and return. */ -#define CHECK_EXT1(EXT1, FUNC) \\ +#define CHECK_EXT1(EXT1) \\ if (!ctx->Extensions.EXT1) { \\ - _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\ - return; \\ + goto invalid_enum_error; \\ } /* * Check if either of two extensions is enabled. */ -#define CHECK_EXT2(EXT1, EXT2, FUNC) \\ +#define CHECK_EXT2(EXT1, EXT2) \\ if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \\ - _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\ - return; \\ + goto invalid_enum_error; \\ } /* * Check if either of three extensions is enabled. */ -#define CHECK_EXT3(EXT1, EXT2, EXT3, FUNC) \\ +#define CHECK_EXT3(EXT1, EXT2, EXT3) \\ if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \\ !ctx->Extensions.EXT3) { \\ - _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\ - return; \\ + goto invalid_enum_error; \\ } /* * Check if either of four extensions is enabled. */ -#define CHECK_EXT4(EXT1, EXT2, EXT3, EXT4, FUNC) \\ +#define CHECK_EXT4(EXT1, EXT2, EXT3, EXT4) \\ if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \\ !ctx->Extensions.EXT3 && !ctx->Extensions.EXT4) { \\ - _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\ - return; \\ + goto invalid_enum_error; \\ } """ |