Working end to end example

This commit is contained in:
Alejandro Saucedo 2020-08-19 21:10:53 +01:00
parent 7c3af1189f
commit b11a54911d
5 changed files with 31 additions and 10 deletions

View file

@ -36,9 +36,16 @@ class Sequence
static_assert(std::is_base_of<OpBase, T>::value, "Template only valid with OpBase derived classes");
SPDLOG_DEBUG("Kompute Sequence record");
T op(this->mPhysicalDevice, this->mDevice, this->mCommandBuffer);
op.init(std::forward<TArgs>(args)...);
op.record();
T* op = new T(this->mPhysicalDevice, this->mDevice, this->mCommandBuffer);
OpBase* baseOp = dynamic_cast<OpBase*>(op);
std::unique_ptr<OpBase> baseOpPtr{baseOp};
baseOpPtr->init(std::forward<TArgs>(args)...);
baseOpPtr->record();
operations.push_back(std::move(baseOpPtr));
}
private:
@ -52,7 +59,7 @@ class Sequence
bool mFreeCommandBuffer = false;
// Base op objects
std::vector<OpBase> operations;
std::vector<std::unique_ptr<OpBase>> operations;
// Record state
bool mRecording = false;