//-----------------------------------------------------------------------
void GLSLESProgramPipeline::updatePassIterationUniforms(GpuProgramParametersSharedPtr params)
{
    if (params->hasPassIterationNumber())
    {
        size_t index = params->getPassIterationNumberIndex();

        GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
        GLUniformReferenceIterator endUniform = mGLUniformReferences.end();

        // Need to find the uniform that matches the multi pass entry
        for (; currentUniform != endUniform; ++currentUniform)
        {
            // Get the index in the parameter real list
            if (index == currentUniform->mConstantDef->physicalIndex)
            {
#if GL_EXT_separate_shader_objects && OGRE_PLATFORM != OGRE_PLATFORM_NACL

                GLuint progID = 0;
                if (mVertexProgram && currentUniform->mSourceProgType == GPT_VERTEX_PROGRAM)
                {
                    if(!mVertexProgram->getUniformCache()->updateUniform(currentUniform->mLocation,
                            params->getFloatPointer(index),
                            currentUniform->mConstantDef->elementSize *
                            currentUniform->mConstantDef->arraySize *
                            sizeof(float)))
                        return;

                    progID = mVertexProgram->getGLSLProgram()->getGLProgramHandle();
                    OGRE_CHECK_GL_ERROR(glProgramUniform1fvEXT(progID, currentUniform->mLocation, 1, params->getFloatPointer(index)));
                }

                if (mFragmentProgram && currentUniform->mSourceProgType == GPT_FRAGMENT_PROGRAM)
                {
                    if(!mFragmentProgram->getUniformCache()->updateUniform(currentUniform->mLocation,
                            params->getFloatPointer(index),
                            currentUniform->mConstantDef->elementSize *
                            currentUniform->mConstantDef->arraySize *
                            sizeof(float)))
                        return;
                    progID = mFragmentProgram->getGLSLProgram()->getGLProgramHandle();
                    OGRE_CHECK_GL_ERROR(glProgramUniform1fvEXT(progID, currentUniform->mLocation, 1, params->getFloatPointer(index)));
                }
#endif
                // There will only be one multipass entry
                return;
            }
        }
    }
}
Exemplo n.º 2
0
void ATI_FS_GLGpuProgram::bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params)
{
	if (params->hasPassIterationNumber())
	{
		size_t physicalIndex = params->getPassIterationNumberIndex();
		size_t logicalIndex = params->getFloatLogicalIndexForPhysicalIndex(physicalIndex);
		const float* pFloat = params->getFloatPointer(physicalIndex);
		glSetFragmentShaderConstantATI( GL_CON_0_ATI + (GLuint)logicalIndex, pFloat);
	}
}
	void FixedFuncPrograms::_updateParameter( GpuProgramParametersSharedPtr & programParameters, const String paramName, const void * value, const size_t sizeInBytes )
	{
		const GpuConstantDefinition& def = programParameters->getConstantDefinition(paramName);
		if (def.isFloat())
		{
			memcpy((programParameters->getFloatPointer(def.physicalIndex)), value, sizeInBytes);
		}
		else
		{
			memcpy((programParameters->getIntPointer(def.physicalIndex)), value, sizeInBytes);
		}
	}
