当前位置: 首页>>代码示例>>C++>>正文


C++ TSymbolTable类代码示例

本文整理汇总了C++中TSymbolTable的典型用法代码示例。如果您正苦于以下问题:C++ TSymbolTable类的具体用法?C++ TSymbolTable怎么用?C++ TSymbolTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TSymbolTable类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: InitializeSymbolTable

/// Initializize the symbol table
/// \param BuiltInStrings
///      Pointer to built in strings.
/// \param language
///      Shading language to initialize symbol table for
/// \param infoSink
///      Information sink (for errors/warnings)
/// \param symbolTables
///      Array of symbol tables (one for each language)
/// \param bUseGlobalSymbolTable
///      Whether to use the global symbol table or the per-language symbol table
/// \return
///      True if succesfully initialized, false otherwise
bool InitializeSymbolTable( TBuiltInStrings* BuiltInStrings, EShLanguage language, TInfoSink& infoSink, 
                            TSymbolTable* symbolTables, bool bUseGlobalSymbolTable )
{
   TIntermediate intermediate(infoSink); 
   TSymbolTable* symbolTable;

   if ( bUseGlobalSymbolTable )
      symbolTable = symbolTables;
   else
      symbolTable = &symbolTables[language];

   TParseContext parseContext(*symbolTable, intermediate, language, infoSink);

   GlobalParseContext = &parseContext;

   setInitialState();

   assert(symbolTable->isEmpty() || symbolTable->atSharedBuiltInLevel());

   //
   // Parse the built-ins.  This should only happen once per
   // language symbol table.
   //
   // Push the symbol table to give it an initial scope.  This
   // push should not have a corresponding pop, so that built-ins
   // are preserved, and the test for an empty table fails.
   //

   symbolTable->push();

   //Initialize the Preprocessor
   int ret = InitPreprocessor();
   if (ret)
   {
      infoSink.info.message(EPrefixInternalError,  "Unable to intialize the Preprocessor");
      return false;
   }

   for (TBuiltInStrings::iterator i  = BuiltInStrings[parseContext.language].begin();
       i != BuiltInStrings[parseContext.language].end();
       ++i)
   {
      const char* builtInShaders = (*i).c_str();

      if (PaParseString(const_cast<char*>(builtInShaders), parseContext) != 0)
      {
         infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins");
         return false;
      }
   }

   if (  !bUseGlobalSymbolTable )
   {
      IdentifyBuiltIns(parseContext.language, *symbolTable);
   }

   FinalizePreprocessor();

   return true;
}
开发者ID:CRivlaldo,项目名称:hlsl2glslfork,代码行数:73,代码来源:HLSL2GLSL.cpp

示例2: InitializeSymbolTable

/// Initializize the symbol table
/// \param BuiltInStrings
///      Pointer to built in strings.
/// \param language
///      Shading language to initialize symbol table for
/// \param infoSink
///      Information sink (for errors/warnings)
/// \param symbolTables
///      Array of symbol tables (one for each language)
/// \param bUseGlobalSymbolTable
///      Whether to use the global symbol table or the per-language symbol table
/// \return
///      True if succesfully initialized, false otherwise
static bool InitializeSymbolTable( TBuiltInStrings* BuiltInStrings, EShLanguage language, TInfoSink& infoSink, 
                            TSymbolTable* symbolTables, bool bUseGlobalSymbolTable )
{
   TSymbolTable* symbolTable;

   if ( bUseGlobalSymbolTable )
      symbolTable = symbolTables;
   else
      symbolTable = &symbolTables[language];

	//@TODO: for now, we use same global symbol table for all target language versions.
	// This is wrong and will have to be changed at some point.
	TParseContext parseContext(*symbolTable, language, ETargetVersionCount, 0, infoSink);

   GlobalParseContext = &parseContext;

   setInitialState();

   assert(symbolTable->isEmpty() || symbolTable->atSharedBuiltInLevel());

   //
   // Parse the built-ins.  This should only happen once per
   // language symbol table.
   //
   // Push the symbol table to give it an initial scope.  This
   // push should not have a corresponding pop, so that built-ins
   // are preserved, and the test for an empty table fails.
   //

   symbolTable->push();

   for (TBuiltInStrings::iterator i  = BuiltInStrings[parseContext.language].begin();
       i != BuiltInStrings[parseContext.language].end();
       ++i)
   {
      const char* builtInShaders = (*i).c_str();

      if (PaParseString(const_cast<char*>(builtInShaders), parseContext, NULL) != 0)
      {
         infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins");
         return false;
      }
   }

   if (  !bUseGlobalSymbolTable )
   {
      IdentifyBuiltIns(parseContext.language, *symbolTable);
   }

   return true;
}
开发者ID:Irina4ik,项目名称:hlsl2glslfork,代码行数:64,代码来源:HLSL2GLSL.cpp

