fix u64 and i64 allocation, setArray bug

This commit is contained in:
Linan Wang 2019-07-19 13:28:25 +08:00
parent 8dea265a91
commit 2a8b760833

View File

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