LCOV - app.info - gfx/angle/src/compiler/ShHandle.h

LCOV - code coverage report
| Current view: | directory - gfx/angle/src/compiler - ShHandle.h (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 6 | 0 | 0.0 %
| Date: | 2012-06-02 | Functions: | 6 | 0 | 0.0 %

           1                 : //
           2                 : // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
           3                 : // Use of this source code is governed by a BSD-style license that can be
           4                 : // found in the LICENSE file.
           5                 : //
           6                 :
           7                 : #ifndef _SHHANDLE_INCLUDED_
           8                 : #define _SHHANDLE_INCLUDED_
           9                 :
          10                 : //
          11                 : // Machine independent part of the compiler private objects
          12                 : // sent as ShHandle to the driver.
          13                 : //
          14                 : // This should not be included by driver code.
          15                 : //
          16                 :
          17                 : #include "GLSLANG/ShaderLang.h"
          18                 :
          19                 : #include "compiler/BuiltInFunctionEmulator.h"
          20                 : #include "compiler/ExtensionBehavior.h"
          21                 : #include "compiler/InfoSink.h"
          22                 : #include "compiler/SymbolTable.h"
          23                 : #include "compiler/VariableInfo.h"
          24                 :
          25                 : class LongNameMap;
          26                 : class TCompiler;
          27                 :
          28                 : //
          29                 : // The base class used to back handles returned to the driver.
          30                 : //
          31                 : class TShHandleBase {
          32                 : public:
          33                 :     TShHandleBase();
          34                 :     virtual ~TShHandleBase();
          35               0 :     virtual TCompiler* getAsCompiler() { return 0; }
          36                 :
          37                 : protected:
          38                 :     // Memory allocator. Allocates and tracks memory required by the compiler.
          39                 :     // Deallocates all memory when compiler is destructed.
          40                 :     TPoolAllocator allocator;
          41                 : };
          42                 :
          43                 : //
          44                 : // The base class for the machine dependent compiler to derive from
          45                 : // for managing object code from the compile.
          46                 : //
          47                 : class TCompiler : public TShHandleBase {
          48                 : public:
          49                 :     TCompiler(ShShaderType type, ShShaderSpec spec);
          50                 :     virtual ~TCompiler();
          51               0 :     virtual TCompiler* getAsCompiler() { return this; }
          52                 :
          53                 :     bool Init(const ShBuiltInResources& resources);
          54                 :     bool compile(const char* const shaderStrings[],
          55                 :                  const int numStrings,
          56                 :                  int compileOptions);
          57                 :
          58                 :     // Get results of the last compilation.
          59               0 :     TInfoSink& getInfoSink() { return infoSink; }
          60               0 :     const TVariableInfoList& getAttribs() const { return attribs; }
          61               0 :     const TVariableInfoList& getUniforms() const { return uniforms; }
          62                 :     int getMappedNameMaxLength() const;
          63                 :
          64                 : protected:
          65               0 :     ShShaderType getShaderType() const { return shaderType; }
          66                 :     ShShaderSpec getShaderSpec() const { return shaderSpec; }
          67                 :     // Initialize symbol-table with built-in symbols.
          68                 :     bool InitBuiltInSymbolTable(const ShBuiltInResources& resources);
          69                 :     // Clears the results from the previous compilation.
          70                 :     void clearResults();
          71                 :     // Return true if function recursion is detected.
          72                 :     bool detectRecursion(TIntermNode* root);
          73                 :     // Returns true if the given shader does not exceed the minimum
          74                 :     // functionality mandated in GLSL 1.0 spec Appendix A.
          75                 :     bool validateLimitations(TIntermNode* root);
          76                 :     // Collect info for all attribs and uniforms.
          77                 :     void collectAttribsUniforms(TIntermNode* root);
          78                 :     // Map long variable names into shorter ones.
          79                 :     void mapLongVariableNames(TIntermNode* root);
          80                 :     // Translate to object code.
          81                 :     virtual void translate(TIntermNode* root) = 0;
          82                 :     // Get built-in extensions with default behavior.
          83                 :     const TExtensionBehavior& getExtensionBehavior() const;
          84                 :
          85                 :     const BuiltInFunctionEmulator& getBuiltInFunctionEmulator() const;
          86                 :
          87                 : private:
          88                 :     ShShaderType shaderType;
          89                 :     ShShaderSpec shaderSpec;
          90                 :
          91                 :     // Built-in symbol table for the given language, spec, and resources.
          92                 :     // It is preserved from compile-to-compile.
          93                 :     TSymbolTable symbolTable;
          94                 :     // Built-in extensions with default behavior.
          95                 :     TExtensionBehavior extensionBehavior;
          96                 :
          97                 :     BuiltInFunctionEmulator builtInFunctionEmulator;
          98                 :
          99                 :     // Results of compilation.
         100                 :     TInfoSink infoSink;  // Output sink.
         101                 :     TVariableInfoList attribs;  // Active attributes in the compiled shader.
         102                 :     TVariableInfoList uniforms;  // Active uniforms in the compiled shader.
         103                 :
         104                 :     // Cached copy of the ref-counted singleton.
         105                 :     LongNameMap* longNameMap;
         106                 : };
         107                 :
         108                 : //
         109                 : // This is the interface between the machine independent code
         110                 : // and the machine dependent code.
         111                 : //
         112                 : // The machine dependent code should derive from the classes
         113                 : // above. Then Construct*() and Delete*() will create and
         114                 : // destroy the machine dependent objects, which contain the
         115                 : // above machine independent information.
         116                 : //
         117                 : TCompiler* ConstructCompiler(
         118                 :     ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
         119                 : void DeleteCompiler(TCompiler*);
         120                 :
         121                 : #endif // _SHHANDLE_INCLUDED_

Generated by: LCOV version 1.7