- /**
- * @brief Copy constructor
- * @param[in] rhs Command
- */
- Command(const Command& rhs)
- {
- switch(rhs.type)
- {
- case CommandType::BIND_VERTEX_BUFFERS:
- {
- new(&bindVertexBuffers) decltype(bindVertexBuffers);
- bindVertexBuffers = rhs.bindVertexBuffers;
- break;
- }
- case CommandType::BIND_INDEX_BUFFER:
- {
- bindIndexBuffer = rhs.bindIndexBuffer;
- break;
- }
- case CommandType::BIND_SAMPLERS:
- {
- bindSamplers = rhs.bindSamplers;
- break;
- }
- case CommandType::BIND_TEXTURES:
- {
- new(&bindTextures) decltype(bindTextures);
- bindTextures = rhs.bindTextures;
- break;
- }
- case CommandType::BIND_PIPELINE:
- {
- bindPipeline = rhs.bindPipeline;
- break;
- }
- case CommandType::BIND_UNIFORM_BUFFER:
- {
- bindUniformBuffers = rhs.bindUniformBuffers;
- break;
- }
- case CommandType::DRAW:
- {
- draw.type = rhs.draw.type;
- draw.draw = rhs.draw.draw;
- break;
- }
- case CommandType::DRAW_INDEXED:
- {
- draw.type = rhs.draw.type;
- draw.drawIndexed = rhs.draw.drawIndexed;
- break;
- }
- case CommandType::DRAW_INDEXED_INDIRECT:
- {
- draw.type = rhs.draw.type;
- draw.drawIndexedIndirect = rhs.draw.drawIndexedIndirect;
- break;
- }
- case CommandType::BEGIN_RENDERPASS:
- {
- new(&beginRenderPass) BeginRenderPassDescriptor(rhs.beginRenderPass);
- break;
- }
- case CommandType::END_RENDERPASS:
- {
- endRenderPass.syncObject = rhs.endRenderPass.syncObject;
- break;
- }
- case CommandType::EXECUTE_COMMAND_BUFFERS:
- {
- executeCommandBuffers = rhs.executeCommandBuffers;
- break;
- }
- case CommandType::FLUSH:
- {
- // Nothing to do
- break;
- }
- case CommandType::SET_SCISSOR:
- {
- scissor.region = rhs.scissor.region;
- break;
- }
- case CommandType::SET_SCISSOR_TEST:
- {
- scissorTest.enable = rhs.scissorTest.enable;
- break;
- }
- case CommandType::SET_VIEWPORT:
- {
- viewport.region = rhs.viewport.region;
- break;
- }
- case CommandType::PRESENT_RENDER_TARGET:
- {
- presentRenderTarget = rhs.presentRenderTarget;
- break;
- }
- case CommandType::SET_COLOR_MASK:
- {
- colorMask.enabled = rhs.colorMask.enabled;
- break;
- }
- case CommandType::CLEAR_STENCIL_BUFFER:
- {
- break;
- }
- case CommandType::CLEAR_DEPTH_BUFFER:
- {
- break;
- }
- case CommandType::SET_STENCIL_TEST_ENABLE:
- {
- stencilTest.enabled = rhs.stencilTest.enabled;
- break;
- }
- case CommandType::SET_STENCIL_FUNC:
- {
- stencilFunc.compareMask = rhs.stencilFunc.compareMask;
- stencilFunc.compareOp = rhs.stencilFunc.compareOp;
- stencilFunc.reference = rhs.stencilFunc.reference;
- break;
- }
- case CommandType::SET_STENCIL_WRITE_MASK:
- {
- stencilWriteMask.mask = rhs.stencilWriteMask.mask;
- break;
- }
- case CommandType::SET_STENCIL_OP:
- {
- stencilOp.failOp = rhs.stencilOp.failOp;
- stencilOp.depthFailOp = rhs.stencilOp.depthFailOp;
- stencilOp.passOp = rhs.stencilOp.passOp;
- break;
- }
-
- case CommandType::SET_DEPTH_COMPARE_OP:
- {
- depth.compareOp = rhs.depth.compareOp;
- break;
- }
- case CommandType::SET_DEPTH_TEST_ENABLE:
- {
- depth.testEnabled = rhs.depth.testEnabled;
- break;
- }
- case CommandType::SET_DEPTH_WRITE_ENABLE:
- {
- depth.writeEnabled = rhs.depth.writeEnabled;
- break;
- }
- }
- type = rhs.type;
- }