From 6488e46cc71f93e392a2f2d0d7c94818043857d3 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 17 Oct 2018 17:33:27 +0200 Subject: [PATCH] Fix errors when building with --override DO_PIPELINING=UNDEF --- panda/src/gobj/geomVertexData.I | 2 + panda/src/pipeline/config_pipeline.cxx | 3 + panda/src/pipeline/cycleData.h | 5 +- .../src/pipeline/cycleDataLockedStageReader.I | 51 ++++++++++++----- panda/src/pipeline/cycleDataStageWriter.I | 57 +++++++++++++------ 5 files changed, 86 insertions(+), 32 deletions(-) diff --git a/panda/src/gobj/geomVertexData.I b/panda/src/gobj/geomVertexData.I index bd68fc4cf4..d0c6bba632 100644 --- a/panda/src/gobj/geomVertexData.I +++ b/panda/src/gobj/geomVertexData.I @@ -772,7 +772,9 @@ set_object(const GeomVertexData *object) { _cdata = (GeomVertexData::CData *)_object->_cycler.read_unlocked(_current_thread); _got_array_readers = false; +#ifdef DO_PIPELINING _cdata->ref(); +#endif // DO_PIPELINING } /** diff --git a/panda/src/pipeline/config_pipeline.cxx b/panda/src/pipeline/config_pipeline.cxx index 2e7bf6487e..4fd5214323 100644 --- a/panda/src/pipeline/config_pipeline.cxx +++ b/panda/src/pipeline/config_pipeline.cxx @@ -71,7 +71,10 @@ init_libpipeline() { } initialized = true; +#ifdef DO_PIPELINING CycleData::init_type(); +#endif + MainThread::init_type(); ExternalThread::init_type(); GenericThread::init_type(); diff --git a/panda/src/pipeline/cycleData.h b/panda/src/pipeline/cycleData.h index de90bdf226..bf0071ac67 100644 --- a/panda/src/pipeline/cycleData.h +++ b/panda/src/pipeline/cycleData.h @@ -50,10 +50,13 @@ class EXPCL_PANDA_PIPELINE CycleData { public: INLINE CycleData() = default; - INLINE CycleData(CycleData &&from) = default; + INLINE CycleData(CycleData &&from) noexcept = default; INLINE CycleData(const CycleData ©) = default; virtual ~CycleData(); + CycleData &operator = (CycleData &&from) noexcept = default; + CycleData &operator = (const CycleData ©) = default; + virtual CycleData *make_copy() const=0; virtual void write_datagram(BamWriter *, Datagram &) const; diff --git a/panda/src/pipeline/cycleDataLockedStageReader.I b/panda/src/pipeline/cycleDataLockedStageReader.I index 22b8785c82..a471aac0b7 100644 --- a/panda/src/pipeline/cycleDataLockedStageReader.I +++ b/panda/src/pipeline/cycleDataLockedStageReader.I @@ -47,6 +47,20 @@ CycleDataLockedStageReader(const CycleDataLockedStageReader © _cycler->increment_read(_pointer); } +/** + * + */ +template +INLINE CycleDataLockedStageReader:: +CycleDataLockedStageReader(CycleDataLockedStageReader &&from) noexcept : + _cycler(from._cycler), + _current_thread(from._current_thread), + _pointer(from._pointer), + _stage(from._stage) +{ + from._pointer = nullptr; +} + /** * */ @@ -64,20 +78,6 @@ operator = (const CycleDataLockedStageReader ©) { _cycler->increment_read(_pointer); } -/** - * - */ -template -INLINE CycleDataLockedStageReader:: -CycleDataLockedStageReader(CycleDataLockedStageReader &&from) noexcept : - _cycler(from._cycler), - _current_thread(from._current_thread), - _pointer(from._pointer), - _stage(from._stage) -{ - from._pointer = nullptr; -} - /** * */ @@ -174,6 +174,17 @@ CycleDataLockedStageReader(const CycleDataLockedStageReader © { } +/** + * + */ +template +INLINE CycleDataLockedStageReader:: +CycleDataLockedStageReader(CycleDataLockedStageReader &&from) noexcept : + _pointer(from._cycler) +{ + from._pointer = nullptr; +} + /** * */ @@ -183,6 +194,18 @@ operator = (const CycleDataLockedStageReader ©) { _pointer = copy._pointer; } +/** + * + */ +template +INLINE void CycleDataLockedStageReader:: +operator = (CycleDataLockedStageReader &&from) noexcept { + nassertv(_pointer == nullptr); + + _pointer = from._pointer; + from._pointer = nullptr; +} + /** * */ diff --git a/panda/src/pipeline/cycleDataStageWriter.I b/panda/src/pipeline/cycleDataStageWriter.I index a4c1851dde..cf25cf807a 100644 --- a/panda/src/pipeline/cycleDataStageWriter.I +++ b/panda/src/pipeline/cycleDataStageWriter.I @@ -62,23 +62,6 @@ CycleDataStageWriter(const CycleDataStageWriter ©) : _cycler->increment_write(_pointer); } -/** - * - */ -template -INLINE void CycleDataStageWriter:: -operator = (const CycleDataStageWriter ©) { - nassertv(_pointer == nullptr); - nassertv(_current_thread == copy._current_thread); - - _cycler = copy._cycler; - _pointer = copy._pointer; - _stage = copy._stage; - - nassertv(_pointer != nullptr); - _cycler->increment_write(_pointer); -} - /** * This flavor of the constructor elevates the pointer from the * CycleDataLockedStageReader from a read to a write pointer (and invalidates @@ -128,6 +111,23 @@ CycleDataStageWriter(CycleDataStageWriter &&from) noexcept : from._pointer = nullptr; } +/** + * + */ +template +INLINE void CycleDataStageWriter:: +operator = (const CycleDataStageWriter ©) { + nassertv(_pointer == nullptr); + nassertv(_current_thread == copy._current_thread); + + _cycler = copy._cycler; + _pointer = copy._pointer; + _stage = copy._stage; + + nassertv(_pointer != nullptr); + _cycler->increment_write(_pointer); +} + /** * */ @@ -227,6 +227,17 @@ CycleDataStageWriter(const CycleDataStageWriter ©) : { } +/** + * + */ +template +INLINE CycleDataStageWriter:: +CycleDataStageWriter(CycleDataStageWriter &&from) noexcept : + _pointer(from._pointer) +{ + from._pointer = nullptr; +} + /** * */ @@ -236,6 +247,18 @@ operator = (const CycleDataStageWriter ©) { _pointer = copy._pointer; } +/** + * + */ +template +INLINE void CycleDataStageWriter:: +operator = (CycleDataStageWriter &&from) noexcept { + nassertv(_pointer == nullptr); + + _pointer = from._pointer; + from._pointer = nullptr; +} + /** * This flavor of the constructor elevates the pointer from the * CycleDataLockedStageReader from a read to a write pointer (and invalidates