18 #ifndef ION_GFX_RENDERER_H_
19 #define ION_GFX_RENDERER_H_
24 #include "base/integral_types.h"
97 static const int kNumFlags = kSaveVertexArray + 1;
98 typedef std::bitset<kNumFlags>
Flags;
111 static const int kNumResourceTypes = kTexture + 1;
134 static const Flags& AllFlags();
135 static const Flags& AllClearFlags();
136 static const Flags& AllProcessFlags();
137 static const Flags& AllRestoreFlags();
138 static const Flags& AllSaveFlags();
174 template <
typename T>
175 void BindResource(
T* holder);
193 template <
typename T>
194 void CreateOrUpdateResource(
T* holder);
198 void CreateOrUpdateResources(
const NodePtr& node);
201 void CreateOrUpdateShapeResources(
const ShapePtr& shape);
207 template <
typename T>
208 void RequestForcedUpdate(
T* holder);
211 void RequestForcedUpdates(
const NodePtr& node);
214 void RequestForcedShapeUpdates(
const ShapePtr& shape);
227 template <
typename T>
228 void CreateResourceWithExternallyManagedId(
T* holder, uint32 gl_id);
234 void SetInitialUniformValue(
const Uniform& u);
244 virtual void DrawScene(
const NodePtr& node);
247 void ProcessResourceInfoRequests();
253 template <
typename T>
254 uint32 GetResourceGlId(
T* holder);
285 BufferObjectDataMapMode mode);
292 BufferObjectDataMapMode mode,
302 return default_shader_;
312 void UpdateStateFromOpenGL(
int window_width,
int window_height);
317 void UpdateStateFromStateTable(
const StateTablePtr& state_to_clear);
326 void UpdateDefaultFramebufferFromOpenGL();
334 void ClearCachedBindings();
345 void PushDebugMarker(
const std::string& marker);
349 void PopDebugMarker();
352 template <
typename HolderType>
353 void ClearResources(
const HolderType* holder);
356 void ClearAllResources();
360 void ReleaseResources();
364 void ClearTypedResources(ResourceType
type);
372 static void DestroyCurrentStateCache();
377 size_t GetGpuMemoryUsage(ResourceType
type)
const;
386 template <
int NumModifiedBits>
class Resource;
387 class BufferResource;
388 class FramebufferResource;
389 class ResourceBinder;
391 class SamplerResource;
393 class ShaderInputRegistryResource;
394 class ShaderProgramResource;
395 class ShaderResource;
396 class TextureResource;
397 class VertexArrayResource;
398 class VertexArrayEmulatorResource;
401 template <
typename T>
402 struct HolderToResource;
409 static ResourceBinderMap& GetResourceBinderMap();
410 ResourceBinder* GetOrCreateInternalResourceBinder(
int line)
const;
411 ResourceBinder* GetInternalResourceBinder(
size_t* visual_id)
const;
415 static void SetResourceHolderBit(
const ResourceHolder* holder,
int bit);
421 std::unique_ptr<ResourceManager> resource_manager_;
433 #endif // ION_GFX_RENDERER_H_
Format
Supported image formats.
Flag
The below flags determine what operations will be performed in a call to DrawScene().
This class can be used in place of std::unordered_map to allow an Ion Allocator to be used for memory...
const Flags & GetFlags() const
Returns/sets rendering flags.
const ShaderProgramPtr & GetDefaultShaderProgram() const
Returns the default shader program that the Renderer uses if no other shader program is set...
Range< 1, int32 > Range1i
Process any outstanding requests for information about internal resources that have been made through...
ResourceType
The types of resources created by the renderer.
Whether to query OpenGL for current states and save them, which can be restored using the above kRest...
Range< 2, int32 > Range2i
Range< 1, uint32 > Range1ui
Whether to restore certain GL state types when drawing is finished.
Thread-safe abstract base class.
void SetFlags(const Flags &flags)
std::bitset< kNumFlags > Flags
void ClearFlags(const Flags &flags)
Release any internal resources that have been marked for destruction, including OpenGL objects...
BufferObjectDataMapMode
The possible ways a BufferObject's data can be mapped.
Whether to clear (set to 0) certain GL objects when drawing is finished.
A ResourceManager is an interface for getting information about a Renderer's internal resources...
Opaque class that sets up an offscreen OpenGL context/surface/visual in a platform-specific way to al...
void ClearFlag(Flag flag)
A StateTable represents a collection of graphical state items that affect OpenGL rendering.
base::ReferentPtr< Renderer >::Type RendererPtr
Convenience typedef for shared pointer to a Renderer.
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...
The Renderer class handles rendering ION scene graphs using OpenGL.
ResourceHolder is an internal base class for objects that hold resources managed by an outside entity...