示例3: InitializeSymbolTable

static bool InitializeSymbolTable(
        const TBuiltInStrings& builtInStrings,
        EShLanguage language, EShSpec spec, const TBuiltInResource& resources,
        TInfoSink& infoSink, TSymbolTable& symbolTable)
{
    TIntermediate intermediate(infoSink);
    TParseContext parseContext(symbolTable, intermediate, language, spec, infoSink);

    GlobalParseContext = &parseContext;

    setInitialState();

    assert(symbolTable.isEmpty());       
    //
    // Parse the built-ins.  This should only happen once per
    // language symbol table.
    //
    // Push the symbol table to give it an initial scope.  This
    // push should not have a corresponding pop, so that built-ins
    // are preserved, and the test for an empty table fails.
    //
    symbolTable.push();
    
    //Initialize the Preprocessor
    if (InitPreprocessor())
    {
        infoSink.info.message(EPrefixInternalError,  "Unable to intialize the Preprocessor");
        return false;
    }

    for (TBuiltInStrings::const_iterator i = builtInStrings.begin(); i != builtInStrings.end(); ++i)
    {
        const char* builtInShaders[1];
        int builtInLengths[1];

        builtInShaders[0] = (*i).c_str();
        builtInLengths[0] = (int) (*i).size();

        if (PaParseStrings(const_cast<char**>(builtInShaders), builtInLengths, 1, parseContext) != 0)
        {
            infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins");
            return false;
        }
    }

    IdentifyBuiltIns(language, spec, resources, symbolTable);

    FinalizePreprocessor();

    return true;
}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:51,代码来源:ShaderLang.cpp

示例4: IdentifyBuiltIns

void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec,
                      const ShBuiltInResources &resources,
                      TSymbolTable &symbolTable)
{
    //
    // Insert some special built-in variables that are not in
    // the built-in header files.
    //
    switch (type)
    {
      case GL_FRAGMENT_SHADER:
        symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_FragCoord"),
            TType(EbtFloat, EbpMedium, EvqFragCoord, 4)));
        symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_FrontFacing"),
            TType(EbtBool,  EbpUndefined, EvqFrontFacing, 1)));
        symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_PointCoord"),
            TType(EbtFloat, EbpMedium, EvqPointCoord, 2)));

        {
            symbolTable.insert(ESSL1_BUILTINS, new TVariable(NewPoolTString("gl_FragColor"),
                TType(EbtFloat, EbpMedium, EvqFragColor, 4)));
            TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, 1, true);
            fragData.setArraySize(resources.MaxDrawBuffers);
            symbolTable.insert(ESSL1_BUILTINS, new TVariable(NewPoolTString("gl_FragData"), fragData));

            if (resources.EXT_blend_func_extended)
            {
                symbolTable.insert(
                    ESSL1_BUILTINS, "GL_EXT_blend_func_extended",
                    new TVariable(NewPoolTString("gl_SecondaryFragColorEXT"),
                                  TType(EbtFloat, EbpMedium, EvqSecondaryFragColorEXT, 4)));
                TType secondaryFragData(EbtFloat, EbpMedium, EvqSecondaryFragDataEXT, 4, 1, true);
                secondaryFragData.setArraySize(resources.MaxDualSourceDrawBuffers);
                symbolTable.insert(
                    ESSL1_BUILTINS, "GL_EXT_blend_func_extended",
                    new TVariable(NewPoolTString("gl_SecondaryFragDataEXT"), secondaryFragData));
            }

            if (resources.EXT_frag_depth)
            {
                symbolTable.insert(ESSL1_BUILTINS, "GL_EXT_frag_depth", new TVariable(NewPoolTString("gl_FragDepthEXT"),
                    TType(EbtFloat, resources.FragmentPrecisionHigh ? EbpHigh : EbpMedium, EvqFragDepth, 1)));
            }

            if (resources.EXT_shader_framebuffer_fetch || resources.NV_shader_framebuffer_fetch)
            {
                TType lastFragData(EbtFloat, EbpMedium, EvqLastFragData, 4, 1, true);
                lastFragData.setArraySize(resources.MaxDrawBuffers);

                if (resources.EXT_shader_framebuffer_fetch)
                {
                    symbolTable.insert(ESSL1_BUILTINS, "GL_EXT_shader_framebuffer_fetch",
                        new TVariable(NewPoolTString("gl_LastFragData"), lastFragData));
                }
                else if (resources.NV_shader_framebuffer_fetch)
                {
                    symbolTable.insert(ESSL1_BUILTINS, "GL_NV_shader_framebuffer_fetch",
                        new TVariable(NewPoolTString("gl_LastFragColor"),
                        TType(EbtFloat, EbpMedium, EvqLastFragColor, 4)));
                    symbolTable.insert(ESSL1_BUILTINS, "GL_NV_shader_framebuffer_fetch",
                        new TVariable(NewPoolTString("gl_LastFragData"), lastFragData));
                }
            }
            else if (resources.ARM_shader_framebuffer_fetch)
            {
                symbolTable.insert(ESSL1_BUILTINS, "GL_ARM_shader_framebuffer_fetch",
                    new TVariable(NewPoolTString("gl_LastFragColorARM"),
                    TType(EbtFloat, EbpMedium, EvqLastFragColor, 4)));
            }
        }

        break;

      case GL_VERTEX_SHADER:
        symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_Position"),
            TType(EbtFloat, EbpHigh, EvqPosition, 4)));
        symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_PointSize"),
            TType(EbtFloat, EbpMedium, EvqPointSize, 1)));
        symbolTable.insert(ESSL3_BUILTINS, new TVariable(NewPoolTString("gl_InstanceID"),
            TType(EbtInt, EbpHigh, EvqInstanceID, 1)));
        break;

      default:
        assert(false && "Language not supported");
    }
}
开发者ID:Happy-Ferret,项目名称:freshplayerplugin,代码行数:86,代码来源:Initialize.cpp

