/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
#include <dali/public-api/images/pixel-data.h>
#include <dali/public-api/images/pixel.h>
+#include <dali/integration-api/pixel-data-integ.h>
+
#include <cstdlib>
using namespace Dali;
}
END_TEST;
}
+
+int UtcDaliPixelDataReleasePixelDataBuffer(void)
+{
+ TestApplication application;
+
+ uint32_t width = 10u;
+ uint32_t height = 10u;
+ uint32_t stride = 12u;
+ uint32_t bufferSize = stride * height * Pixel::GetBytesPerPixel(Pixel::L8);
+ uint8_t* buffer = new uint8_t[bufferSize];
+ buffer[0] = 'a';
+
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, stride, Pixel::L8, PixelData::DELETE_ARRAY);
+
+ DALI_TEST_CHECK(pixelData);
+ DALI_TEST_CHECK(pixelData.GetWidth() == width);
+ DALI_TEST_CHECK(pixelData.GetHeight() == height);
+ DALI_TEST_CHECK(pixelData.GetStride() == stride);
+ DALI_TEST_CHECK(pixelData.GetPixelFormat() == Pixel::L8);
+
+ Dali::Integration::PixelDataBuffer pixelDataBuffer = Dali::Integration::ReleasePixelDataBuffer(pixelData);
+
+ DALI_TEST_CHECK(!pixelData);
+
+ DALI_TEST_EQUALS(pixelDataBuffer.bufferSize, bufferSize, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelDataBuffer.buffer[0], static_cast<uint8_t>('a'), TEST_LOCATION);
+
+ // Release memory by our self.
+ delete[] pixelDataBuffer.buffer;
+
+ END_TEST;
+}
+
+int UtcDaliPixelDataGetPixelDataBuffer(void)
+{
+ TestApplication application;
+
+ uint32_t width = 10u;
+ uint32_t height = 10u;
+ uint32_t stride = 12u;
+ uint32_t bufferSize = stride * height * Pixel::GetBytesPerPixel(Pixel::L8);
+ uint8_t* buffer = new uint8_t[bufferSize];
+ buffer[0] = 'a';
+
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, stride, Pixel::L8, PixelData::DELETE_ARRAY);
+
+ DALI_TEST_CHECK(pixelData);
+ DALI_TEST_CHECK(pixelData.GetWidth() == width);
+ DALI_TEST_CHECK(pixelData.GetHeight() == height);
+ DALI_TEST_CHECK(pixelData.GetStride() == stride);
+ DALI_TEST_CHECK(pixelData.GetPixelFormat() == Pixel::L8);
+
+ Dali::Integration::PixelDataBuffer pixelDataBuffer = Dali::Integration::GetPixelDataBuffer(pixelData);
+
+ DALI_TEST_CHECK(pixelData);
+
+ DALI_TEST_EQUALS(pixelDataBuffer.bufferSize, bufferSize, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelDataBuffer.buffer[0], static_cast<uint8_t>('a'), TEST_LOCATION);
+
+ END_TEST;
+}
END_TEST;
}
+
+int utcDaliRendererDoNotSkipRenderIfTextureSetChanged(void)
+{
+ TestApplication application;
+ tet_infoline("Check to not skip rendering in case of the TextureSet Changed");
+
+ TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
+ drawTrace.Enable(true);
+ drawTrace.Reset();
+
+ Actor actor = CreateRenderableActor();
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
+ application.GetScene().Add(actor);
+
+ // Make any animation to skip rendering.
+ // Delay duration must be bigger than 0.0f
+ Animation animation = Animation::New(2.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(1.0f, 1.0f));
+ animation.Play();
+
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+ Renderer renderer = actor.GetRendererAt(0u);
+
+ Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGB888, 64, 64);
+ TextureSet textureSet = CreateTextureSet(image);
+
+ // Render at least 2 frames
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+
+ drawTrace.Reset();
+
+ application.SendNotification();
+ application.Render();
+
+ // Skip rendering
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
+
+ // Change TextureSet
+ renderer.SetTextures(textureSet);
+
+ application.SendNotification();
+ application.Render(16u);
+
+ // Should not Skip rendering!
+ DALI_TEST_GREATER(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
+
+ END_TEST;
+}
\ No newline at end of file
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
*/
#include <dali-test-suite-utils.h>
-#include <dali/devel-api/images/pixel-data-devel.h>
#include <dali/devel-api/rendering/texture-devel.h>
#include <dali/public-api/dali-core.h>
#include <test-native-image.h>
Stage& Stage::operator=(const Stage& rhs) = default;
-Stage::Stage(Stage&& handle) = default;
+Stage::Stage(Stage&& handle) noexcept = default;
-Stage& Stage::operator=(Stage&& rhs) = default;
+Stage& Stage::operator=(Stage&& rhs) noexcept = default;
Stage::Stage(Internal::Stage* internal)
: BaseHandle(internal)
*
* @param[in] handle A reference to the moved handle
*/
- Stage(Stage&& handle);
+ Stage(Stage&& handle) noexcept;
/**
* @brief This move assignment operator is required for (smart) pointer semantics.
* @param[in] rhs A reference to the moved handle
* @return A reference to this
*/
- Stage& operator=(Stage&& rhs);
+ Stage& operator=(Stage&& rhs) noexcept;
// Containment
${devel_api_src_dir}/events/touch-point.cpp
${devel_api_src_dir}/events/wheel-event-devel.cpp
${devel_api_src_dir}/images/distance-field.cpp
- ${devel_api_src_dir}/images/pixel-data-devel.cpp
${devel_api_src_dir}/object/handle-devel.cpp
${devel_api_src_dir}/object/csharp-type-registry.cpp
${devel_api_src_dir}/rendering/frame-buffer-devel.cpp
SET( devel_api_core_images_header_files
${devel_api_src_dir}/images/distance-field.h
- ${devel_api_src_dir}/images/pixel-data-devel.h
)
#define DALI_GRAPHICS_API_TYPES
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
#include <utility>
#include <vector>
+#include <dali/public-api/images/pixel-data.h>
#include <dali/public-api/signals/callback.h>
namespace Dali
{
BUFFER,
MEMORY,
+ PIXEL_DATA,
TEXTURE
};
void* memory;
} memorySource;
+ struct PixelDataSource
+ {
+ Dali::PixelData pixelData;
+ } pixelDataSource;
+
struct TextureSource
{
Texture* texture;
${platform_abstraction_src_dir}/bitmap.cpp
${platform_abstraction_src_dir}/core.cpp
${platform_abstraction_src_dir}/debug.cpp
- ${platform_abstraction_src_dir}/trace.cpp
- ${platform_abstraction_src_dir}/profiling.cpp
${platform_abstraction_src_dir}/input-options.cpp
${platform_abstraction_src_dir}/lockless-buffer.cpp
+ ${platform_abstraction_src_dir}/pixel-data-integ.cpp
+ ${platform_abstraction_src_dir}/profiling.cpp
${platform_abstraction_src_dir}/render-task-list-integ.cpp
${platform_abstraction_src_dir}/scene.cpp
+ ${platform_abstraction_src_dir}/trace.cpp
+)
+
+SET( platform_abstraction_events_src_files
${platform_abstraction_src_dir}/events/event.cpp
${platform_abstraction_src_dir}/events/hover-event-integ.cpp
${platform_abstraction_src_dir}/events/key-event-integ.cpp
- ${platform_abstraction_src_dir}/events/wheel-event-integ.cpp
${platform_abstraction_src_dir}/events/multi-point-event-integ.cpp
${platform_abstraction_src_dir}/events/point.cpp
- ${platform_abstraction_src_dir}/events/touch-event-integ.cpp
${platform_abstraction_src_dir}/events/touch-event-combiner.cpp
+ ${platform_abstraction_src_dir}/events/touch-event-integ.cpp
${platform_abstraction_src_dir}/events/touch-integ.cpp
+ ${platform_abstraction_src_dir}/events/wheel-event-integ.cpp
)
-
SET( platform_abstraction_header_files
${platform_abstraction_src_dir}/addon-manager.h
+ ${platform_abstraction_src_dir}/bitmap.h
+ ${platform_abstraction_src_dir}/context-notifier.h
${platform_abstraction_src_dir}/core.h
${platform_abstraction_src_dir}/core-enumerations.h
- ${platform_abstraction_src_dir}/context-notifier.h
${platform_abstraction_src_dir}/debug.h
- ${platform_abstraction_src_dir}/trace.h
- ${platform_abstraction_src_dir}/profiling.h
- ${platform_abstraction_src_dir}/input-options.h
- ${platform_abstraction_src_dir}/bitmap.h
- ${platform_abstraction_src_dir}/resource-policies.h
- ${platform_abstraction_src_dir}/resource-types.h
${platform_abstraction_src_dir}/gl-abstraction.h
- ${platform_abstraction_src_dir}/gl-defines.h
${platform_abstraction_src_dir}/gl-context-helper-abstraction.h
+ ${platform_abstraction_src_dir}/gl-defines.h
${platform_abstraction_src_dir}/graphics-sync-abstraction.h
- ${platform_abstraction_src_dir}/render-controller.h
+ ${platform_abstraction_src_dir}/input-options.h
+ ${platform_abstraction_src_dir}/lockless-buffer.h
+ ${platform_abstraction_src_dir}/pixel-data-integ.h
${platform_abstraction_src_dir}/platform-abstraction.h
+ ${platform_abstraction_src_dir}/profiling.h
${platform_abstraction_src_dir}/processor-interface.h
- ${platform_abstraction_src_dir}/lockless-buffer.h
+ ${platform_abstraction_src_dir}/render-controller.h
${platform_abstraction_src_dir}/render-task-list-integ.h
+ ${platform_abstraction_src_dir}/resource-policies.h
+ ${platform_abstraction_src_dir}/resource-types.h
${platform_abstraction_src_dir}/scene.h
+ ${platform_abstraction_src_dir}/trace.h
)
${platform_abstraction_src_dir}/events/event.h
${platform_abstraction_src_dir}/events/hover-event-integ.h
${platform_abstraction_src_dir}/events/key-event-integ.h
- ${platform_abstraction_src_dir}/events/wheel-event-integ.h
${platform_abstraction_src_dir}/events/multi-point-event-integ.h
${platform_abstraction_src_dir}/events/point.h
${platform_abstraction_src_dir}/events/touch-event-combiner.h
${platform_abstraction_src_dir}/events/touch-event-integ.h
${platform_abstraction_src_dir}/events/touch-integ.h
+ ${platform_abstraction_src_dir}/events/wheel-event-integ.h
)
SET( SOURCES ${SOURCES}
${platform_abstraction_src_files}
+ ${platform_abstraction_events_src_files}
)
SET( INTEGRATION_API_HEADERS ${INTEGRATION_API_HEADERS}
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
*/
// FILE HEADER
-#include <dali/devel-api/images/pixel-data-devel.h>
+#include <dali/integration-api/pixel-data-integ.h>
// INTERNAL INCLUDES
#include <dali/internal/event/images/pixel-data-impl.h>
-namespace Dali
+namespace Dali::Integration
{
-namespace DevelPixelData
-{
-PixelDataBuffer ReleasePixelDataBuffer(PixelData& pixelData)
+PixelDataBuffer ReleasePixelDataBuffer(Dali::PixelData& pixelData)
{
Internal::PixelData& pixelDataImpl = GetImplementation(pixelData);
- PixelDataBuffer pixelDataBuffer = pixelDataImpl.ReleaseBuffer();
+ PixelDataBuffer pixelDataBuffer = pixelDataImpl.ReleasePixelDataBuffer();
pixelData.Reset();
return pixelDataBuffer;
}
-} // namespace DevelPixelData
-
-} // namespace Dali
+PixelDataBuffer GetPixelDataBuffer(const Dali::PixelData& pixelData)
+{
+ const Internal::PixelData& pixelDataImpl = GetImplementation(pixelData);
+ PixelDataBuffer pixelDataBuffer = pixelDataImpl.GetPixelDataBuffer();
+ return pixelDataBuffer;
+}
+} // namespace Dali::Integration
-#ifndef DALI_PIXEL_DATA_DEVEL_H
-#define DALI_PIXEL_DATA_DEVEL_H
+#ifndef DALI_PIXEL_DATA_INTEG_H
+#define DALI_PIXEL_DATA_INTEG_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
#include <dali/public-api/images/pixel-data.h>
#include <dali/public-api/images/pixel.h>
-namespace Dali
-{
-namespace DevelPixelData
+namespace Dali::Integration
{
/**
* Struct to keep the buffer pointer and the allocation method.
*/
struct PixelDataBuffer
{
- uint8_t* buffer;
- uint32_t bufferSize;
- PixelData::ReleaseFunction releaseFunction;
+ uint8_t* buffer;
+ uint32_t bufferSize;
+ Dali::PixelData::ReleaseFunction releaseFunction;
- PixelDataBuffer(uint8_t* buffer,
- uint32_t bufferSize,
- PixelData::ReleaseFunction releaseFunction)
+ PixelDataBuffer(uint8_t* buffer,
+ uint32_t bufferSize,
+ Dali::PixelData::ReleaseFunction releaseFunction)
: buffer(buffer),
bufferSize(bufferSize),
releaseFunction(releaseFunction)
* @param[in,out] pixelData The pixel data object to take the buffer from
* @return the buffer and the data release mechanism
*/
-DALI_CORE_API PixelDataBuffer ReleasePixelDataBuffer(PixelData& pixelData);
+DALI_CORE_API PixelDataBuffer ReleasePixelDataBuffer(Dali::PixelData& pixelData);
-} // namespace DevelPixelData
+/**
+ * Get the buffer from a pixel data object.
+ * @param[in] pixelData The pixel data object to get the buffer from
+ * @return the buffer of pixelData.
+ */
+DALI_CORE_API PixelDataBuffer GetPixelDataBuffer(const Dali::PixelData& pixelData);
-} // namespace Dali
+} // namespace Dali::Integration
-#endif // DALI_PIXEL_DATA_DEVEL_H
+#endif // DALI_PIXEL_DATA_INTEG_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
{
namespace Internal
{
-const ImageAttributes ImageAttributes::DEFAULT_ATTRIBUTES;
-
struct ImageAttributes::ImageAttributesImpl
{
ImageAttributesImpl()
#define DALI_INTERNAL_IMAGE_ATTRIBUTES_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
*/
using FilterMode = Dali::SamplingMode::Type;
- static const ImageAttributes DEFAULT_ATTRIBUTES; ///< Default attributes have no size
-
/**
* @brief Default constructor, initializes to default values.
*/
* Move constructor. Passes the ownership of a pointer to another.
* @param[in] other The pointer that gives away the ownership.
*/
- OwnerPointer(OwnerPointer&& other)
+ OwnerPointer(OwnerPointer&& other) noexcept
: mObject(nullptr)
{
Swap(other);
* Move assignment operator. Passes the ownership of a pointer to another.
* @param[in] other The pointer that gives away the ownership.
*/
- OwnerPointer& operator=(OwnerPointer&& other)
+ OwnerPointer& operator=(OwnerPointer&& other) noexcept
{
// Reuse operator=
return operator=(other);
#define DALI_INTERNAL_SHADER_DATA_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
namespace
{
-static const std::vector<char> emptyShader;
-
inline std::vector<char> StringToVector(const std::string& str)
{
auto retval = std::vector<char>{};
else
{
// DALI_LOG_ERROR("Unsupported shader stage\n");
+ static const std::vector<char> emptyShader;
return emptyShader;
}
}
delete mRemoveCallback;
}
-ActorObserver::ActorObserver(ActorObserver&& other)
+ActorObserver::ActorObserver(ActorObserver&& other) noexcept
: ActorObserver(nullptr)
{
operator=(std::move(other));
}
-ActorObserver& ActorObserver::operator=(ActorObserver&& other)
+ActorObserver& ActorObserver::operator=(ActorObserver&& other) noexcept
{
if(this != &other)
{
* @note The other's actor is appropriately disconnected.
* @note Ownership of callback is passed onto this class.
*/
- ActorObserver(ActorObserver&& other);
+ ActorObserver(ActorObserver&& other) noexcept;
/**
* Move assignment operator.
* @note The other's actor is appropriately disconnected.
* @note Ownership of callback is passed onto this class.
*/
- ActorObserver& operator=(ActorObserver&& other);
+ ActorObserver& operator=(ActorObserver&& other) noexcept;
// Not copyable
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
return mBufferSize;
}
-DevelPixelData::PixelDataBuffer PixelData::ReleaseBuffer()
+Dali::Integration::PixelDataBuffer PixelData::ReleasePixelDataBuffer()
{
- DevelPixelData::PixelDataBuffer pixelDataBuffer(mBuffer, mBufferSize, mReleaseFunction);
+ Dali::Integration::PixelDataBuffer pixelDataBuffer(mBuffer, mBufferSize, mReleaseFunction);
mBuffer = nullptr;
return pixelDataBuffer;
}
+Dali::Integration::PixelDataBuffer PixelData::GetPixelDataBuffer() const
+{
+ Dali::Integration::PixelDataBuffer pixelDataBuffer(mBuffer, mBufferSize, mReleaseFunction);
+ return pixelDataBuffer;
+}
+
uint32_t PixelData::GetStride() const
{
return mStride;
#define DALI_INTERNAL_PIXEL_DATA_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
*/
// INTERNAL INCLUDES
-#include <dali/devel-api/images/pixel-data-devel.h>
#include <dali/integration-api/debug.h>
+#include <dali/integration-api/pixel-data-integ.h>
#include <dali/public-api/images/pixel-data.h>
#include <dali/public-api/object/base-object.h>
* Return the buffer pointer and reset the internal buffer to zero.
* @return The buffer pointer and associated data.
*/
- DevelPixelData::PixelDataBuffer ReleaseBuffer();
+ Dali::Integration::PixelDataBuffer ReleasePixelDataBuffer();
+
+ /**
+ * Return the buffer pointer.
+ * @return The buffer pointer.
+ */
+ Dali::Integration::PixelDataBuffer GetPixelDataBuffer() const;
/**
* @copydoc PixelData::GetStride()
${internal_src_dir}/update/render-tasks/scene-graph-render-task-list.cpp
${internal_src_dir}/update/rendering/scene-graph-texture-set.cpp
${internal_src_dir}/update/rendering/scene-graph-renderer.cpp
+ ${internal_src_dir}/update/rendering/scene-graph-visual-renderer.cpp
)
SET( SOURCES ${SOURCES}
std::unique_ptr<Dali::ThreadPool> threadPool; ///< The thread pool
Vector<Graphics::Texture*> boundTextures; ///< The textures bound for rendering
Vector<Graphics::Texture*> textureDependencyList; ///< The dependency list of bound textures
+ Vector<Render::TextureKey> updatedTextures{}; ///< The updated texture list
uint32_t frameCount{0u}; ///< The current frame count
BufferIndex renderBufferIndex{SceneGraphBuffers::INITIAL_UPDATE_BUFFER_INDEX}; ///< The index of the buffer to read from; this is opposite of the "update" buffer
textureKey->Initialize(mImpl->graphicsController);
mImpl->textureContainer.PushBack(textureKey);
+ mImpl->updatedTextures.PushBack(textureKey);
}
void RenderManager::RemoveTexture(const Render::TextureKey& textureKey)
{
DALI_ASSERT_DEBUG(textureKey && "Trying to upload to empty texture key");
textureKey->Upload(pixelData, params);
+
+ mImpl->updatedTextures.PushBack(textureKey);
}
void RenderManager::GenerateMipmaps(const Render::TextureKey& textureKey)
{
DALI_ASSERT_DEBUG(textureKey && "Trying to generate mipmaps on empty texture key");
textureKey->GenerateMipmaps();
+
+ mImpl->updatedTextures.PushBack(textureKey);
+}
+
+void RenderManager::SetTextureUpdated(const Render::TextureKey& textureKey)
+{
+ DALI_ASSERT_DEBUG(textureKey && "Trying to set updated on empty texture key");
+ textureKey->SetUpdated(true);
+
+ mImpl->updatedTextures.PushBack(textureKey);
}
void RenderManager::SetFilterMode(Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode)
iter->OnRenderFinished();
}
- // Notify RenderTexture that rendering has finished
- for(auto&& iter : mImpl->textureContainer)
+ // Notify updated RenderTexture that rendering has finished
+ for(auto&& iter : mImpl->updatedTextures)
{
iter->OnRenderFinished();
}
+ mImpl->updatedTextures.Clear();
mImpl->UpdateTrackers();
void GenerateMipmaps(const Render::TextureKey& texture);
/**
+ * Sets the updated flag of a texture
+ * @param[in] texture The updated texture
+ */
+ void SetTextureUpdated(const Render::TextureKey& textureKey);
+
+ /**
* Adds a framebuffer to the render manager
* @param[in] frameBuffer The framebuffer to add
*/
{
namespace
{
-MemoryPoolObjectAllocator<Renderer> gRenderRendererMemoryPool;
+MemoryPoolObjectAllocator<Renderer>& GetRenderRendererMemoryPool()
+{
+ static MemoryPoolObjectAllocator<Renderer> gRenderRendererMemoryPool;
+ return gRenderRendererMemoryPool;
+}
}
void Renderer::PrepareCommandBuffer()
DepthFunction::Type depthFunction,
StencilParameters& stencilParameters)
{
- void* ptr = gRenderRendererMemoryPool.AllocateRawThreadSafe();
- auto key = gRenderRendererMemoryPool.GetKeyFromPtr(static_cast<Renderer*>(ptr));
+ void* ptr = GetRenderRendererMemoryPool().AllocateRawThreadSafe();
+ auto key = GetRenderRendererMemoryPool().GetKeyFromPtr(static_cast<Renderer*>(ptr));
// Use placement new to construct renderer.
new(ptr) Renderer(dataProvider, geometry, blendingBitmask, blendColor, faceCullingMode, preMultipliedAlphaEnabled, depthWriteMode, depthTestMode, depthFunction, stencilParameters);
void Renderer::operator delete(void* ptr)
{
- gRenderRendererMemoryPool.FreeThreadSafe(static_cast<Renderer*>(ptr));
+ GetRenderRendererMemoryPool().FreeThreadSafe(static_cast<Renderer*>(ptr));
}
Renderer* Renderer::Get(RendererKey::KeyType rendererKey)
{
- return gRenderRendererMemoryPool.GetPtrFromKey(rendererKey);
+ return GetRenderRendererMemoryPool().GetPtrFromKey(rendererKey);
}
void Renderer::SetGeometry(Render::Geometry* geometry)
#endif
// Memory pool used to allocate new textures. Memory used by this pool will be released when shutting down DALi
-MemoryPoolObjectAllocator<Texture> gTextureMemoryPool;
+MemoryPoolObjectAllocator<Texture>& GetTextureMemoryPool()
+{
+ static MemoryPoolObjectAllocator<Texture> gTextureMemoryPool;
+ return gTextureMemoryPool;
+}
/**
* Converts DALi pixel format to Graphics::Format
TextureKey Texture::NewKey(Type type, Pixel::Format format, ImageDimensions size)
{
- void* ptr = gTextureMemoryPool.AllocateRawThreadSafe();
- auto key = gTextureMemoryPool.GetKeyFromPtr(static_cast<Texture*>(ptr));
+ void* ptr = GetTextureMemoryPool().AllocateRawThreadSafe();
+ auto key = GetTextureMemoryPool().GetKeyFromPtr(static_cast<Texture*>(ptr));
new(ptr) Texture(type, format, size);
return TextureKey(key);
TextureKey Texture::NewKey(NativeImageInterfacePtr nativeImageInterface)
{
- void* ptr = gTextureMemoryPool.AllocateRawThreadSafe();
- auto key = gTextureMemoryPool.GetKeyFromPtr(static_cast<Texture*>(ptr));
+ void* ptr = GetTextureMemoryPool().AllocateRawThreadSafe();
+ auto key = GetTextureMemoryPool().GetKeyFromPtr(static_cast<Texture*>(ptr));
new(ptr) Texture(nativeImageInterface);
return TextureKey(key);
void Texture::operator delete(void* ptr)
{
- gTextureMemoryPool.FreeThreadSafe(static_cast<Texture*>(ptr));
+ GetTextureMemoryPool().FreeThreadSafe(static_cast<Texture*>(ptr));
}
Render::Texture* Texture::Get(TextureKey::KeyType key)
{
- return gTextureMemoryPool.GetPtrFromKey(key);
+ return GetTextureMemoryPool().GetPtrFromKey(key);
}
void Texture::Initialize(Graphics::Controller& graphicsController)
info.srcFormat = ConvertPixelFormat(pixelData->GetPixelFormat());
Graphics::TextureUpdateSourceInfo updateSourceInfo{};
- updateSourceInfo.sourceType = Graphics::TextureUpdateSourceInfo::Type::MEMORY;
- updateSourceInfo.memorySource.memory = pixelData->GetBuffer();
+ updateSourceInfo.sourceType = Graphics::TextureUpdateSourceInfo::Type::PIXEL_DATA;
+ updateSourceInfo.pixelDataSource.pixelData = Dali::PixelData(pixelData.Get());
mGraphicsController->UpdateTextures({info}, {updateSourceInfo});
};
DoubleBuffered()
- : mValue1(NULL),
- mValue2(NULL)
+ : mValue1(nullptr),
+ mValue2(nullptr)
{
}
namespace SceneGraph
{
class PropertyOwner;
+class ResetterManager;
using OwnedPropertyContainer = OwnerContainer<PropertyBase*>;
using OwnedPropertyIter = OwnedPropertyContainer::Iterator;
return true;
}
+ /**
+ * @brief Install custom resetter messages to resetter manager.
+ * @pre ConnectToSceneGraph() Should be called before this API.
+ *
+ * @param[in] manager ResetterManager to add resetter.
+ */
+ virtual void AddInitializeResetter(ResetterManager& manager) const
+ {
+ // Do nothing
+ }
+
protected:
/**
* Protected constructor.
--- /dev/null
+#ifndef DALI_INTERNAL_SCENEGRAPH_RENDERER_RESETTER_H
+#define DALI_INTERNAL_SCENEGRAPH_RENDERER_RESETTER_H
+
+/*
+ * Copyright (c) 2023 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// EXTERNAL INCLDUES
+#include <cstdint> // int8_t
+
+#include <dali/internal/update/animation/property-accessor.h>
+#include <dali/internal/update/animation/property-component-accessor.h>
+#include <dali/internal/update/common/property-owner.h>
+#include <dali/internal/update/rendering/scene-graph-renderer.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace SceneGraph
+{
+/**
+ * Class to reset the renderer's properties to their base values. Used by UpdateManager
+ * to reset the renderer properties after the renderer is created.
+ */
+class RendererResetter : public PropertyOwner::Observer
+{
+public:
+ /**
+ * New method.
+ * @param[in] renderer The renderer
+ * @return the new renderer resetter
+ */
+ static RendererResetter* New(const Renderer& renderer)
+ {
+ return new RendererResetter(const_cast<Renderer*>(&renderer));
+ }
+
+ /**
+ * Virtual Destructor
+ */
+ ~RendererResetter() override
+ {
+ if(mRenderer != nullptr)
+ {
+ mRenderer->RemoveObserver(*this);
+ }
+ }
+
+ /**
+ * Initialize.
+ *
+ * Watches the renderer to track if it's destroyed or not.
+ */
+ void Initialize()
+ {
+ mRenderer->AddObserver(*this);
+ }
+
+ /**
+ * Reset the renderer properties to their base values if the renderer is still alive and on stage
+ * @param[in] updateBufferIndex the current buffer index
+ */
+ void ResetToBaseValue(BufferIndex updateBufferIndex)
+ {
+ if(mRenderer != nullptr && mActive)
+ {
+ // Start aging the renderer properties.
+ // We need to reset the renderer properties for only one frames to ensure
+ // initialized case.
+ --mActive;
+
+ mRenderer->ResetToBaseValues(updateBufferIndex);
+ }
+ };
+
+ /**
+ * Called when the renderer is connected to the scene graph.
+ *
+ * Note, SceneGraph::Renderer don't call this API.
+ *
+ * @param[in] owner The property owner
+ */
+ void PropertyOwnerConnected(PropertyOwner& owner) override
+ {
+ }
+
+ /**
+ * Called when mPropertyOwner is disconnected from the scene graph.
+ *
+ * Note, SceneGraph::Renderer don't call this API.
+ *
+ * @param[in] bufferIndex the current buffer index
+ * @param[in] owner The property owner
+ */
+ void PropertyOwnerDisconnected(BufferIndex bufferIndex, PropertyOwner& owner) override
+ {
+ }
+
+ /**
+ * Called shortly before the propertyOwner is destroyed
+ * @param[in] owner The property owner
+ */
+ void PropertyOwnerDestroyed(PropertyOwner& owner) override
+ {
+ mRenderer = nullptr;
+
+ // Don't need to wait another frame as the properties are being destroyed
+ mActive = STOPPED;
+ }
+
+ /**
+ * Determine if the renderer resetter has finished.
+ *
+ * @return true if the renderer resetter has finished.
+ */
+ virtual bool IsFinished()
+ {
+ return mActive <= STOPPED;
+ }
+
+protected:
+ enum
+ {
+ STOPPED = 0,
+ AGING = 1,
+ ACTIVE = 2,
+ };
+
+ /**
+ * Constructor
+ *
+ * @param[in] renderer The renderer storing the base properties
+ */
+ RendererResetter(Renderer* renderer)
+ : mRenderer(renderer),
+ mActive(AGING) // Since we make this resetter only initialize case now.
+ {
+ mRenderer->MarkAsDirty();
+ }
+
+ Renderer* mRenderer; ///< The renderer that owns the properties
+ int8_t mActive; ///< 2 if active, 1 if aging, 0 if stopped
+};
+
+} // namespace SceneGraph
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif //DALI_INTERNAL_SCENEGRAPH_RENDERER_RESETTER_H
--- /dev/null
+#ifndef DALI_INTERNAL_SCENEGRAPH_RESETTER_MANAGER_H
+#define DALI_INTERNAL_SCENEGRAPH_RESETTER_MANAGER_H
+
+/*
+ * Copyright (c) 2023 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// INTERNAL INCLDUES
+#include <dali/internal/common/owner-pointer.h>
+#include <dali/internal/update/common/property-resetter.h>
+
+namespace Dali::Internal::SceneGraph
+{
+class Node;
+class Renderer;
+
+/**
+ * Abstract interface for passing a Resetter object add.
+ */
+class ResetterManager
+{
+public:
+ /**
+ * Add a property resetter. ResetterManager takes ownership of the object.
+ * It will be killed by ResetterManager when the associated animator or
+ * constraint has finished; or the property owner of the property is destroyed.
+ */
+ virtual void AddPropertyResetter(OwnerPointer<PropertyResetterBase>& propertyResetter) = 0;
+
+ /**
+ * Add a node resetter. ResetterManager takes ownership of the object.
+ * It will be killed by ResetterManager when the node is disconnected from the scene graph;
+ * or when the node is destroyed.
+ */
+ virtual void AddNodeResetter(const Node& node) = 0;
+
+ /**
+ * Add a renderer resetter. ResetterManager takes ownership of the object.
+ * It will be killed by ResetterManager when the renderer is destroyed
+ */
+ virtual void AddRendererResetter(const Renderer& renderer) = 0;
+
+protected:
+ /**
+ * Destructor. Protected as no derived class should ever be deleted
+ * through a reference to this pure abstract interface.
+ */
+ virtual ~ResetterManager() = default;
+};
+
+} // namespace Dali::Internal::SceneGraph
+
+#endif //DALI_INTERNAL_SCENEGRAPH_RESETTER_MANAGER_H
new(slot) DerivedType(&mRenderManager, &RenderManager::RemoveRenderTracker, &renderTracker);
}
+RenderManager& RenderMessageDispatcher::GetRenderManager()
+{
+ return mRenderManager;
+}
+
+uint32_t* RenderMessageDispatcher::ReserveMessageSlot(std::size_t size)
+{
+ return mRenderQueue.ReserveMessageSlot(mBuffers.GetUpdateBufferIndex(), size);
+}
+
} // namespace SceneGraph
} // namespace Internal
*/
void RemoveRenderTracker(Render::RenderTracker& renderTracker);
+ /**
+ * Return the render manager.
+ * @return A reference to the render manager.
+ */
+ RenderManager& GetRenderManager();
+
+ /**
+ * Reserve space for another message in the queue.
+ * @param[in] size The message size with respect to the size of type "char".
+ * @return A pointer to the first char allocated for the message.
+ */
+ uint32_t* ReserveMessageSlot(std::size_t size);
+
private:
RenderManager& mRenderManager;
RenderQueue& mRenderQueue;
for(uint32_t index = 0; index < renderableCount; ++index, ++renderListIter)
{
*renderListIter = mSortingHelper[index].renderItem;
- DALI_LOG_INFO(gRenderListLogFilter, Debug::Verbose, " sortedList[%d] = %x\n", index, mSortingHelper[index].renderItem->mRenderer);
+ DALI_LOG_INFO(gRenderListLogFilter, Debug::Verbose, " sortedList[%d] = node : %x renderer : %x\n", index, mSortingHelper[index].renderItem->mNode, mSortingHelper[index].renderItem->mRenderer.Get());
}
}
// We only use the clipping version of the sort comparitor if any clipping nodes exist within the RenderList.
SortRenderItems(updateBufferIndex, *renderList, layer, hasClippingNodes, isOrthographicCamera);
}
+ else
+ {
+ renderList->SetHasColorRenderItems(true);
+ }
isRenderListAdded = true;
}
// Clipping hierarchy is irrelevant when sorting overlay items, so we specify using the non-clipping version of the sort comparitor.
SortRenderItems(updateBufferIndex, *renderList, layer, false, isOrthographicCamera);
}
+ else
+ {
+ renderList->SetHasColorRenderItems(false);
+ }
isRenderListAdded = true;
}
ResetterContainer<PropertyResetterBase> propertyResetters; ///< A container of property resetters
ResetterContainer<NodeResetter> nodeResetters; ///< A container of node resetters
+ ResetterContainer<RendererResetter> rendererResetters; ///< A container of renderer resetters
OwnerContainer<Animation*> animations; ///< A container of owned animations
OwnerContainer<PropertyNotification*> propertyNotifications; ///< A container of owner property notifications.
rootLayer->CreateTransform(&mImpl->transformManager);
rootLayer->SetRoot(true);
- AddNodeResetter(*rootLayer);
+ rootLayer->AddInitializeResetter(*this);
mImpl->scenes.emplace_back(new Impl::SceneInfo(rootLayer));
}
parent->ConnectChild(node);
- AddNodeResetter(*node);
+ node->AddInitializeResetter(*this);
// Inform the frame-callback-processor, if set, about the node-hierarchy changing
if(mImpl->frameCallbackProcessor)
void UpdateManager::AddRenderTaskList(OwnerPointer<RenderTaskList>& taskList)
{
RenderTaskList* taskListPointer = taskList.Release();
- taskListPointer->SetRenderMessageDispatcher(&mImpl->renderMessageDispatcher);
+ taskListPointer->Initialize(*this, mImpl->renderMessageDispatcher);
mImpl->scenes.back()->taskList = taskListPointer;
}
mImpl->nodeResetters.PushBack(nodeResetter.Release());
}
+void UpdateManager::AddRendererResetter(const Renderer& renderer)
+{
+ OwnerPointer<SceneGraph::RendererResetter> rendererResetter = SceneGraph::RendererResetter::New(renderer);
+ rendererResetter->Initialize();
+ mImpl->rendererResetters.PushBack(rendererResetter.Release());
+}
+
void UpdateManager::AddPropertyNotification(OwnerPointer<PropertyNotification>& propertyNotification)
{
mImpl->propertyNotifications.PushBack(propertyNotification.Release());
DALI_LOG_INFO(gLogFilter, Debug::General, "[%x] AddRenderer\n", renderer);
renderer->ConnectToSceneGraph(*mImpl->sceneController, mSceneGraphBuffers.GetUpdateBufferIndex());
+ renderer->AddInitializeResetter(*this);
+
mImpl->renderers.PushBack(rendererKey);
}
void UpdateManager::AddTextureSet(OwnerPointer<TextureSet>& textureSet)
{
+ textureSet->SetRenderMessageDispatcher(&mImpl->renderMessageDispatcher);
mImpl->textureSets.PushBack(textureSet.Release());
}
// Reset node properties
mImpl->nodeResetters.ResetToBaseValues(bufferIndex);
+ // Reset renderer properties
+ mImpl->rendererResetters.ResetToBaseValues(bufferIndex);
+
// Reset all animating / constrained properties
mImpl->propertyResetters.ResetToBaseValues(bufferIndex);
#include <dali/internal/update/animation/scene-graph-animation.h>
#include <dali/internal/update/common/node-resetter.h>
#include <dali/internal/update/common/property-resetter.h>
+#include <dali/internal/update/common/renderer-resetter.h>
+#include <dali/internal/update/common/resetter-manager.h>
#include <dali/internal/update/common/scene-graph-buffers.h>
#include <dali/internal/update/common/scene-graph-property-notification.h>
#include <dali/internal/update/common/scene-graph-scene.h>
* It also maintains the lifecycle of nodes and other property owners that are
* disconnected from the scene graph.
*/
-class UpdateManager : public ShaderSaver
+class UpdateManager : public ShaderSaver, public ResetterManager
{
public:
/**
*/
bool IsAnimationRunning() const;
+ // ResetterManager
+
+ /**
+ * @copydoc Dali::Internal::SceneGraph::ResetterManager::AddPropertyResetter()
+ */
+ void AddPropertyResetter(OwnerPointer<PropertyResetterBase>& propertyResetter) override;
+
/**
- * Add a property resetter. UpdateManager takes ownership of the object.
- * It will be killed by UpdateManager when the associated animator or
- * constraint has finished; or the property owner of the property is destroyed.
+ * @copydoc Dali::Internal::SceneGraph::ResetterManager::AddNodeResetter()
*/
- void AddPropertyResetter(OwnerPointer<PropertyResetterBase>& propertyResetter);
+ void AddNodeResetter(const Node& node) override;
/**
- * Add a node resetter. UpdateManager takes ownership of the object.
- * It will be killed by UpdateManager when the node is disconnected from the scene graph;
- * or when the node is destroyed.
+ * @copydoc Dali::Internal::SceneGraph::ResetterManager::AddRendererResetter()
*/
- void AddNodeResetter(const Node& node);
+ void AddRendererResetter(const Renderer& renderer) override;
// Property Notification
#include <dali/public-api/common/constants.h>
#include <dali/public-api/common/dali-common.h>
+#include <dali/internal/update/common/resetter-manager.h> ///< For AddInitializeResetter
+
namespace
{
// Memory pool used to allocate new nodes. Memory used by this pool will be released when process dies
return mIsConnectedToSceneGraph;
}
+void Node::AddInitializeResetter(ResetterManager& manager) const
+{
+ manager.AddNodeResetter(*this);
+}
+
void Node::ConnectChild(Node* childNode)
{
DALI_ASSERT_ALWAYS(this != childNode);
class Layer;
class RenderTask;
class UpdateManager;
+class ResetterManager;
class Node;
// Flags which require the scene renderable lists to be updated
bool IsAnimationPossible() const override;
/**
+ * @copydoc Dali::Internal::SceneGraph::PropertyOwner::AddInitializeResetter
+ */
+ void AddInitializeResetter(ResetterManager& manager) const override;
+
+ /**
* Called by UpdateManager when the node is added.
* Creates a new transform component in the transform manager and initialize all the properties
* related to the transformation
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/math/math-utils.h>
+#include <dali/internal/update/common/property-resetter.h>
+#include <dali/internal/update/common/resetter-manager.h> ///< For AddInitializeResetter
+
namespace // unnamed namespace
{
const uint32_t UPDATE_COUNT = 2u; // Update projection or view matrix this many frames after a change
!mAspectRatio.IsClean();
}
+void Camera::AddInitializeResetter(ResetterManager& manager) const
+{
+ // Call base class initialize resetter
+ Node::AddInitializeResetter(manager);
+
+ OwnerPointer<SceneGraph::PropertyResetterBase> resetterFieldOvView = SceneGraph::BakerResetter::New(*this, mFieldOfView, SceneGraph::BakerResetter::Lifetime::BAKE);
+ OwnerPointer<SceneGraph::PropertyResetterBase> resetterOrthographicSize = SceneGraph::BakerResetter::New(*this, mOrthographicSize, SceneGraph::BakerResetter::Lifetime::BAKE);
+ OwnerPointer<SceneGraph::PropertyResetterBase> resetterAspectRatio = SceneGraph::BakerResetter::New(*this, mAspectRatio, SceneGraph::BakerResetter::Lifetime::BAKE);
+ manager.AddPropertyResetter(resetterFieldOvView);
+ manager.AddPropertyResetter(resetterOrthographicSize);
+ manager.AddPropertyResetter(resetterAspectRatio);
+}
+
uint32_t Camera::UpdateViewMatrix(BufferIndex updateBufferIndex)
{
uint32_t retval(mUpdateViewFlag);
*/
bool IsProjectionMatrixAnimated() const;
+public:
+ /**
+ * @copydoc Dali::Internal::SceneGraph::PropertyOwner::AddInitializeResetter
+ */
+ void AddInitializeResetter(ResetterManager& manager) const override;
+
private:
/**
* Constructor
// INTERNAL INCLUDES
#include <dali/internal/common/memory-pool-object-allocator.h>
+#include <dali/internal/update/common/resetter-manager.h> ///< For AddInitializeResetter
namespace //Unnamed namespace
{
RenderTaskList::RenderTaskList()
: mNotificationObject(nullptr),
+ mResetterManager(nullptr),
mRenderMessageDispatcher(nullptr),
mOverlayRenderTask(nullptr)
{
GetRenderTaskListMemoryPool().FreeThreadSafe(static_cast<RenderTaskList*>(ptr));
}
-void RenderTaskList::SetRenderMessageDispatcher(RenderMessageDispatcher* renderMessageDispatcher)
+void RenderTaskList::Initialize(ResetterManager& resetterManager, RenderMessageDispatcher& renderMessageDispatcher)
{
- mRenderMessageDispatcher = renderMessageDispatcher;
+ mResetterManager = &resetterManager;
+ mRenderMessageDispatcher = &renderMessageDispatcher;
}
void RenderTaskList::AddTask(OwnerPointer<RenderTask>& newTask)
DALI_ASSERT_DEBUG(newTask && "SceneGraph RenderTask is null");
DALI_ASSERT_DEBUG(mRenderMessageDispatcher != NULL && "RenderMessageDispatcher is null");
- newTask->Initialize(*mRenderMessageDispatcher);
+ newTask->Initialize(*mResetterManager, *mRenderMessageDispatcher);
if(mOverlayRenderTask && mRenderTasks[mRenderTasks.Size() - 1] == mOverlayRenderTask)
{
#define DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
{
class RenderMessageDispatcher;
class RenderTask;
+class ResetterManager;
/**
* An ordered list of render-tasks.
void operator delete(void* ptr);
/**
- * Set the renderMessageDispatcher to send message.
+ * Set the resetterManager and renderMessageDispatcher to send message.
+ * @param[in] resetterManager to send resetter
* @param[in] renderMessageDispatcher The renderMessageDispatcher to send messages.
*/
- void SetRenderMessageDispatcher(RenderMessageDispatcher* renderMessageDispatcher);
+ void Initialize(ResetterManager& resetterManager, RenderMessageDispatcher& renderMessageDispatcher);
/**
* Add a new RenderTask to the list.
private:
CompleteNotificationInterface* mNotificationObject; ///< object to pass in to the complete notification
+ ResetterManager* mResetterManager; ///< for sending bake resetter if rendertask initalized
RenderMessageDispatcher* mRenderMessageDispatcher; ///< for sending messages to render thread
RenderTaskContainer mRenderTasks; ///< A container of owned RenderTasks
RenderTask* mOverlayRenderTask; ///< OverlayRenderTask.
#include <dali/internal/update/nodes/node.h>
#include <dali/public-api/math/matrix.h>
+#include <dali/internal/update/common/property-resetter.h>
+#include <dali/internal/update/common/resetter-manager.h> ///< For AddInitializeResetter
+
#include <dali/internal/update/render-tasks/scene-graph-render-task-debug.h>
namespace Dali
}
}
-void RenderTask::Initialize(RenderMessageDispatcher& renderMessageDispatcher)
+void RenderTask::Initialize(ResetterManager& resetterManager, RenderMessageDispatcher& renderMessageDispatcher)
{
+ mResetterManager = &resetterManager;
mRenderMessageDispatcher = &renderMessageDispatcher;
}
}
}
+void RenderTask::AddInitializeResetter(ResetterManager& manager) const
+{
+ OwnerPointer<SceneGraph::PropertyResetterBase> resetterViewportPosition = SceneGraph::BakerResetter::New(*this, mViewportPosition, SceneGraph::BakerResetter::Lifetime::BAKE);
+ OwnerPointer<SceneGraph::PropertyResetterBase> resetterViewportSize = SceneGraph::BakerResetter::New(*this, mViewportSize, SceneGraph::BakerResetter::Lifetime::BAKE);
+ OwnerPointer<SceneGraph::PropertyResetterBase> resetterClearColor = SceneGraph::BakerResetter::New(*this, mClearColor, SceneGraph::BakerResetter::Lifetime::BAKE);
+ manager.AddPropertyResetter(resetterViewportPosition);
+ manager.AddPropertyResetter(resetterViewportSize);
+ manager.AddPropertyResetter(resetterClearColor);
+}
+
RenderTask::RenderTask()
: mViewportPosition(Vector2::ZERO),
mViewportSize(Vector2::ZERO),
mClearColor(Dali::RenderTask::DEFAULT_CLEAR_COLOR),
+ mResetterManager(nullptr),
mRenderMessageDispatcher(nullptr),
mRenderSyncTracker(nullptr),
mSourceNode(nullptr),
void RenderTask::SetActiveStatus()
{
+ bool oldActive = mActive;
+
// must have a source and camera both connected to scene
mActive = (mSourceNode && mSourceNode->ConnectedToScene() &&
mCameraNode && mCameraNode->ConnectedToScene() && mCamera);
TASK_LOG_FMT(Debug::General, " Source node(%x) active %d. Frame counter: %d\n", mSourceNode, mSourceNode && mSourceNode->ConnectedToScene(), mFrameCounter);
TASK_LOG_FMT(Debug::General, " Camera node(%x) active %d\n", mCameraNode, mCameraNode && mCameraNode->ConnectedToScene());
+
+ if(!oldActive && mActive)
+ {
+ // Send resetter only if newly activated
+ AddInitializeResetter(*mResetterManager);
+ }
}
} // namespace SceneGraph
class Camera;
class RenderInstruction;
class RenderMessageDispatcher;
+class ResetterManager;
/**
* RenderTasks describe how the Dali scene should be rendered.
/**
* Initialize the render task. Called in update thread
+ * @param[in] resetterManager to send resetter
* @param[in] renderMessageDispatcher to send messages to render thread
*/
- void Initialize(RenderMessageDispatcher& renderMessageDispatcher);
+ void Initialize(ResetterManager& resetterManager, RenderMessageDispatcher& renderMessageDispatcher);
/**
* Set the nodes to be rendered.
*/
void PropertyOwnerDestroyed(PropertyOwner& owner) override;
+public:
+ /**
+ * @copydoc Dali::Internal::SceneGraph::PropertyOwner::AddInitializeResetter
+ */
+ void AddInitializeResetter(ResetterManager& manager) const override;
+
private:
void SetActiveStatus();
AnimatableProperty<Vector4> mClearColor; ///< clearColor
private:
+ ResetterManager* mResetterManager;
RenderMessageDispatcher* mRenderMessageDispatcher;
Render::RenderTracker* mRenderSyncTracker;
Node* mSourceNode;
*/
// CLASS HEADER
-#include "scene-graph-renderer.h"
+#include <dali/internal/update/rendering/scene-graph-renderer.h>
// INTERNAL INCLUDES
#include <dali/internal/common/blending-options.h>
#include <dali/internal/update/nodes/node.h>
#include <dali/internal/update/rendering/scene-graph-texture-set.h>
+#include <dali/internal/update/common/property-resetter.h>
+#include <dali/internal/update/common/resetter-manager.h> ///< For AddInitializeResetter
+
#include <dali/integration-api/debug.h>
namespace Dali
bool Renderer::PrepareRender(BufferIndex updateBufferIndex)
{
- bool rendererUpdated = mResendFlag || mRenderingBehavior == DevelRenderer::Rendering::CONTINUOUSLY || mUpdateDecay > 0;
+ bool rendererUpdated = mDirtyFlag || mResendFlag || mRenderingBehavior == DevelRenderer::Rendering::CONTINUOUSLY || mUpdateDecay > 0;
auto shaderMapChangeCounter = mShader ? mShader->GetUniformMap().GetChangeCounter() : 0u;
bool shaderMapChanged = mShader && (mShaderMapChangeCounter != shaderMapChangeCounter);
if(shaderMapChanged)
DALI_ASSERT_DEBUG(geometry != NULL && "Geometry pointer is NULL");
mGeometry = geometry;
+ mDirtyFlag = true;
if(mRenderer)
{
mResendFlag |= RESEND_GEOMETRY;
void Renderer::SetRenderingBehavior(DevelRenderer::Rendering::Type renderingBehavior)
{
mRenderingBehavior = renderingBehavior;
+
+ mDirtyFlag = true;
SetUpdated(true);
}
SetUpdated(false);
}
+void Renderer::ResetToBaseValues(BufferIndex updateBufferIndex)
+{
+ mOpacity.ResetToBaseValue(updateBufferIndex);
+ if(mVisualProperties)
+ {
+ mVisualProperties->ResetToBaseValues(updateBufferIndex);
+ }
+}
+
+void Renderer::MarkAsDirty()
+{
+ mOpacity.MarkAsDirty();
+ if(mVisualProperties)
+ {
+ mVisualProperties->MarkAsDirty();
+ }
+}
+
uint32_t Renderer::GetMemoryPoolCapacity()
{
return GetRendererMemoryPool().GetCapacity();
mRegenerateUniformMap = true; // Should remain true until this renderer is added to a RenderList.
}
+void Renderer::AddInitializeResetter(ResetterManager& manager) const
+{
+ manager.AddRendererResetter(*this);
+}
+
const CollectedUniformMap& Renderer::GetCollectedUniformMap() const
{
return mCollectedUniformMap;
void ResetDirtyFlag();
/**
+ * @brief Reset to base values of all animatable properties.
+ *
+ * @param[in] updateBufferIndex the current buffer index
+ */
+ void ResetToBaseValues(BufferIndex updateBufferIndex);
+
+ /**
+ * @brief Mark all animatable properties as dirty.
+ */
+ void MarkAsDirty();
+
+ /**
* Get the capacity of the memory pools
* @return the capacity of the memory pools
*/
*/
virtual void ResetDefaultProperties(BufferIndex updateBufferIndex){};
+ /**
+ * @copydoc Dali::Internal::SceneGraph::PropertyOwner::AddInitializeResetter
+ */
+ void AddInitializeResetter(ResetterManager& manager) const override;
+
public: // From UniformMapDataProvider
/**
* @copydoc UniformMapDataProvider::GetCollectedUniformMap
// INTERNAL HEADERS
#include <dali/internal/common/internal-constants.h>
#include <dali/internal/common/memory-pool-object-allocator.h>
+#include <dali/internal/render/common/render-manager.h>
#include <dali/internal/render/renderers/render-texture.h>
+#include <dali/internal/update/controllers/render-message-dispatcher.h>
#include <dali/internal/update/rendering/scene-graph-renderer.h>
namespace //Unnamed namespace
if(index < static_cast<uint32_t>(mTextures.Size()))
{
- mTextures[index]->SetUpdated(true);
+ // Send a message to the RenderManagerReserveMessageSlot
+ using DerivedType = MessageValue1<RenderManager, Render::TextureKey>;
+
+ // Reserve some memory inside the render queue
+ uint32_t* slot = mRenderMessageDispatcher->ReserveMessageSlot(sizeof(DerivedType));
+
+ // Construct message in the render queue memory; note that delete should not be called on the return value
+ new(slot) DerivedType(&mRenderMessageDispatcher->GetRenderManager(), &RenderManager::SetTextureUpdated, mTextures[index]);
}
}
if(texture)
{
mHasAlpha |= texture->HasAlphaChannel();
- texture->SetUpdated(true);
+
+ // Send a message to the RenderManagerReserveMessageSlot
+ using DerivedType = MessageValue1<RenderManager, Render::TextureKey>;
+
+ // Reserve some memory inside the render queue
+ uint32_t* slot = mRenderMessageDispatcher->ReserveMessageSlot(sizeof(DerivedType));
+
+ // Construct message in the render queue memory; note that delete should not be called on the return value
+ new(slot) DerivedType(&mRenderMessageDispatcher->GetRenderManager(), &RenderManager::SetTextureUpdated, texture);
}
}
return mHasAlpha;
}
+void TextureSet::SetRenderMessageDispatcher(RenderMessageDispatcher* renderMessageDispatcher)
+{
+ mRenderMessageDispatcher = renderMessageDispatcher;
+}
+
uint32_t TextureSet::GetMemoryPoolCapacity()
{
return GetTextureSetMemoryPool().GetCapacity();
namespace SceneGraph
{
class Renderer;
+class RenderMessageDispatcher;
class TextureSet
{
}
/**
+ * Set the renderMessageDispatcher to send message.
+ * @param[in] renderMessageDispatcher The renderMessageDispatcher to send messages.
+ */
+ void SetRenderMessageDispatcher(RenderMessageDispatcher* renderMessageDispatcher);
+
+ /**
* Get the capacity of the memory pools
* @return the capacity of the memory pools
*/
TextureSet();
private:
- Vector<Render::Sampler*> mSamplers; ///< List of samplers used by each texture. Not owned
- Vector<Render::TextureKey> mTextures; ///< List of Textures. Not owned
- bool mHasAlpha; ///< if any of the textures has an alpha channel
+ Vector<Render::Sampler*> mSamplers; ///< List of samplers used by each texture. Not owned
+ Vector<Render::TextureKey> mTextures; ///< List of Textures. Not owned
+ RenderMessageDispatcher* mRenderMessageDispatcher{nullptr}; ///< for sending messages to render thread. Not owned
+ bool mHasAlpha; ///< if any of the textures has an alpha channel
};
inline void SetTextureMessage(EventThreadServices& eventThreadServices, const TextureSet& textureSet, uint32_t index, const Render::TextureKey& textureKey)
--- /dev/null
+/*
+ * Copyright (c) 2023 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// CLASS HEADER
+#include <dali/internal/update/rendering/scene-graph-visual-renderer.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/update/common/property-resetter.h>
+#include <dali/internal/update/rendering/scene-graph-renderer.h>
+
+namespace Dali::Internal::SceneGraph::VisualRenderer
+{
+void AnimatableVisualProperties::ResetToBaseValues(BufferIndex updateBufferIndex)
+{
+ mTransformOffset.ResetToBaseValue(updateBufferIndex);
+ mTransformSize.ResetToBaseValue(updateBufferIndex);
+ mTransformOrigin.ResetToBaseValue(updateBufferIndex);
+ mTransformAnchorPoint.ResetToBaseValue(updateBufferIndex);
+ mTransformOffsetSizeMode.ResetToBaseValue(updateBufferIndex);
+ mExtraSize.ResetToBaseValue(updateBufferIndex);
+ mMixColor.ResetToBaseValue(updateBufferIndex);
+ mPreMultipliedAlpha.ResetToBaseValue(updateBufferIndex);
+ if(mExtendedProperties)
+ {
+ auto* decoratedVisualProperties = static_cast<VisualRenderer::AnimatableDecoratedVisualProperties*>(mExtendedProperties);
+ decoratedVisualProperties->ResetToBaseValues(updateBufferIndex);
+ }
+}
+
+void AnimatableVisualProperties::MarkAsDirty()
+{
+ mTransformOffset.MarkAsDirty();
+ mTransformSize.MarkAsDirty();
+ mTransformOrigin.MarkAsDirty();
+ mTransformAnchorPoint.MarkAsDirty();
+ mTransformOffsetSizeMode.MarkAsDirty();
+ mExtraSize.MarkAsDirty();
+ mMixColor.MarkAsDirty();
+ mPreMultipliedAlpha.MarkAsDirty();
+ if(mExtendedProperties)
+ {
+ auto* decoratedVisualProperties = static_cast<VisualRenderer::AnimatableDecoratedVisualProperties*>(mExtendedProperties);
+ decoratedVisualProperties->MarkAsDirty();
+ }
+}
+
+void AnimatableDecoratedVisualProperties::ResetToBaseValues(BufferIndex updateBufferIndex)
+{
+ mCornerRadius.ResetToBaseValue(updateBufferIndex);
+ mCornerRadiusPolicy.ResetToBaseValue(updateBufferIndex);
+ mBorderlineWidth.ResetToBaseValue(updateBufferIndex);
+ mBorderlineColor.ResetToBaseValue(updateBufferIndex);
+ mBorderlineOffset.ResetToBaseValue(updateBufferIndex);
+ mBlurRadius.ResetToBaseValue(updateBufferIndex);
+}
+
+void AnimatableDecoratedVisualProperties::MarkAsDirty()
+{
+ mCornerRadius.MarkAsDirty();
+ mCornerRadiusPolicy.MarkAsDirty();
+ mBorderlineWidth.MarkAsDirty();
+ mBorderlineColor.MarkAsDirty();
+ mBorderlineOffset.MarkAsDirty();
+ mBlurRadius.MarkAsDirty();
+}
+
+} // namespace Dali::Internal::SceneGraph::VisualRenderer
\ No newline at end of file
}
}
+public: // Public API
+ /**
+ * @copydoc Dali::Internal::SceneGraph::Renderer::ResetToBaseValues
+ */
+ void ResetToBaseValues(BufferIndex updateBufferIndex);
+
+ /**
+ * @copydoc Dali::Internal::SceneGraph::Renderer::MarkAsDirty
+ */
+ void MarkAsDirty();
+
+public:
/**
* @brief Cached coefficient value when we calculate visual transformed update size.
* It can reduce complexity of calculate the vertex position.
{
}
+public: // Public API
// Delete function of AnimatableDecoratedVisualProperties* converted as void*
static void DeleteFunction(void* data)
{
}
/**
+ * @copydoc Dali::Internal::SceneGraph::Renderer::ResetToBaseValues
+ */
+ void ResetToBaseValues(BufferIndex updateBufferIndex);
+
+ /**
+ * @copydoc Dali::Internal::SceneGraph::Renderer::MarkAsDirty
+ */
+ void MarkAsDirty();
+
+public:
+ /**
* @brief Cached coefficient value when we calculate visual transformed update size.
* It can reduce complexity of calculate the vertex position.
*
{
const uint32_t CORE_MAJOR_VERSION = 2;
const uint32_t CORE_MINOR_VERSION = 2;
-const uint32_t CORE_MICRO_VERSION = 18;
+const uint32_t CORE_MICRO_VERSION = 19;
const char* const CORE_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali2
Summary: DALi 3D Engine
-Version: 2.2.18
+Version: 2.2.19
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT