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


C++ ProgramPtr::get方法代码示例

本文整理汇总了C++中ProgramPtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ ProgramPtr::get方法的具体用法?C++ ProgramPtr::get怎么用?C++ ProgramPtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProgramPtr的用法示例。


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

示例1: CompileShaderPrimary

bool Compiler::CompileShaderPrimary(
    const ShaderInput&          inputDesc,
    const ShaderOutput&         outputDesc,
    Reflection::ReflectionData* reflectionData)
{
    /* Validate arguments */
    ValidateArguments(inputDesc, outputDesc);

    /* ----- Pre-processing ----- */

    timePoints_.preprocessor = Time::now();

    std::unique_ptr<IncludeHandler> stdIncludeHandler;
    if (!inputDesc.includeHandler)
        stdIncludeHandler = std::unique_ptr<IncludeHandler>(new IncludeHandler());

    auto includeHandler = (inputDesc.includeHandler != nullptr ? inputDesc.includeHandler : stdIncludeHandler.get());

    std::unique_ptr<PreProcessor> preProcessor;

    if (IsLanguageHLSL(inputDesc.shaderVersion))
        preProcessor = MakeUnique<PreProcessor>(*includeHandler, log_);
    else if (IsLanguageGLSL(inputDesc.shaderVersion))
        preProcessor = MakeUnique<GLSLPreProcessor>(*includeHandler, log_);

    const bool writeLineMarksInPP = (!outputDesc.options.preprocessOnly || outputDesc.formatting.lineMarks);
    const bool writeLineMarkFilenamesInPP = (!outputDesc.options.preprocessOnly || IsLanguageHLSL(inputDesc.shaderVersion));

    auto processedInput = preProcessor->Process(
        std::make_shared<SourceCode>(inputDesc.sourceCode),
        inputDesc.filename,
        writeLineMarksInPP,
        writeLineMarkFilenamesInPP,
        ((inputDesc.warnings & Warnings::PreProcessor) != 0)
    );

    if (reflectionData)
        reflectionData->macros = preProcessor->ListDefinedMacroIdents();

    if (!processedInput)
        return ReturnWithError(R_PreProcessingSourceFailed);

    if (outputDesc.options.preprocessOnly)
    {
        (*outputDesc.sourceCode) << processedInput->rdbuf();
        return true;
    }

    /* ----- Parsing ----- */

    timePoints_.parser = Time::now();

    std::unique_ptr<IntrinsicAdept> intrinsicAdpet;
    ProgramPtr program;

    if (IsLanguageHLSL(inputDesc.shaderVersion))
    {
        /* Establish intrinsic adept */
        intrinsicAdpet = MakeUnique<HLSLIntrinsicAdept>();

        /* Parse HLSL input code */
        HLSLParser parser(log_);
        program = parser.ParseSource(
            std::make_shared<SourceCode>(std::move(processedInput)),
            outputDesc.nameMangling,
            inputDesc.shaderVersion,
            outputDesc.options.rowMajorAlignment,
            ((inputDesc.warnings & Warnings::Syntax) != 0)
        );
    }
    else if (IsLanguageGLSL(inputDesc.shaderVersion))
    {
        /* Establish intrinsic adept */
        #if 0
        intrinsicAdpet = MakeUnique<GLSLIntrinsicAdept>();
        #else //!!!
        intrinsicAdpet = MakeUnique<HLSLIntrinsicAdept>();
        #endif

        /* Parse GLSL input code */
        GLSLParser parser(log_);
        program = parser.ParseSource(
            std::make_shared<SourceCode>(std::move(processedInput)),
            outputDesc.nameMangling,
            inputDesc.shaderVersion,
            ((inputDesc.warnings & Warnings::Syntax) != 0)
        );
    }

    if (!program)
        return ReturnWithError(R_ParsingSourceFailed);

    /* ----- Context analysis ----- */

    timePoints_.analyzer = Time::now();

    bool analyzerResult = false;

    if (IsLanguageHLSL(inputDesc.shaderVersion))
    {
//.........这里部分代码省略.........
开发者ID:LukasBanana,项目名称:HLSLTranslator,代码行数:101,代码来源:Compiler.cpp

示例2: setProgram

 /** Bind a program
     Program have bindings globalVar->parameter
 */
 void GLEngine::setProgram(ProgramPtr program)
 {
     if(mCurrentProgram.get() == program.get())
         return;
     mCurrentProgram = program;
 }
开发者ID:BackupTheBerlios,项目名称:libgpgpu-svn,代码行数:9,代码来源:GLEngine.cpp


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