示例5: InsertBuiltInFunctions

void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
{
    const TType *float1 = TCache::getType(EbtFloat);
    const TType *float2 = TCache::getType(EbtFloat, 2);
    const TType *float3 = TCache::getType(EbtFloat, 3);
    const TType *float4 = TCache::getType(EbtFloat, 4);
    const TType *int1 = TCache::getType(EbtInt);
    const TType *int2 = TCache::getType(EbtInt, 2);
    const TType *int3 = TCache::getType(EbtInt, 3);
    const TType *uint1 = TCache::getType(EbtUInt);
    const TType *bool1 = TCache::getType(EbtBool);
    const TType *genType = TCache::getType(EbtGenType);
    const TType *genIType = TCache::getType(EbtGenIType);
    const TType *genUType = TCache::getType(EbtGenUType);
    const TType *genBType = TCache::getType(EbtGenBType);

    //
    // Angle and Trigonometric Functions.
    //
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpRadians, genType, "radians", genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpDegrees, genType, "degrees", genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSin, genType, "sin", genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpCos, genType, "cos", genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpTan, genType, "tan", genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAsin, genType, "asin", genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAcos, genType, "acos", genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAtan, genType, "atan", genType, genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAtan, genType, "atan", genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpSinh, genType, "sinh", genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpCosh, genType, "cosh", genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTanh, genType, "tanh", genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAsinh, genType, "asinh", genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAcosh, genType, "acosh", genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAtanh, genType, "atanh", genType);

    //
    // Exponential Functions.
    //
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpPow, genType, "pow", genType, genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpExp, genType, "exp", genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLog, genType, "log", genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpExp2, genType, "exp2", genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLog2, genType, "log2", genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSqrt, genType, "sqrt", genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpInverseSqrt, genType, "inversesqrt", genType);

    //
    // Common Functions.
    //
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAbs, genType, "abs", genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAbs, genIType, "abs", genIType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSign, genType, "sign", genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpSign, genIType, "sign", genIType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFloor, genType, "floor", genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTrunc, genType, "trunc", genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpRound, genType, "round", genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpRoundEven, genType, "roundEven", genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpCeil, genType, "ceil", genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFract, genType, "fract", genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMod, genType, "mod", genType, float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMod, genType, "mod", genType, genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMin, genType, "min", genType, float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMin, genType, "min", genType, genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genIType, "min", genIType, genIType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genIType, "min", genIType, int1);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genUType, "min", genUType, genUType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genUType, "min", genUType, uint1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMax, genType, "max", genType, float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMax, genType, "max", genType, genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genIType, "max", genIType, genIType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genIType, "max", genIType, int1);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genUType, "max", genUType, genUType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genUType, "max", genUType, uint1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpClamp, genType, "clamp", genType, float1, float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpClamp, genType, "clamp", genType, genType, genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genIType, "clamp", genIType, int1, int1);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genIType, "clamp", genIType, genIType, genIType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genUType, "clamp", genUType, uint1, uint1);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genUType, "clamp", genUType, genUType, genUType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMix, genType, "mix", genType, genType, float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMix, genType, "mix", genType, genType, genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMix, genType, "mix", genType, genType, genBType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpStep, genType, "step", genType, genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpStep, genType, "step", float1, genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSmoothStep, genType, "smoothstep", genType, genType, genType);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSmoothStep, genType, "smoothstep", float1, float1, genType);

    const TType *outFloat1 = TCache::getType(EbtFloat, EvqOut);
    const TType *outFloat2 = TCache::getType(EbtFloat, EvqOut, 2);
    const TType *outFloat3 = TCache::getType(EbtFloat, EvqOut, 3);
    const TType *outFloat4 = TCache::getType(EbtFloat, EvqOut, 4);

    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float1, "modf", float1, outFloat1);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float2, "modf", float2, outFloat2);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float3, "modf", float3, outFloat3);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float4, "modf", float4, outFloat4);

    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpIsNan, genBType, "isnan", genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpIsInf, genBType, "isinf", genType);
    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpFloatBitsToInt, genIType, "floatBitsToInt", genType);
