1 /*
2 * Copyright 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 
17 #ifndef SHADER_PARSER_H
18 #define SHADER_PARSER_H
19 
20 #include "GLESv2Context.h"
21 #include <string>
22 #include <GLES2/gl2.h>
23 #include <GLcommon/objectNameManager.h>
24 
25 class ShaderParser:public ObjectData{
26 public:
27     ShaderParser();
28     ShaderParser(GLenum type);
29     void           setSrc(const Version& ver,GLsizei count,const GLchar** strings,const GLint* length);
30     const char*    getOriginalSrc();
31     const GLchar** parsedLines();
32     GLenum         getType();
33     ~ShaderParser();
34 
35     void setInfoLog(GLchar * infoLog);
36     GLchar* getInfoLog();
37 
38 private:
39     void parseOriginalSrc();
40     void parseGLSLversion();
41     void parseBuiltinConstants();
42     void parseOmitPrecision();
43     void parseExtendDefaultPrecision();
44     void parseLineNumbers();
45     void clearParsedSrc();
46 
47     GLenum      m_type;
48     char*       m_originalSrc;
49     std::string m_src;
50     std::string m_parsedSrc;
51     GLchar*     m_parsedLines;
52     GLchar*     m_infoLog;
53 };
54 #endif
55