//********************************** Banshee Engine (www.banshee3d.com) **************************************************// //**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************// #include "CoreThread/BsCoreThreadQueue.h" #include "CoreThread/BsCommandQueue.h" #include "Material/BsMaterial.h" #include "CoreThread/BsCoreThread.h" namespace bs { CoreThreadQueueBase::CoreThreadQueueBase(CommandQueueBase* commandQueue) :mCommandQueue(commandQueue) { } CoreThreadQueueBase::~CoreThreadQueueBase() { bs_delete(mCommandQueue); } AsyncOp CoreThreadQueueBase::queueReturnCommand(std::function commandCallback) { return mCommandQueue->queueReturn(commandCallback); } void CoreThreadQueueBase::queueCommand(std::function commandCallback) { mCommandQueue->queue(commandCallback); } void CoreThreadQueueBase::submitToCoreThread(bool blockUntilComplete) { Queue* commands = mCommandQueue->flush(); gCoreThread().queueCommand(std::bind(&CommandQueueBase::playback, mCommandQueue, commands), CTQF_InternalQueue | CTQF_BlockUntilComplete); } void CoreThreadQueueBase::cancelAll() { // Note that this won't free any Frame data allocated for all the canceled commands since // frame data will only get cleared at frame start mCommandQueue->cancelAll(); } }