//.........这里部分代码省略.........
开发者ID:Happy-Ferret,项目名称:freshplayerplugin,代码行数:101,代码来源:Initialize.cpp

示例6: IdentifyBuiltIns

void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
                      const ShBuiltInResources &resources,
                      TSymbolTable &symbolTable)
{
    //
    // First, insert some special built-in variables that are not in 
    // the built-in header files.
    //
    switch(type) {
    case SH_FRAGMENT_SHADER:
        symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EbpMedium, EvqFragCoord,   4)));
        symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool,  EbpUndefined, EvqFrontFacing, 1)));
        symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EbpMedium, EvqPointCoord,  2)));

        //
        // In CSS Shaders, gl_FragColor, gl_FragData, and gl_MaxDrawBuffers are not available.
        // Instead, css_MixColor and css_ColorMatrix are available.
        //
        if (spec != SH_CSS_SHADERS_SPEC) {
            symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EbpMedium, EvqFragColor,   4)));
            symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragData[gl_MaxDrawBuffers]"), TType(EbtFloat, EbpMedium, EvqFragData,    4)));
            if (resources.EXT_frag_depth) {
                symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragDepthEXT"), TType(EbtFloat, resources.FragmentPrecisionHigh ? EbpHigh : EbpMedium, EvqFragDepth, 1)));
                symbolTable.relateToExtension(ESSL1_BUILTINS, "gl_FragDepthEXT", "GL_EXT_frag_depth");
            }
        } else {
            symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("css_MixColor"), TType(EbtFloat, EbpMedium, EvqGlobal,      4)));
            symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("css_ColorMatrix"), TType(EbtFloat, EbpMedium, EvqGlobal,      4, 4)));
        }

        break;

    case SH_VERTEX_SHADER:
        symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EbpHigh, EvqPosition,    4)));
        symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EbpMedium, EvqPointSize,   1)));
        break;

    default: assert(false && "Language not supported");
    }

    //
    // Next, identify which built-ins from the already loaded headers have
    // a mapping to an operator.  Those that are not identified as such are
    // expected to be resolved through a library of functions, versus as
    // operations.
    //
    symbolTable.relateToOperator(COMMON_BUILTINS, "matrixCompMult",   EOpMul);

    symbolTable.relateToOperator(COMMON_BUILTINS, "equal",            EOpVectorEqual);
    symbolTable.relateToOperator(COMMON_BUILTINS, "notEqual",         EOpVectorNotEqual);
    symbolTable.relateToOperator(COMMON_BUILTINS, "lessThan",         EOpLessThan);
    symbolTable.relateToOperator(COMMON_BUILTINS, "greaterThan",      EOpGreaterThan);
    symbolTable.relateToOperator(COMMON_BUILTINS, "lessThanEqual",    EOpLessThanEqual);
    symbolTable.relateToOperator(COMMON_BUILTINS, "greaterThanEqual", EOpGreaterThanEqual);
    
    symbolTable.relateToOperator(COMMON_BUILTINS, "radians",      EOpRadians);
    symbolTable.relateToOperator(COMMON_BUILTINS, "degrees",      EOpDegrees);
    symbolTable.relateToOperator(COMMON_BUILTINS, "sin",          EOpSin);
    symbolTable.relateToOperator(COMMON_BUILTINS, "cos",          EOpCos);
    symbolTable.relateToOperator(COMMON_BUILTINS, "tan",          EOpTan);
    symbolTable.relateToOperator(COMMON_BUILTINS, "asin",         EOpAsin);
    symbolTable.relateToOperator(COMMON_BUILTINS, "acos",         EOpAcos);
    symbolTable.relateToOperator(COMMON_BUILTINS, "atan",         EOpAtan);

    symbolTable.relateToOperator(COMMON_BUILTINS, "pow",          EOpPow);
    symbolTable.relateToOperator(COMMON_BUILTINS, "exp2",         EOpExp2);
    symbolTable.relateToOperator(COMMON_BUILTINS, "log",          EOpLog);
    symbolTable.relateToOperator(COMMON_BUILTINS, "exp",          EOpExp);
    symbolTable.relateToOperator(COMMON_BUILTINS, "log2",         EOpLog2);
    symbolTable.relateToOperator(COMMON_BUILTINS, "sqrt",         EOpSqrt);
    symbolTable.relateToOperator(COMMON_BUILTINS, "inversesqrt",  EOpInverseSqrt);

    symbolTable.relateToOperator(COMMON_BUILTINS, "abs",          EOpAbs);
    symbolTable.relateToOperator(COMMON_BUILTINS, "sign",         EOpSign);
    symbolTable.relateToOperator(COMMON_BUILTINS, "floor",        EOpFloor);
    symbolTable.relateToOperator(COMMON_BUILTINS, "ceil",         EOpCeil);
    symbolTable.relateToOperator(COMMON_BUILTINS, "fract",        EOpFract);
    symbolTable.relateToOperator(COMMON_BUILTINS, "mod",          EOpMod);
    symbolTable.relateToOperator(COMMON_BUILTINS, "min",          EOpMin);
    symbolTable.relateToOperator(COMMON_BUILTINS, "max",          EOpMax);
    symbolTable.relateToOperator(COMMON_BUILTINS, "clamp",        EOpClamp);
    symbolTable.relateToOperator(COMMON_BUILTINS, "mix",          EOpMix);
    symbolTable.relateToOperator(COMMON_BUILTINS, "step",         EOpStep);
    symbolTable.relateToOperator(COMMON_BUILTINS, "smoothstep",   EOpSmoothStep);

    symbolTable.relateToOperator(COMMON_BUILTINS, "length",       EOpLength);
    symbolTable.relateToOperator(COMMON_BUILTINS, "distance",     EOpDistance);
    symbolTable.relateToOperator(COMMON_BUILTINS, "dot",          EOpDot);
    symbolTable.relateToOperator(COMMON_BUILTINS, "cross",        EOpCross);
    symbolTable.relateToOperator(COMMON_BUILTINS, "normalize",    EOpNormalize);
    symbolTable.relateToOperator(COMMON_BUILTINS, "faceforward",  EOpFaceForward);
    symbolTable.relateToOperator(COMMON_BUILTINS, "reflect",      EOpReflect);
    symbolTable.relateToOperator(COMMON_BUILTINS, "refract",      EOpRefract);

    symbolTable.relateToOperator(COMMON_BUILTINS, "any",          EOpAny);
    symbolTable.relateToOperator(COMMON_BUILTINS, "all",          EOpAll);
    symbolTable.relateToOperator(COMMON_BUILTINS, "not",          EOpVectorLogicalNot);

    // Map language-specific operators.
    switch(type) {
//.........这里部分代码省略.........
开发者ID:CodeSpeaker,项目名称:gecko-dev,代码行数:101,代码来源:Initialize.cpp

示例7: InsertBuiltInFunctions

void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
{
    TType *float1 = new TType(EbtFloat);
    TType *float2 = new TType(EbtFloat, 2);
    TType *float3 = new TType(EbtFloat, 3);
    TType *float4 = new TType(EbtFloat, 4);

    TType *int1 = new TType(EbtInt);
    TType *int2 = new TType(EbtInt, 2);
    TType *int3 = new TType(EbtInt, 3);
    TType *int4 = new TType(EbtInt, 4);

    //
    // Angle and Trigonometric Functions.
    //
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "radians", float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "radians", float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "radians", float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "radians", float4);

    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "degrees", float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "degrees", float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "degrees", float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "degrees", float4);

    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "sin", float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "sin", float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "sin", float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "sin", float4);

    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "cos", float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "cos", float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "cos", float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "cos", float4);

    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "tan", float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "tan", float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "tan", float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "tan", float4);

    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "asin", float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "asin", float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "asin", float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "asin", float4);

    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "acos", float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "acos", float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "acos", float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "acos", float4);

    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "atan", float1, float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "atan", float2, float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "atan", float3, float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "atan", float4, float4);

    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "atan", float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "atan", float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "atan", float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "atan", float4);

    //
    // Exponential Functions.
    //
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "pow", float1, float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "pow", float2, float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "pow", float3, float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "pow", float4, float4);

    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "exp", float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "exp", float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "exp", float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "exp", float4);

    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "log", float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "log", float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "log", float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "log", float4);

    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "exp2", float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "exp2", float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "exp2", float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "exp2", float4);

    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "log2", float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "log2", float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "log2", float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "log2", float4);

    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "sqrt", float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "sqrt", float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "sqrt", float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "sqrt", float4);

    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "inversesqrt", float1);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "inversesqrt", float2);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "inversesqrt", float3);
    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "inversesqrt", float4);

    //
    // Common Functions.
