[Tizen] Add IsUploaded devel api in Texture 01/257301/3 accepted/tizen/6.0/unified/20210422.132210 submit/tizen_6.0/20210422.101220
authorseungho <sbsh.baek@samsung.com>
Thu, 22 Apr 2021 07:09:03 +0000 (16:09 +0900)
committerseungho <sbsh.baek@samsung.com>
Thu, 22 Apr 2021 07:52:35 +0000 (16:52 +0900)
Change-Id: I100a3ff6a7f8361ad5c857ee18c89ea5544a4fdf
Signed-off-by: seungho <sbsh.baek@samsung.com>
dali/devel-api/rendering/texture-devel.cpp
dali/devel-api/rendering/texture-devel.h
dali/internal/event/rendering/texture-impl.cpp
dali/internal/event/rendering/texture-impl.h
dali/internal/render/renderers/render-texture.cpp
dali/internal/render/renderers/render-texture.h

index d56cae6..5897d41 100644 (file)
@@ -33,5 +33,11 @@ bool ApplyNativeFragmentShader(Dali::Texture texture, std::string& shader)
   return impl.ApplyNativeFragmentShader(shader);
 }
 
+bool IsUploaded(Dali::Texture texture)
+{
+  auto& impl = GetImplementation(texture);
+  return impl.IsUploaded();
+}
+
 } // namespace DevelTexture
 } // namespace Dali
index 0204a41..7214e0b 100644 (file)
@@ -44,6 +44,8 @@ bool DALI_CORE_API IsNative(Dali::Texture texture);
  */
 bool DALI_CORE_API ApplyNativeFragmentShader(Dali::Texture texture, std::string& shader);
 
+bool DALI_CORE_API IsUploaded(Dali::Texture texture);
+
 } // namespace DevelTexture
 } // namespace Dali
 
index 54d611f..926cf99 100644 (file)
@@ -244,5 +244,14 @@ bool Texture::ApplyNativeFragmentShader(std::string& shader)
   return modified;
 }
 
+bool Texture::IsUploaded()
+{
+  if(EventThreadServices::IsCoreRunning() && mRenderObject)
+  {
+    return mRenderObject->IsUploaded();
+  }
+  return false;
+}
+
 } // namespace Internal
 } // namespace Dali
index 57b098d..ef56213 100644 (file)
@@ -127,6 +127,11 @@ public:
    */
   bool ApplyNativeFragmentShader(std::string& shader);
 
+  /**
+   * @brief Check whether texture is uploaded or not.
+   */
+  bool IsUploaded();
+
 private: // implementation
   /**
    * Constructor
index f77ddb6..9452866 100644 (file)
@@ -672,7 +672,8 @@ Texture::Texture( Type type, Pixel::Format format, ImageDimensions size )
   mMaxMipMapLevel( 0 ),
   mType( type ),
   mHasAlpha( HasAlpha( format ) ),
-  mIsCompressed( IsCompressedFormat( format ) )
+  mIsCompressed( IsCompressedFormat( format ) ),
+  mIsUploaded( false )
 {
   PixelFormatToGl( format,
                    mGlFormat,
@@ -693,7 +694,8 @@ Texture::Texture( NativeImageInterfacePtr nativeImageInterface )
   mMaxMipMapLevel( 0 ),
   mType( TextureType::TEXTURE_2D ),
   mHasAlpha( nativeImageInterface->RequiresBlending() ),
-  mIsCompressed( false )
+  mIsCompressed( false ),
+  mIsUploaded( false )
 {
 }
 
@@ -870,6 +872,7 @@ void Texture::Upload( Context& context, PixelDataPtr pixelData, const Internal::
                                        glFormat, static_cast<GLsizei>( pixelData->GetBufferSize() ), buffer );
     }
   }
+  mIsUploaded = true;
 }
 
 bool Texture::Bind( Context& context, uint32_t textureUnit, Render::Sampler* sampler )
index 0dbfd4a..35421eb 100644 (file)
@@ -145,6 +145,11 @@ public:
     return mNativeImage;
   }
 
+  bool IsUploaded() const
+  {
+    return mIsUploaded;
+  }
+
 private:
 
   /**
@@ -167,6 +172,7 @@ private:
   Type mType:3;                         ///< Type of the texture
   bool mHasAlpha : 1;                   ///< Whether the format has an alpha channel
   bool mIsCompressed : 1;               ///< Whether the format is compressed
+  bool mIsUploaded : 1;
 
 };