diff options
author | Paul Berry <[email protected]> | 2012-08-02 11:02:55 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2012-12-06 12:13:21 -0800 |
commit | 629b9edc99a0b662cf907b9e068be2fd6ac5ae26 (patch) | |
tree | 1928c767aa184a98290c7b34ab586f70f7525381 /src/glsl/glsl_parser.yy | |
parent | a03c2c7ab958f024eb77d986285ae294ad459706 (diff) |
glsl/parser: Extract version directive processing into a function.
Version directive handling is going to have to be used within two
parser rules, one for desktop-style version directives (e.g. "#version
130") and one for the new ES-style version directive (e.g. "#version
300 es"), so this patch moves it to a function that can be called from
both rules.
No functional change.
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Acked-by: Carl Worth <[email protected]>
Diffstat (limited to 'src/glsl/glsl_parser.yy')
-rw-r--r-- | src/glsl/glsl_parser.yy | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 6cc1a513bd5..b15e1d1f548 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -261,48 +261,7 @@ version_statement: /* blank - no #version specified: defaults are already set */ | VERSION_TOK INTCONSTANT EOL { - bool supported = false; - - switch ($2) { - case 100: - state->es_shader = true; - supported = state->ctx->API == API_OPENGLES2 || - state->ctx->Extensions.ARB_ES2_compatibility; - break; - case 110: - case 120: - /* FINISHME: Once the OpenGL 3.0 'forward compatible' context or - * the OpenGL 3.2 Core context is supported, this logic will need - * change. Older versions of GLSL are no longer supported - * outside the compatibility contexts of 3.x. - */ - case 130: - case 140: - case 150: - case 330: - case 400: - case 410: - case 420: - supported = _mesa_is_desktop_gl(state->ctx) && - ((unsigned) $2) <= state->ctx->Const.GLSLVersion; - break; - default: - supported = false; - break; - } - - state->language_version = $2; - - if (!supported) { - _mesa_glsl_error(& @2, state, "%s is not supported. " - "Supported versions are: %s\n", - state->get_version_string(), - state->supported_version_string); - } - - if (state->language_version >= 140) { - state->ARB_uniform_buffer_object_enable = true; - } + state->process_version_directive(&@2, $2); } ; |