2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiEffects_RendererGraphicsEngineRenderBufferCache.h
20 * @brief Class for buffer caching
24 #ifndef _FUI_EFFECTS_INTERNAL_RENDERER_GRAPHICS_ENGINE_RENDER_BUFFER_CACHE_H_
25 #define _FUI_EFFECTS_INTERNAL_RENDERER_GRAPHICS_ENGINE_RENDER_BUFFER_CACHE_H_
27 #include <renderer/engine-model/FUiEffects_RendererEngineModelForwardDeclaration.h>
28 #include <renderer/engine-model/FUiEffects_RendererEngineModelBuffer.h>
29 #include <renderer/system/FUiEffects_RendererSystemSmartPtr.h>
31 #include <renderer/graphics-engine/FUiEffects_RendererGraphicsEngineOpenGLImplementation.h>
32 #include <renderer/graphics-engine/FUiEffects_RendererGraphicsEngineRenderCache.h>
34 namespace Tizen { namespace Ui { namespace Effects { namespace _Renderer { namespace GraphicsEngine
43 IBufferCache(Render* pRender);
44 virtual ~IBufferCache(void);
46 static GLenum GetGlUsage(Tizen::Ui::Effects::_Renderer::EngineModel::SolidBufferStrategy::BufferUsage::Value usage);
47 static GLenum GetGlDataType(Tizen::Ui::Effects::_Renderer::EngineModel::TypedBufferStrategy::DataType::Value dataType);
48 static GLsizei GetGlDataTypeSize(Tizen::Ui::Effects::_Renderer::EngineModel::TypedBufferStrategy::DataType::Value dataType);
50 virtual void DropCache(void);
51 virtual void DestroyCache(void);
58 class IndexBufferCache:
62 IndexBufferCache(Render* pRender, Tizen::Ui::Effects::_Renderer::EngineModel::IndexBuffer* pBuffer);
63 virtual ~IndexBufferCache(void);
65 static GLenum GetGlPrimitiveType(Tizen::Ui::Effects::_Renderer::EngineModel::IndexBuffer::PrimitiveType::Value primitiveType);
67 virtual void Die(void);
68 virtual void Validate(Render*);
69 virtual void DestroyCache(void);
71 void DrawElements(Render*);
74 GLsizei __elementsCount;
75 GLenum __primitiveType;
76 Tizen::Ui::Effects::_Renderer::EngineModel::IndexBuffer* __pBuffer;
79 typedef Tizen::Ui::Effects::_Renderer::System::SmartPtr<IndexBufferCache> IndexBufferCachePtr;
81 class VertexBufferCache:
85 VertexBufferCache(Render* pRender): IBufferCache(pRender) {}
86 virtual ~VertexBufferCache(void) {}
88 virtual void BindToAttrib(Render*, GLuint index) = 0;
89 virtual void BindAsVertices(Render*) = 0;
90 virtual void BindAsColor(Render*) = 0;
91 virtual void BindAsTexCoord(Render*, GLuint stage) = 0;
94 typedef Tizen::Ui::Effects::_Renderer::System::SmartPtr<VertexBufferCache> VertexBufferCachePtr;
96 class SolidVertexBufferCache:
97 public VertexBufferCache
100 SolidVertexBufferCache(Render *pRender, Tizen::Ui::Effects::_Renderer::EngineModel::VertexBuffer* pBuffer);
101 virtual ~SolidVertexBufferCache(void);
103 virtual void Die(void);
104 virtual void Validate(Render*);
105 virtual void DestroyCache();
107 void BindToAttrib(Render*, GLuint index);
108 void BindAsVertices(Render*);
109 void BindAsColor(Render*);
110 void BindAsTexCoord(Render*, GLuint stage);
113 GLint __componentsPerElement;
114 Tizen::Ui::Effects::_Renderer::EngineModel::VertexBuffer* __pBuffer;
117 typedef Tizen::Ui::Effects::_Renderer::System::SmartPtr<SolidVertexBufferCache> SolidVertexBufferCachePtr;
119 class PartVertexBufferCache:
120 public VertexBufferCache
123 PartVertexBufferCache(Render *pRender, Tizen::Ui::Effects::_Renderer::EngineModel::PartVertexBuffer* pBuffer);
124 virtual ~PartVertexBufferCache(void);
126 virtual void Die(void);
127 virtual void Validate(Render*);
128 virtual void DestroyCache(void);
130 void BindToAttrib(Render*, GLuint index);
131 void BindAsVertices(Render*);
132 void BindAsColor(Render*);
133 void BindAsTexCoord(Render*, GLuint stage);
136 GLint __componentsPerElement;
139 Tizen::Ui::Effects::_Renderer::EngineModel::PartVertexBuffer* __pBuffer;
142 typedef Tizen::Ui::Effects::_Renderer::System::SmartPtr<PartVertexBufferCache> PartVertexBufferCachePtr;
144 class CompositeVertexBufferCache:
148 CompositeVertexBufferCache(Render *pRender, Tizen::Ui::Effects::_Renderer::EngineModel::CompositeVertexBuffer* pBuffer);
149 virtual ~CompositeVertexBufferCache(void);
151 virtual void Die(void);
152 virtual void Validate(Render*);
153 virtual void DestroyCache(void);
158 Tizen::Ui::Effects::_Renderer::EngineModel::CompositeVertexBuffer* __pBuffer;
161 typedef Tizen::Ui::Effects::_Renderer::System::SmartPtr<CompositeVertexBufferCache> CompositeVertexBufferCachePtr;
163 }}}}} // Tizen::Ui::Effects::_Renderer::GraphicsEngine
165 #endif //_FUI_EFFECTS_INTERNAL_RENDERER_GRAPHICS_ENGINE_RENDER_BUFFER_CACHE_H_