From f97f43a6402b898a1e501d12fc1b841f87c1ee0c Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Fri, 29 Jul 2022 11:38:15 +0900 Subject: [PATCH] [Tizen] Change GetTextureProperties Backporting of GLView direct rendering feature Change-Id: Ib9d7de4a2de4fc7fbc27d1cc6d07603d27942ab0 --- .../dali-test-suite-utils/test-graphics-controller.cpp | 2 +- .../dali-test-suite-utils/test-graphics-controller.h | 4 ++-- .../graphics/gles-impl/egl-graphics-controller.cpp | 15 +++++++++++++++ .../internal/graphics/gles-impl/egl-graphics-controller.h | 8 +------- dali/internal/graphics/gles-impl/gles-graphics-texture.h | 2 +- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.cpp index fc176e5..04d193c 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.cpp +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.cpp @@ -1302,7 +1302,7 @@ Graphics::MemoryRequirements TestGraphicsController::GetBufferMemoryRequirements return Graphics::MemoryRequirements{}; } -const Graphics::TextureProperties& TestGraphicsController::GetTextureProperties(const Graphics::Texture& texture) +Graphics::TextureProperties TestGraphicsController::GetTextureProperties(const Graphics::Texture& texture) { static Graphics::TextureProperties textureProperties{}; mCallStack.PushCall("GetTextureProperties", ""); diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.h index cabc414..81b93d2 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.h @@ -2,7 +2,7 @@ #define TEST_GRAPHICS_CONTROLLER_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -354,7 +354,7 @@ public: * * @return Returns the TextureProperties object */ - const Graphics::TextureProperties& GetTextureProperties(const Graphics::Texture& texture) override; + Graphics::TextureProperties GetTextureProperties(const Graphics::Texture& texture) override; /** * @brief Returns the reflection of the given program diff --git a/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp b/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp index 8717f7f..be7a0c3 100644 --- a/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp +++ b/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp @@ -302,6 +302,21 @@ Graphics::UniquePtr EglGraphicsController::CreateSyncObject(const Sy } } +TextureProperties EglGraphicsController::GetTextureProperties(const Texture& texture) +{ + const GLES::Texture* glesTexture = static_cast(&texture); + auto createInfo = glesTexture->GetCreateInfo(); + + TextureProperties properties{}; + properties.format = createInfo.format; + properties.compressed = glesTexture->IsCompressed(); + properties.extent2D = createInfo.size; + properties.nativeHandle = glesTexture->GetGLTexture(); + //TODO: Skip format1, emulated, packed, directWriteAccessEnabled of TextureProperties for now + + return properties; +} + const Graphics::Reflection& EglGraphicsController::GetProgramReflection(const Graphics::Program& program) { return static_cast(&program)->GetReflection(); diff --git a/dali/internal/graphics/gles-impl/egl-graphics-controller.h b/dali/internal/graphics/gles-impl/egl-graphics-controller.h index 44f52ff..b89fa31 100644 --- a/dali/internal/graphics/gles-impl/egl-graphics-controller.h +++ b/dali/internal/graphics/gles-impl/egl-graphics-controller.h @@ -298,17 +298,11 @@ public: /** * @copydoc Dali::Graphics::GetTextureProperties() */ - const TextureProperties& GetTextureProperties(const Texture& texture) override - { - // for compiler not to moan - static TextureProperties dummy{}; - return dummy; - } + TextureProperties GetTextureProperties(const Texture& texture) override; /** * @copydoc Dali::Graphics::Controller::GetPipelineReflection() */ - [[nodiscard]] const Reflection& GetProgramReflection(const Graphics::Program& program) override; /** diff --git a/dali/internal/graphics/gles-impl/gles-graphics-texture.h b/dali/internal/graphics/gles-impl/gles-graphics-texture.h index 398735e..8da8d2c 100644 --- a/dali/internal/graphics/gles-impl/gles-graphics-texture.h +++ b/dali/internal/graphics/gles-impl/gles-graphics-texture.h @@ -144,7 +144,7 @@ public: Format ValidateFormat(Format sourceFormat); - bool IsCompressed() + bool IsCompressed() const { return mIsCompressed; } -- 2.7.4