void NetStreamSender::graphClear(const GS_STRING & source_id, GS_LONG time_id){ NetStreamStorage event = NetStreamStorage(); event.writeByte(EVENT_CLEARED); event.writeString(source_id); event.writeUnsignedVarInt(time_id); _sendEvent(event); }
void NetStreamSender::graphClear(const string & source_id, long time_id){ NetStreamStorage event = NetStreamStorage(); event.writeByte(EVENT_CLEARED); event.writeString(source_id); event.writeLong(time_id); _sendEvent(event); }
void NetStreamSender::removeGraphAttribute(const GS_STRING & source_id, GS_LONG time_id, const GS_STRING & attribute){ NetStreamStorage event = NetStreamStorage(); event.writeByte(EVENT_DEL_GRAPH_ATTR); event.writeString(source_id); event.writeUnsignedVarInt(time_id); event.writeString(attribute); _sendEvent(event); }
void NetStreamSender::stepBegins(const GS_STRING & source_id, GS_LONG time_id, GS_DOUBLE timestamp){ NetStreamStorage event = NetStreamStorage(); event.writeByte(EVENT_STEP); event.writeString(source_id); event.writeUnsignedVarInt(time_id); event.writeDouble(timestamp); _sendEvent(event); }
void NetStreamSender::removeEdge(const GS_STRING & source_id, GS_LONG time_id, const GS_STRING & edge_id){ NetStreamStorage event = NetStreamStorage(); event.writeByte(EVENT_DEL_EDGE); event.writeString(source_id); event.writeUnsignedVarInt(time_id); event.writeString(edge_id); _sendEvent(event); }
void NetStreamSender::removeGraphAttribute(const string & source_id, long time_id, const string & attribute){ NetStreamStorage event = NetStreamStorage(); event.writeByte(EVENT_DEL_GRAPH_ATTR); event.writeString(source_id); event.writeLong(time_id); event.writeString(attribute); _sendEvent(event); }
// ================== // = Element events = // ================== void NetStreamSender::addNode(const GS_STRING & source_id, GS_LONG time_id, const GS_STRING & node_id){ NetStreamStorage event = NetStreamStorage(); event.writeByte(EVENT_ADD_NODE); event.writeString(source_id); event.writeUnsignedVarInt(time_id); event.writeString(node_id); _sendEvent(event); }
void NetStreamSender::removeEdge(const string & source_id, long time_id, const string & edge_id){ NetStreamStorage event = NetStreamStorage(); event.writeByte(EVENT_DEL_EDGE); event.writeString(source_id); event.writeLong(time_id); event.writeString(edge_id); _sendEvent(event); }
void NetStreamSender::stepBegins(const string & source_id, long time_id, double timestamp){ NetStreamStorage event = NetStreamStorage(); event.writeByte(EVENT_STEP); event.writeString(source_id); event.writeLong(time_id); event.writeDouble(timestamp); _sendEvent(event); }
// ================== // = Element events = // ================== void NetStreamSender::addNode(const string & source_id, long time_id, const string & node_id){ NetStreamStorage event = NetStreamStorage(); event.writeByte(EVENT_ADD_NODE); event.writeString(source_id); event.writeLong(time_id); event.writeString(node_id); _sendEvent(event); }
void NetStreamSender::addEdge(const string & source_id, long time_id, const string & edge_id, const string & from_node, const string & to_node, bool directed){ NetStreamStorage event = NetStreamStorage(); event.writeByte(EVENT_ADD_EDGE); event.writeString(source_id); event.writeLong(time_id); event.writeString(edge_id); event.writeString(from_node); event.writeString(to_node); event.writeByte(directed?1:0); _sendEvent(event); }
void NetStreamSender::addEdge(const GS_STRING & source_id, GS_LONG time_id, const GS_STRING & edge_id, const GS_STRING & from_node, const GS_STRING & to_node, GS_BOOL directed){ NetStreamStorage event = NetStreamStorage(); event.writeByte(EVENT_ADD_EDGE); event.writeString(source_id); event.writeUnsignedVarInt(time_id); event.writeString(edge_id); event.writeString(from_node); event.writeString(to_node); event.writeByte(directed?1:0); _sendEvent(event); }
void Channel::frameStart( const eq::uint128_t& frameID, const uint32_t frameNumber ) { Config* config = static_cast< Config* >( getConfig( )); const lunchbox::Clock* clock = config->getClock(); if( clock ) { const std::string formatType = "app->pipe thread latency"; _sendEvent( START_LATENCY, clock->getTimef(), eq::Vector2i( 0, 0 ), formatType, 0, 0 ); } eq::Channel::frameStart( frameID, frameNumber ); }
bool QmlKeyInjector::send(QInputMethodEvent* inputEvent, QQuickItem* rootItem) { // Work around missing key event support in Qt for offscreen windows. const auto items = rootItem->findChildren<QQuickItem*>(); for (auto item : items) { if (!item->hasFocus()) continue; if (_isEnterEvent(inputEvent) && _sendKeyEvent(Qt::Key_Enter, item)) return true; if (_sendEvent(inputEvent, item)) return true; } return false; }
void Channel::_testFormats( float applyZoom ) { glGetError(); // reset //----- setup constant data const eq::Images& images = _frame.getImages(); eq::Image* image = images[ 0 ]; LBASSERT( image ); const eq::PixelViewport& pvp = getPixelViewport(); const eq::Vector2i offset( pvp.x, pvp.y ); const eq::Zoom zoom( applyZoom, applyZoom ); lunchbox::Clock clock; eq::util::ObjectManager& glObjects = getObjectManager(); //----- test all default format/type combinations for( uint32_t i=0; _enums[i].internalFormatString; ++i ) { const uint32_t internalFormat = _enums[i].internalFormat; image->flush(); image->setInternalFormat( eq::Frame::BUFFER_COLOR, internalFormat ); image->setQuality( eq::Frame::BUFFER_COLOR, 0.f ); image->setAlphaUsage( false ); const GLEWContext* glewContext = glewGetContext(); const std::vector< uint32_t >& names = image->findTransferers( eq::Frame::BUFFER_COLOR, glewContext ); for( std::vector< uint32_t >::const_iterator j = names.begin(); j != names.end(); ++j ) { _draw( co::uint128_t( )); image->allocDownloader( eq::Frame::BUFFER_COLOR, *j, glewContext ); image->setPixelViewport( pvp ); const uint32_t outputToken = image->getExternalFormat( eq::Frame::BUFFER_COLOR ); std::stringstream formatType; formatType << std::hex << *j << ':' << _enums[i].internalFormatString << '/' << outputToken << std::dec; // read glFinish(); size_t nLoops = 0; try { clock.reset(); while( clock.getTime64() < 100 /*ms*/ ) { image->startReadback( eq::Frame::BUFFER_COLOR, pvp, zoom, glObjects ); image->finishReadback( glObjects.glewGetContext( )); ++nLoops; } glFinish(); const float msec = clock.getTimef() / float( nLoops ); const GLenum error = glGetError(); // release mode if( error != GL_NO_ERROR ) throw eq::GLException( error ); const eq::PixelData& pixels = image->getPixelData( eq::Frame::BUFFER_COLOR ); const eq::Vector2i area( pixels.pvp.w, pixels.pvp.h ); const uint64_t dataSizeGPU = area.x() * area.y() * _enums[i].pixelSize; const uint64_t dataSizeCPU = image->getPixelDataSize( eq::Frame::BUFFER_COLOR ); _sendEvent( READBACK, msec, area, formatType.str(), dataSizeGPU, dataSizeCPU ); } catch( const eq::GLException& e ) { _sendEvent( READBACK, -static_cast<float>( e.glError ), eq::Vector2i(), formatType.str(), 0, 0 ); continue; } // write eq::Compositor::ImageOp op; op.channel = this; op.buffers = eq::Frame::BUFFER_COLOR; op.offset = offset; op.zoom = zoom; const uint64_t dataSizeCPU = image->getPixelDataSize( eq::Frame::BUFFER_COLOR ); try { clock.reset(); eq::Compositor::assembleImage( image, op ); glFinish(); const float msec = clock.getTimef() / float( nLoops ); const GLenum error = glGetError(); // release mode if( error != GL_NO_ERROR ) throw eq::Exception( error ); const eq::PixelData& pixels = image->getPixelData( eq::Frame::BUFFER_COLOR ); const eq::Vector2i area( pixels.pvp.w, pixels.pvp.h ); const uint64_t dataSizeGPU = image->getPixelDataSize( eq::Frame::BUFFER_COLOR ); _sendEvent( ASSEMBLE, msec, area, formatType.str(), dataSizeGPU, dataSizeCPU ); } catch( const eq::GLException& e ) // debug mode { _sendEvent( ASSEMBLE, -static_cast<float>( e.glError ), eq::Vector2i(), formatType.str(), 0, 0 ); } } } }
bool _sendKeyEvent(const int key, QQuickItem* rootItem) { QKeyEvent press(QEvent::KeyPress, key, Qt::NoModifier); QKeyEvent release(QEvent::KeyRelease, key, Qt::NoModifier); return _sendEvent(&press, rootItem) && _sendEvent(&release, rootItem); }
void Channel::_testDepthAssemble() { glGetError(); // reset //----- setup constant data const eq::Images& images = _frame.getImages(); eq::Image* image = images[ 0 ]; LBASSERT( image ); const eq::PixelViewport& pvp = getPixelViewport(); const eq::Vector2i offset( pvp.x, pvp.y ); eq::Vector2i area; area.x() = pvp.w; lunchbox::Clock clock; eq::util::ObjectManager& glObjects = getObjectManager(); const GLEWContext* glewContext = glewGetContext(); //----- test depth-based assembly algorithms for( unsigned i = 0; i < NUM_IMAGES; ++i ) { image = images[ i ]; LBASSERT( image ); image->setPixelViewport( pvp ); } area.y() = pvp.h; for( uint64_t i = 0; i < NUM_IMAGES; ++i ) { _draw( co::uint128_t( i ) ); // fill depth & color image image = images[ i ]; LBCHECK( image->allocDownloader( eq::Frame::BUFFER_COLOR, EQ_COMPRESSOR_TRANSFER_RGBA_TO_BGRA, glewContext )); LBCHECK( image->allocDownloader( eq::Frame::BUFFER_DEPTH, EQ_COMPRESSOR_TRANSFER_DEPTH_TO_DEPTH_UNSIGNED_INT, glewContext )); image->clearPixelData( eq::Frame::BUFFER_COLOR ); image->clearPixelData( eq::Frame::BUFFER_DEPTH ); image->startReadback( eq::Frame::BUFFER_COLOR | eq::Frame::BUFFER_DEPTH, pvp, eq::Zoom::NONE, glObjects ); image->finishReadback( glObjects.glewGetContext( )); LBASSERT( image->hasPixelData( eq::Frame::BUFFER_COLOR )); LBASSERT( image->hasPixelData( eq::Frame::BUFFER_DEPTH )); if( i == NUM_IMAGES-1 ) _saveImage( image,"EQ_COMPRESSOR_DATATYPE_DEPTH_UNSIGNED_INT", "depthAssemble" ); // benchmark eq::Compositor::ImageOp op; op.channel = this; op.buffers = eq::Frame::BUFFER_COLOR | eq::Frame::BUFFER_DEPTH; op.offset = offset; // fixed-function std::stringstream formatType; formatType << "depth, GL1.1, " << i+1 << " images"; clock.reset(); for( unsigned j = 0; j <= i; ++j ) eq::Compositor::assembleImageDB_FF( images[j], op ); float msec = clock.getTimef(); _sendEvent( ASSEMBLE, msec, area, formatType.str(), 0, 0 ); // GLSL if( GLEW_VERSION_2_0 ) { formatType.str(""); formatType << "depth, GLSL, " << i+1 << " images"; clock.reset(); for( unsigned j = 0; j <= i; ++j ) eq::Compositor::assembleImageDB_GLSL( images[j], op ); msec = clock.getTimef(); _sendEvent( ASSEMBLE, msec, area, formatType.str(), 0, 0 ); } // CPU formatType.str(""); formatType << "depth, CPU, " << i+1 << " images"; std::vector< eq::Frame* > frames; frames.push_back( &_frame ); clock.reset(); eq::Compositor::assembleFramesCPU( frames, this ); msec = clock.getTimef(); _sendEvent( ASSEMBLE, msec, area, formatType.str(), 0, 0 ); } }
void Channel::_testTiledOperations() { glGetError(); // reset //----- setup constant data const eq::Images& images = _frame.getImages(); LBASSERT( images[0] ); const eq::PixelViewport& pvp = getPixelViewport(); const eq::Vector2i offset( pvp.x, pvp.y ); eq::Vector2i area; area.x() = pvp.w; lunchbox::Clock clock; eq::util::ObjectManager& glObjects = getObjectManager(); const GLEWContext* glewContext = glewGetContext(); //----- test tiled assembly algorithms eq::PixelViewport subPVP = pvp; subPVP.h /= NUM_IMAGES; for( unsigned i = 0; i < NUM_IMAGES; ++i ) { LBASSERT( images[ i ] ); images[ i ]->setPixelViewport( subPVP ); } for( unsigned tiles = 0; tiles < NUM_IMAGES; ++tiles ) { EQ_GL_CALL( _draw( co::uint128_t( ))); area.y() = subPVP.h * (tiles+1); //---- readback of 'tiles' depth images std::stringstream formatType; formatType << tiles+1 << " depth tiles"; float msec = 0; for( unsigned j = 0; j <= tiles; ++j ) { subPVP.y = pvp.y + j * subPVP.h; eq::Image* image = images[ j ]; LBCHECK( image->allocDownloader( eq::Frame::BUFFER_DEPTH, EQ_COMPRESSOR_TRANSFER_DEPTH_TO_DEPTH_UNSIGNED_INT, glewContext )); image->clearPixelData( eq::Frame::BUFFER_DEPTH ); clock.reset(); image->startReadback( eq::Frame::BUFFER_DEPTH, subPVP, eq::Zoom::NONE, glObjects ); image->finishReadback( glObjects.glewGetContext( )); msec += clock.getTimef(); } _sendEvent( READBACK, msec, area, formatType.str(), 0, 0 ); if( tiles == NUM_IMAGES-1 ) for( unsigned j = 0; j <= tiles; ++j ) _saveImage( images[j], "EQ_COMPRESSOR_DATATYPE_DEPTH_UNSIGNED_INT", "tiles" ); //---- readback of 'tiles' color images formatType.str(""); formatType << tiles+1 << " color tiles"; msec = 0; for( unsigned j = 0; j <= tiles; ++j ) { subPVP.y = pvp.y + j * subPVP.h; eq::Image* image = images[ j ]; LBCHECK( image->allocDownloader( eq::Frame::BUFFER_COLOR, EQ_COMPRESSOR_TRANSFER_RGBA_TO_BGRA, glewContext )); image->clearPixelData( eq::Frame::BUFFER_COLOR ); clock.reset(); image->startReadback( eq::Frame::BUFFER_COLOR, subPVP, eq::Zoom::NONE, glObjects ); image->finishReadback( glObjects.glewGetContext( )); msec += clock.getTimef(); } _sendEvent( READBACK, msec, area, formatType.str(), 0, 0 ); if( tiles == NUM_IMAGES-1 ) for( unsigned j = 0; j <= tiles; ++j ) _saveImage( images[j],"EQ_COMPRESSOR_DATATYPE_BGRA","tiles" ); //---- benchmark assembly operations subPVP.y = pvp.y + tiles * subPVP.h; eq::Compositor::ImageOp op; op.channel = this; op.buffers = eq::Frame::BUFFER_COLOR | eq::Frame::BUFFER_DEPTH; op.offset = offset; // fixed-function formatType.str(""); formatType << "tiles, GL1.1, " << tiles+1 << " images"; clock.reset(); for( unsigned j = 0; j <= tiles; ++j ) eq::Compositor::assembleImage( images[j], op ); msec = clock.getTimef(); _sendEvent( ASSEMBLE, msec, area, formatType.str(), 0, 0 ); // CPU formatType.str(""); formatType << "tiles, CPU, " << tiles+1 << " images"; std::vector< eq::Frame* > frames; frames.push_back( &_frame ); clock.reset(); eq::Compositor::assembleFramesCPU( frames, this ); msec = clock.getTimef(); _sendEvent( ASSEMBLE, msec, area, formatType.str(), 0, 0 ); } }