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
*/
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;
void UpdateManager::AddTextureSet(OwnerPointer<TextureSet>& textureSet)
{
+ textureSet->SetRenderMessageDispatcher(&mImpl->renderMessageDispatcher);
mImpl->textureSets.PushBack(textureSet.Release());
}
// 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)