Merge remote-tracking branch 'origin/tizen' into new_text
[platform/core/uifw/dali-core.git] / dali / internal / render / shaders / program.cpp
index 8b145fc..509d0d7 100644 (file)
@@ -102,19 +102,7 @@ const char* gStdUniforms[ Program::UNIFORM_TYPE_LAST ] =
   "sEffectRect",          // UNIFORM_EFFECT_SAMPLER_RECT
   "uTimeDelta",           // UNIFORM_TIME_DELTA
   "sOpacityTexture",      // UNIFORM_SAMPLER_OPACITY
-  "sNormalMapTexture",    // UNIFORM_SAMPLER_NORMAL_MAP
-  "uTextColor",           // UNIFORM_TEXT_COLOR
-  "uSmoothing",           // UNIFORM_SMOOTHING
-  "uOutline",             // UNIFORM_OUTLINE
-  "uOutlineColor",        // UNIFORM_OUTLINE_COLOR
-  "uGlow",                // UNIFORM_GLOW
-  "uGlowColor",           // UNIFORM_GLOW_COLOR
-  "uShadow",              // UNIFORM_SHADOW
-  "uShadowColor",         // UNIFORM_SHADOW_COLOR
-  "uShadowSmoothing",     // UNIFORM_SHADOW_SMOOTHING
-  "uGradientColor",       // UNIFORM_GRADIENT_COLOR
-  "uGradientLine",        // UNIFORM_GRADIENT_LINE
-  "uInvTextSize"          // UNIFORM_INVERSE_TEXT_SIZE
+  "sNormalMapTexture"     // UNIFORM_SAMPLER_NORMAL_MAP
 };
 
 }  // <unnamed> namespace
@@ -152,7 +140,6 @@ void Program::Use()
     {
       LOG_GL( "UseProgram(%d)\n", mProgramId );
       CHECK_GL( mGlAbstraction, mGlAbstraction.UseProgram(mProgramId) );
-      INCREASE_COUNTER(PerformanceMonitor::SHADER_STATE_CHANGES);
 
       mCache.SetCurrentProgram( this );
     }
@@ -489,16 +476,14 @@ void Program::Load()
     {
       DALI_LOG_ERROR("Failed to load program binary \n");
 
-      char* szLog = NULL;
       GLint nLength;
       CHECK_GL( mGlAbstraction, mGlAbstraction.GetProgramiv( mProgramId, GL_INFO_LOG_LENGTH, &nLength) );
       if(nLength > 0)
       {
-        szLog = new char[ nLength ];
-        CHECK_GL( mGlAbstraction, mGlAbstraction.GetProgramInfoLog( mProgramId, nLength, &nLength, szLog ) );
-        DALI_LOG_ERROR( "Program Link Error: %s\n", szLog );
-
-        delete [] szLog;
+        Dali::Vector< char > szLog;
+        szLog.Reserve( nLength ); // Don't call Resize as we don't want to initialise the data, just reserve a buffer
+        CHECK_GL( mGlAbstraction, mGlAbstraction.GetProgramInfoLog( mProgramId, nLength, &nLength, szLog.Begin() ) );
+        DALI_LOG_ERROR( "Program Link Error: %s\n", szLog.Begin() );
       }
     }
     else
@@ -588,17 +573,17 @@ bool Program::CompileShader( GLenum shaderType, GLuint& shaderId, const char* sr
     DALI_LOG_ERROR("Failed to compile shader\n");
     LogWithLineNumbers(src);
 
-    Dali::Vector< char > szLog;
     GLint nLength;
     mGlAbstraction.GetShaderiv( shaderId, GL_INFO_LOG_LENGTH, &nLength);
     if(nLength > 0)
     {
-      szLog.Reserve( nLength );
-      mGlAbstraction.GetShaderInfoLog( shaderId, nLength, &nLength, &szLog[ 0 ] );
-      DALI_LOG_ERROR( "Shader Compiler Error: %s\n", &szLog[ 0 ] );
+      Dali::Vector< char > szLog;
+      szLog.Reserve( nLength ); // Don't call Resize as we don't want to initialise the data, just reserve a buffer
+      mGlAbstraction.GetShaderInfoLog( shaderId, nLength, &nLength, szLog.Begin() );
+      DALI_LOG_ERROR( "Shader Compiler Error: %s\n", szLog.Begin() );
     }
 
-    throw DaliException( "Shader compilation failure", &szLog[ 0 ] );
+    DALI_ASSERT_ALWAYS( 0 && "Shader compilation failure" );
   }
 
   return compiled != 0;
@@ -617,18 +602,17 @@ void Program::Link()
   {
     DALI_LOG_ERROR("Shader failed to link \n");
 
-    char* szLog = NULL;
     GLint nLength;
     mGlAbstraction.GetProgramiv( mProgramId, GL_INFO_LOG_LENGTH, &nLength);
     if(nLength > 0)
     {
-      szLog = new char[ nLength ];
-      mGlAbstraction.GetProgramInfoLog( mProgramId, nLength, &nLength, szLog );
-      DALI_LOG_ERROR( "Shader Link Error: %s\n", szLog );
-      delete [] szLog;
+      Dali::Vector< char > szLog;
+      szLog.Reserve( nLength ); // Don't call Resize as we don't want to initialise the data, just reserve a buffer
+      mGlAbstraction.GetProgramInfoLog( mProgramId, nLength, &nLength, szLog.Begin() );
+      DALI_LOG_ERROR( "Shader Link Error: %s\n", szLog.Begin() );
     }
 
-    DALI_ASSERT_DEBUG(0);
+    DALI_ASSERT_ALWAYS( 0 && "Shader linking failure" );
   }
 
   mLinked = linked != GL_FALSE;