Change texture upload code
authorHeeyong Song <heeyong.song@samsung.com>
Fri, 21 Feb 2014 07:21:05 +0000 (16:21 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Fri, 21 Feb 2014 07:29:56 +0000 (16:29 +0900)
Change-Id: Iabec5b64ddd074fd4528f60bfd4a2343ff4054c4

src/graphics/FGrp_Canvas.cpp
src/ui-core/src/graphics/FGrp_Canvas.cpp
src/ui/animations/FUiAnim_GlNode.cpp
src/ui/animations/FUiAnim_GlNode.h
src/ui/animations/FUiAnim_GlRenderManager.cpp
src/ui/animations/FUiAnim_GlVisualElementSurfaceImpl.cpp
src/ui/animations/FUiAnim_GlVisualElementSurfaceImpl.h
src/ui/animations/FUiAnim_VisualElementSurfaceManager.cpp

index c4e749a..dbee24c 100644 (file)
@@ -305,7 +305,6 @@ public:
                        {
                                SysLog(NID_GRP, "[] cannot get the buffer!", handle);
                        }
-                       ((Tizen::Ui::Animations::TextureInfo*)handle)->updated = true;
                }
 
                this->_pitch = pitch;
@@ -353,8 +352,6 @@ public:
                        {
                                        SysLog(NID_GRP, "[] cannot get the buffer!", handle);
                        }
-                               
-                       ((Tizen::Ui::Animations::TextureInfo*)handle)->updated = true;
                }
 
                this->_pBuffer += (_y * pitch + _x);
index 15221bc..6247adc 100644 (file)
@@ -301,7 +301,6 @@ public:
         {
                        SysLog(NID_GRP, "[] cannot get the buffer!", handle);
                }
-               ((Tizen::Ui::Animations::TextureInfo*)handle)->updated = true;
 #endif
 
                this->_pitch = pitch;
@@ -344,7 +343,6 @@ public:
         {
                        SysLog(NID_GRP, "[] cannot get the buffer!", handle);
         }
-               ((Tizen::Ui::Animations::TextureInfo*)handle)->updated = true;
 #endif
 
                this->_pBuffer += (_y * pitch + _x);
index eebe1ff..8b57e39 100644 (file)
@@ -88,7 +88,6 @@ _GlNode::_GlNode(void)
        , __pMesh(null)
        , __pLight(null)
        , __pMaterial(null)
-       , __textureUpdated(true)
        , __alphaUpdated(true)
        , __textureRepeated(false)
        , __pShaderProgram(null)
@@ -363,14 +362,6 @@ _GlNode::SyncStatus(VisualElementSurface* pSurface, _VisualElementImpl& element)
 
                                        __pSurface = pNewSurface;
                                }
-
-                               __textureUpdated = true;
-                       }
-
-                       if(static_cast<_GlVisualElementSurfaceImpl*>(pSurfaceImpl)->IsInvalidated())
-                       {
-                               __textureUpdated = true;
-                               pSurfaceImpl->Invalidate(false);
                        }
 
                        // Set texture info
index 67fcbb9..2df49d3 100644 (file)
@@ -113,7 +113,6 @@ private:
        Light* __pLight;
        Material* __pMaterial;
 
-       bool __textureUpdated;
        bool __alphaUpdated;
        bool __extraSurfaceUpdated[EXTRA_SURFACE_MAX];
        bool __textureRepeated;
index cdeddfe..15a3831 100644 (file)
@@ -79,6 +79,7 @@ using namespace Tizen::Ui::Animations;
 //#define PRINT(...) fprintf(stderr, __VA_ARGS__)
 #define PRINT(...)
 
+#if 0
 static bool __checkCondition(bool condition)
 {
        bool bCond = condition;
@@ -88,6 +89,8 @@ static bool __checkCondition(bool condition)
        }
        return bCond;
 }
+#endif
+
 //#define ASSERT(__CONDITION__,...) {__checkCondition(__CONDITION__); SysAssertf(__CONDITION__,__VA_ARGS__);}
 #define ASSERT(...) SysAssertf(__VA_ARGS__)
 
