[Tizen] Ignore mipmap generation when texture format compressed 56/298356/2
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 17 Aug 2023 05:41:34 +0000 (14:41 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Wed, 6 Sep 2023 07:00:16 +0000 (16:00 +0900)
Change-Id: I41f991873d5300910affa218256e375171bd4a2c
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
automated-tests/src/dali/utc-Dali-Texture.cpp
dali/internal/render/renderers/render-texture.cpp

index 4a2126fbab8d40e130eab7fe84b99d596017c643..296435ebee97b8cfc3f11711fcc5712f91d354e2 100644 (file)
@@ -973,6 +973,26 @@ int UtcDaliTextureGenerateMipmaps(void)
   END_TEST;
 }
 
+int UtcDaliTextureGenerateMipmapsCompressedFormat(void)
+{
+  TestApplication application;
+  unsigned int    width(64);
+  unsigned int    height(64);
+
+  Texture texture = CreateTexture(TextureType::TEXTURE_2D, Pixel::COMPRESSED_RGBA8_ETC2_EAC, width, height);
+  texture.GenerateMipmaps();
+
+  application.GetGlAbstraction().EnableTextureCallTrace(true);
+  TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
+  application.SendNotification();
+  application.Render();
+
+  // Check generate mipmap didn't called when we use compressed pixel format.
+  DALI_TEST_CHECK(!callStack.FindMethod("GenerateMipmap"));
+
+  END_TEST;
+}
+
 int UtcDaliTextureGetWidth(void)
 {
   TestApplication application;
index 8662303890889d14087e94dc1dcd627200c940ad..bef1b0a09b3bead3676c7ad5380fba2b4ef77c78 100644 (file)
@@ -363,6 +363,12 @@ bool Texture::HasAlphaChannel() const
 
 void Texture::GenerateMipmaps()
 {
+  // Compressed pixel doesn't support mipmap generation.
+  if(Pixel::IsCompressed(mPixelFormat))
+  {
+    return;
+  }
+
   if(!mGraphicsTexture)
   {
     Create(static_cast<Graphics::TextureUsageFlags>(Graphics::TextureUsageFlagBits::SAMPLE));