Merge pull request #797 from wangii/OpenSceneGraph-3.6

fix u64 and i64 allocation, setArray bug
This commit is contained in:
OpenSceneGraph git repository 2019-07-19 09:10:02 +01:00 committed by GitHub
commit cd124228fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,7 +123,7 @@ void Uniform::setNumElements( unsigned int numElements )
void Uniform::allocateDataArray()
{
// if one array is already allocated, the job is done.
if( _floatArray.valid() || _doubleArray.valid() || _intArray.valid() || _uintArray.valid() ) return;
if( _floatArray.valid() || _doubleArray.valid() || _intArray.valid() || _uintArray.valid() || _int64Array.valid() || _uint64Array.valid()) return;
// array cannot be created until _type and _numElements are specified
int arrayNumElements = getInternalArrayNumElements();
@ -147,6 +147,14 @@ void Uniform::allocateDataArray()
_uintArray = new UIntArray(arrayNumElements);
return;
case GL_INT64_ARB:
_int64Array = new Int64Array(arrayNumElements);
return;
case GL_UNSIGNED_INT64_ARB:
_uint64Array = new UInt64Array(arrayNumElements);
return;
default:
break;
}
@ -241,7 +249,7 @@ bool Uniform::setArray( UInt64Array* array )
if( !array ) return false;
// incoming array must match configuration of the Uniform
if( getInternalArrayType(getType())!=GL_UNSIGNED_INT || getInternalArrayNumElements()!=array->getNumElements() )
if( getInternalArrayType(getType())!=GL_UNSIGNED_INT64_ARB || getInternalArrayNumElements()!=array->getNumElements() )
{
OSG_WARN << "Uniform::setArray : incompatible array" << std::endl;
return false;
@ -262,7 +270,7 @@ bool Uniform::setArray( Int64Array* array )
if( !array ) return false;
// incoming array must match configuration of the Uniform
if( getInternalArrayType(getType())!=GL_UNSIGNED_INT || getInternalArrayNumElements()!=array->getNumElements() )
if( getInternalArrayType(getType())!=GL_UNSIGNED_INT64_ARB || getInternalArrayNumElements()!=array->getNumElements() )
{
OSG_WARN << "Uniform::setArray : incompatible array" << std::endl;
return false;