| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #include "BsGLCommandBuffer.h"
- namespace bs { namespace ct
- {
- GLCommandBuffer::GLCommandBuffer(GpuQueueType type, UINT32 deviceIdx, UINT32 queueIdx, bool secondary)
- : CommandBuffer(type, deviceIdx, queueIdx, secondary), mCurrentDrawOperation(DOT_TRIANGLE_LIST)
- {
- if (deviceIdx != 0)
- BS_EXCEPT(InvalidParametersException, "Only a single device supported on DX11.");
- }
- void GLCommandBuffer::queueCommand(const std::function<void()> command)
- {
- mCommands.push_back(command);
- }
- void GLCommandBuffer::appendSecondary(const SPtr<GLCommandBuffer>& secondaryBuffer)
- {
- #if BS_DEBUG_MODE
- if(!secondaryBuffer->mIsSecondary)
- {
- LOGERR("Cannot append a command buffer that is not secondary.");
- return;
- }
- if(mIsSecondary)
- {
- LOGERR("Cannot append a buffer to a secondary command buffer.");
- return;
- }
- #endif
- for (auto& entry : secondaryBuffer->mCommands)
- mCommands.push_back(entry);
- }
- void GLCommandBuffer::executeCommands()
- {
- #if BS_DEBUG_MODE
- if (mIsSecondary)
- {
- LOGERR("Cannot execute commands on a secondary buffer.");
- return;
- }
- #endif
- for (auto& entry : mCommands)
- entry();
- }
- void GLCommandBuffer::clear()
- {
- mCommands.clear();
- }
- }}
|