2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/render/shaders/program.h>
25 #include <dali/public-api/common/dali-common.h>
26 #include <dali/public-api/common/dali-vector.h>
27 #include <dali/public-api/common/constants.h>
28 #include <dali/integration-api/debug.h>
29 #include <dali/integration-api/shader-data.h>
30 #include <dali/integration-api/gl-defines.h>
31 #include <dali/internal/render/common/performance-monitor.h>
32 #include <dali/internal/render/shaders/program-cache.h>
33 #include <dali/internal/render/gl-resources/gl-call-debug.h>
37 void LogWithLineNumbers( const char * source )
39 unsigned int lineNumber = 0u;
40 const char *prev = source;
41 const char *ptr = prev;
49 // seek the next end of line or end of text
50 while( *ptr!='\n' && *ptr != '\0' )
55 std::string line( prev, ptr-prev );
56 Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugError, "%4d %s\n", lineNumber, line.c_str());
79 const char* gStdAttribs[ Program::ATTRIB_TYPE_LAST ] =
81 "aPosition", // ATTRIB_POSITION
82 "aNormal", // ATTRIB_NORMAL
83 "aTexCoord", // ATTRIB_TEXCOORD
84 "aColor", // ATTRIB_COLOR
85 "aBoneWeights", // ATTRIB_BONE_WEIGHTS
86 "aBoneIndices" // ATTRIB_BONE_INDICES
89 const char* gStdUniforms[ Program::UNIFORM_TYPE_LAST ] =
91 "uMvpMatrix", // UNIFORM_MVP_MATRIX
92 "uModelView", // UNIFORM_MODELVIEW_MATRIX
93 "uProjection", // UNIFORM_PROJECTION_MATRIX
94 "uModelMatrix", // UNIFORM_MODEL_MATRIX,
95 "uViewMatrix", // UNIFORM_VIEW_MATRIX,
96 "uNormalMatrix", // UNIFORM_NORMAL_MATRIX
97 "uColor", // UNIFORM_COLOR
98 "uCustomTextureCoords", // UNIFORM_CUSTOM_TEXTURE_COORDS
99 "sTexture", // UNIFORM_SAMPLER
100 "sTextureRect", // UNIFORM_SAMPLER_RECT
101 "sEffect", // UNIFORM_EFFECT_SAMPLER
102 "sEffectRect", // UNIFORM_EFFECT_SAMPLER_RECT
103 "uTimeDelta", // UNIFORM_TIME_DELTA
104 "sOpacityTexture", // UNIFORM_SAMPLER_OPACITY
105 "sNormalMapTexture", // UNIFORM_SAMPLER_NORMAL_MAP
106 "uSize" // UNIFORM_SIZE
109 } // <unnamed> namespace
113 Program* Program::New( ProgramCache& cache, Integration::ShaderDataPtr shaderData, bool modifiesGeometry )
115 size_t shaderHash = shaderData->GetHashValue();
116 Program* program = cache.GetProgram( shaderHash );
118 if( NULL == program )
120 // program not found so create it
121 program = new Program( cache, shaderData, modifiesGeometry );
123 // we want to lazy load programs so dont do a Load yet, it gets done in Use()
125 cache.AddProgram( shaderHash, program );
140 if ( this != mCache.GetCurrentProgram() )
142 LOG_GL( "UseProgram(%d)\n", mProgramId );
143 CHECK_GL( mGlAbstraction, mGlAbstraction.UseProgram(mProgramId) );
145 mCache.SetCurrentProgram( this );
150 bool Program::IsUsed()
152 return ( this == mCache.GetCurrentProgram() );
155 GLint Program::GetAttribLocation( AttribType type )
157 DALI_ASSERT_DEBUG(type != ATTRIB_UNKNOWN);
159 return GetCustomAttributeLocation( type );
162 unsigned int Program::RegisterCustomAttribute( const std::string& name )
164 unsigned int index = 0;
165 // find the value from cache
166 for( ;index < mAttributeLocations.size(); ++index )
168 if( mAttributeLocations[ index ].first == name )
170 // name found so return index
174 // if we get here, index is one past end so push back the new name
175 mAttributeLocations.push_back( std::make_pair( name, ATTRIB_UNKNOWN ) );
179 GLint Program::GetCustomAttributeLocation( unsigned int attributeIndex )
181 // debug check that index is within name cache
182 DALI_ASSERT_DEBUG( mAttributeLocations.size() > attributeIndex );
184 // check if we have already queried the location of the attribute
185 GLint location = mAttributeLocations[ attributeIndex ].second;
187 if( location == ATTRIB_UNKNOWN )
189 location = CHECK_GL( mGlAbstraction, mGlAbstraction.GetAttribLocation( mProgramId, mAttributeLocations[ attributeIndex ].first.c_str() ) );
191 mAttributeLocations[ attributeIndex ].second = location;
192 LOG_GL( "GetAttributeLocation(program=%d,%s) = %d\n", mProgramId, mAttributeLocations[ attributeIndex ].first.c_str(), mAttributeLocations[ attributeIndex ].second );
199 unsigned int Program::RegisterUniform( const std::string& name )
201 unsigned int index = 0;
202 // find the value from cache
203 for( ;index < mUniformLocations.size(); ++index )
205 if( mUniformLocations[ index ].first == name )
207 // name found so return index
211 // if we get here, index is one past end so push back the new name
212 mUniformLocations.push_back( std::make_pair( name, UNIFORM_NOT_QUERIED ) );
216 GLint Program::GetUniformLocation( unsigned int uniformIndex )
218 // debug check that index is within name cache
219 DALI_ASSERT_DEBUG( mUniformLocations.size() > uniformIndex );
221 // check if we have already queried the location of the uniform
222 GLint location = mUniformLocations[ uniformIndex ].second;
224 if( location == UNIFORM_NOT_QUERIED )
226 location = CHECK_GL( mGlAbstraction, mGlAbstraction.GetUniformLocation( mProgramId, mUniformLocations[ uniformIndex ].first.c_str() ) );
228 mUniformLocations[ uniformIndex ].second = location;
229 LOG_GL( "GetUniformLocation(program=%d,%s) = %d\n", mProgramId, mUniformLocations[ uniformIndex ].first.c_str(), mUniformLocations[ uniformIndex ].second );
235 void Program::SetUniform1i( GLint location, GLint value0 )
237 DALI_ASSERT_DEBUG( IsUsed() ); // should not call this if this program is not used
239 if( UNIFORM_UNKNOWN == location )
241 // From http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml : Notes
242 // If location is equal to UNIFORM_UNKNOWN, the data passed in will be silently ignored and the
243 // specified uniform variable will not be changed.following opengl silently do nothing
247 // check if uniform location fits the cache
248 if( location >= MAX_UNIFORM_CACHE_SIZE )
250 // not cached, make the gl call
251 LOG_GL( "Uniform1i(%d,%d)\n", location, value0 );
252 CHECK_GL( mGlAbstraction, mGlAbstraction.Uniform1i( location, value0 ) );
256 // check if the value is different from what's already been set
257 if( value0 != mUniformCacheInt[ location ] )
260 LOG_GL( "Uniform1i(%d,%d)\n", location, value0 );
261 CHECK_GL( mGlAbstraction, mGlAbstraction.Uniform1i( location, value0 ) );
263 mUniformCacheInt[ location ] = value0;
268 void Program::SetUniform4i( GLint location, GLint value0, GLint value1, GLint value2, GLint value3 )
270 DALI_ASSERT_DEBUG( IsUsed() ); // should not call this if this program is not used
272 if( UNIFORM_UNKNOWN == location )
274 // From http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml : Notes
275 // If location is equal to UNIFORM_UNKNOWN, the data passed in will be silently ignored and the
276 // specified uniform variable will not be changed.following opengl silently do nothing
280 // Not caching these as based on current analysis this is not called that often by our shaders
281 LOG_GL( "Uniform4i(%d,%d,%d,%d,%d)\n", location, value0, value1, value2, value3 );
282 CHECK_GL( mGlAbstraction, mGlAbstraction.Uniform4i( location, value0, value1, value2, value3 ) );
285 void Program::SetUniform1f( GLint location, GLfloat value0 )
287 DALI_ASSERT_DEBUG( IsUsed() ); // should not call this if this program is not used
289 if( UNIFORM_UNKNOWN == location )
291 // From http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml : Notes
292 // If location is equal to UNIFORM_UNKNOWN, the data passed in will be silently ignored and the
293 // specified uniform variable will not be changed.following opengl silently do nothing
297 // check if uniform location fits the cache
298 if( location >= MAX_UNIFORM_CACHE_SIZE )
300 // not cached, make the gl call
301 LOG_GL( "Uniform1f(%d,%f)\n", location, value0 );
302 CHECK_GL( mGlAbstraction, mGlAbstraction.Uniform1f( location, value0 ) );
306 // check if the same value has already been set, reset if it is different
307 if( ( fabsf(value0 - mUniformCacheFloat[ location ]) >= Math::MACHINE_EPSILON_1 ) )
310 LOG_GL( "Uniform1f(%d,%f)\n", location, value0 );
311 CHECK_GL( mGlAbstraction, mGlAbstraction.Uniform1f( location, value0 ) );
314 mUniformCacheFloat[ location ] = value0;
319 void Program::SetUniform2f( GLint location, GLfloat value0, GLfloat value1 )
321 DALI_ASSERT_DEBUG( IsUsed() ); // should not call this if this program is not used
323 if( UNIFORM_UNKNOWN == location )
325 // From http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml : Notes
326 // If location is equal to UNIFORM_UNKNOWN, the data passed in will be silently ignored and the
327 // specified uniform variable will not be changed.following opengl silently do nothing
331 // Not caching these as based on current analysis this is not called that often by our shaders
332 LOG_GL( "Uniform2f(%d,%f,%f)\n", location, value0, value1 );
333 CHECK_GL( mGlAbstraction, mGlAbstraction.Uniform2f( location, value0, value1 ) );
336 void Program::SetUniform3f( GLint location, GLfloat value0, GLfloat value1, GLfloat value2 )
338 DALI_ASSERT_DEBUG( IsUsed() ); // should not call this if this program is not used
340 if( UNIFORM_UNKNOWN == location )
342 // From http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml : Notes
343 // If location is equal to UNIFORM_UNKNOWN, the data passed in will be silently ignored and the
344 // specified uniform variable will not be changed.following opengl silently do nothing
348 // Not caching these as based on current analysis this is not called that often by our shaders
349 LOG_GL( "Uniform3f(%d,%f,%f,%f)\n", location, value0, value1, value2 );
350 CHECK_GL( mGlAbstraction, mGlAbstraction.Uniform3f( location, value0, value1, value2 ) );
353 void Program::SetUniform4f( GLint location, GLfloat value0, GLfloat value1, GLfloat value2, GLfloat value3 )
355 DALI_ASSERT_DEBUG( IsUsed() ); // should not call this if this program is not used
357 if( UNIFORM_UNKNOWN == location )
359 // From http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml : Notes
360 // If location is equal to UNIFORM_UNKNOWN, the data passed in will be silently ignored and the
361 // specified uniform variable will not be changed.following opengl silently do nothing
365 // check if uniform location fits the cache
366 if( location >= MAX_UNIFORM_CACHE_SIZE )
368 // not cached, make the gl call
369 LOG_GL( "Uniform4f(%d,%f,%f,%f,%f)\n", location, value0, value1, value2, value3 );
370 CHECK_GL( mGlAbstraction, mGlAbstraction.Uniform4f( location, value0, value1, value2, value3 ) );
374 // check if the same value has already been set, reset if any component is different
375 // checking index 3 first because we're often animating alpha (rgba)
376 if( ( fabsf(value3 - mUniformCacheFloat4[ location ][ 3 ]) >= Math::MACHINE_EPSILON_1 )||
377 ( fabsf(value0 - mUniformCacheFloat4[ location ][ 0 ]) >= Math::MACHINE_EPSILON_1 )||
378 ( fabsf(value1 - mUniformCacheFloat4[ location ][ 1 ]) >= Math::MACHINE_EPSILON_1 )||
379 ( fabsf(value2 - mUniformCacheFloat4[ location ][ 2 ]) >= Math::MACHINE_EPSILON_1 ) )
382 LOG_GL( "Uniform4f(%d,%f,%f,%f,%f)\n", location, value0, value1, value2, value3 );
383 CHECK_GL( mGlAbstraction, mGlAbstraction.Uniform4f( location, value0, value1, value2, value3 ) );
385 mUniformCacheFloat4[ location ][ 0 ] = value0;
386 mUniformCacheFloat4[ location ][ 1 ] = value1;
387 mUniformCacheFloat4[ location ][ 2 ] = value2;
388 mUniformCacheFloat4[ location ][ 3 ] = value3;
393 void Program::SetUniformMatrix4fv( GLint location, GLsizei count, const GLfloat* value )
395 DALI_ASSERT_DEBUG( IsUsed() ); // should not call this if this program is not used
397 if( UNIFORM_UNKNOWN == location )
399 // From http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml : Notes
400 // If location is equal to UNIFORM_UNKNOWN, the data passed in will be silently ignored and the
401 // specified uniform variable will not be changed.following opengl silently do nothing
405 // Not caching these calls. Based on current analysis this is called very often
406 // but with different values (we're using this for MVP matrices)
407 // NOTE! we never want driver or GPU to transpose
408 LOG_GL( "UniformMatrix4fv(%d,%d,GL_FALSE,%x)\n", location, count, value );
409 CHECK_GL( mGlAbstraction, mGlAbstraction.UniformMatrix4fv( location, count, GL_FALSE, value ) );
412 void Program::SetUniformMatrix3fv( GLint location, GLsizei count, const GLfloat* value )
414 DALI_ASSERT_DEBUG( IsUsed() ); // should not call this if this program is not used
416 if( UNIFORM_UNKNOWN == location )
418 // From http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml : Notes
419 // If location is equal to UNIFORM_UNKNOWN, the data passed in will be silently ignored and the
420 // specified uniform variable will not be changed.following opengl silently do nothing
425 // Not caching these calls. Based on current analysis this is called very often
426 // but with different values (we're using this for MVP matrices)
427 // NOTE! we never want driver or GPU to transpose
428 LOG_GL( "UniformMatrix3fv(%d,%d,GL_FALSE,%x)\n", location, count, value );
429 CHECK_GL( mGlAbstraction, mGlAbstraction.UniformMatrix3fv( location, count, GL_FALSE, value ) );
432 void Program::GlContextCreated()
436 void Program::GlContextDestroyed()
440 mFragmentShaderId = 0;
443 ResetAttribsUniformCache();
446 bool Program::ModifiesGeometry()
448 return mModifiesGeometry;
451 Program::Program( ProgramCache& cache, Integration::ShaderDataPtr shaderData, bool modifiesGeometry )
453 mGlAbstraction( mCache.GetGlAbstraction() ),
454 mProjectionMatrix( NULL ),
457 mVertexShaderId( 0 ),
458 mFragmentShaderId( 0 ),
460 mProgramData(shaderData),
461 mModifiesGeometry( modifiesGeometry )
463 // reserve space for standard attributes
464 mAttributeLocations.reserve( ATTRIB_TYPE_LAST );
465 for( int i=0; i<ATTRIB_TYPE_LAST; ++i )
467 RegisterCustomAttribute( gStdAttribs[i] );
470 // reserve space for standard uniforms
471 mUniformLocations.reserve( UNIFORM_TYPE_LAST );
472 // reset built in uniform names in cache
473 for( int i = 0; i < UNIFORM_TYPE_LAST; ++i )
475 RegisterUniform( gStdUniforms[ i ] );
478 ResetAttribsUniformCache();
488 DALI_ASSERT_ALWAYS( NULL != mProgramData.Get() && "Program data is not initialized" );
490 LOG_GL( "CreateProgram()\n" );
491 mProgramId = CHECK_GL( mGlAbstraction, mGlAbstraction.CreateProgram() );
493 GLint linked = GL_FALSE;
495 const bool binariesSupported = mCache.IsBinarySupported();
497 // if shader binaries are supported and ShaderData contains compiled bytecode?
498 if( binariesSupported && mProgramData->HasBinary() )
500 DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "Program::Load() - Using Compiled Shader, Size = %d\n", mProgramData->GetBufferSize());
502 CHECK_GL( mGlAbstraction, mGlAbstraction.ProgramBinary(mProgramId, mCache.ProgramBinaryFormat(), mProgramData->GetBufferData(), mProgramData->GetBufferSize()) );
504 CHECK_GL( mGlAbstraction, mGlAbstraction.ValidateProgram(mProgramId) );
507 CHECK_GL( mGlAbstraction, mGlAbstraction.GetProgramiv( mProgramId, GL_VALIDATE_STATUS, &success ) );
509 DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "ValidateProgram Status = %d\n", success);
511 CHECK_GL( mGlAbstraction, mGlAbstraction.GetProgramiv( mProgramId, GL_LINK_STATUS, &linked ) );
513 if( GL_FALSE == linked )
515 DALI_LOG_ERROR("Failed to load program binary \n");
518 CHECK_GL( mGlAbstraction, mGlAbstraction.GetProgramiv( mProgramId, GL_INFO_LOG_LENGTH, &nLength) );
521 Dali::Vector< char > szLog;
522 szLog.Reserve( nLength ); // Don't call Resize as we don't want to initialise the data, just reserve a buffer
523 CHECK_GL( mGlAbstraction, mGlAbstraction.GetProgramInfoLog( mProgramId, nLength, &nLength, szLog.Begin() ) );
524 DALI_LOG_ERROR( "Program Link Error: %s\n", szLog.Begin() );
533 // Fall back to compiling and linking the vertex and fragment sources
534 if( GL_FALSE == linked )
536 DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "Program::Load() - Runtime compilation\n");
537 if( CompileShader( GL_VERTEX_SHADER, mVertexShaderId, mProgramData->GetVertexShader() ) )
539 if( CompileShader( GL_FRAGMENT_SHADER, mFragmentShaderId, mProgramData->GetFragmentShader() ) )
543 if( binariesSupported && mLinked )
545 GLint binaryLength = 0;
548 CHECK_GL( mGlAbstraction, mGlAbstraction.GetProgramiv(mProgramId, GL_PROGRAM_BINARY_LENGTH_OES, &binaryLength) );
549 DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "Program::Load() - GL_PROGRAM_BINARY_LENGTH_OES: %d\n", binaryLength);
550 if( binaryLength > 0 )
552 // Allocate space for the bytecode in ShaderData
553 mProgramData->AllocateBuffer(binaryLength);
554 // Copy the bytecode to ShaderData
555 CHECK_GL( mGlAbstraction, mGlAbstraction.GetProgramBinary(mProgramId, binaryLength, NULL, &binaryFormat, mProgramData->GetBufferData()) );
556 mCache.StoreBinary( mProgramData );
567 void Program::Unload()
571 if( this == mCache.GetCurrentProgram() )
573 CHECK_GL( mGlAbstraction, mGlAbstraction.UseProgram(0) );
575 mCache.SetCurrentProgram( NULL );
580 LOG_GL( "DeleteProgram(%d)\n", mProgramId );
581 CHECK_GL( mGlAbstraction, mGlAbstraction.DeleteProgram( mProgramId ) );
589 bool Program::CompileShader( GLenum shaderType, GLuint& shaderId, const char* src )
593 LOG_GL( "CreateShader(%d)\n", shaderType );
594 shaderId = CHECK_GL( mGlAbstraction, mGlAbstraction.CreateShader( shaderType ) );
595 LOG_GL( "AttachShader(%d,%d)\n", mProgramId, shaderId );
596 CHECK_GL( mGlAbstraction, mGlAbstraction.AttachShader( mProgramId, shaderId ) );
599 LOG_GL( "ShaderSource(%d)\n", shaderId );
600 CHECK_GL( mGlAbstraction, mGlAbstraction.ShaderSource(shaderId, 1, &src, NULL ) );
602 LOG_GL( "CompileShader(%d)\n", shaderId );
603 CHECK_GL( mGlAbstraction, mGlAbstraction.CompileShader( shaderId ) );
606 LOG_GL( "GetShaderiv(%d)\n", shaderId );
607 CHECK_GL( mGlAbstraction, mGlAbstraction.GetShaderiv( shaderId, GL_COMPILE_STATUS, &compiled ) );
609 if (compiled == GL_FALSE)
611 DALI_LOG_ERROR("Failed to compile shader\n");
612 LogWithLineNumbers(src);
615 mGlAbstraction.GetShaderiv( shaderId, GL_INFO_LOG_LENGTH, &nLength);
618 Dali::Vector< char > szLog;
619 szLog.Reserve( nLength ); // Don't call Resize as we don't want to initialise the data, just reserve a buffer
620 mGlAbstraction.GetShaderInfoLog( shaderId, nLength, &nLength, szLog.Begin() );
621 DALI_LOG_ERROR( "Shader Compiler Error: %s\n", szLog.Begin() );
624 DALI_ASSERT_ALWAYS( 0 && "Shader compilation failure" );
627 return compiled != 0;
632 LOG_GL( "LinkProgram(%d)\n", mProgramId );
633 CHECK_GL( mGlAbstraction, mGlAbstraction.LinkProgram( mProgramId ) );
636 LOG_GL( "GetProgramiv(%d)\n", mProgramId );
637 CHECK_GL( mGlAbstraction, mGlAbstraction.GetProgramiv( mProgramId, GL_LINK_STATUS, &linked ) );
639 if (linked == GL_FALSE)
641 DALI_LOG_ERROR("Shader failed to link \n");
644 mGlAbstraction.GetProgramiv( mProgramId, GL_INFO_LOG_LENGTH, &nLength);
647 Dali::Vector< char > szLog;
648 szLog.Reserve( nLength ); // Don't call Resize as we don't want to initialise the data, just reserve a buffer
649 mGlAbstraction.GetProgramInfoLog( mProgramId, nLength, &nLength, szLog.Begin() );
650 DALI_LOG_ERROR( "Shader Link Error: %s\n", szLog.Begin() );
653 DALI_ASSERT_ALWAYS( 0 && "Shader linking failure" );
656 mLinked = linked != GL_FALSE;
659 void Program::FreeShaders()
663 LOG_GL( "DeleteShader(%d)\n", mVertexShaderId );
664 CHECK_GL( mGlAbstraction, mGlAbstraction.DetachShader( mProgramId, mVertexShaderId ) );
665 CHECK_GL( mGlAbstraction, mGlAbstraction.DeleteShader( mVertexShaderId ) );
669 if (mFragmentShaderId)
671 LOG_GL( "DeleteShader(%d)\n", mFragmentShaderId );
672 CHECK_GL( mGlAbstraction, mGlAbstraction.DetachShader( mProgramId, mFragmentShaderId ) );
673 CHECK_GL( mGlAbstraction, mGlAbstraction.DeleteShader( mFragmentShaderId ) );
674 mFragmentShaderId = 0;
678 void Program::ResetAttribsUniformCache()
680 // reset attribute locations
681 for( unsigned i = 0; i < mAttributeLocations.size() ; ++i )
683 mAttributeLocations[ i ].second = ATTRIB_UNKNOWN;
686 // reset all gl uniform locations
687 for( unsigned int i = 0; i < mUniformLocations.size(); ++i )
689 // reset gl program locations and names
690 mUniformLocations[ i ].second = UNIFORM_NOT_QUERIED;
693 // reset uniform cache
694 for( int i = 0; i < MAX_UNIFORM_CACHE_SIZE; ++i )
696 // GL initializes uniforms to 0
697 mUniformCacheInt[ i ] = 0;
698 mUniformCacheFloat[ i ] = 0.0f;
699 mUniformCacheFloat4[ i ][ 0 ] = 0.0f;
700 mUniformCacheFloat4[ i ][ 1 ] = 0.0f;
701 mUniformCacheFloat4[ i ][ 2 ] = 0.0f;
702 mUniformCacheFloat4[ i ][ 3 ] = 0.0f;
706 } // namespace Internal