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

Commit 4700bbba authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Removed unlockInExtraThread flag from AbstractProcessor::process() - this is...

Removed unlockInExtraThread flag from AbstractProcessor::process() - this is no longer needed as signal handling is done asynchroneously now anyway.

#ref 384

Conflicts:
	core/pipeline/abstractprocessor.cpp

Conflicts:
	core/pipeline/abstractprocessor.cpp
	core/pipeline/abstractprocessor.h
parent 8671e65c
...@@ -43,11 +43,6 @@ ...@@ -43,11 +43,6 @@
#define CAMPVIS_CORE_API #define CAMPVIS_CORE_API
#endif #endif
#endif #endif
#ifdef DLL_TEMPLATE_INST
// declare and instantiate sigslot templates for symbol ex-/import
class CAMPVIS_CORE_API sigslot::SIGSLOT_DEFAULT_MT_POLICY;
template class CAMPVIS_CORE_API sigslot::has_slots<sigslot::SIGSLOT_DEFAULT_MT_POLICY>;
#endif
#else #else
// building/including static library -> do nothing // building/including static library -> do nothing
#define CAMPVIS_CORE_API #define CAMPVIS_CORE_API
......
...@@ -142,7 +142,7 @@ namespace campvis { ...@@ -142,7 +142,7 @@ namespace campvis {
return *_data; return *_data;
} }
void AbstractPipeline::executeProcessor(AbstractProcessor* processor, bool unlockInExtraThred) { void AbstractPipeline::executeProcessor(AbstractProcessor* processor) {
tgtAssert(processor != 0, "Processor must not be 0."); tgtAssert(processor != 0, "Processor must not be 0.");
// execute processor if needed // execute processor if needed
...@@ -219,12 +219,12 @@ namespace campvis { ...@@ -219,12 +219,12 @@ namespace campvis {
tgtAssert(_canvas != 0, "Set a valid canvas before calling this method!"); tgtAssert(_canvas != 0, "Set a valid canvas before calling this method!");
GLJobProc.enqueueJob( GLJobProc.enqueueJob(
_canvas, _canvas,
makeJobOnHeap<AbstractPipeline, AbstractProcessor*, bool>(this, &AbstractPipeline::executeProcessor, processor, true), makeJobOnHeap<AbstractPipeline, AbstractProcessor*>(this, &AbstractPipeline::executeProcessor, processor),
OpenGLJobProcessor::SerialJob); OpenGLJobProcessor::SerialJob);
} }
void AbstractPipeline::executeProcessorAndCheckOpenGLState(AbstractProcessor* processor) { void AbstractPipeline::executeProcessorAndCheckOpenGLState(AbstractProcessor* processor) {
AbstractPipeline::executeProcessor(processor, true); AbstractPipeline::executeProcessor(processor);
#ifdef CAMPVIS_DEBUG #ifdef CAMPVIS_DEBUG
tgtAssert(getGlBool(GL_DEPTH_TEST) == false, "Invalid OpenGL state after processor execution, GL_DEPTH_TEST != false."); tgtAssert(getGlBool(GL_DEPTH_TEST) == false, "Invalid OpenGL state after processor execution, GL_DEPTH_TEST != false.");
......
...@@ -177,9 +177,8 @@ namespace campvis { ...@@ -177,9 +177,8 @@ namespace campvis {
/** /**
* Executes the processor \a processor on the pipeline's data and locks its properties meanwhile. * Executes the processor \a processor on the pipeline's data and locks its properties meanwhile.
* \param processor Processor to execute. * \param processor Processor to execute.
* \param unlockInExtraThred If true, the call to processor->unlock() will be done in an extra thread.
*/ */
void executeProcessor(AbstractProcessor* processor, bool unlockInExtraThred); void executeProcessor(AbstractProcessor* processor);
/** /**
* Acquires and locks the OpenGL context, executes the processor \a processor on the pipeline's data * Acquires and locks the OpenGL context, executes the processor \a processor on the pipeline's data
......
...@@ -132,7 +132,7 @@ namespace campvis { ...@@ -132,7 +132,7 @@ namespace campvis {
} }
void AbstractProcessor::process(DataContainer& data, bool unlockInExtraThread) { void AbstractProcessor::process(DataContainer& data) {
if (hasInvalidShader()) { if (hasInvalidShader()) {
updateShader(); updateShader();
validate(INVALID_SHADER); validate(INVALID_SHADER);
...@@ -143,7 +143,7 @@ namespace campvis { ...@@ -143,7 +143,7 @@ namespace campvis {
} }
// use a scoped lock for exception safety // use a scoped lock for exception safety
AbstractProcessor::ScopedLock lock(this, unlockInExtraThread); AbstractProcessor::ScopedLock lock(this);
tgtAssert(_locked == true, "Processor not locked, this should not happen!"); tgtAssert(_locked == true, "Processor not locked, this should not happen!");
if (hasInvalidResult()) { if (hasInvalidResult()) {
...@@ -173,23 +173,4 @@ namespace campvis { ...@@ -173,23 +173,4 @@ namespace campvis {
tbb::spin_rw_mutex::scoped_lock lock(_mtxInvalidationMap, true); tbb::spin_rw_mutex::scoped_lock lock(_mtxInvalidationMap, true);
_invalidationMap[&prop] = invalidationLevel; _invalidationMap[&prop] = invalidationLevel;
} }
// ================================================================================================
AbstractProcessor::ScopedLock::ScopedLock(AbstractProcessor* p, bool unlockInExtraThread)
: _p(p)
, _unlockInExtraThread(unlockInExtraThread)
{
_p->lockProcessor();
}
AbstractProcessor::ScopedLock::~ScopedLock() {
// Unlocking processors might be expensive, since a long chain of invalidations might be started
// -> do this in another thread...
if (_unlockInExtraThread)
SimpleJobProc.enqueueJob(makeJob(_p, &AbstractProcessor::unlockProcessor));
else
_p->unlockProcessor();
}
} }
...@@ -66,17 +66,22 @@ namespace campvis { ...@@ -66,17 +66,22 @@ namespace campvis {
/** /**
* Constructs a new Scoped lock, locking \a p and unlocking \a p on destruction. * Constructs a new Scoped lock, locking \a p and unlocking \a p on destruction.
* \param p Processor to lock * \param p Processor to lock
* \param unlockInExtraThread Unlock \a p in extra thread (since this might be an expensive operation)
*/ */
ScopedLock(AbstractProcessor* p, bool unlockInExtraThread); ScopedLock(AbstractProcessor* p)
: _p(p)
{
_p->lockProcessor();
};
/// Destructor, unlocks the processor /// Destructor, unlocks the processor
~ScopedLock(); ~ScopedLock() {
_p->unlockProcessor();
};
AbstractProcessor* _p; ///< The processor to lock AbstractProcessor* _p; ///< The processor to lock
bool _unlockInExtraThread; ///< Unlock _p in extra thread (since this might be an expensive operation)
}; };
/** /**
* Available invalidation levels * Available invalidation levels
*/ */
...@@ -175,9 +180,8 @@ namespace campvis { ...@@ -175,9 +180,8 @@ namespace campvis {
* with respect to the current invalidation level. * with respect to the current invalidation level.
* *
* \param data DataContainer to work on. * \param data DataContainer to work on.
* \param unlockInExtraThread Flag whether the processor shall be unlockedin an extra thread (since unlock might be expensive).
**/ **/
void process(DataContainer& data, bool unlockInExtraThread = false); void process(DataContainer& data);
/** /**
* Gets the flag whether this processor is currently enabled. * Gets the flag whether this processor is currently enabled.
......
...@@ -75,7 +75,7 @@ namespace campvis { ...@@ -75,7 +75,7 @@ namespace campvis {
OpenGLJobProcessor::SerialJob); OpenGLJobProcessor::SerialJob);
} }
else { else {
SimpleJobProc.enqueueJob(makeJob<AutoEvaluationPipeline, AbstractProcessor*, bool>(this, &AutoEvaluationPipeline::executeProcessor, processor, false)); SimpleJobProc.enqueueJob(makeJob<AutoEvaluationPipeline, AbstractProcessor*>(this, &AutoEvaluationPipeline::executeProcessor, processor));
} }
} }
else { else {
......
...@@ -41,7 +41,7 @@ namespace campvis { ...@@ -41,7 +41,7 @@ namespace campvis {
* generateHeader() to define computeGradient(tex, texParams, texCoords) in GLSL calling * generateHeader() to define computeGradient(tex, texParams, texCoords) in GLSL calling
* the selected function. * the selected function.
*/ */
class CAMPVIS_CORE_API ProcessorDecoratorGradient : public AbstractProcessorDecorator, public sigslot::has_slots<> { class CAMPVIS_CORE_API ProcessorDecoratorGradient : public AbstractProcessorDecorator, public sigslot::has_slots {
public: public:
/// Method for online-calculating gradients /// Method for online-calculating gradients
enum GradientMethod { enum GradientMethod {
......
...@@ -242,6 +242,7 @@ namespace sigslot { ...@@ -242,6 +242,7 @@ namespace sigslot {
void erase(const const_iterator& it) { *it = nullptr; }; void erase(const const_iterator& it) { *it = nullptr; };
void erase(const const_iterator& begin, const const_iterator& end); void erase(const const_iterator& begin, const const_iterator& end);
bool empty() const;
protected: protected:
StorageType _storage; StorageType _storage;
...@@ -272,6 +273,20 @@ namespace sigslot { ...@@ -272,6 +273,20 @@ namespace sigslot {
} }
} }
template<typename T>
bool sigslot::concurrent_pointer_list<T>::empty() const {
iterator it = begin();
iterator itEnd = end();
for (/* nothing here */; it != itEnd; ++it) {
if (*it != nullptr) {
return false;
}
}
return true;
}
// ================================================================================================ // ================================================================================================
/// Base class for signal handles that provides an interface to emit the signal. /// Base class for signal handles that provides an interface to emit the signal.
...@@ -421,14 +436,14 @@ namespace sigslot { ...@@ -421,14 +436,14 @@ namespace sigslot {
// ================================================================================================ // ================================================================================================
class _signal_base class SIGSLOT_API _signal_base
{ {
public: public:
virtual void slot_disconnect(has_slots* pslot) = 0; virtual void slot_disconnect(has_slots* pslot) = 0;
virtual void slot_duplicate(has_slots const* poldslot, has_slots* pnewslot) = 0; virtual void slot_duplicate(has_slots const* poldslot, has_slots* pnewslot) = 0;
}; };
class has_slots class SIGSLOT_API has_slots
{ {
private: private:
typedef concurrent_pointer_list<_signal_base> sender_set; typedef concurrent_pointer_list<_signal_base> sender_set;
......
...@@ -35,7 +35,7 @@ namespace campvis { ...@@ -35,7 +35,7 @@ namespace campvis {
/** /**
* Data object storing information about selected predicates and their settings. * Data object storing information about selected predicates and their settings.
*/ */
class PointPredicateHistogram : public sigslot::has_slots<> { class PointPredicateHistogram : public sigslot::has_slots {
public: public:
/** /**
......
...@@ -45,7 +45,7 @@ namespace campvis { ...@@ -45,7 +45,7 @@ namespace campvis {
* others, they will share the pointer (instead of copying around as with other properties)! * others, they will share the pointer (instead of copying around as with other properties)!
* Therefore, we use a std::shared_ptr. * Therefore, we use a std::shared_ptr.
*/ */
class PointPredicateHistogramProperty : public AbstractProperty, public sigslot::has_slots<> { class PointPredicateHistogramProperty : public AbstractProperty, public sigslot::has_slot {
public: public:
/** /**
* Creates a new PointPredicateHistogramProperty * Creates a new PointPredicateHistogramProperty
......
...@@ -325,7 +325,7 @@ namespace campvis { ...@@ -325,7 +325,7 @@ namespace campvis {
} }
// lock this processor, so that the slice orientation's setting does not change // lock this processor, so that the slice orientation's setting does not change
AbstractProcessor::ScopedLock lock(this, false); AbstractProcessor::ScopedLock lock(this);
if (me->y() <= p_sliceRenderSize.getValue().y) { if (me->y() <= p_sliceRenderSize.getValue().y) {
_sliceExtractor.p_sliceOrientation.selectByOption(SliceExtractor::XY_PLANE); _sliceExtractor.p_sliceOrientation.selectByOption(SliceExtractor::XY_PLANE);
......
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