changed NoBase to NoType in glw and resolved conflict with Type enum.
This commit is contained in:
parent
a9839c1673
commit
37acc0146a
|
@ -9,17 +9,17 @@ namespace glw
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
struct NoBase { };
|
struct NoType { };
|
||||||
template <typename T> struct DefaultDeleter { void operator () (T * t) { delete t; } };
|
template <typename T> struct DefaultDeleter { void operator () (T * t) { delete t; } };
|
||||||
|
|
||||||
template <typename T> struct BaseOf { typedef NoBase Type; };
|
template <typename T> struct BaseOf { typedef NoType Type; };
|
||||||
|
|
||||||
template <typename T, typename B> struct RootOfType { typedef typename RootOfType<B, typename BaseOf<B>::Type>::Type Type; };
|
template <typename T, typename B> struct RootOfType { typedef typename RootOfType<B, typename BaseOf<B>::Type>::Type Type; };
|
||||||
template <typename T> struct RootOfType<T, NoBase> { typedef T Type; };
|
template <typename T> struct RootOfType<T, NoType> { typedef T Type; };
|
||||||
template <typename T> struct RootOf { typedef typename RootOfType<T, typename BaseOf<T>::Type>::Type Type; };
|
template <typename T> struct RootOf { typedef typename RootOfType<T, typename BaseOf<T>::Type>::Type Type; };
|
||||||
|
|
||||||
template <typename T, typename B> struct DeleterOfType { typedef typename DeleterOfType<B, typename BaseOf<B>::Type>::Type Type; };
|
template <typename T, typename B> struct DeleterOfType { typedef typename DeleterOfType<B, typename BaseOf<B>::Type>::Type Type; };
|
||||||
template <typename T> struct DeleterOfType<T, NoBase> { typedef DefaultDeleter<T> Type; };
|
template <typename T> struct DeleterOfType<T, NoType> { typedef DefaultDeleter<T> Type; };
|
||||||
template <typename T> struct DeleterOf { typedef typename DeleterOfType<T, typename BaseOf<T>::Type>::Type Type; };
|
template <typename T> struct DeleterOf { typedef typename DeleterOfType<T, typename BaseOf<T>::Type>::Type Type; };
|
||||||
|
|
||||||
template <typename TObject, typename TDeleter, typename TBaseObject>
|
template <typename TObject, typename TDeleter, typename TBaseObject>
|
||||||
|
@ -51,15 +51,15 @@ class RefCountedObject : public RefCountedObject<TBaseObject, TDeleter, typename
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename TObject, typename TDeleter>
|
template <typename TObject, typename TDeleter>
|
||||||
class RefCountedObject<TObject, TDeleter, NoBase>
|
class RefCountedObject<TObject, TDeleter, NoType>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef void BaseType;
|
typedef void BaseType;
|
||||||
typedef RefCountedObject<TObject, TDeleter, NoBase> ThisType;
|
typedef RefCountedObject<TObject, TDeleter, NoType> ThisType;
|
||||||
typedef TObject ObjectType;
|
typedef TObject ObjectType;
|
||||||
typedef TDeleter DeleterType;
|
typedef TDeleter DeleterType;
|
||||||
typedef NoBase BaseObjectType;
|
typedef NoType BaseObjectType;
|
||||||
|
|
||||||
RefCountedObject(ObjectType * object, const DeleterType & deleter)
|
RefCountedObject(ObjectType * object, const DeleterType & deleter)
|
||||||
: m_object (object)
|
: m_object (object)
|
||||||
|
@ -216,16 +216,16 @@ class ObjectSharedPointer : public ObjectSharedPointer<TBaseObject, TDeleter, ty
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename TObject, typename TDeleter>
|
template <typename TObject, typename TDeleter>
|
||||||
class ObjectSharedPointer<TObject, TDeleter, NoBase>
|
class ObjectSharedPointer<TObject, TDeleter, NoType>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef void BaseType;
|
typedef void BaseType;
|
||||||
typedef ObjectSharedPointer<TObject, TDeleter, NoBase> ThisType;
|
typedef ObjectSharedPointer<TObject, TDeleter, NoType> ThisType;
|
||||||
typedef TObject ObjectType;
|
typedef TObject ObjectType;
|
||||||
typedef TDeleter DeleterType;
|
typedef TDeleter DeleterType;
|
||||||
typedef NoBase BaseObjectType;
|
typedef NoType BaseObjectType;
|
||||||
typedef RefCountedObject<ObjectType, DeleterType, NoBase> RefCountedObjectType;
|
typedef RefCountedObject<ObjectType, DeleterType, NoType> RefCountedObjectType;
|
||||||
|
|
||||||
ObjectSharedPointer(void)
|
ObjectSharedPointer(void)
|
||||||
: m_refObject(0)
|
: m_refObject(0)
|
||||||
|
|
|
@ -30,7 +30,9 @@ class Context : public detail::NonCopyable
|
||||||
|
|
||||||
Context(void)
|
Context(void)
|
||||||
: m_acquired (false)
|
: m_acquired (false)
|
||||||
, m_textureUnits (0)
|
, m_maxUniformBuffers (0)
|
||||||
|
, m_maxFeedbackBuffers (0)
|
||||||
|
, m_maxTextureUnits (0)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -387,7 +389,9 @@ class Context : public detail::NonCopyable
|
||||||
typedef RefCountedBindingPtrMap::value_type RefCountedBindingPtrMapValue;
|
typedef RefCountedBindingPtrMap::value_type RefCountedBindingPtrMapValue;
|
||||||
|
|
||||||
bool m_acquired;
|
bool m_acquired;
|
||||||
int m_textureUnits;
|
int m_maxUniformBuffers;
|
||||||
|
int m_maxFeedbackBuffers;
|
||||||
|
int m_maxTextureUnits;
|
||||||
RefCountedPtrPtrMap m_objects;
|
RefCountedPtrPtrMap m_objects;
|
||||||
RefCountedBindingPtrMap m_bindings;
|
RefCountedBindingPtrMap m_bindings;
|
||||||
|
|
||||||
|
@ -418,8 +422,6 @@ class Context : public detail::NonCopyable
|
||||||
this->initializeTarget<BoundIndexBuffer, IndexBufferBindingParams >(IndexBufferBindingParams () );
|
this->initializeTarget<BoundIndexBuffer, IndexBufferBindingParams >(IndexBufferBindingParams () );
|
||||||
this->initializeTarget<BoundPixelPackBuffer, PixelPackBufferBindingParams >(PixelPackBufferBindingParams () );
|
this->initializeTarget<BoundPixelPackBuffer, PixelPackBufferBindingParams >(PixelPackBufferBindingParams () );
|
||||||
this->initializeTarget<BoundPixelUnpackBuffer, PixelUnpackBufferBindingParams >(PixelUnpackBufferBindingParams () );
|
this->initializeTarget<BoundPixelUnpackBuffer, PixelUnpackBufferBindingParams >(PixelUnpackBufferBindingParams () );
|
||||||
this->initializeTarget<BoundUniformBuffer, UniformBufferBindingParams >(UniformBufferBindingParams (0, 0, 0));
|
|
||||||
this->initializeTarget<BoundFeedbackBuffer, FeedbackBufferBindingParams >(FeedbackBufferBindingParams (0, 0, 0));
|
|
||||||
this->initializeTarget<BoundRenderbuffer, RenderbufferBindingParams >(RenderbufferBindingParams () );
|
this->initializeTarget<BoundRenderbuffer, RenderbufferBindingParams >(RenderbufferBindingParams () );
|
||||||
this->initializeTarget<BoundVertexShader, VertexShaderBindingParams >(VertexShaderBindingParams () );
|
this->initializeTarget<BoundVertexShader, VertexShaderBindingParams >(VertexShaderBindingParams () );
|
||||||
this->initializeTarget<BoundGeometryShader, GeometryShaderBindingParams >(GeometryShaderBindingParams () );
|
this->initializeTarget<BoundGeometryShader, GeometryShaderBindingParams >(GeometryShaderBindingParams () );
|
||||||
|
@ -430,16 +432,35 @@ class Context : public detail::NonCopyable
|
||||||
this->initializeTarget<BoundReadDrawFramebuffer, ReadDrawFramebufferBindingParams >(ReadDrawFramebufferBindingParams () );
|
this->initializeTarget<BoundReadDrawFramebuffer, ReadDrawFramebufferBindingParams >(ReadDrawFramebufferBindingParams () );
|
||||||
|
|
||||||
{
|
{
|
||||||
GLint texUnits = 0;
|
GLint uniformBuffers = 0;
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texUnits);
|
glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &uniformBuffers);
|
||||||
this->m_textureUnits = int(texUnits);
|
this->m_maxUniformBuffers = int(uniformBuffers);
|
||||||
|
for (int i=0; i<this->m_maxUniformBuffers; ++i)
|
||||||
|
{
|
||||||
|
this->initializeTarget<BoundUniformBuffer, UniformBufferBindingParams>(UniformBufferBindingParams(GLuint(i), 0, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<this->m_textureUnits; ++i)
|
{
|
||||||
|
GLint feedbackBuffers = 0;
|
||||||
|
glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &feedbackBuffers);
|
||||||
|
this->m_maxFeedbackBuffers = int(feedbackBuffers);
|
||||||
|
for (int i=0; i<this->m_maxFeedbackBuffers; ++i)
|
||||||
|
{
|
||||||
|
this->initializeTarget<BoundFeedbackBuffer, FeedbackBufferBindingParams>(FeedbackBufferBindingParams(GLuint(i), 0, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
GLint texUnits = 0;
|
||||||
|
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texUnits);
|
||||||
|
this->m_maxTextureUnits = int(texUnits);
|
||||||
|
for (int i=0; i<this->m_maxTextureUnits; ++i)
|
||||||
{
|
{
|
||||||
this->initializeTarget<BoundTexture2D>(Texture2DBindingParams(GLint(i)));
|
this->initializeTarget<BoundTexture2D>(Texture2DBindingParams(GLint(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void terminateTargets(void)
|
void terminateTargets(void)
|
||||||
{
|
{
|
||||||
|
@ -447,8 +468,6 @@ class Context : public detail::NonCopyable
|
||||||
this->terminateTarget<BoundIndexBuffer, IndexBufferBindingParams >(IndexBufferBindingParams () );
|
this->terminateTarget<BoundIndexBuffer, IndexBufferBindingParams >(IndexBufferBindingParams () );
|
||||||
this->terminateTarget<BoundPixelPackBuffer, PixelPackBufferBindingParams >(PixelPackBufferBindingParams () );
|
this->terminateTarget<BoundPixelPackBuffer, PixelPackBufferBindingParams >(PixelPackBufferBindingParams () );
|
||||||
this->terminateTarget<BoundPixelUnpackBuffer, PixelUnpackBufferBindingParams >(PixelUnpackBufferBindingParams () );
|
this->terminateTarget<BoundPixelUnpackBuffer, PixelUnpackBufferBindingParams >(PixelUnpackBufferBindingParams () );
|
||||||
this->terminateTarget<BoundUniformBuffer, UniformBufferBindingParams >(UniformBufferBindingParams (0, 0, 0));
|
|
||||||
this->terminateTarget<BoundFeedbackBuffer, FeedbackBufferBindingParams >(FeedbackBufferBindingParams (0, 0, 0));
|
|
||||||
this->terminateTarget<BoundRenderbuffer, RenderbufferBindingParams >(RenderbufferBindingParams () );
|
this->terminateTarget<BoundRenderbuffer, RenderbufferBindingParams >(RenderbufferBindingParams () );
|
||||||
this->terminateTarget<BoundVertexShader, VertexShaderBindingParams >(VertexShaderBindingParams () );
|
this->terminateTarget<BoundVertexShader, VertexShaderBindingParams >(VertexShaderBindingParams () );
|
||||||
this->terminateTarget<BoundGeometryShader, GeometryShaderBindingParams >(GeometryShaderBindingParams () );
|
this->terminateTarget<BoundGeometryShader, GeometryShaderBindingParams >(GeometryShaderBindingParams () );
|
||||||
|
@ -458,12 +477,29 @@ class Context : public detail::NonCopyable
|
||||||
this->terminateTarget<BoundDrawFramebuffer, DrawFramebufferBindingParams >(DrawFramebufferBindingParams () );
|
this->terminateTarget<BoundDrawFramebuffer, DrawFramebufferBindingParams >(DrawFramebufferBindingParams () );
|
||||||
this->terminateTarget<BoundReadDrawFramebuffer, ReadDrawFramebufferBindingParams >(ReadDrawFramebufferBindingParams () );
|
this->terminateTarget<BoundReadDrawFramebuffer, ReadDrawFramebufferBindingParams >(ReadDrawFramebufferBindingParams () );
|
||||||
|
|
||||||
for (int i=0; i<this->m_textureUnits; ++i)
|
{
|
||||||
|
for (int i=0; i<this->m_maxUniformBuffers; ++i)
|
||||||
|
{
|
||||||
|
this->terminateTarget<BoundUniformBuffer, UniformBufferBindingParams>(UniformBufferBindingParams(GLuint(i), 0, 0));
|
||||||
|
}
|
||||||
|
this->m_maxUniformBuffers = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
for (int i=0; i<this->m_maxFeedbackBuffers; ++i)
|
||||||
|
{
|
||||||
|
this->terminateTarget<BoundFeedbackBuffer, FeedbackBufferBindingParams>(FeedbackBufferBindingParams(GLuint(i), 0, 0));
|
||||||
|
}
|
||||||
|
this->m_maxFeedbackBuffers = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
for (int i=0; i<this->m_maxTextureUnits; ++i)
|
||||||
{
|
{
|
||||||
this->terminateTarget<BoundTexture2D>(Texture2DBindingParams(GLint(i)));
|
this->terminateTarget<BoundTexture2D>(Texture2DBindingParams(GLint(i)));
|
||||||
}
|
}
|
||||||
|
this->m_maxTextureUnits = 0;
|
||||||
this->m_textureUnits = 0;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TObject>
|
template <typename TObject>
|
||||||
|
|
|
@ -90,11 +90,11 @@ class Object : public detail::NonCopyable
|
||||||
virtual bool doIsValid(void) const = 0;
|
virtual bool doIsValid(void) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace detail { template <typename T> struct ObjectBase { typedef NoBase Type; }; };
|
namespace detail { template <typename T> struct ObjectBase { typedef NoType Type; }; };
|
||||||
namespace detail { template <typename T> struct ObjectSafe { typedef NoBase Type; }; };
|
namespace detail { template <typename T> struct ObjectSafe { typedef NoType Type; }; };
|
||||||
namespace detail { template <typename T> struct ObjectBound { typedef NoBase Type; }; };
|
namespace detail { template <typename T> struct ObjectBound { typedef NoType Type; }; };
|
||||||
|
|
||||||
namespace detail { template <> struct BaseOf <Object> { typedef NoBase Type; }; };
|
namespace detail { template <> struct BaseOf <Object> { typedef NoType Type; }; };
|
||||||
namespace detail { template <> struct DeleterOf <Object> { typedef ObjectDeleter Type; }; };
|
namespace detail { template <> struct DeleterOf <Object> { typedef ObjectDeleter Type; }; };
|
||||||
typedef detail::ObjectSharedPointerTraits <Object> ::Type ObjectPtr;
|
typedef detail::ObjectSharedPointerTraits <Object> ::Type ObjectPtr;
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ class SafeObject : public detail::NonCopyable
|
||||||
|
|
||||||
Type type(void) const
|
Type type(void) const
|
||||||
{
|
{
|
||||||
if (this->isNull()) return NoType;
|
if (this->isNull()) return InvalidType;
|
||||||
return this->m_object->type();
|
return this->m_object->type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ class SafeObject : public detail::NonCopyable
|
||||||
ObjectPtr m_object;
|
ObjectPtr m_object;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace detail { template <> struct BaseOf <SafeObject> { typedef NoBase Type; }; };
|
namespace detail { template <> struct BaseOf <SafeObject> { typedef NoType Type; }; };
|
||||||
namespace detail { template <> struct DeleterOf <SafeObject> { typedef DefaultDeleter<SafeObject> Type; }; };
|
namespace detail { template <> struct DeleterOf <SafeObject> { typedef DefaultDeleter<SafeObject> Type; }; };
|
||||||
namespace detail { template <> struct ObjectBase <SafeObject> { typedef Object Type; }; };
|
namespace detail { template <> struct ObjectBase <SafeObject> { typedef Object Type; }; };
|
||||||
namespace detail { template <> struct ObjectSafe <Object > { typedef SafeObject Type; }; };
|
namespace detail { template <> struct ObjectSafe <Object > { typedef SafeObject Type; }; };
|
||||||
|
@ -282,10 +282,10 @@ class BoundObject : public detail::NonCopyable
|
||||||
virtual void unbind (void) = 0;
|
virtual void unbind (void) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace detail { template <typename T> struct ParamsOf { typedef NoBase Type; }; };
|
namespace detail { template <typename T> struct ParamsOf { typedef NoType Type; }; };
|
||||||
|
|
||||||
namespace detail { template <> struct ParamsOf <BoundObject> { typedef ObjectBindingParams Type; }; };
|
namespace detail { template <> struct ParamsOf <BoundObject> { typedef ObjectBindingParams Type; }; };
|
||||||
namespace detail { template <> struct BaseOf <BoundObject> { typedef NoBase Type; }; };
|
namespace detail { template <> struct BaseOf <BoundObject> { typedef NoType Type; }; };
|
||||||
namespace detail { template <> struct DeleterOf <BoundObject> { typedef DefaultDeleter<BoundObject> Type; }; };
|
namespace detail { template <> struct DeleterOf <BoundObject> { typedef DefaultDeleter<BoundObject> Type; }; };
|
||||||
namespace detail { template <> struct ObjectBase <BoundObject> { typedef Object Type; }; };
|
namespace detail { template <> struct ObjectBase <BoundObject> { typedef Object Type; }; };
|
||||||
namespace detail { template <> struct ObjectBound <Object > { typedef BoundObject Type; }; };
|
namespace detail { template <> struct ObjectBound <Object > { typedef BoundObject Type; }; };
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace glw
|
||||||
|
|
||||||
enum Type
|
enum Type
|
||||||
{
|
{
|
||||||
NoType = 0,
|
InvalidType = 0,
|
||||||
BufferType,
|
BufferType,
|
||||||
RenderbufferType,
|
RenderbufferType,
|
||||||
VertexShaderType,
|
VertexShaderType,
|
||||||
|
|
Loading…
Reference in New Issue