18 #ifndef ION_GFX_RESOURCEMANAGER_H_
19 #define ION_GFX_RESOURCEMANAGER_H_
38 class FramebufferObject;
39 class GraphicsManager;
132 PlatformInfo() : major_version(-1), minor_version(-1), glsl_version(-1) {}
139 GLfloat aliased_line_width_range[2];
140 GLfloat aliased_point_size_range[2];
159 GLint max_viewport_dims[2];
178 : images(base::AllocationManager::GetDefaultAllocatorForLifetime(
187 typedef std::function<void(const std::vector<T>& infos)>
Type;
200 return graphics_manager_;
208 template <
typename HolderType,
typename InfoType>
214 GetResourceRequestVector<HolderType, InfoType>()->push_back(
221 template <
typename HolderType,
typename InfoType>
225 GetResourceRequestVector<HolderType, InfoType>()->push_back(
232 void RequestPlatformInfo(
const InfoCallback<PlatformInfo>::Type& callback);
240 void RequestTextureImage(
241 GLuint
id,
const InfoCallback<TextureImageInfo>::Type& callback);
245 template <
typename InfoType>
250 :
id(id_in), callback(callback_in) {}
256 template <
typename HolderType,
typename InfoType>
261 : holder(holder_in), callback(callback_in) {}
274 template <
typename HolderType,
typename InfoType>
275 std::vector<ResourceRequest<HolderType, InfoType> >*
276 GetResourceRequestVector();
280 template <
typename InfoType>
281 std::vector<DataRequest<InfoType> >* GetDataRequestVector();
287 template <
typename InfoType>
288 void FillInfoFromOpenGL(InfoType* info);
297 std::vector<ResourceRequest<AttributeArray, ArrayInfo> > array_requests_;
298 std::vector<ResourceRequest<BufferObject, BufferInfo> > buffer_requests_;
299 std::vector<ResourceRequest<FramebufferObject, FramebufferInfo> >
300 framebuffer_requests_;
301 std::vector<DataRequest<PlatformInfo> > platform_requests_;
302 std::vector<ResourceRequest<ShaderProgram, ProgramInfo> >
304 std::vector<ResourceRequest<Sampler, SamplerInfo> > sampler_requests_;
305 std::vector<ResourceRequest<Shader, ShaderInfo> > shader_requests_;
306 std::vector<DataRequest<TextureImageInfo> > texture_image_requests_;
307 std::vector<ResourceRequest<TextureBase, TextureInfo> > texture_requests_;
313 #endif // ION_GFX_RESOURCEMANAGER_H_
RenderbufferInfo depth_renderbuffer
base::ReferentPtr< FramebufferObject >::Type FramebufferObjectPtr
Convenience typedef for shared pointer to a FramebufferObject.
A ShaderInfo corresponds to an OpenGL Shader Object.
A SamplerInfo corresponds to an OpenGL Sampler Object.
The below info types contain additional informative fields about resources.
Format
Supported image formats.
gfx::BufferInfo< BufferTargetInfo > BufferInfo
DataRequest(GLuint id_in, const typename InfoCallback< InfoType >::Type &callback_in)
RenderbufferInfo stencil_renderbuffer
GLenum unit
The texture unit the texture is bound to.
gfx::FramebufferInfo< FramebufferResourceInfo > FramebufferInfo
Image::Format format
The format of the texture.
GLuint target
The buffer's target, either GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER.
const GraphicsManagerPtr & GetGraphicsManager() const
Functions.
base::AllocVector< ImagePtr > images
void RequestResourceInfo(const typename base::ReferentPtr< HolderType >::Type &holder, const typename InfoCallback< InfoType >::Type &callback)
Requests information about a particular resource if the ReferentPtr is non-NULL.
std::function< void(const std::vector< ion::gfx::ProgramInfo > &infos)> Type
Callbacks called when requested resource information is available.
base::ReferentPtr< Sampler >::Type SamplerPtr
Convenience typedef for shared pointer to a Sampler.
GLuint width
The dimensions of the texture.
T * Get() const
Returns a raw pointer to the instance, which may be NULL.
A LockGuard locks a mutex when created, and unlocks it when destroyed.
gfx::TextureInfo< TextureResourceInfo > TextureInfo
Allocatable is an abstract base class for classes whose memory is managed by an Allocator.
Wrapper struct for resource info requests.
Struct containing information about a texture and its image(s).
gfx::ProgramInfo< ResourceInfo > ProgramInfo
InfoCallback< InfoType >::Type callback
port::Mutex request_mutex_
For locking access to request vectors.
GLuint sampler
The sampler that is currently bound to the same unit as the texture.
base::ReferentPtr< ShaderProgram >::Type ShaderProgramPtr
gfx::SamplerInfo< ResourceInfo > SamplerInfo
base::ReferentPtr< Shader >::Type ShaderPtr
Convenience typedef for shared pointers to Shaders.
void RequestAllResourceInfos(const typename InfoCallback< InfoType >::Type &callback)
Requests information about all resources of the passed type.
A ProgramInfo corresponds to an OpenGL Program Object.
A ResourceManager is an interface for getting information about a Renderer's internal resources...
ResourceRequest(const typename base::ReferentPtr< HolderType >::Type &holder_in, const typename InfoCallback< InfoType >::Type &callback_in)
base::ReferentPtr< TextureBase >::Type TextureBasePtr
Wrapper struct for data requests.
base::ReferentPtr< AttributeArray >::Type AttributeArrayPtr
Convenience typedef for shared pointer to a AttributeArray.
SharedPtr< AttributeArray > Type
A BufferInfo corresponds to an OpenGL Framebuffer Object.
size_t vertex_count
The total number of vertices calculated the last time the array was rendered.
base::ReferentPtr< GraphicsManager >::Type GraphicsManagerPtr
Convenience typedef for shared pointer to a GraphicsManager.
gfx::RenderbufferInfo< ResourceInfo > RenderbufferInfo
A BufferInfo corresponds to an OpenGL Buffer Object.
gfx::ArrayInfo< ArrayResourceInfo > ArrayInfo
The actual info types.
RenderbufferInfo color0_renderbuffer
The renderbuffers attached to the framebuffer, if any.
base::ReferentPtr< BufferObject >::Type BufferObjectPtr
Convenience typedef for shared pointer to a BufferObject.
The below structs correspond to OpenGL "objects." For example, a BufferObject corresponds to an OpenG...
A TextureInfo corresponds to an OpenGL Texture Object.
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...
kMediumTerm is used for objects that don't fall into the kShortTerm or kLongTerm categories.
base::ReferentPtr< HolderType >::Type holder
std::string label
The label of the ResourceHolder that owns the Resource.
GLuint id
OpenGL object id.
A Mutex is used to ensure that only one thread or process can access a block of code at one time...
InfoCallback< InfoType >::Type callback
gfx::ShaderInfo< ResourceInfo > ShaderInfo
This class can be used in place of std::vector to allow an Ion Allocator to be used for memory alloca...