Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 25e14d19 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Various fixes/improvements

* Fixed AutoEvaluationPipeline missing some updates
* Fixed AutoEvaluationPipeline::executePipeline() to execute processors too often
* Fixed ParticleFlowRenderer overwriting bound FBO
* Added Debug checks to tgt::FramebufferObject and tgt::Shader to print warnings when FBO/Shader activation would overwrite an already active FBO/Shader
parent cb736ee0
......@@ -37,30 +37,6 @@
#include "core/pipeline/abstractprocessor.h"
#ifdef CAMPVIS_DEBUG
// Anonymous OpenGL helper functions
namespace {
GLboolean getGlBool(GLenum param) {
GLboolean toReturn;
glGetBooleanv(param, &toReturn);
return toReturn;
};
GLint getGlInt(GLenum param) {
GLint toReturn;
glGetIntegerv(param, &toReturn);
return toReturn;
};
GLfloat getGlFloat(GLenum param) {
GLfloat toReturn;
glGetFloatv(param, &toReturn);
return toReturn;
}
}
#endif
namespace campvis {
const std::string AbstractPipeline::loggerCat_ = "CAMPVis.core.datastructures.AbstractPipeline";
......@@ -211,23 +187,23 @@ namespace campvis {
AbstractPipeline::executeProcessor(processor);
#ifdef CAMPVIS_DEBUG
tgtAssert(getGlBool(GL_DEPTH_TEST) == false, "Invalid OpenGL state after processor execution, GL_DEPTH_TEST != false.");
tgtAssert(getGlBool(GL_SCISSOR_TEST) == false, "Invalid OpenGL state after processor execution, GL_SCISSOR_TEST != false.");
tgtAssert(tgt::getGlBool(GL_DEPTH_TEST) == false, "Invalid OpenGL state after processor execution, GL_DEPTH_TEST != false.");
tgtAssert(tgt::getGlBool(GL_SCISSOR_TEST) == false, "Invalid OpenGL state after processor execution, GL_SCISSOR_TEST != false.");
tgtAssert(getGlInt(GL_CULL_FACE_MODE) == GL_BACK, "Invalid OpenGL state after processor execution, GL_CULL_FACE_MODE != GL_BACk.");
tgtAssert(getGlInt(GL_DEPTH_FUNC) == GL_LESS, "Invalid OpenGL state after processor execution, GL_DEPTH_FUNC != GL_LESS.");
tgtAssert(tgt::getGlInt(GL_CULL_FACE_MODE) == GL_BACK, "Invalid OpenGL state after processor execution, GL_CULL_FACE_MODE != GL_BACk.");
tgtAssert(tgt::getGlInt(GL_DEPTH_FUNC) == GL_LESS, "Invalid OpenGL state after processor execution, GL_DEPTH_FUNC != GL_LESS.");
tgtAssert(getGlFloat(GL_DEPTH_CLEAR_VALUE) == 1.f, "Invalid OpenGL state after processor execution, GL_DEPTH_CLEAR_VALUE != 1.f.");
tgtAssert(tgt::getGlFloat(GL_DEPTH_CLEAR_VALUE) == 1.f, "Invalid OpenGL state after processor execution, GL_DEPTH_CLEAR_VALUE != 1.f.");
tgtAssert(getGlFloat(GL_RED_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_RED_SCALE != 1.f.");
tgtAssert(getGlFloat(GL_GREEN_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_GREEN_SCALE != 1.f.");
tgtAssert(getGlFloat(GL_BLUE_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_BLUE_SCALE != 1.f.");
tgtAssert(getGlFloat(GL_ALPHA_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_ALPHA_SCALE != 1.f.");
tgtAssert(tgt::getGlFloat(GL_RED_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_RED_SCALE != 1.f.");
tgtAssert(tgt::getGlFloat(GL_GREEN_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_GREEN_SCALE != 1.f.");
tgtAssert(tgt::getGlFloat(GL_BLUE_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_BLUE_SCALE != 1.f.");
tgtAssert(tgt::getGlFloat(GL_ALPHA_SCALE) == 1.f, "Invalid OpenGL state after processor execution, GL_ALPHA_SCALE != 1.f.");
tgtAssert(getGlFloat(GL_RED_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_RED_BIAS != 0.f.");
tgtAssert(getGlFloat(GL_GREEN_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_GREEN_BIAS != 0.f.");
tgtAssert(getGlFloat(GL_BLUE_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_BLUE_BIAS != 0.f.");
tgtAssert(getGlFloat(GL_ALPHA_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_ALPHA_BIAS != 0.f.");
tgtAssert(tgt::getGlFloat(GL_RED_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_RED_BIAS != 0.f.");
tgtAssert(tgt::getGlFloat(GL_GREEN_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_GREEN_BIAS != 0.f.");
tgtAssert(tgt::getGlFloat(GL_BLUE_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_BLUE_BIAS != 0.f.");
tgtAssert(tgt::getGlFloat(GL_ALPHA_BIAS) == 0.f, "Invalid OpenGL state after processor execution, GL_ALPHA_BIAS != 0.f.");
#endif
}
......
......@@ -49,9 +49,13 @@ namespace campvis {
for (std::vector<AbstractProcessor*>::iterator it = _processors.begin(); it != _processors.end(); ++it) {
(*it)->s_invalidated.connect(this, &AutoEvaluationPipeline::onProcessorInvalidated);
}
_data->s_dataAdded.connect(this, &AutoEvaluationPipeline::onDataContainerDataAdded);
}
void AutoEvaluationPipeline::deinit() {
_data->s_dataAdded.disconnect(this);
for (std::vector<AbstractProcessor*>::iterator it = _processors.begin(); it != _processors.end(); ++it) {
(*it)->s_invalidated.disconnect(this);
}
......@@ -74,11 +78,10 @@ namespace campvis {
}
void AutoEvaluationPipeline::executePipeline() {
// execute each processor (we do this n*n times, as we might have a complex dependency graph)
// execute each processor once
// (AbstractProcessor::process() takes care of executing only invalid processors)
for (size_t i = 0; i < _processors.size(); ++i) {
for (size_t i = 0; i < _processors.size(); ++i) {
_processors[i]->process(getDataContainer());
}
_processors[i]->process(getDataContainer());
}
}
......
......@@ -66,7 +66,8 @@ namespace campvis {
: _parentProcessor(vp)
, _fbo(vp->_fbo)
{
tgtAssert(_fbo != 0, "FBO must not be 0.");
tgtAssert(_fbo != nullptr, "FBO must not be 0.");
tgtAssert(_fbo->getId() != 0, "The FBO's OpenGL ID is 0, this is wrong.");
_fbo->activate();
const tgt::ivec2& windowSize = vp->getEffectiveViewportSize();
......
......@@ -45,6 +45,11 @@ FramebufferObject::~FramebufferObject()
void FramebufferObject::activate()
{
#if TGT_DEBUG
if (tgt::getGlInt(GL_FRAMEBUFFER_BINDING) != 0)
LWARNING("Binding a new FBO while another FBO is bound. Do you really want to do this?");
#endif
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, id_);
LGL_ERROR;
}
......
......@@ -471,10 +471,15 @@ void Shader::detachObject(ShaderObject* obj) {
void Shader::activate() {
if (isLinked_)
glUseProgram(id_);
activate(id_);
}
void Shader::activate(GLint id) {
#if TGT_DEBUG
if (tgt::getGlInt(GL_CURRENT_PROGRAM) != 0)
LWARNING("Binding a new Shader while another Shader is active. Do you really want to do this?");
#endif
glUseProgram(id);
}
......
......@@ -45,4 +45,22 @@ GLenum _lGLError(int line, const char* file) {
return err;
}
GLboolean getGlBool(GLenum param) {
GLboolean toReturn;
glGetBooleanv(param, &toReturn);
return toReturn;
}
GLint getGlInt(GLenum param) {
GLint toReturn;
glGetIntegerv(param, &toReturn);
return toReturn;
}
GLfloat getGlFloat(GLenum param) {
GLfloat toReturn;
glGetFloatv(param, &toReturn);
return toReturn;
}
} // namespace tgt
......@@ -40,6 +40,12 @@
namespace tgt {
TGT_API GLenum _lGLError(int line, const char* file);
GLboolean getGlBool(GLenum param);;
GLint getGlInt(GLenum param);;
GLfloat getGlFloat(GLenum param);
} // namespace tgt
#ifdef TGT_DEBUG
......
......@@ -202,16 +202,16 @@ namespace campvis {
}
// stage 2: render particles
FramebufferActivationGuard fag(this);
createAndAttachColorTexture();
createAndAttachDepthTexture();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
tgt::TextureUnit tfUnit;
_shader->selectSubroutine(tgt::ShaderObject::VERTEX_SHADER, "render");
_shader->setUniform("_coloringMode", p_coloring.getValue());
p_transferFunction.getTF()->bind(_shader, tfUnit);
FramebufferActivationGuard fag(this);
createAndAttachColorTexture();
createAndAttachDepthTexture();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_POINT_SPRITE);
glBindVertexArray((_drawBuffer == 1) ? _vaoA->getId() : _vaoB->getId());
glPointSize(static_cast<GLfloat>(p_pointSize.getValue()));
......
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