The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated 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 dc3e7de1 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Adjusted test-campvis to the new CAMPVis init API.

parent e0d06197
......@@ -42,6 +42,7 @@
#include "cgt/shadermanager.h"
#include "cgt/qt/qtthreadedcanvas.h"
#include "core/init.h"
#include "core/tools/simplejobprocessor.h"
#include "core/tools/quadrenderer.h"
......@@ -54,58 +55,16 @@ static const std::string loggerCat_;
void init() {
// Make Xlib and GLX thread safe under X11
QApplication::setAttribute(Qt::AA_X11InitThreads);
sigslot::signal_manager::init();
sigslot::signal_manager::getRef().setSignalHandlingMode(sigslot::signal_manager::FORCE_DIRECT);
sigslot::signal_manager::getRef().start();
cgt::GlContextManager::init();
cgt::OpenGLJobProcessor::init();
campvis::SimpleJobProcessor::init();
cgtAssert(_initialized == false, "Tried to initialize CampVisApplication twice.");
// Init CGT
cgt::InitFeature::Features featureset = cgt::InitFeature::ALL;
cgt::init(featureset);
LogMgr.getConsoleLog()->addCat("", true, cgt::Info);
std::vector<std::string> searchPaths;
#ifdef CAMPVIS_SOURCE_DIR
searchPaths.push_back(CAMPVIS_SOURCE_DIR);
#endif
// create a local OpenGL context and init GL
cgt::QtThreadedCanvas* backgroundCanvas = new cgt::QtThreadedCanvas("", cgt::ivec2(16, 16));
GLCtxtMgr.registerContextAndInitGlew(backgroundCanvas, "Background Context");
GLCtxtMgr.releaseContext(backgroundCanvas, false);
GLJobProc.setContext(backgroundCanvas);
GLJobProc.start();
campvis::init(backgroundCanvas, searchPaths);
_localContext = new cgt::QtThreadedCanvas("", cgt::ivec2(16, 16));
cgt::GlContextManager::getRef().registerContextAndInitGlew(_localContext, "Local Context");
cgt::initGL(featureset);
ShdrMgr.setDefaultGlslVersion("330");
campvis::QuadRenderer::init();
#ifdef CAMPVIS_SOURCE_DIR
{
std::string sourcePath = CAMPVIS_SOURCE_DIR;
ShdrMgr.addPath(sourcePath);
ShdrMgr.addPath(sourcePath + "/core/glsl");
}
#endif
// ensure matching OpenGL specs
LINFO("Using Graphics Hardware " << GpuCaps.getVendorAsString() << " " << GpuCaps.getGlRendererString() << " on " << GpuCaps.getOSVersionString());
LINFO("Supported OpenGL " << GpuCaps.getGlVersion() << ", GLSL " << GpuCaps.getShaderVersion());
if (GpuCaps.getGlVersion() < cgt::GpuCapabilities::GlVersion::CGT_GL_VERSION_3_3) {
LERROR("Your system does not support OpenGL 3.3, which is mandatory. CAMPVis will probably not work as intended.");
}
if (GpuCaps.getShaderVersion() < cgt::GpuCapabilities::GlVersion::SHADER_VERSION_330) {
LERROR("Your system does not support GLSL Shader Version 3.30, which is mandatory. CAMPVis will probably not work as intended.");
}
GLCtxtMgr.releaseContext(_localContext, false);
_initialized = true;
......@@ -113,26 +72,7 @@ void init() {
void deinit() {
cgtAssert(_initialized, "Tried to deinitialize uninitialized CampVisApplication.");
{
// Deinit everything OpenGL related using the local context.
cgt::GLContextScopedLock lock(_localContext);
campvis::QuadRenderer::deinit();
campvis::SimpleJobProcessor::deinit();
GLJobProc.stop();
cgt::OpenGLJobProcessor::deinit();
cgt::deinitGL();
}
cgt::GlContextManager::deinit();
cgt::deinit();
sigslot::signal_manager::getRef().stop();
sigslot::signal_manager::deinit();
campvis::deinit();
_initialized = false;
}
......@@ -146,14 +86,17 @@ GTEST_API_ int main(int argc, char **argv) {
QApplication::setAttribute(Qt::AA_X11InitThreads);
testing::InitGoogleTest(&argc, argv);
init();
int ret;
init();
{
std::thread testThread([&] () {
cgt::GLContextScopedLock lock(_localContext);
ret= RUN_ALL_TESTS();
}
app->exit();
});
app->exec();
deinit();
delete app;
......
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