diff options
author | Ian Romanick <[email protected]> | 2010-07-18 15:59:43 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-07-20 17:48:24 -0700 |
commit | 2462a536ea5c98867296905e3da127eba7c7bdff (patch) | |
tree | 661139c92c86bda4966b6365cd95820650fc52ef /src/glsl/glsl_parser_extras.cpp | |
parent | 7e2aa91507a5883e33473e0a94215ee3985baad1 (diff) |
glsl2: Add a constructor for _mesa_glsl_parse_state
Coming changes to the handling of built-in functions necessitate this.
Diffstat (limited to 'src/glsl/glsl_parser_extras.cpp')
-rw-r--r-- | src/glsl/glsl_parser_extras.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index cb7b6d36a2d..bcf2579733d 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -34,6 +34,47 @@ extern "C" { #include "glsl_parser_extras.h" #include "glsl_parser.h" +_mesa_glsl_parse_state::_mesa_glsl_parse_state(struct __GLcontextRec *ctx, + GLenum target, void *mem_ctx) +{ + switch (target) { + case GL_VERTEX_SHADER: this->target = vertex_shader; break; + case GL_FRAGMENT_SHADER: this->target = fragment_shader; break; + case GL_GEOMETRY_SHADER: this->target = geometry_shader; break; + } + + this->scanner = NULL; + this->translation_unit.make_empty(); + this->symbols = new(mem_ctx) glsl_symbol_table; + this->info_log = talloc_strdup(mem_ctx, ""); + this->error = false; + this->loop_or_switch_nesting = NULL; + this->ARB_texture_rectangle_enable = true; + + if (ctx != NULL) { + this->extensions = &ctx->Extensions; + + this->Const.MaxLights = ctx->Const.MaxLights; + this->Const.MaxClipPlanes = ctx->Const.MaxClipPlanes; + this->Const.MaxTextureUnits = ctx->Const.MaxTextureUnits; + this->Const.MaxTextureCoords = ctx->Const.MaxTextureCoordUnits; + this->Const.MaxVertexAttribs = ctx->Const.VertexProgram.MaxAttribs; + this->Const.MaxVertexUniformComponents = ctx->Const.VertexProgram.MaxUniformComponents; + this->Const.MaxVaryingFloats = ctx->Const.MaxVarying * 4; + this->Const.MaxVertexTextureImageUnits = ctx->Const.MaxVertexTextureImageUnits; + this->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxCombinedTextureImageUnits; + this->Const.MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits; + this->Const.MaxFragmentUniformComponents = ctx->Const.FragmentProgram.MaxUniformComponents; + + this->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers; + } else { + static struct gl_extensions null_extensions; + + memset(&null_extensions, 0, sizeof(null_extensions)); + this->extensions = &null_extensions; + } +} + const char * _mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target) { |