Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 73cd3ed8 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

fixed dynamic creation of pipeline canvases

parent 21800549
...@@ -255,14 +255,25 @@ namespace campvis { ...@@ -255,14 +255,25 @@ namespace campvis {
// OpenGL job processor, since we need to create a new context. // OpenGL job processor, since we need to create a new context.
if (_initialized) { if (_initialized) {
GLJobProc.pause(); GLJobProc.pause();
{
tgt::QtThreadedCanvas* canvas = CtxtMgr.createContext(name, "CAMPVis", tgt::ivec2(512, 512));
tgt::GLContextScopedLock lock(canvas->getContext());
addPipelineImpl(canvas, name, pipeline);
}
GLJobProc.resume();
} }
else {
_mainWindow->addVisualizationPipelineWidget("foobar", new QWidget()); tgt::QtThreadedCanvas* canvas = CtxtMgr.createContext(name, "CAMPVis", tgt::ivec2(512, 512));
addPipelineImpl(canvas, name, pipeline);
}
s_PipelinesChanged();
}
void CampVisApplication::addPipelineImpl(tgt::QtThreadedCanvas* canvas, const std::string& name, AbstractPipeline* pipeline) {
// create canvas and painter for the pipeline and connect all together // create canvas and painter for the pipeline and connect all together
tgt::QtThreadedCanvas* canvas = CtxtMgr.createContext(name, "CAMPVis", tgt::ivec2(512, 512));
GLJobProc.registerContext(canvas); GLJobProc.registerContext(canvas);
_mainWindow->addVisualizationPipelineWidget(name, canvas);
canvas->init(); canvas->init();
CampVisPainter* painter = new CampVisPainter(canvas, pipeline); CampVisPainter* painter = new CampVisPainter(canvas, pipeline);
...@@ -273,16 +284,21 @@ namespace campvis { ...@@ -273,16 +284,21 @@ namespace campvis {
_pipelines.push_back(pipeline); _pipelines.push_back(pipeline);
if (_initialized) { if (_initialized) {
pipeline->setEnabled(false); LGL_ERROR;
pipeline->init(); pipeline->init();
LGL_ERROR;
painter->init(); painter->init();
pipeline->setEnabled(true); LGL_ERROR;
GLJobProc.resume();
} }
CtxtMgr.releaseCurrentContext(); CtxtMgr.releaseCurrentContext();
s_PipelinesChanged(); _mainWindow->addVisualizationPipelineWidget(name, canvas);
// enable pipeline and invalidate all processors
pipeline->setEnabled(true);
for (std::vector<AbstractProcessor*>::const_iterator it = pipeline->getProcessors().begin(); it != pipeline->getProcessors().end(); ++it) {
(*it)->invalidate(AbstractProcessor::INVALID_RESULT);
}
} }
void CampVisApplication::registerDockWidget(Qt::DockWidgetArea area, QDockWidget* dock) { void CampVisApplication::registerDockWidget(Qt::DockWidgetArea area, QDockWidget* dock) {
......
...@@ -130,6 +130,8 @@ namespace campvis { ...@@ -130,6 +130,8 @@ namespace campvis {
sigslot::signal0<> s_DataContainersChanged; sigslot::signal0<> s_DataContainersChanged;
private: private:
void addPipelineImpl(tgt::QtThreadedCanvas* canvas, const std::string& name, AbstractPipeline* pipeline);
/// All pipelines /// All pipelines
std::vector<AbstractPipeline*> _pipelines; std::vector<AbstractPipeline*> _pipelines;
/// All visualisations (i.e. Pipelines with their corresponding painters/canvases) /// All visualisations (i.e. Pipelines with their corresponding painters/canvases)
......
...@@ -246,7 +246,6 @@ namespace campvis { ...@@ -246,7 +246,6 @@ namespace campvis {
_layout->addWidget(lblOpacityBottom, 3, 0, 1, 1, Qt::AlignRight); _layout->addWidget(lblOpacityBottom, 3, 0, 1, 1, Qt::AlignRight);
_canvas = CtxtMgr.createContext("tfcanvas", "", tgt::ivec2(256, 128), tgt::GLCanvas::RGBA_BUFFER, 0, false); _canvas = CtxtMgr.createContext("tfcanvas", "", tgt::ivec2(256, 128), tgt::GLCanvas::RGBA_BUFFER, 0, false);
_canvas->doneCurrent();
GLJobProc.registerContext(_canvas); GLJobProc.registerContext(_canvas);
_canvas->setPainter(this, false); _canvas->setPainter(this, false);
_layout->addWidget(_canvas, 1, 1, 3, 3); _layout->addWidget(_canvas, 1, 1, 3, 3);
......
...@@ -232,7 +232,6 @@ namespace campvis { ...@@ -232,7 +232,6 @@ namespace campvis {
_layout->addWidget(lblOpacityBottom, 3, 0, 1, 1, Qt::AlignRight); _layout->addWidget(lblOpacityBottom, 3, 0, 1, 1, Qt::AlignRight);
_canvas = CtxtMgr.createContext("tfcanvas", "", tgt::ivec2(256, 128), tgt::GLCanvas::RGBA_BUFFER, 0, false); _canvas = CtxtMgr.createContext("tfcanvas", "", tgt::ivec2(256, 128), tgt::GLCanvas::RGBA_BUFFER, 0, false);
_canvas->doneCurrent();
GLJobProc.registerContext(_canvas); GLJobProc.registerContext(_canvas);
_canvas->setPainter(this, false); _canvas->setPainter(this, false);
_layout->addWidget(_canvas, 1, 1, 3, 3); _layout->addWidget(_canvas, 1, 1, 3, 3);
......
...@@ -45,6 +45,8 @@ namespace campvis { ...@@ -45,6 +45,8 @@ namespace campvis {
const QString& windowTitle = QString::fromStdString(name); const QString& windowTitle = QString::fromStdString(name);
_mdiSubWindow->setWindowTitle(windowTitle); _mdiSubWindow->setWindowTitle(windowTitle);
_pipelineWidget->setWindowTitle(windowTitle); _pipelineWidget->setWindowTitle(windowTitle);
_pipelineWidget->show();
_mdiArea->tileSubWindows();
connect(_mdiSubWindow, SIGNAL(s_positionChanged(const QPoint&)), connect(_mdiSubWindow, SIGNAL(s_positionChanged(const QPoint&)),
this, SLOT(trackMdiSubWindowsPosition(const QPoint&))); this, SLOT(trackMdiSubWindowsPosition(const QPoint&)));
......
...@@ -130,11 +130,9 @@ namespace campvis { ...@@ -130,11 +130,9 @@ namespace campvis {
ImageRepresentationLocal* toReturn = 0; ImageRepresentationLocal* toReturn = 0;
GLJobProc.pause(); GLJobProc.pause();
try { try {
tbb::mutex::scoped_lock lock(CtxtMgr.getGlMutex()); tgt::GLContextScopedLock lock(context->getContext());
context->getContext()->acquire();
WeaklyTypedPointer wtp = tester->getWeaklyTypedPointer(); WeaklyTypedPointer wtp = tester->getWeaklyTypedPointer();
toReturn = convertToGenericLocal(source, wtp); toReturn = convertToGenericLocal(source, wtp);
CtxtMgr.releaseCurrentContext();
} }
catch (...) { catch (...) {
LERROR("An unknown error occured during conversion..."); LERROR("An unknown error occured during conversion...");
......
// ================================================================================================ // ================================================================================================
// //
// This file is part of the CAMPVis Software Framework. // This file is part of the CAMPVis Software Framework.
...@@ -79,7 +80,7 @@ namespace campvis { ...@@ -79,7 +80,7 @@ namespace campvis {
{ {
tgtAssert(_data != 0, "Pointer to the DataContainer for this pipeline must not be 0!"); tgtAssert(_data != 0, "Pointer to the DataContainer for this pipeline must not be 0!");
_enabled = true; _enabled = false;
addProperty(&_renderTargetID); addProperty(&_renderTargetID);
addProperty(&_canvasSize); addProperty(&_canvasSize);
......
...@@ -67,7 +67,7 @@ namespace campvis { ...@@ -67,7 +67,7 @@ namespace campvis {
} }
void AutoEvaluationPipeline::onProcessorInvalidated(AbstractProcessor* processor) { void AutoEvaluationPipeline::onProcessorInvalidated(AbstractProcessor* processor) {
if (_canvas == 0) if (_canvas == 0 || _enabled == false)
return; return;
tbb::concurrent_hash_map<AbstractProcessor*, bool>::const_accessor a; tbb::concurrent_hash_map<AbstractProcessor*, bool>::const_accessor a;
......
...@@ -28,6 +28,7 @@ namespace tgt { ...@@ -28,6 +28,7 @@ namespace tgt {
_contexts.insert(std::make_pair(key, toReturn)); _contexts.insert(std::make_pair(key, toReturn));
toReturn->makeCurrent(); toReturn->makeCurrent();
_currentContext = toReturn->getContext();
// Init GLEW for this context // Init GLEW for this context
GLenum err = glewInit(); GLenum err = glewInit();
if (err != GLEW_OK) { if (err != GLEW_OK) {
...@@ -36,6 +37,7 @@ namespace tgt { ...@@ -36,6 +37,7 @@ namespace tgt {
std::cerr << "glewInit failed, error: " << glewGetErrorString(err) << std::endl; std::cerr << "glewInit failed, error: " << glewGetErrorString(err) << std::endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
releaseCurrentContext();
return toReturn; return toReturn;
} }
...@@ -77,11 +79,13 @@ namespace tgt { ...@@ -77,11 +79,13 @@ namespace tgt {
} }
void QtContextManager::releaseCurrentContext() { void QtContextManager::releaseCurrentContext() {
glFlush(); glFinish();
setCurrent(0); setCurrent(0);
} }
QtCanvas* QtContextManager::getCurrentContext() const { QtCanvas* QtContextManager::getCurrentContext() const {
if (_currentContext == 0)
return 0;
return _currentContext->getCanvas(); return _currentContext->getCanvas();
} }
......
...@@ -34,7 +34,8 @@ namespace tgt { ...@@ -34,7 +34,8 @@ namespace tgt {
/** /**
* Creates a new OpenGL context in a QtThreadedCanvas with the given arguments. * Creates a new OpenGL context in a QtThreadedCanvas with the given arguments.
* Parameters are the same as in QtThreadedCanvas() but context sharing is enables per default. * Parameters are the same as in QtThreadedCanvas() but context sharing is enables per default.
* The newly created context will be active, but the OpenGL mutex not be locked. *
* \note Must be called with the OpenGL mutex acquired!
* *
* \note The created canvas/context is owned by this ContextManager. Hence, you may not * \note The created canvas/context is owned by this ContextManager. Hence, you may not
* delete it yourself! * delete it yourself!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment