Ignore mipmap generation when texture format compressed 41/297341/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 17 Aug 2023 05:41:34 +0000 (14:41 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Thu, 17 Aug 2023 05:41:34 +0000 (14:41 +0900)
Change-Id: I41f991873d5300910affa218256e375171bd4a2c
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
automated-tests/src/dali/utc-Dali-Texture.cpp
dali/internal/render/renderers/render-texture.cpp

index de5ea96..1043cdc 100644 (file)
@@ -1074,6 +1074,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 3c8e040..5e39b71 100644 (file)
@@ -347,6 +347,12 @@ void Texture::GenerateMipmaps()
 {
   DALI_ASSERT_ALWAYS(mResourceId == 0u);
 
+  // Compressed pixel doesn't support mipmap generation.
+  if(Pixel::IsCompressed(mPixelFormat))
+  {
+    return;
+  }
+
   if(!mGraphicsTexture)
   {
     Create(static_cast<Graphics::TextureUsageFlags>(Graphics::TextureUsageFlagBits::SAMPLE));