X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Frenderers%2Frender-geometry.h;h=2f04c973133649a9ca9019ba24804ed03fef1eda;hb=a513234144a775134eff3a24144983a5e374d1d5;hp=c8ac1e5434946f779a77a41fe46206d62149f28d;hpb=e5f24bbdefd82ab32d7530dc44ffc321e5b42d17;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/renderers/render-geometry.h b/dali/internal/render/renderers/render-geometry.h index c8ac1e5..2f04c97 100644 --- a/dali/internal/render/renderers/render-geometry.h +++ b/dali/internal/render/renderers/render-geometry.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_RENDER_GEOMETRY_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. @@ -18,20 +18,18 @@ */ // INTERNAL INCLUDES -#include -#include #include -#include +#include +#include #include #include -#include -#include +#include +#include namespace Dali { namespace Internal { -class Context; class Program; class GpuBuffer; @@ -47,7 +45,11 @@ class VertexBuffer; class Geometry { public: - typedef Dali::Geometry::Type Type; + using Type = Dali::Geometry::Type; + using IndexType = Dali::Graphics::Format; + + using Uint16ContainerType = Dali::Vector; + using Uint32ContainerType = Dali::Vector; Geometry(); @@ -57,40 +59,34 @@ public: ~Geometry(); /** - * Called on Gl Context created - */ - void GlContextCreated( Context& context ); - - /** - * Called on Gl Context destroyed. + * Adds a property buffer to the geometry + * @param[in] dataProvider The VertexBuffer data provider */ - void GlContextDestroyed(); + void AddVertexBuffer(Render::VertexBuffer* vertexBuffer); /** - * Adds a property buffer to the geometry - * @param[in] dataProvider The VertexBuffer data provider + * Set the data for the index buffer to be used by the geometry + * @param[in] indices A vector containing the indices */ - void AddVertexBuffer( Render::VertexBuffer* vertexBuffer ); + void SetIndexBuffer(Uint16ContainerType& indices); /** * Set the data for the index buffer to be used by the geometry * @param[in] indices A vector containing the indices */ - void SetIndexBuffer( Dali::Vector& indices ); + void SetIndexBuffer(Uint32ContainerType& indices); /** * Removes a VertexBuffer from the geometry * @param[in] vertexBuffer The property buffer to be removed */ - void RemoveVertexBuffer( const Render::VertexBuffer* vertexBuffer ); + void RemoveVertexBuffer(const Render::VertexBuffer* vertexBuffer); /** - * Gets the attribute locations on the shader for the attributes defined in the geometry RenderBuffers - * @param[out] attributeLocation The vector where the attributes locations will be stored - * @param[in] program The program - * @param[in] bufferIndex The current buffer index + * Get the vertex buffers + * @return the list of vertex buffers */ - void GetAttributeLocationFromProgram( Vector& attributeLocation, Program& program, BufferIndex bufferIndex ) const; + [[nodiscard]] const Vector& GetVertexBuffers() const; /** * Called from RenderManager to notify the geometry that current rendering pass has finished. @@ -101,7 +97,7 @@ public: * Check if the attributes for the geometry have changed * @return True if vertex buffers have been added or removed since last frame, false otherwise */ - bool AttributesChanged() const + [[maybe_unused]] [[nodiscard]] bool AttributesChanged() const { return mAttributesChanged; } @@ -110,39 +106,51 @@ public: * Sets the geometry type * @param[in] type The new geometry type */ - void SetType( Type type ) + void SetType(Type type) { mGeometryType = type; } /** + * @return the topology of this geometry + */ + [[nodiscard]] Graphics::PrimitiveTopology GetTopology() const; + + /** * Upload the geometry if it has changed - * @param[in] context The GL context */ - void Upload( Context& context ); + void Upload(Graphics::Controller& graphicsController); /** - * Set up the attributes and perform the Draw call corresponding to the geometry type - * @param[in] context The GL context - * @param[in] bufferIndex The current buffer index - * @param[in] attributeLocation The location for the attributes in the shader + * Set up the attributes and perform the Draw call corresponding to the geometry type. + * + * @param[in] graphicsController The graphics controller + * @param[in,out] commandBuffer The current command buffer queue * @param[in] elementBufferOffset The index of first element to draw if index buffer bound * @param[in] elementBufferCount Number of elements to draw if index buffer bound, uses whole buffer when 0 + * @return true if the draw command was issued, false otherwise */ - void Draw(Context& context, - BufferIndex bufferIndex, - Vector& attributeLocation, - uint32_t elementBufferOffset, - uint32_t elementBufferCount ); + bool Draw(Graphics::Controller& graphicsController, + Graphics::CommandBuffer& commandBuffer, + uint32_t elementBufferOffset, + uint32_t elementBufferCount); -private: + /** + * @brief Set up the attributes bind commaneds + * + * @param[in,out] commandBuffer The current command buffer queue + * @return true if the bind command was issued, false otherwise + */ + bool BindVertexAttributes(Graphics::CommandBuffer& commandBuffer); +private: // VertexBuffers - Vector< Render::VertexBuffer* > mVertexBuffers; + Vector mVertexBuffers; - Dali::Vector< uint16_t > mIndices; - OwnerPointer< GpuBuffer > mIndexBuffer; - Type mGeometryType; + Uint16ContainerType mIndices; + OwnerPointer mIndexBuffer; + IndexType mIndexType; + Type mGeometryType; // Booleans bool mIndicesChanged : 1;