From 2a8b76083354af4f755845beab62446bebc7a6b8 Mon Sep 17 00:00:00 2001 From: Linan Wang Date: Fri, 19 Jul 2019 13:28:25 +0800 Subject: [PATCH] fix u64 and i64 allocation, setArray bug --- src/osg/Uniform.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/osg/Uniform.cpp b/src/osg/Uniform.cpp index 50ab08552..92b12a1fe 100644 --- a/src/osg/Uniform.cpp +++ b/src/osg/Uniform.cpp @@ -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_UINT64_ARB: + _uintArray = 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;