//.........这里部分代码省略.........
开发者ID:CodeSpeaker,项目名称:gecko-dev,代码行数:101,代码来源:Initialize.cpp

示例8: InsertBuiltInFunctions

void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
{
    TType *float1 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 1);
    TType *float2 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 2);
    TType *float3 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 3);
    TType *float4 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 4);

    TType *int2 = new TType(EbtInt, EbpUndefined, EvqGlobal, 2);
    TType *int3 = new TType(EbtInt, EbpUndefined, EvqGlobal, 3);
    TType *int4 = new TType(EbtInt, EbpUndefined, EvqGlobal, 4);

    //
    // Angle and Trigonometric Functions.
    //
    symbolTable.insertBuiltIn(float1, "radians", float1);
    symbolTable.insertBuiltIn(float2, "radians", float2);
    symbolTable.insertBuiltIn(float3, "radians", float3);
    symbolTable.insertBuiltIn(float4, "radians", float4);

    symbolTable.insertBuiltIn(float1, "degrees", float1);
    symbolTable.insertBuiltIn(float2, "degrees", float2);
    symbolTable.insertBuiltIn(float3, "degrees", float3);
    symbolTable.insertBuiltIn(float4, "degrees", float4);

    symbolTable.insertBuiltIn(float1, "sin", float1);
    symbolTable.insertBuiltIn(float2, "sin", float2);
    symbolTable.insertBuiltIn(float3, "sin", float3);
    symbolTable.insertBuiltIn(float4, "sin", float4);

    symbolTable.insertBuiltIn(float1, "cos", float1);
    symbolTable.insertBuiltIn(float2, "cos", float2);
    symbolTable.insertBuiltIn(float3, "cos", float3);
    symbolTable.insertBuiltIn(float4, "cos", float4);

    symbolTable.insertBuiltIn(float1, "tan", float1);
    symbolTable.insertBuiltIn(float2, "tan", float2);
    symbolTable.insertBuiltIn(float3, "tan", float3);
    symbolTable.insertBuiltIn(float4, "tan", float4);

    symbolTable.insertBuiltIn(float1, "asin", float1);
    symbolTable.insertBuiltIn(float2, "asin", float2);
    symbolTable.insertBuiltIn(float3, "asin", float3);
    symbolTable.insertBuiltIn(float4, "asin", float4);

    symbolTable.insertBuiltIn(float1, "acos", float1);
    symbolTable.insertBuiltIn(float2, "acos", float2);
    symbolTable.insertBuiltIn(float3, "acos", float3);
    symbolTable.insertBuiltIn(float4, "acos", float4);

    symbolTable.insertBuiltIn(float1, "atan", float1, float1);
    symbolTable.insertBuiltIn(float2, "atan", float2, float2);
    symbolTable.insertBuiltIn(float3, "atan", float3, float3);
    symbolTable.insertBuiltIn(float4, "atan", float4, float4);

    symbolTable.insertBuiltIn(float1, "atan", float1);
    symbolTable.insertBuiltIn(float2, "atan", float2);
    symbolTable.insertBuiltIn(float3, "atan", float3);
    symbolTable.insertBuiltIn(float4, "atan", float4);

    //
    // Exponential Functions.
    //
    symbolTable.insertBuiltIn(float1, "pow", float1, float1);
    symbolTable.insertBuiltIn(float2, "pow", float2, float2);
    symbolTable.insertBuiltIn(float3, "pow", float3, float3);
    symbolTable.insertBuiltIn(float4, "pow", float4, float4);

    symbolTable.insertBuiltIn(float1, "exp", float1);
    symbolTable.insertBuiltIn(float2, "exp", float2);
    symbolTable.insertBuiltIn(float3, "exp", float3);
    symbolTable.insertBuiltIn(float4, "exp", float4);

    symbolTable.insertBuiltIn(float1, "log", float1);
    symbolTable.insertBuiltIn(float2, "log", float2);
    symbolTable.insertBuiltIn(float3, "log", float3);
    symbolTable.insertBuiltIn(float4, "log", float4);

    symbolTable.insertBuiltIn(float1, "exp2", float1);
    symbolTable.insertBuiltIn(float2, "exp2", float2);
    symbolTable.insertBuiltIn(float3, "exp2", float3);
    symbolTable.insertBuiltIn(float4, "exp2", float4);

    symbolTable.insertBuiltIn(float1, "log2", float1);
    symbolTable.insertBuiltIn(float2, "log2", float2);
    symbolTable.insertBuiltIn(float3, "log2", float3);
    symbolTable.insertBuiltIn(float4, "log2", float4);

    symbolTable.insertBuiltIn(float1, "sqrt", float1);
    symbolTable.insertBuiltIn(float2, "sqrt", float2);
    symbolTable.insertBuiltIn(float3, "sqrt", float3);
    symbolTable.insertBuiltIn(float4, "sqrt", float4);

    symbolTable.insertBuiltIn(float1, "inversesqrt", float1);
    symbolTable.insertBuiltIn(float2, "inversesqrt", float2);
    symbolTable.insertBuiltIn(float3, "inversesqrt", float3);
    symbolTable.insertBuiltIn(float4, "inversesqrt", float4);

    //
    // Common Functions.
    //
