Change shader data pointer to IntrusivePtr 59/26859/1
authorKevin Butchart <k.butchart@partner.samsung.com>
Fri, 29 Aug 2014 12:32:43 +0000 (13:32 +0100)
committerKevin Butchart <k.butchart@partner.samsung.com>
Fri, 29 Aug 2014 12:32:43 +0000 (13:32 +0100)
Change to using intrusive pointer as, especially after GL Context loss
and restore, the pointer may not be valid. IntrusivePtr ensures that
the program data will not be destroyed for the lifetime of the program
class

Change-Id: Ibe3b27b2e4f94baab04e325b8284b9d26f516240

dali/internal/render/shaders/program.cpp
dali/internal/render/shaders/program.h

index c25fdb0..7a8cbe4 100644 (file)
@@ -465,7 +465,7 @@ Program::~Program()
 
 void Program::Load()
 {
-  DALI_ASSERT_ALWAYS( NULL != mProgramData && "Program data is not initialized" );
+  DALI_ASSERT_ALWAYS( NULL != mProgramData.Get() && "Program data is not initialized" );
 
   Unload();
 
index 0a0e94a..341abb9 100644 (file)
@@ -27,6 +27,7 @@
 #include <dali/public-api/object/ref-object.h>
 #include <dali/internal/render/gl-resources/context.h>
 #include <dali/integration-api/resource-cache.h>
+#include <dali/integration-api/shader-data.h>
 
 namespace Dali
 {
@@ -360,7 +361,7 @@ private:  // Data
   GLuint mVertexShaderId;                     ///< GL identifier for vertex shader
   GLuint mFragmentShaderId;                   ///< GL identifier for fragment shader
   GLuint mProgramId;                          ///< GL identifier for program
-  Integration::ShaderData* mProgramData;      ///< Shader program source and binary (when compiled & linked or loaded)
+  Integration::ShaderDataPtr mProgramData;    ///< Shader program source and binary (when compiled & linked or loaded)
 
   // location caches
   GLint mAttribLocations[ ATTRIB_TYPE_LAST ]; ///< attribute location cache