Revert "[4.0] Discard render instruction if it is empty"
[platform/core/uifw/dali-core.git] / dali / internal / render / shaders / program.h
index 9c30efb..0d5f416 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_PROGRAM_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -74,11 +74,7 @@ public:
   {
     ATTRIB_UNKNOWN = -1,
     ATTRIB_POSITION,
-    ATTRIB_NORMAL,
     ATTRIB_TEXCOORD,
-    ATTRIB_COLOR,
-    ATTRIB_BONE_WEIGHTS,
-    ATTRIB_BONE_INDICES,
     ATTRIB_TYPE_LAST
   };
 
@@ -161,6 +157,25 @@ public:
   GLint GetUniformLocation( unsigned int uniformIndex );
 
   /**
+   * Introspect the newly loaded shader to get the active sampler locations
+   */
+  void GetActiveSamplerUniforms();
+
+  /**
+   * Gets the uniform location for a sampler
+   * @param [in] index The index of the active sampler
+   * @param [out] location The location of the requested sampler
+   * @return true if the active sampler was found
+   */
+  bool GetSamplerUniformLocation( unsigned int index, GLint& location );
+
+  /**
+   * Get the number of active samplers present in the shader
+   * @return The number of active samplers
+   */
+  size_t GetActiveSamplerCount() const;
+
+  /**
    * Sets the uniform value
    * @param [in] location of uniform
    * @param [in] value0 as int
@@ -309,10 +324,9 @@ public:
 
 private:
 
-  // default constructor, not defined
-  Program();
-  // assignment operator, not defined
-  Program& operator=( const Program& );
+  Program(); ///< default constructor, not defined
+  Program( const Program& ); ///< copy constructor, not defined
+  Program& operator=( const Program& ); ///< assignment operator, not defined
 
   /**
    * Load the shader, from a precompiled binary if available, else from source code
@@ -358,16 +372,21 @@ private:  // Data
   GLuint mVertexShaderId;                     ///< GL identifier for vertex shader
   GLuint mFragmentShaderId;                   ///< GL identifier for fragment shader
   GLuint mProgramId;                          ///< GL identifier for program
-  Internal::ShaderDataPtr mProgramData;    ///< Shader program source and binary (when compiled & linked or loaded)
+  Internal::ShaderDataPtr mProgramData;       ///< Shader program source and binary (when compiled & linked or loaded)
 
   // location caches
-  std::vector< std::pair< std::string, GLint > > mAttributeLocations; ///< attribute location cache
-  std::vector< std::pair< std::string, GLint > > mUniformLocations; ///< uniform location cache
+  typedef std::pair< std::string, GLint > NameLocationPair;
+  typedef std::vector< NameLocationPair > Locations;
+
+  Locations mAttributeLocations;      ///< attribute location cache
+  Locations mUniformLocations;        ///< uniform location cache
+  std::vector<GLint> mSamplerUniformLocations; ///< sampler uniform location cache
 
   // uniform value caching
   GLint mUniformCacheInt[ MAX_UNIFORM_CACHE_SIZE ];         ///< Value cache for uniforms of single int
   GLfloat mUniformCacheFloat[ MAX_UNIFORM_CACHE_SIZE ];     ///< Value cache for uniforms of single float
-  GLfloat mUniformCacheFloat4[ MAX_UNIFORM_CACHE_SIZE ][4]; ///< Value cache for uniforms of four float
+  GLfloat mUniformCacheFloat2[ MAX_UNIFORM_CACHE_SIZE ][2]; ///< Value cache for uniforms of two floats
+  GLfloat mUniformCacheFloat4[ MAX_UNIFORM_CACHE_SIZE ][4]; ///< Value cache for uniforms of four floats
   Vector3 mSizeUniformCache;                                ///< Cache value for size uniform
   bool mModifiesGeometry;  ///< True if the program changes geometry