Exemplo n.º 4
0
void GLArbGpuProgram::bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params)
{
    if (params->hasPassIterationNumber())
    {
		GLenum type = getGLShaderType(mType);

		size_t physicalIndex = params->getPassIterationNumberIndex();
		size_t logicalIndex = params->getFloatLogicalIndexForPhysicalIndex(physicalIndex);
		const float* pFloat = params->getFloatPointer(physicalIndex);
        glProgramLocalParameter4fvARB(type, (GLuint)logicalIndex, pFloat);
    }

}
Exemplo n.º 5
0
void GLArbGpuProgram::bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params)
{
    if (params->hasPassIterationNumber())
    {
		GLenum type = (mType == GPT_VERTEX_PROGRAM) ? 
			GL_VERTEX_PROGRAM_ARB : GL_FRAGMENT_PROGRAM_ARB;

		size_t physicalIndex = params->getPassIterationNumberIndex();
		size_t logicalIndex = params->getFloatLogicalIndexForPhysicalIndex(physicalIndex);
		const float* pFloat = params->getFloatPointer(physicalIndex);
        glProgramLocalParameter4fvARB(type, (GLuint)logicalIndex, pFloat);
    }

}
Exemplo n.º 6
0
void ATI_FS_GLGpuProgram::bindProgramParameters(GpuProgramParametersSharedPtr params)
{

	// only supports float constants
	const GpuLogicalBufferStruct* floatStruct = params->getFloatLogicalBufferStruct();

	for (GpuLogicalIndexUseMap::const_iterator i = floatStruct->map.begin();
		i != floatStruct->map.end(); ++i)
	{
		size_t logicalIndex = i->first;
		const float* pFloat = params->getFloatPointer(i->second.physicalIndex);
		// Iterate over the params, set in 4-float chunks (low-level)
		for (size_t j = 0; j < i->second.currentSize; j+=4)
		{
			glSetFragmentShaderConstantATI(GL_CON_0_ATI + logicalIndex, pFloat);
			pFloat += 4;
			++logicalIndex;
		}
	}

}
Exemplo n.º 7
0
void GLArbGpuProgram::bindProgramParameters(GpuProgramParametersSharedPtr params)
{
    GLenum type = (mType == GPT_VERTEX_PROGRAM) ? 
        GL_VERTEX_PROGRAM_ARB : GL_FRAGMENT_PROGRAM_ARB;
    
	// only supports float constants
	const GpuLogicalBufferStruct* floatStruct = params->getFloatLogicalBufferStruct();

	for (GpuLogicalIndexUseMap::const_iterator i = floatStruct->map.begin();
		i != floatStruct->map.end(); ++i)
	{
		size_t logicalIndex = i->first;
		const float* pFloat = params->getFloatPointer(i->second.physicalIndex);
		// Iterate over the params, set in 4-float chunks (low-level)
		for (size_t j = 0; j < i->second.currentSize; j+=4)
		{
			glProgramLocalParameter4fvARB(type, logicalIndex, pFloat);
			pFloat += 4;
			++logicalIndex;
		}
	}
}
	//-----------------------------------------------------------------------
	void GLSLLinkProgram::updatePassIterationUniforms(GpuProgramParametersSharedPtr params)
	{
		if (params->hasPassIterationNumber())
		{
			size_t index = params->getPassIterationNumberIndex();

			GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
			GLUniformReferenceIterator endUniform = mGLUniformReferences.end();

			// Need to find the uniform that matches the multi pass entry
			for (;currentUniform != endUniform; ++currentUniform)
			{
				// Get the index in the parameter real list
				if (index == currentUniform->mConstantDef->physicalIndex)
				{
					OGRE_CHECK_GL_ERROR(glUniform1fv(currentUniform->mLocation, 1, params->getFloatPointer(index)));
					// There will only be one multipass entry
					return;
				}
			}
		}
    }
