fix shader binary compilation to work with lazy compilation
[platform/core/uifw/dali-core.git] / dali / internal / render / shaders / program.h
index 0a0e94a..af24326 100644 (file)
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/common/set-wrapper.h>
 #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
 {
@@ -139,7 +139,7 @@ public:
    * @param [in] modifiesGeometry True if the shader modifies geometry
    * @return pointer to the program
    */
-  static Program* New( const Integration::ResourceId& resourceId, Integration::ShaderData* shaderData, Context& context, bool modifiesGeometry );
+  static Program* New( const Integration::ResourceId& resourceId, Integration::ShaderDataPtr shaderData, Context& context, bool modifiesGeometry );
 
   /**
    * Takes this program into use
@@ -296,11 +296,11 @@ private: // Implementation
 
   /**
    * Constructor, private so no direct instantiation
-   * @param[in] shaderData A pointer to a data structure containing the program source and binary
+   * @param[in] shaderData A smart pointer to a data structure containing the program source and binary
    * @param[in] context    The GL context state cache.
    * @param[in] modifiesGeometry True if the vertex shader changes geometry
    */
-  Program( Integration::ShaderData* shaderData, Context& context, bool modifiesGeometry );
+  Program( Integration::ShaderDataPtr shaderData, Context& context, bool modifiesGeometry );
 
 public:
 
@@ -309,6 +309,11 @@ public:
    */
   ~Program();
 
+  /**
+   * Load the shader, from a precompiled binary if available, else from source code
+   */
+  void Load();
+
 private:
 
   // default constructor, not defined
@@ -317,11 +322,6 @@ private:
   Program& operator=( const Program& );
 
   /**
-   * Load the shader, from a precompiled binary if available, else from source code
-   */
-  void Load();
-
-  /**
    * Unload the shader
    */
   void Unload();
@@ -348,7 +348,7 @@ private:
   /**
    * Resets caches
    */
-  void ResetAttribsUniforms();
+  void ResetAttribsUniformCache();
 
 private:  // Data
 
@@ -360,7 +360,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