@@ -459,6 +462,16 @@ _GlRenderManager::_RenderObject::SetObject(_GlNode* pNode, const _Matrix4f& mvp,
                        __textureId = pNode->__textureId;
                        __textureRepeated = pNode->__textureRepeated;
 
+                       if (__pSurfaceInfo->updated)
+                       {
+                               __isTexUpdated = true;
+                               pSurfaceImpl->Invalidate(false);
+                       }
+                       else
+                       {
+                               __isTexUpdated = false;
+                       }
+
                        __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[3];
                        __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[4];
 
@@ -559,9 +572,20 @@ _GlRenderManager::_RenderObject::SetObject(_GlNode* pNode, const _Matrix4f& mvp,
                        _VisualElementSurfaceImpl* pSurfaceImpl = _VisualElementSurfaceImpl::GetInstance(*pNode->GetSurface());
 
                        __pSurfaceInfo = (TextureInfo*)pSurfaceImpl->GetNativeHandle();
+
                        __textureId = pNode->__textureId;
                        __textureRepeated = pNode->__textureRepeated;
 
+                       if (__pSurfaceInfo->updated)
+                       {
+                               __isTexUpdated = true;
+                               pSurfaceImpl->Invalidate(false);
+                       }
+                       else
+                       {
+                               __isTexUpdated = false;
+                       }
+
                        __pTexCoords = pMeshImpl->__pTexCoordinates;
 
                        if (_FloatCompare(pNode->__opacity, 1.0f))
@@ -600,12 +624,6 @@ _GlRenderManager::_RenderObject::SetObject(_GlNode* pNode, const _Matrix4f& mvp,
                }
        }
 
-       if (pNode->__textureUpdated)
-       {
-               __isTexUpdated = true;
-               pNode->__textureUpdated = false;
-       }
-
        if (pNode->__alphaUpdated)
        {
                __isAlphaMaskUpdated = true;
@@ -1244,11 +1262,9 @@ _GlRenderManager::FlushRenderQueue(void)
 
                        glUniform1i(pProgramImpl->__uniformLocation[UNIFORM_SAMPLER2D_TEXTURE], 0);
 
-                       if (!__pRenderQueue[i].__isMesh || __pRenderQueue[i].__isTexUpdated)
+                       if (__pRenderQueue[i].__isTexUpdated)
                        {
                                __pGlContext->UpdateTexture(__pRenderQueue[i].__pSurfaceInfo);
-
-                               __pRenderQueue[i].__isTexUpdated = false;
                        }
                }
                else
index 5f4f777..f8d33e0 100644 (file)
@@ -47,7 +47,6 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const FloatDimension& s
        : _VisualElementSurfaceImpl(size)
        , __textureInfo()
        , __pLayer(null)
-       , __needToUpdate(true)  // CHECKME: Is it needed to set 'True' here ?
 {
        ClearLastResult();
 
@@ -98,7 +97,6 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const FloatDimension& s
        if (_VisualElementSurfaceManager::GetInstance()->CreateSurface(this) != E_SUCCESS)
        {
                SysAssertf(false, "Cannot initialize GL texture for surface");
-               __needToUpdate = false;
        }
 }
 
@@ -106,7 +104,6 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const Handle layer, con
     : _VisualElementSurfaceImpl(size)
        , __textureInfo()
        , __pLayer(null)
-    , __needToUpdate(true)     // CHECKME: Is it needed to set 'True' here ?
 {
        ClearLastResult();
 
@@ -149,7 +146,6 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const Handle layer, con
        if (_VisualElementSurfaceManager::GetInstance()->CreateSurface(this) != E_SUCCESS)
        {
                SysAssertf(false, "Cannot initialize GL texture for surface");
-               __needToUpdate = false;
        }
 }
 
@@ -158,7 +154,6 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const Bitmap& bitmap, c
        : _VisualElementSurfaceImpl(FloatDimension(bitmap.GetWidthF(),bitmap.GetHeightF()))
        , __textureInfo()
        , __pLayer(null)
-       , __needToUpdate(true)  // CHECKME: Is it needed to set 'True' here ?
 {
        ClearLastResult();
 
@@ -217,7 +212,6 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const Bitmap& bitmap, c
                if (_VisualElementSurfaceManager::GetInstance()->CreateSurface(this) != E_SUCCESS)
                {
                        SysAssertf(false, "Cannot initialize GL texture for surface");
-                       __needToUpdate = false;
                }
 
                // draw bitmap on texture buffer
@@ -243,7 +237,6 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const Bitmap& bitmap, c
                if (_VisualElementSurfaceManager::GetInstance()->CreateSurface(this) != E_SUCCESS)
                {
                        SysAssertf(false, "Cannot initialize GL texture for surface");
-                       __needToUpdate = false;
                }
        }
 
index 916d72e..513a62d 100644 (file)
@@ -85,12 +85,10 @@ public:
        virtual result GetBufferInfo(Tizen::Graphics::BufferInfo& bufferInfo) const;
        virtual Tizen::Graphics::Dimension GetPhysicalSize(void) const;
 
-       virtual void Invalidate(bool invalidate) { __needToUpdate = invalidate; }
+       virtual void Invalidate(bool invalidate) { __textureInfo.updated = invalidate; }
 
        const _GlLayer* GetLayer(void) const;
 
-       bool IsInvalidated(void) const { return __needToUpdate; }
-
 private:
        _GlVisualElementSurfaceImpl(void);      // no implementation
        _GlVisualElementSurfaceImpl(const _GlVisualElementSurfaceImpl& rhs);
@@ -99,7 +97,6 @@ private:
 private:
        TextureInfo __textureInfo;
        const _GlLayer* __pLayer;
-       bool __needToUpdate;
        Tizen::Base::String __imageName;
 
        friend class _VisualElementSurfaceImpl;
index da29c03..29f1729 100644 (file)
@@ -41,6 +41,7 @@
 //#define PRINT(...) fprintf(stderr, __VA_ARGS__)
 #define PRINT(...)
 
+#if 0
 static bool __checkCondition(bool condition)
 {
        bool bCond = condition;
@@ -50,6 +51,8 @@ static bool __checkCondition(bool condition)
        }
        return bCond;
 }
+#endif
+
 //#define ASSERT(__CONDITION__,...) {__checkCondition(__CONDITION__); SysAssertf(__CONDITION__,__VA_ARGS__);}
 #define ASSERT(...) SysAssertf(__VA_ARGS__)