Added support for Bindless texture extension,

64 bit uniforms, 64 bit buffers
Added new bindless texture example
This commit is contained in:
d-a-heitbrink
2017-01-13 09:56:42 -06:00
parent 18369bed2d
commit 3d2f4ea404
16 changed files with 171 additions and 10 deletions

View File

@@ -58,6 +58,8 @@ public:
virtual void writeULong( unsigned long l ) { write(l); }
virtual void writeFloat( float f ) { write(f); }
virtual void writeDouble( double d ) { write(d); }
virtual void writeInt64( long long ll ) { write(ll); }
virtual void writeUInt64( unsigned long long ull ) { write(ull); }
virtual void writeString( const std::string& s ) { _str.insert(_str.end(), s.begin(), s.end()); }
virtual void writeStream( std::ostream& (*)(std::ostream&) ) {}
virtual void writeBase( std::ios_base& (*)(std::ios_base&) ) {}

View File

@@ -497,6 +497,34 @@ void DataOutputStream::writeVec4b(const osg::Vec4b& v){
if (_verboseOutput) std::cout<<"read/writeVec4b() ["<<v<<"]"<<std::endl;
}
void DataOutputStream::writeUInt64(unsigned long long ull){
_ostream->write((char*)&ull, INT64SIZE);
if (_verboseOutput) std::cout<<"read/writeUInt64() ["<<ull<<"]"<<std::endl;
}
void DataOutputStream::writeInt64(long long ll){
_ostream->write((char*)&ll, INT64SIZE);
if (_verboseOutput) std::cout<<"read/writeInt64() ["<<ll<<"]"<<std::endl;
}
void DataOutputStream::writeUInt64Array(const osg::UInt64Array* a){
int size = a->getNumElements();
writeUInt64(size);
for(int i =0; i<size ;i++){
writeInt((*a)[i]);
}
if (_verboseOutput) std::cout<<"read/writeUInt64Array() ["<<size<<"]"<<std::endl;
}
void DataOutputStream::writeInt64Array(const osg::Int64Array* a){
int size = a->getNumElements();
writeInt64(size);
for(int i =0; i<size ;i++){
writeInt((*a)[i]);
}
if (_verboseOutput) std::cout<<"read/writeInt64Array() ["<<size<<"]"<<std::endl;
}
void DataOutputStream::writeQuat(const osg::Quat& q){
writeFloat(q.x());
@@ -589,10 +617,14 @@ void DataOutputStream::writeArray(const osg::Array* a){
writeChar((char)16);
writeVec3dArray(static_cast<const osg::Vec3dArray*>(a));
break;
case osg::Array::Vec4dArrayType:
case osg::Array::Vec4dArrayType:
writeChar((char)17);
writeVec4dArray(static_cast<const osg::Vec4dArray*>(a));
break;
case osg::Array::UInt64ArrayType:
writeChar((char)18);
writeUInt64Array(static_cast<const osg::UInt64Array*>(a));
break;
default: throwException("Unknown array type in DataOutputStream::writeArray()");
}
}

View File

@@ -72,7 +72,11 @@ public:
void writeVec2b(const osg::Vec2b& v);
void writeVec3b(const osg::Vec3b& v);
void writeVec4b(const osg::Vec4b& v);
void writeUInt64(unsigned long long ull);
void writeInt64(long long ll);
void writeUInt64Array(const osg::UInt64Array* a);
void writeInt64Array(const osg::Int64Array* a);
void writePackedFloatArray(const osg::FloatArray* a, float maxError);
void writeFloatArray(const osg::FloatArray* a);

View File

@@ -9,7 +9,7 @@
#define FLOATSIZE 4
#define LONGSIZE 4
#define DOUBLESIZE 8
#define INT64SIZE 8
//Don't know where else to put this
namespace ive{

View File

@@ -49,6 +49,12 @@ public:
virtual void writeULong( unsigned long l )
{ indentIfRequired(); *_out << l << ' '; }
virtual void writeInt64( long long ll )
{ indentIfRequired(); *_out << ll << ' '; }
virtual void writeUInt64( unsigned long long ull )
{ indentIfRequired(); *_out << ull << ' '; }
virtual void writeFloat( float f )
{ indentIfRequired(); *_out << f << ' '; }

View File

@@ -49,6 +49,18 @@ public:
_out->write( (char*)&value, osgDB::LONG_SIZE );
}
virtual void writeInt64( int64_t ll )
{_out->write( (char*)&ll, osgDB::INT64_SIZE );}
virtual void writeUInt64( uint64_t ull )
{_out->write( (char*)&ull, osgDB::INT64_SIZE );}
virtual void writeInt( long long ll )
{ _out->write( (char*)&ll, osgDB::INT64_SIZE ); }
virtual void writeUInt( unsigned long long ull )
{ _out->write( (char*)&ull, osgDB::INT64_SIZE ); }
virtual void writeFloat( float f )
{ _out->write( (char*)&f, osgDB::FLOAT_SIZE ); }

View File

@@ -59,6 +59,18 @@ public:
virtual void writeULong( unsigned long l )
{ _sstream << l; addToCurrentNode( _sstream.str() ); _sstream.str(""); }
virtual void writeUInt64(uint64_t ull)
{_sstream << ull; addToCurrentNode( _sstream.str() ); _sstream.str("");}
virtual void writeInt64(int64_t ll)
{_sstream << ll; addToCurrentNode( _sstream.str() ); _sstream.str("");}
virtual void writeInt( unsigned long long ull )
{ _sstream << ull; addToCurrentNode( _sstream.str() ); _sstream.str(""); }
virtual void writeUInt( long long ll )
{ _sstream << ll; addToCurrentNode( _sstream.str() ); _sstream.str(""); }
virtual void writeFloat( float f )
{ _sstream << f; addToCurrentNode( _sstream.str() ); _sstream.str(""); }

View File

@@ -995,6 +995,21 @@ bool Array_writeLocalData(const Array& array,Output& fw)
return true;
}
break;
case(Array::UInt64ArrayType):
{
fw<<array.className()<<" "<<array.getNumElements()<<std::endl;
const UInt64Array::ElementDataType* base = static_cast<const UInt64Array::ElementDataType*>(array.getDataPointer());
writeArray(fw,&base[0], &base[array.getNumElements()]);
return true;
}
case(Array::Int64ArrayType):
{
fw<<array.className()<<" "<<array.getNumElements()<<std::endl;
const Int64Array::ElementDataType* base = static_cast<const Int64Array::ElementDataType*>(array.getDataPointer());
writeArray(fw,&base[0], &base[array.getNumElements()]);
return true;
}
break;
case(Array::ArrayType):
default:
return false;