[3.0] remove Uniform name cache as its no longer used
[platform/core/uifw/dali-core.git] / dali / internal / render / renderers / render-texture.h
index cc58c2f..8e3dc3d 100644 (file)
 #include <string>
 
 // INTERNAL INCLUDES
-#include <dali/devel-api/rendering/sampler.h>
-#include <dali/devel-api/rendering/texture.h>
-#include <dali/integration-api/resource-declarations.h>
-
+#include <dali/public-api/rendering/sampler.h>
+#include <dali/public-api/rendering/texture.h>
+#include <dali/internal/event/rendering/texture-impl.h>
 #include <dali/internal/render/gl-resources/context.h>
-#include <dali/integration-api/gl-defines.h>
 #include <dali/internal/render/renderers/render-sampler.h>
+#include <dali/integration-api/gl-defines.h>
+#include <dali/integration-api/resource-declarations.h>
 
 namespace Dali
 {
@@ -45,14 +45,6 @@ class Texture
 public:
 
   /**
-   * Enumeration to tell that this sampler does not have a unique index yet
-   */
-  enum
-  {
-    NOT_INITIALIZED = -1
-  };
-
-  /**
    * Constructor
    */
   Texture()
@@ -86,7 +78,6 @@ public:
 public: // called from RenderThread
 
   /**
-   * @param[in] buffer A vector wit
    * Get the texture ID
    * @return the id of the associated texture
    */
@@ -108,12 +99,23 @@ class NewTexture
 public:
 
   typedef Dali::TextureType::Type Type;
+
   /**
    * Constructor
+   * @param[in] type The type of the texture
+   * @param[in] format The format of the pixel data
+   * @param[in] width The width of the texture
+   * @param[in] height The height of the texture
    */
   NewTexture( Type type, Pixel::Format format, unsigned int width, unsigned int height );
 
   /**
+   * Constructor from native image
+   * @param[in] nativeImageInterface The native image
+   */
+  NewTexture( NativeImageInterfacePtr nativeImageInterface );
+
+  /**
    * Destructor
    */
   ~NewTexture();
@@ -134,21 +136,23 @@ public:
   /**
    * Uploads data to the texture.
    * @param[in] context The GL context
-   * @param[in] buffer A vector with the data to be uploaded
-   * @param[in] params Upload parameters. See TextureUploadParams
+   * @param[in] pixelData A pixel data object
+   * @param[in] params Upload parameters. See UploadParams
    */
-  void Upload( Context& context, Vector<unsigned char>& buffer, const Dali::TextureUploadParams& params );
+  void Upload( Context& context, PixelDataPtr pixelData, const Internal::NewTexture::UploadParams& params );
 
   /**
    * Bind the texture to the given texture unit and applies the given sampler
    * @param[in] context The GL context
    * @param[in] textureUnit the texture unit
    * @param[in] sampler The sampler to be used with the texture
+   * @return true if the bind succeeded, false otherwise
    */
-  void Bind( Context& context, unsigned int textureUnit, Render::Sampler* sampler );
+  bool Bind( Context& context, unsigned int textureUnit, Render::Sampler* sampler );
 
   /**
    * Auto generates mipmaps for the texture
+   * @param[in] context The GL context
    */
   void GenerateMipmaps( Context& context );
 
@@ -158,21 +162,37 @@ public:
    */
   bool HasAlphaChannel();
 
+  /**
+   * Get the id of the texture
+   * @return Id of the texture
+   */
   GLuint GetId()
   {
     return mId;
   }
 
+  /**
+   * Get the width of the texture
+   * @return Width of the texture
+   */
   unsigned int GetWidth() const
   {
     return mWidth;
   }
 
+  /**
+   * Get the height of the texture
+   * @return Height of the texture
+   */
   unsigned int GetHeight() const
   {
     return mHeight;
   }
 
+  /**
+   * Get the type of the texture
+   * @return Type of the texture
+   */
   Type GetType() const
   {
     return mType;
@@ -187,15 +207,16 @@ private:
    */
   void ApplySampler( Context& context, Render::Sampler* sampler );
 
-
   GLuint mId;                         ///<Id of the texture
   Type mType;                         ///<Type of the texture
+  Render::Sampler mSampler;           ///<The current sampler state
+  NativeImageInterfacePtr mNativeImage; ///<Pointer to native image
   GLenum mInternalFormat;             ///<The format of the pixel data
   GLenum mPixelDataType;              ///<The data type of the pixel data
   unsigned int mWidth;                ///<Widht of the texture
   unsigned int mHeight;               ///<Height of the texture
-  Render::Sampler mSampler;           ///<The current sampler state
   bool mHasAlpha : 1;                 ///<Whether the format has an alpha channel
+  bool mIsCompressed : 1;             ///<Whether the format is compressed
 };