X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Fcommon%2Frender-manager.h;h=400d1386d667fbcf94a5f7895ac4aae0863730e8;hb=e2ee93d144c63abb914c086281d09c40b213919f;hp=a807f9a774db0e44a637bb98e882c6bafdc5766b;hpb=503fbbc32fda46c316549f0a3788e376a59a3618;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/common/render-manager.h b/dali/internal/render/common/render-manager.h index a807f9a..400d138 100644 --- a/dali/internal/render/common/render-manager.h +++ b/dali/internal/render/common/render-manager.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_SCENE_GRAPH_RENDER_MANAGER_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 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. @@ -20,8 +20,10 @@ // INTERNAL INCLUDES #include -#include -#include +#include +#include +#include +#include namespace Dali { @@ -29,6 +31,7 @@ namespace Dali namespace Integration { class GlAbstraction; +class GlSyncAbstraction; class RenderStatus; } @@ -38,32 +41,42 @@ namespace Internal { class Context; class ProgramCache; +class ShaderSaver; -namespace SceneGraph +namespace Render { +class FrameBuffer; class Renderer; +struct Sampler; +class RenderTracker; +class Geometry; +class Texture; +} + +namespace SceneGraph +{ class RenderQueue; -class RenderMaterial; -class TextureCache; class RenderInstruction; class RenderInstructionContainer; -class RenderTracker; class Shader; +class PropertyBufferDataProvider; /** * RenderManager is responsible for rendering the result of the previous "update", which * is provided in a RenderCommand during UpdateManager::Update(). */ -class RenderManager : public PostProcessResourceDispatcher +class RenderManager { public: /** * Construct a new RenderManager. * @param[in] glAbstraction The GL abstraction used for rendering. - * @param[out] resourcePostProcessQueue A queue for sending rendered texture ids to the update-thread. + * @param[in] glSyncAbstraction The GL sync abstraction used fence sync creation/deletion. + * @param[out] resourcePostProcessQueue A queue for sending rendered texture ids to the update-thread.* */ - static RenderManager* New( Dali::Integration::GlAbstraction& glAbstraction, ResourcePostProcessList& resourcePostProcessQueue ); + static RenderManager* New( Integration::GlAbstraction& glAbstraction, + Integration::GlSyncAbstraction& glSyncAbstraction ); /** * Non-virtual destructor; not intended as a base class @@ -77,13 +90,6 @@ public: RenderQueue& GetRenderQueue(); /** - * Retrieve the texture cache. Messages should only be sent to this from the update thread, - * accessor methods should only be used from the render thread. - * @return The texture cache - */ - TextureCache& GetTextureCache(); - - /** * @copydoc Dali::Integration::Core::ContextCreated() */ void ContextCreated(); @@ -94,10 +100,12 @@ public: void ContextDestroyed(); /** - * Dispatch requests onto the postProcessResourcesQueue - * @param[in] request The request to dispatch + * Set the upstream interface for compiled shader binaries to be sent back to for eventual + * caching and saving. + * @param[in] upstream The abstract interface to send any received ShaderDatas onwards to.. + * @note This should be called during core initialisation if shader binaries are to be used. */ - virtual void DispatchPostProcessRequest(ResourcePostProcessRequest& request); + void SetShaderSaver( ShaderSaver& upstream ); /** * Retrieve the render instructions; these should be set during each "update" traversal. @@ -130,31 +138,162 @@ public: * @param[in] renderer The renderer to add. * @post renderer is owned by RenderManager */ - void AddRenderer( Renderer* renderer ); + void AddRenderer( OwnerPointer< Render::Renderer >& renderer ); /** * Remove a Renderer from the render manager. * @param[in] renderer The renderer to remove. * @post renderer is destroyed. */ - void RemoveRenderer( Renderer* renderer ); + void RemoveRenderer( Render::Renderer* renderer ); + + /** + * Add a sampler to the render manager. + * @param[in] sampler The sampler to add. + * @post sampler is owned by RenderManager + */ + void AddSampler( OwnerPointer< Render::Sampler >& sampler ); + + /** + * Remove a sampler from the render manager. + * @param[in] sampler The sampler to remove. + * @post sampler is destroyed. + */ + void RemoveSampler( Render::Sampler* sampler ); + + /** + * Set minification and magnification filter modes for a sampler + * @param[in] minFilterMode Filter mode to use when the texture is minificated + * @param[in] magFilterMode Filter mode to use when the texture is magnified + */ + void SetFilterMode( Render::Sampler* sampler, unsigned int minFilterMode, unsigned int magFilterMode ); + + /** + * Set wrapping mode for a sampler + * @param[in] rWrapMode Wrap mode in the z direction + * @param[in] uWrapMode Wrap mode in the x direction + * @param[in] vWrapMode Wrap mode in the y direction + */ + void SetWrapMode( Render::Sampler* sampler, unsigned int rWrapMode, unsigned int sWrapMode, unsigned int tWrapMode ); + + /** + * Add a property buffer to the render manager. + * @param[in] propertyBuffer The property buffer to add. + * @post propertBuffer is owned by RenderManager + */ + void AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertyBuffer ); + + /** + * Remove a property buffer from the render manager. + * @param[in] propertyBuffer The property buffer to remove. + * @post propertyBuffer is destroyed. + */ + void RemovePropertyBuffer( Render::PropertyBuffer* propertyBuffer ); + + /** + * Add a geometry to the render manager. + * @param[in] geometry The geometry to add. + * @post geometry is owned by RenderManager + */ + void AddGeometry( OwnerPointer< Render::Geometry >& geometry ); + + /** + * Remove a geometry from the render manager. + * @param[in] geometry The geometry to remove. + * @post geometry is destroyed. + */ + void RemoveGeometry( Render::Geometry* geometry ); + + /** + * Adds a property buffer to a geometry from the render manager. + * @param[in] geometry The geometry + * @param[in] propertyBuffer The property buffer to remove. + */ + void AttachVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer ); + + /** + * Remove a property buffer from a Render::Geometry from the render manager. + * @param[in] geometry The geometry + * @param[in] propertyBuffer The property buffer to remove. + * @post property buffer is destroyed. + */ + void RemoveVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer ); + + /** + * Sets the format of an existing property buffer + * @param[in] propertyBuffer The property buffer. + * @param[in] format The new format of the buffer + */ + void SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format ); + + /** + * Sets the data of an existing property buffer + * @param[in] propertyBuffer The property buffer. + * @param[in] data The new data of the buffer + * @param[in] size The new size of the buffer + */ + void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector >& data, size_t size ); + + /** + * Sets the data for the index buffer of an existing geometry + * @param[in] geometry The geometry + * @param[in] data A vector containing the indices + */ + void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector& data ); /** - * Adds a RenderMaterial to the render manager for MeshRenderers to use. - * The RenderManager takes ownership of the material - * @param[in] renderMaterial - * @post renderMaterial is owned by RenderManager + * Set the geometry type of an existing render geometry + * @param[in] geometry The render geometry + * @param[in] geometryType The new geometry type */ - void AddRenderMaterial( RenderMaterial* renderMaterial ); + void SetGeometryType( Render::Geometry* geometry, unsigned int geometryType ); /** - * Removes a RenderMaterial from the RenderManager - * RenderManager will destroy the material - * @pre renderManager owns the materail - * @param[in] renderMaterial - * @post renderMaterial is destroyed + * Adds a texture to the render manager + * @param[in] texture The texture to add */ - void RemoveRenderMaterial( RenderMaterial* renderMaterial ); + void AddTexture( OwnerPointer< Render::Texture >& texture ); + + /** + * Removes a texture from the render manager + * @param[in] texture The texture to remove + */ + void RemoveTexture( Render::Texture* texture ); + + /** + * Uploads data to an existing texture + * @param[in] texture The texture + * @param[in] pixelData The pixel data object + * @param[in] params The parameters for the upload + */ + void UploadTexture( Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params ); + + /** + * Generates mipmaps for a given texture + * @param[in] texture The texture + */ + void GenerateMipmaps( Render::Texture* texture ); + + /** + * Adds a framebuffer to the render manager + * @param[in] frameBuffer The framebuffer to add + */ + void AddFrameBuffer( Render::FrameBuffer* frameBuffer ); + + /** + * Removes a framebuffer from the render manager + * @param[in] frameBuffer The framebuffer to remove + */ + void RemoveFrameBuffer( Render::FrameBuffer* frameBuffer ); + + /** + * Attach a texture as color output to an existing FrameBuffer + * @param[in] frameBuffer The FrameBuffer + * @param[in] texture The texture that will be used as output when rendering + * @param[in] mipmapLevel The mipmap of the texture to be attached + * @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures + */ + void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer ); /** * Adds a render tracker to the RenderManager. RenderManager takes ownership of the @@ -162,19 +301,13 @@ public: * object, usually an offscreen render task. * @param[in] renderTracker The render tracker */ - void AddRenderTracker( RenderTracker* renderTracker ); + void AddRenderTracker( Render::RenderTracker* renderTracker ); /** * Removes a render tracker from the RenderManager. * @param[in] renderTracker The render tracker to remove. */ - void RemoveRenderTracker( RenderTracker* renderTracker ); - - /** - * Set the default shader that is to be used in absence of custom shader - * @param[in] shader that is the default one - */ - void SetDefaultShader( Shader* shader ); + void RemoveRenderTracker( Render::RenderTracker* renderTracker ); /** * returns the Program controller for sending program messages @@ -186,20 +319,17 @@ public: /** * Renders the results of the previous "update" traversal. - * @param[out] status contains the flag that indicates if render instructions exist - * @return true if a further update is required + * @param[out] status contains the rendering flags. */ - bool Render( Integration::RenderStatus& status ); + void Render( Integration::RenderStatus& status ); private: /** * Helper to process a single RenderInstruction. * @param[in] instruction A description of the rendering operation. - * @param[in] defaultShader default shader to use. - * @param[in] elapsedTime from previous render. */ - void DoRender( RenderInstruction& instruction, Shader& defaultShader, float elapsedTime ); + void DoRender( RenderInstruction& instruction ); private: