Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

Commit 1365bcd6 authored by schultezub's avatar schultezub
Browse files

* bugfix in OpenGLJobProcessor scheduling algorithm

 * added CameraProperty::setWindowRatio()
 * improved OpenCL error reporting

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@257 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 203e285e
......@@ -191,9 +191,6 @@ namespace TUMVis {
for (std::vector<PipelineEvaluator*>::iterator it = _pipelineEvaluators.begin(); it != _pipelineEvaluators.end(); ++it) {
(*it)->start();
}
// for (std::vector< std::pair<VisualizationPipeline*, TumVisPainter*> >::iterator it = _visualizations.begin(); it != _visualizations.end(); ++it) {
// it->second->start();
// }
// Start QApplication
int toReturn = QApplication::exec();
......@@ -202,9 +199,6 @@ namespace TUMVis {
for (std::vector<PipelineEvaluator*>::iterator it = _pipelineEvaluators.begin(); it != _pipelineEvaluators.end(); ++it) {
(*it)->stop();
}
// for (std::vector< std::pair<VisualizationPipeline*, TumVisPainter*> >::iterator it = _visualizations.begin(); it != _visualizations.end(); ++it) {
// it->second->stop();
// }
return toReturn;
}
......
......@@ -99,8 +99,8 @@ namespace TUMVis {
/**
* Adds a visualization pipeline (i.e. a pipeline that needs a OpenGL context).
* For each added pipeline, two OpenGL contexts will be created (one for the evaluation,
* one for the rendering).
* For each added pipeline, an OpenGL context will be created (for the evaluation
* and rendering).
*
* \note You do \b not need to call addPipeline.
* \param name Name of the OpenGL context to create for the pipeline.
......
......@@ -40,4 +40,14 @@ namespace TUMVis {
CameraProperty::~CameraProperty() {
}
void CameraProperty::setWindowRatio(float r) {
if (r == 0) {
LERROR("Window ratio must not be 0.");
return;
}
tgt::Camera c = getValue();
c.setWindowRatio(r);
setValue(c);
}
}
......@@ -51,6 +51,12 @@ namespace TUMVis {
virtual ~CameraProperty();
/**
* Sets the camera's window ratio.
* \param r The new camera's window ratio (viewport.x / viewport.y)
*/
void setWindowRatio(float r);
protected:
static const std::string loggerCat_;
......
......@@ -83,6 +83,9 @@ namespace TUMVis {
if (a->second->empty())
continue;
// we will have work, so update the flag
hadWork = true;
// perform context switch if necessary
if (_currentContext != context) {
if (_currentContext != 0) {
......@@ -119,9 +122,6 @@ namespace TUMVis {
delete jobToDo;
a->second->_paintJob = 0;
}
// update hadWork flag
hadWork = (jobToDo != 0);
}
if (! hadWork) {
......
......@@ -23,7 +23,7 @@
#include "kisscl/stringutils.h"
namespace kisscl {
std::string clErrorToString(cl_int err) {
std::string clErrorToString(cl_int err, const char* code) {
std::string toReturn;
switch(err) {
case(CL_SUCCESS): toReturn = "CL_SUCCESS"; break;
......@@ -78,17 +78,19 @@ namespace kisscl {
}
std::ostringstream tmp;
tmp << toReturn << " (" << (int)err << ")";
if (code != 0)
tmp << ", caused by: " << code;
return tmp.str();
}
cl_int _lCLError(cl_int err, int line, const char* file) {
cl_int _lCLError(cl_int err, int line, const char* file, const char* code) {
if (err != CL_SUCCESS) {
std::ostringstream tmp2, loggerCat;
if (file) {
tmp2 << " File: " << file << "@" << line;
loggerCat << "cl-error:" << file << ':' << line;
}
LogMgr.log(loggerCat.str(), tgt::Error, clErrorToString(err), tmp2.str());
LogMgr.log(loggerCat.str(), tgt::Error, clErrorToString(err, code), tmp2.str());
}
return err;
}
......
......@@ -235,7 +235,7 @@ namespace kisscl {
* \param err OpenCL error code.
* \return String representation of the error code.
*/
std::string clErrorToString(cl_int err);
std::string clErrorToString(cl_int err, const char* code);
/**
* Helper function for debugging OpenCL errors.
......@@ -244,9 +244,9 @@ namespace kisscl {
* \param file code file
* \return err
*/
cl_int _lCLError(cl_int err, int line, const char* file);
cl_int _lCLError(cl_int err, int line, const char* file, const char* code);
#define LCL_ERROR(err) _lCLError(err, __LINE__, __FILE__)
#define LCL_ERROR(err) _lCLError(err, __LINE__, __FILE__, #err)
/**
......
......@@ -142,14 +142,14 @@ namespace TUMVis {
if (! _eepGenerator.getInvalidationLevel().isValid()) {
lockGLContextAndExecuteProcessor(&_eepGenerator);
}
if (! _eepGenerator.getInvalidationLevel().isValid() || !_drrraycater.getInvalidationLevel().isValid()) {
if (!_drrraycater.getInvalidationLevel().isValid()) {
lockGLContextAndExecuteProcessor(&_drrraycater);
}
if (! _eepGenerator.getInvalidationLevel().isValid() || !_simpleRaycaster.getInvalidationLevel().isValid()) {
if (!_simpleRaycaster.getInvalidationLevel().isValid()) {
lockGLContextAndExecuteProcessor(&_simpleRaycaster);
}
if (! _eepGenerator.getInvalidationLevel().isValid() || !_clRaycaster.getInvalidationLevel().isValid()) {
//lockGLContextAndExecuteProcessor(&_clRaycaster);
if (!_clRaycaster.getInvalidationLevel().isValid()) {
lockGLContextAndExecuteProcessor(&_clRaycaster);
}
}
......@@ -159,6 +159,8 @@ namespace TUMVis {
void DVRVis::onRenderTargetSizeChanged(const AbstractProperty* prop) {
_trackballEH->setViewportSize(_renderTargetSize.getValue());
float ratio = static_cast<float>(_renderTargetSize.getValue().x) / static_cast<float>(_renderTargetSize.getValue().y);
_camera.setWindowRatio(ratio);
}
}
\ No newline at end of file
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