コード例 #1
0
//-----------------------------------------------------------------------
void GLSLESProgramPipeline::activate(void)
{
    if (!mLinked && !mTriedToLinkAndFailed)
    {
        glGetError(); // Clean up the error. Otherwise will flood log.

#if !OGRE_NO_GLES2_GLSL_OPTIMISER
        // Check CmdParams for each shader type to see if we should optimise
        if(mVertexProgram)
        {
            String paramStr = mVertexProgram->getGLSLProgram()->getParameter("use_optimiser");
            if((paramStr == "true") || paramStr.empty())
            {
                GLSLESProgramPipelineManager::getSingleton().optimiseShaderSource(mVertexProgram);
            }
        }

        if(mFragmentProgram)
        {
            String paramStr = mFragmentProgram->getGLSLProgram()->getParameter("use_optimiser");
            if((paramStr == "true") || paramStr.empty())
            {
                GLSLESProgramPipelineManager::getSingleton().optimiseShaderSource(mFragmentProgram);
            }
        }
#endif
        compileAndLink();

        extractLayoutQualifiers();

        buildGLUniformReferences();
    }

    _useProgram();
}
コード例 #2
0
    //-----------------------------------------------------------------------
	void GLSLProgramPipeline::activate(void)
	{
		if (!mLinked && !mTriedToLinkAndFailed)
		{            
			if ( GpuProgramManager::getSingleton().canGetCompiledShaderBuffer() &&
				GpuProgramManager::getSingleton().isMicrocodeAvailableInCache(getCombinedName()) )
			{
				getMicrocodeFromCache();
			}
			else
			{
				compileAndLink();
			}

            extractLayoutQualifiers();

			buildGLUniformReferences();
		}

        _useProgram();
	}