Exemplo n.º 9
0
void GLArbGpuProgram::bindProgramParameters(GpuProgramParametersSharedPtr params, uint16 mask)
{
    GLenum type = getGLShaderType(mType);
    
	// only supports float constants
	GpuLogicalBufferStructPtr floatStruct = params->getFloatLogicalBufferStruct();

	for (GpuLogicalIndexUseMap::const_iterator i = floatStruct->map.begin();
		i != floatStruct->map.end(); ++i)
	{
		if (i->second.variability & mask)
		{
			size_t logicalIndex = i->first;
			const float* pFloat = params->getFloatPointer(i->second.physicalIndex);
			// Iterate over the params, set in 4-float chunks (low-level)
			for (size_t j = 0; j < i->second.currentSize; j+=4)
			{
				glProgramLocalParameter4fvARB(type, logicalIndex, pFloat);
				pFloat += 4;
				++logicalIndex;
			}
		}
	}
}
Exemplo n.º 10
0
    //-----------------------------------------------------------------------
    void GLSLESProgramPipeline::updateUniforms(GpuProgramParametersSharedPtr params, 
                                           uint16 mask, GpuProgramType fromProgType)
    {
        // Iterate through uniform reference list and update uniform values
        GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
        GLUniformReferenceIterator endUniform = mGLUniformReferences.end();
#if OGRE_PLATFORM != OGRE_PLATFORM_NACL
        GLuint progID = 0;
        GLUniformCache* uniformCache=0;
        if(fromProgType == GPT_VERTEX_PROGRAM)
        {
            progID = getVertexProgram()->getGLProgramHandle();
            uniformCache = getVertexProgram()->getUniformCache();
        }
        else if(fromProgType == GPT_FRAGMENT_PROGRAM)
        {
            progID = mFragmentProgram->getGLProgramHandle();
            uniformCache = mFragmentProgram->getUniformCache();
        }

        for (;currentUniform != endUniform; ++currentUniform)
        {
            // Only pull values from buffer it's supposed to be in (vertex or fragment)
            // This method will be called twice, once for vertex program params, 
            // and once for fragment program params.
            if (fromProgType == currentUniform->mSourceProgType)
            {
                const GpuConstantDefinition* def = currentUniform->mConstantDef;
                if (def->variability & mask)
                {
                    GLsizei glArraySize = (GLsizei)def->arraySize;
                    bool shouldUpdate = true;
                    switch (def->constType)
                    {
                        case GCT_INT1:
                        case GCT_INT2:
                        case GCT_INT3:
                        case GCT_INT4:
                        case GCT_SAMPLER1D:
                        case GCT_SAMPLER1DSHADOW:
                        case GCT_SAMPLER2D:
                        case GCT_SAMPLER2DSHADOW:
                        case GCT_SAMPLER3D:
                        case GCT_SAMPLERCUBE:
#if OGRE_NO_GLES3_SUPPORT == 0
                        case GCT_SAMPLER2DARRAY:
#endif
                            shouldUpdate = uniformCache->updateUniform(currentUniform->mLocation,
                                                                        params->getIntPointer(def->physicalIndex),
                                                                        static_cast<GLsizei>(def->elementSize * def->arraySize * sizeof(int)));
                            break;
                        default:
                            shouldUpdate = uniformCache->updateUniform(currentUniform->mLocation,
                                                                        params->getFloatPointer(def->physicalIndex),
                                                                        static_cast<GLsizei>(def->elementSize * def->arraySize * sizeof(float)));
                            break;
                    }

                    if(!shouldUpdate)
                        continue;

                    // Get the index in the parameter real list
                    switch (def->constType)
                    {
                        case GCT_FLOAT1:
                            OGRE_CHECK_GL_ERROR(glProgramUniform1fvEXT(progID, currentUniform->mLocation, glArraySize, 
                                                                       params->getFloatPointer(def->physicalIndex)));
                            break;
                        case GCT_FLOAT2:
                            OGRE_CHECK_GL_ERROR(glProgramUniform2fvEXT(progID, currentUniform->mLocation, glArraySize, 
                                                                       params->getFloatPointer(def->physicalIndex)));
                            break;
                        case GCT_FLOAT3:
                            OGRE_CHECK_GL_ERROR(glProgramUniform3fvEXT(progID, currentUniform->mLocation, glArraySize, 
                                                                       params->getFloatPointer(def->physicalIndex)));
                            break;
                        case GCT_FLOAT4:
                            OGRE_CHECK_GL_ERROR(glProgramUniform4fvEXT(progID, currentUniform->mLocation, glArraySize, 
                                                                       params->getFloatPointer(def->physicalIndex)));
                            break;
                        case GCT_MATRIX_2X2:
                            OGRE_CHECK_GL_ERROR(glProgramUniformMatrix2fvEXT(progID, currentUniform->mLocation, glArraySize, 
                                                                             GL_FALSE, params->getFloatPointer(def->physicalIndex)));
                            break;
                        case GCT_MATRIX_3X3:
                            OGRE_CHECK_GL_ERROR(glProgramUniformMatrix3fvEXT(progID, currentUniform->mLocation, glArraySize, 
                                                                             GL_FALSE, params->getFloatPointer(def->physicalIndex)));
                            break;
                        case GCT_MATRIX_4X4:
                            OGRE_CHECK_GL_ERROR(glProgramUniformMatrix4fvEXT(progID, currentUniform->mLocation, glArraySize, 
                                                                             GL_FALSE, params->getFloatPointer(def->physicalIndex)));
                            break;
                        case GCT_INT1:
                            OGRE_CHECK_GL_ERROR(glProgramUniform1ivEXT(progID, currentUniform->mLocation, glArraySize, 
                                                                       params->getIntPointer(def->physicalIndex)));
                            break;
                        case GCT_INT2:
                            OGRE_CHECK_GL_ERROR(glProgramUniform2ivEXT(progID, currentUniform->mLocation, glArraySize, 
                                                                       params->getIntPointer(def->physicalIndex)));
                            break;
                        case GCT_INT3:
                            OGRE_CHECK_GL_ERROR(glProgramUniform3ivEXT(progID, currentUniform->mLocation, glArraySize, 
                                                                       params->getIntPointer(def->physicalIndex)));
                            break;
                        case GCT_INT4:
                            OGRE_CHECK_GL_ERROR(glProgramUniform4ivEXT(progID, currentUniform->mLocation, glArraySize, 
                                                                       params->getIntPointer(def->physicalIndex)));
                            break;
                        case GCT_SAMPLER1D:
                        case GCT_SAMPLER1DSHADOW:
                        case GCT_SAMPLER2D:
                        case GCT_SAMPLER2DSHADOW:
                        case GCT_SAMPLER3D:
                        case GCT_SAMPLERCUBE:
#if OGRE_NO_GLES3_SUPPORT == 0
                        case GCT_SAMPLER2DARRAY:
#endif
                            // Samplers handled like 1-element ints
                            OGRE_CHECK_GL_ERROR(glProgramUniform1ivEXT(progID, currentUniform->mLocation, 1,
                                                                       params->getIntPointer(def->physicalIndex)));
                            break;
#if OGRE_NO_GLES3_SUPPORT == 0
                        case GCT_MATRIX_2X3:
                            OGRE_CHECK_GL_ERROR(glProgramUniformMatrix2x3fvEXT(progID, currentUniform->mLocation, glArraySize,
                                                                            GL_FALSE, params->getFloatPointer(def->physicalIndex)));
                            break;
                        case GCT_MATRIX_2X4:
                            OGRE_CHECK_GL_ERROR(glProgramUniformMatrix2x4fvEXT(progID, currentUniform->mLocation, glArraySize,
                                                                            GL_FALSE, params->getFloatPointer(def->physicalIndex)));
                            break;
                        case GCT_MATRIX_3X2:
                            OGRE_CHECK_GL_ERROR(glProgramUniformMatrix3x2fvEXT(progID, currentUniform->mLocation, glArraySize,
                                                                            GL_FALSE, params->getFloatPointer(def->physicalIndex)));
                            break;
                        case GCT_MATRIX_3X4:
                            OGRE_CHECK_GL_ERROR(glProgramUniformMatrix3x4fvEXT(progID, currentUniform->mLocation, glArraySize,
                                                                            GL_FALSE, params->getFloatPointer(def->physicalIndex)));
                            break;
                        case GCT_MATRIX_4X2:
                            OGRE_CHECK_GL_ERROR(glProgramUniformMatrix4x2fvEXT(progID, currentUniform->mLocation, glArraySize,
                                                                            GL_FALSE, params->getFloatPointer(def->physicalIndex)));
                            break;
                        case GCT_MATRIX_4X3:
                            OGRE_CHECK_GL_ERROR(glProgramUniformMatrix4x3fvEXT(progID, currentUniform->mLocation, glArraySize,
                                                                            GL_FALSE, params->getFloatPointer(def->physicalIndex)));
                            break;
#else
                        case GCT_MATRIX_2X3:
                        case GCT_MATRIX_2X4:
                        case GCT_MATRIX_3X2:
                        case GCT_MATRIX_3X4:
                        case GCT_MATRIX_4X2:
                        case GCT_MATRIX_4X3:
                        case GCT_SAMPLER2DARRAY:
#endif
                        case GCT_UNKNOWN:
                        case GCT_SUBROUTINE:
                        case GCT_DOUBLE1:
                        case GCT_DOUBLE2:
                        case GCT_DOUBLE3:
                        case GCT_DOUBLE4:
                        case GCT_SAMPLERRECT:
                        case GCT_MATRIX_DOUBLE_2X2:
                        case GCT_MATRIX_DOUBLE_2X3:
                        case GCT_MATRIX_DOUBLE_2X4:
                        case GCT_MATRIX_DOUBLE_3X2:
                        case GCT_MATRIX_DOUBLE_3X3:
                        case GCT_MATRIX_DOUBLE_3X4:
                        case GCT_MATRIX_DOUBLE_4X2:
                        case GCT_MATRIX_DOUBLE_4X3:
                        case GCT_MATRIX_DOUBLE_4X4:
                        default:
                            break;
                            
                    } // End switch
                } // Variability & mask
            } // fromProgType == currentUniform->mSourceProgType
            
        } // End for
#endif
    }
    void GLSLSeparableProgram::updatePassIterationUniforms(GpuProgramParametersSharedPtr params)
    {
        if (params->hasPassIterationNumber())
        {
            size_t index = params->getPassIterationNumberIndex();

            GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
            GLUniformReferenceIterator endUniform = mGLUniformReferences.end();

            // Need to find the uniform that matches the multi pass entry
            for (;currentUniform != endUniform; ++currentUniform)
            {
                // Get the index in the parameter real list
                if (index == currentUniform->mConstantDef->physicalIndex)
                {
                    GLuint progID = 0;
                    if (mVertexShader && currentUniform->mSourceProgType == GPT_VERTEX_PROGRAM)
                    {
                        progID = mVertexShader->getGLProgramHandle();
                    }

                    if (mFragmentShader && currentUniform->mSourceProgType == GPT_FRAGMENT_PROGRAM)
                    {
                        progID = mFragmentShader->getGLProgramHandle();
                    }

                    if (mGeometryShader && currentUniform->mSourceProgType == GPT_GEOMETRY_PROGRAM)
                    {
                        progID = mGeometryShader->getGLProgramHandle();
                    }

                    if (mDomainShader && currentUniform->mSourceProgType == GPT_DOMAIN_PROGRAM)
                    {
                        progID = mDomainShader->getGLProgramHandle();
                    }

                    if (mHullShader && currentUniform->mSourceProgType == GPT_HULL_PROGRAM)
                    {
                        progID = mHullShader->getGLProgramHandle();
                    }

                    if (mComputeShader && currentUniform->mSourceProgType == GPT_COMPUTE_PROGRAM)
                    {
                        progID = mComputeShader->getGLProgramHandle();
                    }

                    OGRE_CHECK_GL_ERROR(glProgramUniform1fv(progID, currentUniform->mLocation, 1, params->getFloatPointer(index)));

                    // There will only be one multipass entry
                    return;
                }
            }
        }
    }
    void GLSLSeparableProgram::updateUniforms(GpuProgramParametersSharedPtr params,
                                              uint16 mask, GpuProgramType fromProgType)
    {
        // Iterate through uniform reference list and update uniform values
        GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
        GLUniformReferenceIterator endUniform = mGLUniformReferences.end();

        // determine if we need to transpose matrices when binding
        int transpose = GL_TRUE;
        if ((fromProgType == GPT_FRAGMENT_PROGRAM && mVertexShader && (!mVertexShader->getColumnMajorMatrices())) ||
            (fromProgType == GPT_VERTEX_PROGRAM && mFragmentShader && (!mFragmentShader->getColumnMajorMatrices())) ||
            (fromProgType == GPT_GEOMETRY_PROGRAM && mGeometryShader && (!mGeometryShader->getColumnMajorMatrices())) ||
            (fromProgType == GPT_HULL_PROGRAM && mHullShader && (!mHullShader->getColumnMajorMatrices())) ||
            (fromProgType == GPT_DOMAIN_PROGRAM && mDomainShader && (!mDomainShader->getColumnMajorMatrices())) ||
            (fromProgType == GPT_COMPUTE_PROGRAM && mComputeShader && (!mComputeShader->getColumnMajorMatrices())))
        {
            transpose = GL_FALSE;
        }

        GLuint progID = 0;
        if (fromProgType == GPT_VERTEX_PROGRAM)
        {
            progID = mVertexShader->getGLProgramHandle();
        }
        else if (fromProgType == GPT_FRAGMENT_PROGRAM)
        {
            progID = mFragmentShader->getGLProgramHandle();
        }
        else if (fromProgType == GPT_GEOMETRY_PROGRAM)
        {
            progID = mGeometryShader->getGLProgramHandle();
        }
        else if (fromProgType == GPT_HULL_PROGRAM)
        {
            progID = mHullShader->getGLProgramHandle();
        }
        else if (fromProgType == GPT_DOMAIN_PROGRAM)
        {
            progID = mDomainShader->getGLProgramHandle();
        }
        else if (fromProgType == GPT_COMPUTE_PROGRAM)
        {
            progID = mComputeShader->getGLProgramHandle();
        }

        for (; currentUniform != endUniform; ++currentUniform)
        {
            // Only pull values from buffer it's supposed to be in (vertex or fragment)
            // This method will be called once per shader stage.
            if (fromProgType == currentUniform->mSourceProgType)
            {
                const GpuConstantDefinition* def = currentUniform->mConstantDef;
                if (def->variability & mask)
                {
                    GLsizei glArraySize = (GLsizei)def->arraySize;

                    // Get the index in the parameter real list
                    switch (def->constType)
                    {
                    case GCT_FLOAT1:
                        OGRE_CHECK_GL_ERROR(glProgramUniform1fv(progID, currentUniform->mLocation, glArraySize,
                                                                params->getFloatPointer(def->physicalIndex)));
                        break;
                    case GCT_FLOAT2:
                        OGRE_CHECK_GL_ERROR(glProgramUniform2fv(progID, currentUniform->mLocation, glArraySize,
                                                                params->getFloatPointer(def->physicalIndex)));
                        break;
                    case GCT_FLOAT3:
                        OGRE_CHECK_GL_ERROR(glProgramUniform3fv(progID, currentUniform->mLocation, glArraySize,
                                                                params->getFloatPointer(def->physicalIndex)));
                        break;
                    case GCT_FLOAT4:
                        OGRE_CHECK_GL_ERROR(glProgramUniform4fv(progID, currentUniform->mLocation, glArraySize,
                                                                params->getFloatPointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_2X2:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix2fv(progID, currentUniform->mLocation, glArraySize,
                                                                      transpose, params->getFloatPointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_3X3:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix3fv(progID, currentUniform->mLocation, glArraySize,
                                                                      transpose, params->getFloatPointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_4X4:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix4fv(progID, currentUniform->mLocation, glArraySize,
                                                                      transpose, params->getFloatPointer(def->physicalIndex)));
                        break;
                    case GCT_INT1:
                        OGRE_CHECK_GL_ERROR(glProgramUniform1iv(progID, currentUniform->mLocation, glArraySize,
                                                                params->getIntPointer(def->physicalIndex)));
                        break;
                    case GCT_INT2:
                        OGRE_CHECK_GL_ERROR(glProgramUniform2iv(progID, currentUniform->mLocation, glArraySize,
                                                                params->getIntPointer(def->physicalIndex)));
                        break;
                    case GCT_INT3:
                        OGRE_CHECK_GL_ERROR(glProgramUniform3iv(progID, currentUniform->mLocation, glArraySize,
                                                                params->getIntPointer(def->physicalIndex)));
                        break;
                    case GCT_INT4:
                        OGRE_CHECK_GL_ERROR(glProgramUniform4iv(progID, currentUniform->mLocation, glArraySize,
                                                                params->getIntPointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_2X3:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix2x3fv(progID, currentUniform->mLocation, glArraySize,
                                                                        transpose, params->getFloatPointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_2X4:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix2x4fv(progID, currentUniform->mLocation, glArraySize,
                                                                        transpose, params->getFloatPointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_3X2:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix3x2fv(progID, currentUniform->mLocation, glArraySize,
                                                                        transpose, params->getFloatPointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_3X4:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix3x4fv(progID, currentUniform->mLocation, glArraySize,
                                                                        transpose, params->getFloatPointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_4X2:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix4x2fv(progID, currentUniform->mLocation, glArraySize,
                                                                        transpose, params->getFloatPointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_4X3:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix4x3fv(progID, currentUniform->mLocation, glArraySize,
                                                                        transpose, params->getFloatPointer(def->physicalIndex)));
                        break;
                    case GCT_DOUBLE1:
                        OGRE_CHECK_GL_ERROR(glProgramUniform1dv(progID, currentUniform->mLocation, glArraySize,
                                                                params->getDoublePointer(def->physicalIndex)));
                        break;
                    case GCT_DOUBLE2:
                        OGRE_CHECK_GL_ERROR(glProgramUniform2dv(progID, currentUniform->mLocation, glArraySize,
                                                                params->getDoublePointer(def->physicalIndex)));
                        break;
                    case GCT_DOUBLE3:
                        OGRE_CHECK_GL_ERROR(glProgramUniform3dv(progID, currentUniform->mLocation, glArraySize,
                                                                params->getDoublePointer(def->physicalIndex)));
                        break;
                    case GCT_DOUBLE4:
                        OGRE_CHECK_GL_ERROR(glProgramUniform4dv(progID, currentUniform->mLocation, glArraySize,
                                                                params->getDoublePointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_DOUBLE_2X2:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix2dv(progID, currentUniform->mLocation, glArraySize,
                                                                      transpose, params->getDoublePointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_DOUBLE_3X3:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix3dv(progID, currentUniform->mLocation, glArraySize,
                                                                      transpose, params->getDoublePointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_DOUBLE_4X4:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix4dv(progID, currentUniform->mLocation, glArraySize,
                                                                      transpose, params->getDoublePointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_DOUBLE_2X3:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix2x3dv(progID, currentUniform->mLocation, glArraySize,
                                                                        transpose, params->getDoublePointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_DOUBLE_2X4:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix2x4dv(progID, currentUniform->mLocation, glArraySize,
                                                                        transpose, params->getDoublePointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_DOUBLE_3X2:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix3x2dv(progID, currentUniform->mLocation, glArraySize,
                                                                        transpose, params->getDoublePointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_DOUBLE_3X4:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix3x4dv(progID, currentUniform->mLocation, glArraySize,
                                                                        transpose, params->getDoublePointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_DOUBLE_4X2:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix4x2dv(progID, currentUniform->mLocation, glArraySize,
                                                                        transpose, params->getDoublePointer(def->physicalIndex)));
                        break;
                    case GCT_MATRIX_DOUBLE_4X3:
                        OGRE_CHECK_GL_ERROR(glProgramUniformMatrix4x3dv(progID, currentUniform->mLocation, glArraySize,
                                                                        transpose, params->getDoublePointer(def->physicalIndex)));
                        break;
                    case GCT_UINT1:
                    case GCT_BOOL1:
                        OGRE_CHECK_GL_ERROR(glProgramUniform1uiv(progID, currentUniform->mLocation, glArraySize,
                                                                 params->getUnsignedIntPointer(def->physicalIndex)));
                        break;
                    case GCT_UINT2:
                    case GCT_BOOL2:
                        OGRE_CHECK_GL_ERROR(glProgramUniform2uiv(progID, currentUniform->mLocation, glArraySize,
                                                                 params->getUnsignedIntPointer(def->physicalIndex)));
                        break;
                    case GCT_UINT3:
                    case GCT_BOOL3:
                        OGRE_CHECK_GL_ERROR(glProgramUniform3uiv(progID, currentUniform->mLocation, glArraySize,
                                                                 params->getUnsignedIntPointer(def->physicalIndex)));
                        break;
                    case GCT_UINT4:
                    case GCT_BOOL4:
                        OGRE_CHECK_GL_ERROR(glProgramUniform4uiv(progID, currentUniform->mLocation, glArraySize,
                                                                 params->getUnsignedIntPointer(def->physicalIndex)));
                        break;

                    case GCT_SAMPLER1D:
                    case GCT_SAMPLER1DSHADOW:
                    case GCT_SAMPLER2D:
                    case GCT_SAMPLER2DSHADOW:
                    case GCT_SAMPLER2DARRAY:
                    case GCT_SAMPLER3D:
                    case GCT_SAMPLERCUBE:
                    case GCT_SAMPLERRECT:
                        // Samplers handled like 1-element ints
                        OGRE_CHECK_GL_ERROR(glProgramUniform1iv(progID, currentUniform->mLocation, 1,
                                                                params->getIntPointer(def->physicalIndex)));
                        break;
                    case GCT_UNKNOWN:
                    case GCT_SUBROUTINE:
                        break;

                    } // End switch
                } // Variability & mask
            } // fromProgType == currentUniform->mSourceProgType

        } // End for
    }
//-----------------------------------------------------------------------
void GLSLLinkProgram::updateUniforms(GpuProgramParametersSharedPtr params,
                                     uint16 mask, GpuProgramType fromProgType)
{
    // iterate through uniform reference list and update uniform values
    GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
    GLUniformReferenceIterator endUniform = mGLUniformReferences.end();

    for (; currentUniform != endUniform; ++currentUniform)
    {
        // Only pull values from buffer it's supposed to be in (vertex or fragment)
        // This method will be called twice, once for vertex program params,
        // and once for fragment program params.
        if (fromProgType == currentUniform->mSourceProgType)
        {
            const GpuConstantDefinition* def = currentUniform->mConstantDef;
            if (def->variability & mask)
            {

                GLsizei glArraySize = (GLsizei)def->arraySize;

                // get the index in the parameter real list
                switch (def->constType)
                {
                case GCT_FLOAT1:
                    glUniform1fvARB(currentUniform->mLocation, glArraySize,
                                    params->getFloatPointer(def->physicalIndex));
                    break;
                case GCT_FLOAT2:
                    glUniform2fvARB(currentUniform->mLocation, glArraySize,
                                    params->getFloatPointer(def->physicalIndex));
                    break;
                case GCT_FLOAT3:
                    glUniform3fvARB(currentUniform->mLocation, glArraySize,
                                    params->getFloatPointer(def->physicalIndex));
                    break;
                case GCT_FLOAT4:
                    glUniform4fvARB(currentUniform->mLocation, glArraySize,
                                    params->getFloatPointer(def->physicalIndex));
                    break;
                case GCT_MATRIX_2X2:
                    glUniformMatrix2fvARB(currentUniform->mLocation, glArraySize,
                                          GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    break;
                case GCT_MATRIX_2X3:
                    if (GLEW_VERSION_2_1)
                    {
                        glUniformMatrix2x3fv(currentUniform->mLocation, glArraySize,
                                             GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    }
                    break;
                case GCT_MATRIX_2X4:
                    if (GLEW_VERSION_2_1)
                    {
                        glUniformMatrix2x4fv(currentUniform->mLocation, glArraySize,
                                             GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    }
                    break;
                case GCT_MATRIX_3X2:
                    if (GLEW_VERSION_2_1)
                    {
                        glUniformMatrix3x2fv(currentUniform->mLocation, glArraySize,
                                             GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    }
                    break;
                case GCT_MATRIX_3X3:
                    glUniformMatrix3fvARB(currentUniform->mLocation, glArraySize,
                                          GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    break;
                case GCT_MATRIX_3X4:
                    if (GLEW_VERSION_2_1)
                    {
                        glUniformMatrix3x4fv(currentUniform->mLocation, glArraySize,
                                             GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    }
                    break;
                case GCT_MATRIX_4X2:
                    if (GLEW_VERSION_2_1)
                    {
                        glUniformMatrix4x2fv(currentUniform->mLocation, glArraySize,
                                             GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    }
                    break;
                case GCT_MATRIX_4X3:
                    if (GLEW_VERSION_2_1)
                    {
                        glUniformMatrix4x3fv(currentUniform->mLocation, glArraySize,
                                             GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    }
                    break;
                case GCT_MATRIX_4X4:
                    glUniformMatrix4fvARB(currentUniform->mLocation, glArraySize,
                                          GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    break;
                case GCT_INT1:
                    glUniform1ivARB(currentUniform->mLocation, glArraySize,
                                    (GLint*)params->getIntPointer(def->physicalIndex));
                    break;
                case GCT_INT2:
                    glUniform2ivARB(currentUniform->mLocation, glArraySize,
                                    (GLint*)params->getIntPointer(def->physicalIndex));
                    break;
                case GCT_INT3:
                    glUniform3ivARB(currentUniform->mLocation, glArraySize,
                                    (GLint*)params->getIntPointer(def->physicalIndex));
                    break;
                case GCT_INT4:
                    glUniform4ivARB(currentUniform->mLocation, glArraySize,
                                    (GLint*)params->getIntPointer(def->physicalIndex));
                    break;
                case GCT_SAMPLER1D:
                case GCT_SAMPLER1DSHADOW:
                case GCT_SAMPLER2D:
                case GCT_SAMPLER2DSHADOW:
                case GCT_SAMPLER3D:
                case GCT_SAMPLERCUBE:
                    // samplers handled like 1-element ints
                    glUniform1ivARB(currentUniform->mLocation, 1,
                                    (GLint*)params->getIntPointer(def->physicalIndex));
                    break;
                case GCT_UNKNOWN:
                    break;

                } // end switch
#if OGRE_DEBUG_MODE
                checkForGLSLError( "GLSLLinkProgram::updateUniforms", "Error updating uniform", 0 );
#endif
            } // variability & mask
        } // fromProgType == currentUniform->mSourceProgType

    } // end for
}