//-----------------------------------------------------------------------
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();
}
    void GLSLSeparableProgram::activate(void)
    {
        if (!mLinked && !mTriedToLinkAndFailed)
        {
            compileAndLink();

            extractLayoutQualifiers();

            buildGLUniformReferences();
        }

        // _useProgram();


        if (mLinked)
        { 
            OGRE_CHECK_GL_ERROR(glBindProgramPipeline(mGLProgramPipelineHandle));
        }
    }
Example #3
0
	//-----------------------------------------------------------------------
	void GLSLESLinkProgram::activate(void)
	{
		if (!mLinked && !mTriedToLinkAndFailed)
		{
			glGetError(); // Clean up the error. Otherwise will flood log.

			mGLProgramHandle = glCreateProgram();
 			GL_CHECK_ERROR

			if ( GpuProgramManager::getSingleton().canGetCompiledShaderBuffer() &&
				GpuProgramManager::getSingleton().isMicrocodeAvailableInCache(getCombinedName()) )
			{
				getMicrocodeFromCache();
			}
			else
			{
#if !OGRE_NO_GLES2_GLSL_OPTIMISER
                // Check CmdParams for each shader type to see if we should optimize
                if(mVertexProgram)
                {
                    String paramStr = mVertexProgram->getGLSLProgram()->getParameter("use_optimiser");
                    if((paramStr == "true") || paramStr.empty())
                    {
                        GLSLESLinkProgramManager::getSingleton().optimiseShaderSource(mVertexProgram);
                    }
                }

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

            extractLayoutQualifiers();
			buildGLUniformReferences();
		}
    //-----------------------------------------------------------------------
	void GLSLProgramPipeline::activate(void)
	{
		if (!mLinked && !mTriedToLinkAndFailed)
		{            
			if ( GpuProgramManager::getSingleton().canGetCompiledShaderBuffer() &&
				GpuProgramManager::getSingleton().isMicrocodeAvailableInCache(getCombinedName()) )
			{
				getMicrocodeFromCache();
			}
			else
			{
				compileAndLink();
			}

            extractLayoutQualifiers();

			buildGLUniformReferences();
		}

        _useProgram();
	}