Merge pull request #211 from D-A-Heitbrink/master
Added support for unsigned 64 bit ints + some code for bindless textures
This commit is contained in:
@@ -112,7 +112,10 @@ class OSG_EXPORT Array : public BufferData
|
||||
MatrixArrayType = 33,
|
||||
MatrixdArrayType = 34,
|
||||
|
||||
QuatArrayType = 35
|
||||
QuatArrayType = 35,
|
||||
|
||||
UInt64ArrayType = 36,
|
||||
Int64ArrayType = 37
|
||||
};
|
||||
|
||||
enum Binding
|
||||
@@ -442,7 +445,8 @@ typedef TemplateArray<Matrixd,Array::MatrixdArrayType,16,GL_DOUBLE>
|
||||
|
||||
typedef TemplateArray<Quat,Array::QuatArrayType,4,GL_DOUBLE> QuatArray;
|
||||
|
||||
|
||||
typedef TemplateIndexArray<GLuint64,Array::UInt64ArrayType,1,GL_UNSIGNED_INT64_ARB> UInt64Array;
|
||||
typedef TemplateIndexArray<GLint64,Array::Int64ArrayType,1,GL_INT64_ARB> Int64Array;
|
||||
class ArrayVisitor
|
||||
{
|
||||
public:
|
||||
@@ -497,6 +501,9 @@ class ArrayVisitor
|
||||
|
||||
virtual void apply(MatrixfArray&) {}
|
||||
virtual void apply(MatrixdArray&) {}
|
||||
|
||||
virtual void apply(UInt64Array&) {}
|
||||
virtual void apply(Int64Array&) {}
|
||||
};
|
||||
|
||||
class ConstArrayVisitor
|
||||
@@ -553,6 +560,9 @@ class ConstArrayVisitor
|
||||
|
||||
virtual void apply(const MatrixfArray&) {}
|
||||
virtual void apply(const MatrixdArray&) {}
|
||||
|
||||
virtual void apply(const UInt64Array&) {}
|
||||
virtual void apply(const Int64Array&) {}
|
||||
};
|
||||
|
||||
|
||||
@@ -610,6 +620,9 @@ class ValueVisitor
|
||||
virtual void apply(Matrixd&) {}
|
||||
|
||||
virtual void apply(Quat&) {}
|
||||
|
||||
virtual void apply(GLuint64&){}
|
||||
virtual void apply(GLint64&){}
|
||||
};
|
||||
|
||||
class ConstValueVisitor
|
||||
@@ -666,6 +679,9 @@ class ConstValueVisitor
|
||||
virtual void apply(const Matrixd&) {}
|
||||
|
||||
virtual void apply(const Quat&) {}
|
||||
|
||||
virtual void apply(const GLuint64&){}
|
||||
virtual void apply(const GLint64&){}
|
||||
};
|
||||
|
||||
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
||||
|
||||
@@ -556,6 +556,14 @@ typedef char GLchar;
|
||||
#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
|
||||
#endif
|
||||
|
||||
#define GL_INT64_ARB 0x140E
|
||||
#define GL_UNSIGNED_INT64_ARB 0x140F
|
||||
#define GL_INT64_VEC2_ARB 0x8FE9
|
||||
#define GL_INT64_VEC3_ARB 0x8FEA
|
||||
#define GL_INT64_VEC4_ARB 0x8FEB
|
||||
#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FF5
|
||||
#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FF6
|
||||
#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FF7
|
||||
/* ------------------------------ GL_KHR_debug ----------------------------- */
|
||||
#ifndef GL_KHR_debug
|
||||
#define GL_KHR_debug 1
|
||||
@@ -602,7 +610,6 @@ typedef char GLchar;
|
||||
#define GL_DEBUG_OUTPUT 0x92E0
|
||||
|
||||
#endif /* GL_KHR_debug */
|
||||
|
||||
#ifndef GL_ARB_sync
|
||||
#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
|
||||
#define GL_OBJECT_TYPE 0x9112
|
||||
@@ -653,6 +660,10 @@ typedef char GLchar;
|
||||
#define GL_ALPHA_TEST 0x0BC0
|
||||
#endif
|
||||
|
||||
#ifndef GLuint64EXT
|
||||
typedef uint64_t GLuint64EXT;
|
||||
#endif
|
||||
|
||||
namespace osg
|
||||
{
|
||||
#ifndef GL_VERSION_3_2
|
||||
|
||||
@@ -319,6 +319,22 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
||||
void (GL_APIENTRY * glUniform2uiv)( GLint location, GLsizei count, const GLuint *value );
|
||||
void (GL_APIENTRY * glUniform3uiv)( GLint location, GLsizei count, const GLuint *value );
|
||||
void (GL_APIENTRY * glUniform4uiv)( GLint location, GLsizei count, const GLuint *value );
|
||||
void (GL_APIENTRY * glUniform1i64 )(GLint location, GLint64 x) ;
|
||||
void (GL_APIENTRY * glUniform1i64v )(GLint location, GLsizei count, const GLint64* value) ;
|
||||
void (GL_APIENTRY * glUniform1ui64 )(GLint location, GLuint64 x) ;
|
||||
void (GL_APIENTRY * glUniform1ui64v)(GLint location, GLsizei count, const GLuint64* value) ;
|
||||
void (GL_APIENTRY * glUniform2i64 )(GLint location, GLint64 x, GLint64 y) ;
|
||||
void (GL_APIENTRY * glUniform2i64v )(GLint location, GLsizei count, const GLint64* value) ;
|
||||
void (GL_APIENTRY * glUniform2ui64 )(GLint location, GLuint64 x, GLuint64 y) ;
|
||||
void (GL_APIENTRY * glUniform2ui64v)(GLint location, GLsizei count, const GLuint64* value) ;
|
||||
void (GL_APIENTRY * glUniform3i64 )(GLint location, GLint64 x, GLint64 y, GLint64 z) ;
|
||||
void (GL_APIENTRY * glUniform3i64v )(GLint location, GLsizei count, const GLint64* value) ;
|
||||
void (GL_APIENTRY * glUniform3ui64 )(GLint location, GLuint64 x, GLuint64 y, GLuint64 z) ;
|
||||
void (GL_APIENTRY * glUniform3ui64v)(GLint location, GLsizei count, const GLuint64* value) ;
|
||||
void (GL_APIENTRY * glUniform4i64 )(GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w) ;
|
||||
void (GL_APIENTRY * glUniform4i64v )(GLint location, GLsizei count, const GLint64* value) ;
|
||||
void (GL_APIENTRY * glUniform4ui64 )(GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w) ;
|
||||
void (GL_APIENTRY * glUniform4ui64v)(GLint location, GLsizei count, const GLuint64* value) ;
|
||||
GLuint (GL_APIENTRY * glGetHandleARB) (GLenum pname);
|
||||
void (GL_APIENTRY * glGetUniformIndices)(GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices);
|
||||
void (GL_APIENTRY * glGetActiveUniformsiv)(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
|
||||
@@ -348,7 +364,11 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
||||
void (GL_APIENTRY * glUniformMatrix4x3dv)( GLint location, GLsizei count, GLboolean transpose, const GLdouble* value );
|
||||
void (GL_APIENTRY * glGetActiveAtomicCounterBufferiv)( GLuint program, GLuint bufferIndex, GLenum pname, GLint* params );
|
||||
void (GL_APIENTRY * glDispatchCompute)( GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ );
|
||||
|
||||
GLuint64EXT (GL_APIENTRY* glGetTextureHandle)(GLint texture);
|
||||
void (GL_APIENTRY* glMakeTextureHandleResident)(GLuint64EXT handle);
|
||||
void (GL_APIENTRY* glMakeTextureHandleNonResident)(GLuint64EXT handle);
|
||||
void (GL_APIENTRY* glUniformHandleui64)(GLint location, GLuint64EXT handle);
|
||||
GLboolean (GL_APIENTRY* glIsTextureHandleResident)(GLuint64EXT handle);
|
||||
|
||||
// Buffer Object extensions
|
||||
bool isBufferObjectSupported;
|
||||
|
||||
@@ -439,6 +439,9 @@ class OSG_EXPORT Uniform : public Object
|
||||
BOOL_VEC3 = GL_BOOL_VEC3,
|
||||
BOOL_VEC4 = GL_BOOL_VEC4,
|
||||
|
||||
INT64 = GL_INT64_ARB,
|
||||
UNSIGNED_INT64 = GL_UNSIGNED_INT64_ARB,
|
||||
|
||||
FLOAT_MAT2 = GL_FLOAT_MAT2,
|
||||
FLOAT_MAT3 = GL_FLOAT_MAT3,
|
||||
FLOAT_MAT4 = GL_FLOAT_MAT4,
|
||||
@@ -603,6 +606,8 @@ class OSG_EXPORT Uniform : public Object
|
||||
explicit Uniform( const char* name, int i );
|
||||
explicit Uniform( const char* name, unsigned int ui );
|
||||
explicit Uniform( const char* name, bool b );
|
||||
explicit Uniform( const char* name, unsigned long long ull);
|
||||
explicit Uniform( const char* name, long long ll );
|
||||
Uniform( const char* name, const osg::Vec2& v2 );
|
||||
Uniform( const char* name, const osg::Vec3& v3 );
|
||||
Uniform( const char* name, const osg::Vec4& v4 );
|
||||
@@ -679,6 +684,8 @@ class OSG_EXPORT Uniform : public Object
|
||||
bool set( int i );
|
||||
bool set( unsigned int ui );
|
||||
bool set( bool b );
|
||||
bool set( unsigned long long ull );
|
||||
bool set( long long ll );
|
||||
bool set( const osg::Vec2& v2 );
|
||||
bool set( const osg::Vec3& v3 );
|
||||
bool set( const osg::Vec4& v4 );
|
||||
@@ -719,6 +726,8 @@ class OSG_EXPORT Uniform : public Object
|
||||
bool get( int& i ) const;
|
||||
bool get( unsigned int& ui ) const;
|
||||
bool get( bool& b ) const;
|
||||
bool get( unsigned long long & ull ) const;
|
||||
bool get( long long& ll ) const;
|
||||
bool get( osg::Vec2& v2 ) const;
|
||||
bool get( osg::Vec3& v3 ) const;
|
||||
bool get( osg::Vec4& v4 ) const;
|
||||
@@ -759,6 +768,8 @@ class OSG_EXPORT Uniform : public Object
|
||||
bool setElement( unsigned int index, int i );
|
||||
bool setElement( unsigned int index, unsigned int ui );
|
||||
bool setElement( unsigned int index, bool b );
|
||||
bool setElement( unsigned int index, unsigned long long ull );
|
||||
bool setElement( unsigned int index, long long ll );
|
||||
bool setElement( unsigned int index, const osg::Vec2& v2 );
|
||||
bool setElement( unsigned int index, const osg::Vec3& v3 );
|
||||
bool setElement( unsigned int index, const osg::Vec4& v4 );
|
||||
@@ -799,6 +810,8 @@ class OSG_EXPORT Uniform : public Object
|
||||
bool getElement( unsigned int index, int& i ) const;
|
||||
bool getElement( unsigned int index, unsigned int& ui ) const;
|
||||
bool getElement( unsigned int index, bool& b ) const;
|
||||
bool getElement( unsigned int index, unsigned long long & ull ) const;
|
||||
bool getElement( unsigned int index, long long& ll ) const;
|
||||
bool getElement( unsigned int index, osg::Vec2& v2 ) const;
|
||||
bool getElement( unsigned int index, osg::Vec3& v3 ) const;
|
||||
bool getElement( unsigned int index, osg::Vec4& v4 ) const;
|
||||
@@ -866,7 +879,8 @@ class OSG_EXPORT Uniform : public Object
|
||||
bool setArray( DoubleArray* array );
|
||||
bool setArray( IntArray* array );
|
||||
bool setArray( UIntArray* array );
|
||||
|
||||
bool setArray( UInt64Array* array );
|
||||
bool setArray( Int64Array* array );
|
||||
/** Get the internal data array for a float osg::Uniform. */
|
||||
FloatArray* getFloatArray() { return _floatArray.get(); }
|
||||
const FloatArray* getFloatArray() const { return _floatArray.get(); }
|
||||
@@ -883,6 +897,14 @@ class OSG_EXPORT Uniform : public Object
|
||||
UIntArray* getUIntArray() { return _uintArray.get(); }
|
||||
const UIntArray* getUIntArray() const { return _uintArray.get(); }
|
||||
|
||||
/** Get the internal data array for an unsigned int osg::Uniform. */
|
||||
UInt64Array* getUInt64Array() { return _uint64Array.get(); }
|
||||
const UInt64Array* getUInt64Array() const { return _uint64Array.get(); }
|
||||
|
||||
/** Get the internal data array for an unsigned int osg::Uniform. */
|
||||
Int64Array* getInt64Array() { return _int64Array.get(); }
|
||||
const Int64Array* getInt64Array() const { return _int64Array.get(); }
|
||||
|
||||
inline void setModifiedCount(unsigned int mc) { _modifiedCount = mc; }
|
||||
inline unsigned int getModifiedCount() const { return _modifiedCount; }
|
||||
|
||||
@@ -922,6 +944,8 @@ class OSG_EXPORT Uniform : public Object
|
||||
ref_ptr<DoubleArray> _doubleArray;
|
||||
ref_ptr<IntArray> _intArray;
|
||||
ref_ptr<UIntArray> _uintArray;
|
||||
ref_ptr<Int64Array> _int64Array;
|
||||
ref_ptr<UInt64Array> _uint64Array;
|
||||
|
||||
ref_ptr<UniformCallback> _updateCallback;
|
||||
ref_ptr<UniformCallback> _eventCallback;
|
||||
|
||||
@@ -33,6 +33,7 @@ const int CHAR_SIZE = 1;
|
||||
const int SHORT_SIZE = 2;
|
||||
const int INT_SIZE = 4;
|
||||
const int LONG_SIZE = 4;
|
||||
const int INT64_SIZE = 8;
|
||||
const int FLOAT_SIZE = 4;
|
||||
const int DOUBLE_SIZE = 8;
|
||||
const int GLENUM_SIZE = 4;
|
||||
@@ -71,6 +72,9 @@ const int ID_VEC2UI_ARRAY = 29;
|
||||
const int ID_VEC3UI_ARRAY = 30;
|
||||
const int ID_VEC4UI_ARRAY = 31;
|
||||
|
||||
const int ID_UINT64_ARRAY = 32;
|
||||
const int ID_INT64_ARRAY = 33;
|
||||
|
||||
const int ID_DRAWARRAYS = 50;
|
||||
const int ID_DRAWARRAY_LENGTH = 51;
|
||||
const int ID_DRAWELEMENTS_UBYTE = 52;
|
||||
|
||||
@@ -102,6 +102,8 @@ public:
|
||||
OutputStream& operator<<( unsigned long l ) { _out->writeULong(l); return *this; }
|
||||
OutputStream& operator<<( float f ) { _out->writeFloat(f); return *this; }
|
||||
OutputStream& operator<<( double d ) { _out->writeDouble(d); return *this; }
|
||||
OutputStream& operator<<( long long ll ) { _out->writeInt64(ll); return *this; }
|
||||
OutputStream& operator<<( unsigned long long ull ) { _out->writeUInt64(ull); return *this; }
|
||||
OutputStream& operator<<( const std::string& s ) { _out->writeString(s); return *this; }
|
||||
OutputStream& operator<<( const char* s ) { _out->writeString(s); return *this; }
|
||||
OutputStream& operator<<( std::ostream& (*fn)(std::ostream&) ) { _out->writeStream(fn); return *this; }
|
||||
|
||||
@@ -37,6 +37,8 @@ public:
|
||||
virtual void writeUInt( unsigned int i ) = 0;
|
||||
virtual void writeLong( long l ) = 0;
|
||||
virtual void writeULong( unsigned long l ) = 0;
|
||||
virtual void writeInt64( int64_t ll ) = 0;
|
||||
virtual void writeUInt64( uint64_t ull ) = 0;
|
||||
virtual void writeFloat( float f ) = 0;
|
||||
virtual void writeDouble( double d ) = 0;
|
||||
virtual void writeString( const std::string& s ) = 0;
|
||||
|
||||
Reference in New Issue
Block a user