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
|
||||
{
|
||||
|
||||
struct NoBase { };
|
||||
struct NoType { };
|
||||
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> 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, 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 TObject, typename TDeleter, typename TBaseObject>
|
||||
|
@ -51,15 +51,15 @@ class RefCountedObject : public RefCountedObject<TBaseObject, TDeleter, typename
|
|||
};
|
||||
|
||||
template <typename TObject, typename TDeleter>
|
||||
class RefCountedObject<TObject, TDeleter, NoBase>
|
||||
class RefCountedObject<TObject, TDeleter, NoType>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef void BaseType;
|
||||
typedef RefCountedObject<TObject, TDeleter, NoBase> ThisType;
|
||||
typedef RefCountedObject<TObject, TDeleter, NoType> ThisType;
|
||||
typedef TObject ObjectType;
|
||||
typedef TDeleter DeleterType;
|
||||
typedef NoBase BaseObjectType;
|
||||
typedef NoType BaseObjectType;
|
||||
|
||||
RefCountedObject(ObjectType * object, const DeleterType & deleter)
|
||||
: m_object (object)
|
||||
|
@ -216,16 +216,16 @@ class ObjectSharedPointer : public ObjectSharedPointer<TBaseObject, TDeleter, ty
|
|||
};
|
||||
|
||||
template <typename TObject, typename TDeleter>
|
||||
class ObjectSharedPointer<TObject, TDeleter, NoBase>
|
||||
class ObjectSharedPointer<TObject, TDeleter, NoType>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef void BaseType;
|
||||
typedef ObjectSharedPointer<TObject, TDeleter, NoBase> ThisType;
|
||||
typedef ObjectSharedPointer<TObject, TDeleter, NoType> ThisType;
|
||||
typedef TObject ObjectType;
|
||||
typedef TDeleter DeleterType;
|
||||
typedef NoBase BaseObjectType;
|
||||
typedef RefCountedObject<ObjectType, DeleterType, NoBase> RefCountedObjectType;
|
||||
typedef NoType BaseObjectType;
|
||||
typedef RefCountedObject<ObjectType, DeleterType, NoType> RefCountedObjectType;
|
||||
|
||||
ObjectSharedPointer(void)
|
||||
: m_refObject(0)
|
||||
|
|
|
@ -29,8 +29,10 @@ class Context : public detail::NonCopyable
|
|||
typedef Context ThisType;
|
||||
|
||||
Context(void)
|
||||
: m_acquired (false)
|
||||
, m_textureUnits (0)
|
||||
: m_acquired (false)
|
||||
, m_maxUniformBuffers (0)
|
||||
, m_maxFeedbackBuffers (0)
|
||||
, m_maxTextureUnits (0)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
@ -387,7 +389,9 @@ class Context : public detail::NonCopyable
|
|||
typedef RefCountedBindingPtrMap::value_type RefCountedBindingPtrMapValue;
|
||||
|
||||
bool m_acquired;
|
||||
int m_textureUnits;
|
||||
int m_maxUniformBuffers;
|
||||
int m_maxFeedbackBuffers;
|
||||
int m_maxTextureUnits;
|
||||
RefCountedPtrPtrMap m_objects;
|
||||
RefCountedBindingPtrMap m_bindings;
|
||||
|
||||
|
@ -418,8 +422,6 @@ class Context : public detail::NonCopyable
|
|||
this->initializeTarget<BoundIndexBuffer, IndexBufferBindingParams >(IndexBufferBindingParams () );
|
||||
this->initializeTarget<BoundPixelPackBuffer, PixelPackBufferBindingParams >(PixelPackBufferBindingParams () );
|
||||
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<BoundVertexShader, VertexShaderBindingParams >(VertexShaderBindingParams () );
|
||||
this->initializeTarget<BoundGeometryShader, GeometryShaderBindingParams >(GeometryShaderBindingParams () );
|
||||
|
@ -430,14 +432,33 @@ class Context : public detail::NonCopyable
|
|||
this->initializeTarget<BoundReadDrawFramebuffer, ReadDrawFramebufferBindingParams >(ReadDrawFramebufferBindingParams () );
|
||||
|
||||
{
|
||||
GLint texUnits = 0;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texUnits);
|
||||
this->m_textureUnits = int(texUnits);
|
||||
GLint uniformBuffers = 0;
|
||||
glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &uniformBuffers);
|
||||
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)
|
||||
{
|
||||
this->initializeTarget<BoundTexture2D>(Texture2DBindingParams(GLint(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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -447,8 +468,6 @@ class Context : public detail::NonCopyable
|
|||
this->terminateTarget<BoundIndexBuffer, IndexBufferBindingParams >(IndexBufferBindingParams () );
|
||||
this->terminateTarget<BoundPixelPackBuffer, PixelPackBufferBindingParams >(PixelPackBufferBindingParams () );
|
||||
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<BoundVertexShader, VertexShaderBindingParams >(VertexShaderBindingParams () );
|
||||
this->terminateTarget<BoundGeometryShader, GeometryShaderBindingParams >(GeometryShaderBindingParams () );
|
||||
|
@ -458,12 +477,29 @@ class Context : public detail::NonCopyable
|
|||
this->terminateTarget<BoundDrawFramebuffer, DrawFramebufferBindingParams >(DrawFramebufferBindingParams () );
|
||||
this->terminateTarget<BoundReadDrawFramebuffer, ReadDrawFramebufferBindingParams >(ReadDrawFramebufferBindingParams () );
|
||||
|
||||
for (int i=0; i<this->m_textureUnits; ++i)
|
||||
{
|
||||
this->terminateTarget<BoundTexture2D>(Texture2DBindingParams(GLint(i)));
|
||||
for (int i=0; i<this->m_maxUniformBuffers; ++i)
|
||||
{
|
||||
this->terminateTarget<BoundUniformBuffer, UniformBufferBindingParams>(UniformBufferBindingParams(GLuint(i), 0, 0));
|
||||
}
|
||||
this->m_maxUniformBuffers = 0;
|
||||
}
|
||||
|
||||
this->m_textureUnits = 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->m_maxTextureUnits = 0;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename TObject>
|
||||
|
|
|
@ -90,11 +90,11 @@ class Object : public detail::NonCopyable
|
|||
virtual bool doIsValid(void) const = 0;
|
||||
};
|
||||
|
||||
namespace detail { template <typename T> struct ObjectBase { typedef NoBase Type; }; };
|
||||
namespace detail { template <typename T> struct ObjectSafe { typedef NoBase Type; }; };
|
||||
namespace detail { template <typename T> struct ObjectBound { typedef NoBase Type; }; };
|
||||
namespace detail { template <typename T> struct ObjectBase { typedef NoType Type; }; };
|
||||
namespace detail { template <typename T> struct ObjectSafe { typedef NoType 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; }; };
|
||||
typedef detail::ObjectSharedPointerTraits <Object> ::Type ObjectPtr;
|
||||
|
||||
|
@ -149,7 +149,7 @@ class SafeObject : public detail::NonCopyable
|
|||
|
||||
Type type(void) const
|
||||
{
|
||||
if (this->isNull()) return NoType;
|
||||
if (this->isNull()) return InvalidType;
|
||||
return this->m_object->type();
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ class SafeObject : public detail::NonCopyable
|
|||
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 ObjectBase <SafeObject> { typedef Object Type; }; };
|
||||
namespace detail { template <> struct ObjectSafe <Object > { typedef SafeObject Type; }; };
|
||||
|
@ -282,10 +282,10 @@ class BoundObject : public detail::NonCopyable
|
|||
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 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 ObjectBase <BoundObject> { typedef Object Type; }; };
|
||||
namespace detail { template <> struct ObjectBound <Object > { typedef BoundObject Type; }; };
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace glw
|
|||
|
||||
enum Type
|
||||
{
|
||||
NoType = 0,
|
||||
InvalidType = 0,
|
||||
BufferType,
|
||||
RenderbufferType,
|
||||
VertexShaderType,
|
||||
|
|
Loading…
Reference in New Issue