//.........这里部分代码省略.........
开发者ID:13609594236,项目名称:CrossApp,代码行数:101,代码来源:Initialize.cpp

示例9: IdentifyBuiltIns

void IdentifyBuiltIns(EShLanguage language, TSymbolTable& symbolTable)
{


   //
   // Next, identify which built-ins from the already loaded headers have
   // a mapping to an operator.  Those that are not identified as such are
   // expected to be resolved through a library of functions, versus as
   // operations.
   //
   symbolTable.relateToOperator("fmod",             EOpMod); //HLSL version


   symbolTable.relateToOperator("radians",      EOpRadians);
   symbolTable.relateToOperator("degrees",      EOpDegrees);
   symbolTable.relateToOperator("sin",          EOpSin);
   symbolTable.relateToOperator("cos",          EOpCos);
   symbolTable.relateToOperator("tan",          EOpTan);
   symbolTable.relateToOperator("asin",         EOpAsin);
   symbolTable.relateToOperator("acos",         EOpAcos);
   symbolTable.relateToOperator("atan",         EOpAtan);
   symbolTable.relateToOperator("atan2",        EOpAtan2);
   symbolTable.relateToOperator("sincos",       EOpSinCos);

   symbolTable.relateToOperator("pow",          EOpPow);
   symbolTable.relateToOperator("exp2",         EOpExp2);
   symbolTable.relateToOperator("log",          EOpLog);
   symbolTable.relateToOperator("exp",          EOpExp);
   symbolTable.relateToOperator("log2",         EOpLog2);
   symbolTable.relateToOperator("log10",        EOpLog10);
   symbolTable.relateToOperator("sqrt",         EOpSqrt);
   symbolTable.relateToOperator("rsqrt",        EOpInverseSqrt); //HLSL version

   symbolTable.relateToOperator("abs",          EOpAbs);
   symbolTable.relateToOperator("sign",         EOpSign);
   symbolTable.relateToOperator("floor",        EOpFloor);
   symbolTable.relateToOperator("ceil",         EOpCeil);
   symbolTable.relateToOperator("frac",         EOpFract); //HLSL version
   symbolTable.relateToOperator("min",          EOpMin);
   symbolTable.relateToOperator("max",          EOpMax);
   symbolTable.relateToOperator("clamp",        EOpClamp);
   symbolTable.relateToOperator("lerp",         EOpMix);  //HLSL version
   symbolTable.relateToOperator("step",         EOpStep);
   symbolTable.relateToOperator("smoothstep",   EOpSmoothStep);

   symbolTable.relateToOperator("mul",          EOpMul); //HLSL mul function
   symbolTable.relateToOperator("transpose",    EOpTranspose);
   symbolTable.relateToOperator("determinant",  EOpDeterminant);

   symbolTable.relateToOperator("length",       EOpLength);
   symbolTable.relateToOperator("distance",     EOpDistance);
   symbolTable.relateToOperator("dot",          EOpDot);
   symbolTable.relateToOperator("cross",        EOpCross);
   symbolTable.relateToOperator("normalize",    EOpNormalize);
   symbolTable.relateToOperator("forward",      EOpFaceForward);
   symbolTable.relateToOperator("reflect",      EOpReflect);
   symbolTable.relateToOperator("refract",      EOpRefract);

   symbolTable.relateToOperator("any",          EOpAny);
   symbolTable.relateToOperator("all",          EOpAll);

   symbolTable.relateToOperator("tex1D",        EOpTex1D);
   symbolTable.relateToOperator("tex1Dproj",    EOpTex1DProj);
   symbolTable.relateToOperator("tex1Dlod",     EOpTex1DLod);
   symbolTable.relateToOperator("tex1Dbias",    EOpTex1DBias);
   symbolTable.relateToOperator("tex1Dgrad",    EOpTex1DGrad);
   symbolTable.relateToOperator("tex2D",        EOpTex2D);
   symbolTable.relateToOperator("tex2Dproj",    EOpTex2DProj);
   symbolTable.relateToOperator("tex2Dlod",     EOpTex2DLod);
   symbolTable.relateToOperator("tex2Dbias",    EOpTex2DBias);
   symbolTable.relateToOperator("tex2Dgrad",    EOpTex2DGrad);
   symbolTable.relateToOperator("tex3D",        EOpTex3D);
   symbolTable.relateToOperator("tex3Dproj",    EOpTex3DProj);
   symbolTable.relateToOperator("tex3Dlod",     EOpTex3DLod);
   symbolTable.relateToOperator("tex3Dbias",    EOpTex3DBias);
   symbolTable.relateToOperator("tex3Dgrad",    EOpTex3DGrad);
   symbolTable.relateToOperator("texRECT",      EOpTexRect);
   symbolTable.relateToOperator("texRECTproj",  EOpTexRectProj);
   symbolTable.relateToOperator("texCUBE",      EOpTexCube);
   symbolTable.relateToOperator("texCUBEproj",  EOpTexCubeProj);
   symbolTable.relateToOperator("texCUBElod",   EOpTexCubeLod);
   symbolTable.relateToOperator("texCUBEbias",  EOpTexCubeBias);
   symbolTable.relateToOperator("texCUBEgrad",  EOpTexCubeGrad);
	symbolTable.relateToOperator("shadow2D",        EOpShadow2D);
	symbolTable.relateToOperator("shadow2Dproj",    EOpShadow2DProj);

   symbolTable.relateToOperator("saturate",     EOpSaturate);
   symbolTable.relateToOperator("modf",         EOpModf);
   symbolTable.relateToOperator("ldexp",        EOpLdexp);
	symbolTable.relateToOperator("round", EOpRound);
	symbolTable.relateToOperator("trunc", EOpTrunc);

   symbolTable.relateToOperator("lit",          EOpLit);

   symbolTable.relateToOperator("D3DCOLORtoUBYTE4", EOpD3DCOLORtoUBYTE4);

   switch (language)
   {
   
   case EShLangVertex:
//.........这里部分代码省略.........
开发者ID:Joelone,项目名称:hlsl2glslfork,代码行数:101,代码来源:Initialize.cpp


注:本文中的TSymbolTable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。