Change-Id: Ic8afdfeac79c74b7ec70abccf9f3d450501e32f8
{
case CommandType::BIND_VERTEX_BUFFERS:
{
{
case CommandType::BIND_VERTEX_BUFFERS:
{
- bindVertexBuffers = rhs.bindVertexBuffers;
+ data.bindVertexBuffers = rhs.data.bindVertexBuffers;
break;
}
case CommandType::BIND_INDEX_BUFFER:
{
break;
}
case CommandType::BIND_INDEX_BUFFER:
{
- bindIndexBuffer = rhs.bindIndexBuffer;
+ data.bindIndexBuffer = rhs.data.bindIndexBuffer;
break;
}
case CommandType::BIND_SAMPLERS:
{
break;
}
case CommandType::BIND_SAMPLERS:
{
- bindSamplers = rhs.bindSamplers;
+ data.bindSamplers = rhs.data.bindSamplers;
break;
}
case CommandType::BIND_TEXTURES:
{
break;
}
case CommandType::BIND_TEXTURES:
{
- bindTextures = rhs.bindTextures;
+ data.bindTextures = rhs.data.bindTextures;
break;
}
case CommandType::BIND_PIPELINE:
{
break;
}
case CommandType::BIND_PIPELINE:
{
- bindPipeline = rhs.bindPipeline;
+ data.bindPipeline = rhs.data.bindPipeline;
break;
}
case CommandType::BIND_UNIFORM_BUFFER:
{
break;
}
case CommandType::BIND_UNIFORM_BUFFER:
{
- bindUniformBuffers = rhs.bindUniformBuffers;
+ data.bindUniformBuffers = rhs.data.bindUniformBuffers;
break;
}
case CommandType::DRAW:
{
break;
}
case CommandType::DRAW:
{
- draw.type = rhs.draw.type;
- draw.draw = rhs.draw.draw;
+ data.draw.type = rhs.data.draw.type;
+ data.draw.draw = rhs.data.draw.draw;
break;
}
case CommandType::DRAW_INDEXED:
{
break;
}
case CommandType::DRAW_INDEXED:
{
- draw.type = rhs.draw.type;
- draw.drawIndexed = rhs.draw.drawIndexed;
+ data.draw.type = rhs.data.draw.type;
+ data.draw.drawIndexed = rhs.data.draw.drawIndexed;
break;
}
case CommandType::DRAW_INDEXED_INDIRECT:
{
break;
}
case CommandType::DRAW_INDEXED_INDIRECT:
{
- draw.type = rhs.draw.type;
- draw.drawIndexedIndirect = rhs.draw.drawIndexedIndirect;
+ data.draw.type = rhs.data.draw.type;
+ data.draw.drawIndexedIndirect = rhs.data.draw.drawIndexedIndirect;
break;
}
case CommandType::FLUSH:
break;
}
case CommandType::FLUSH:
{
case CommandType::BIND_VERTEX_BUFFERS:
{
{
case CommandType::BIND_VERTEX_BUFFERS:
{
- bindVertexBuffers = std::move(rhs.bindVertexBuffers);
+ data.bindVertexBuffers = std::move(rhs.data.bindVertexBuffers);
break;
}
case CommandType::BIND_INDEX_BUFFER:
{
break;
}
case CommandType::BIND_INDEX_BUFFER:
{
- bindIndexBuffer = rhs.bindIndexBuffer;
+ data.bindIndexBuffer = rhs.data.bindIndexBuffer;
break;
}
case CommandType::BIND_UNIFORM_BUFFER:
{
break;
}
case CommandType::BIND_UNIFORM_BUFFER:
{
- bindUniformBuffers = std::move(rhs.bindUniformBuffers);
+ data.bindUniformBuffers = std::move(rhs.data.bindUniformBuffers);
break;
}
case CommandType::BIND_SAMPLERS:
{
break;
}
case CommandType::BIND_SAMPLERS:
{
- bindSamplers = std::move(rhs.bindSamplers);
+ data.bindSamplers = std::move(rhs.data.bindSamplers);
break;
}
case CommandType::BIND_TEXTURES:
{
break;
}
case CommandType::BIND_TEXTURES:
{
- bindTextures = std::move(rhs.bindTextures);
+ data.bindTextures = std::move(rhs.data.bindTextures);
break;
}
case CommandType::BIND_PIPELINE:
{
break;
}
case CommandType::BIND_PIPELINE:
{
- bindPipeline = rhs.bindPipeline;
+ data.bindPipeline = rhs.data.bindPipeline;
break;
}
case CommandType::DRAW:
{
break;
}
case CommandType::DRAW:
{
- draw.type = rhs.draw.type;
- draw.draw = rhs.draw.draw;
+ data.draw.type = rhs.data.draw.type;
+ data.draw.draw = rhs.data.draw.draw;
break;
}
case CommandType::DRAW_INDEXED:
{
break;
}
case CommandType::DRAW_INDEXED:
{
- draw.type = rhs.draw.type;
- draw.drawIndexed = rhs.draw.drawIndexed;
+ data.draw.type = rhs.data.draw.type;
+ data.draw.drawIndexed = rhs.data.draw.drawIndexed;
break;
}
case CommandType::DRAW_INDEXED_INDIRECT:
{
break;
}
case CommandType::DRAW_INDEXED_INDIRECT:
{
- draw.type = rhs.draw.type;
- draw.drawIndexedIndirect = rhs.draw.drawIndexedIndirect;
+ data.draw.type = rhs.data.draw.type;
+ data.draw.drawIndexedIndirect = rhs.data.draw.drawIndexedIndirect;
break;
}
case CommandType::FLUSH:
break;
}
case CommandType::FLUSH:
CommandType type{CommandType::FLUSH}; ///< Type of command
CommandType type{CommandType::FLUSH}; ///< Type of command
+ CommandData()
+ {}
+
+ ~CommandData()
+ {} // do nothing
+
struct
{
std::vector<Graphics::TextureBinding> textureBindings;
struct
{
std::vector<Graphics::TextureBinding> textureBindings;
struct : public DrawCallDescriptor
{
} draw;
struct : public DrawCallDescriptor
{
} draw;
{
mCommands.emplace_back();
mCommands.back().type = CommandType::BIND_VERTEX_BUFFERS;
{
mCommands.emplace_back();
mCommands.back().type = CommandType::BIND_VERTEX_BUFFERS;
- auto& bindings = mCommands.back().bindVertexBuffers.vertexBufferBindings;
+ auto& bindings = mCommands.back().data.bindVertexBuffers.vertexBufferBindings;
if(bindings.size() < firstBinding + buffers.size())
{
bindings.resize(firstBinding + buffers.size());
if(bindings.size() < firstBinding + buffers.size())
{
bindings.resize(firstBinding + buffers.size());
mCommands.emplace_back();
auto& cmd = mCommands.back();
cmd.type = CommandType::BIND_UNIFORM_BUFFER;
mCommands.emplace_back();
auto& cmd = mCommands.back();
cmd.type = CommandType::BIND_UNIFORM_BUFFER;
- auto& bindCmd = cmd.bindUniformBuffers;
+ auto& bindCmd = cmd.data.bindUniformBuffers;
for(const auto& binding : bindings)
{
if(binding.buffer)
for(const auto& binding : bindings)
{
if(binding.buffer)
{
mCommands.emplace_back();
mCommands.back().type = CommandType::BIND_PIPELINE;
{
mCommands.emplace_back();
mCommands.back().type = CommandType::BIND_PIPELINE;
- mCommands.back().bindPipeline.pipeline = static_cast<const TestGraphicsPipeline*>(&pipeline);
+ mCommands.back().data.bindPipeline.pipeline = static_cast<const TestGraphicsPipeline*>(&pipeline);
mCallStack.PushCall("BindPipeline", "");
}
mCallStack.PushCall("BindPipeline", "");
}
{
mCommands.emplace_back();
mCommands.back().type = CommandType::BIND_TEXTURES;
{
mCommands.emplace_back();
mCommands.back().type = CommandType::BIND_TEXTURES;
- mCommands.back().bindTextures.textureBindings = std::move(textureBindings);
+ mCommands.back().data.bindTextures.textureBindings = std::move(textureBindings);
mCallStack.PushCall("BindTextures", "");
}
void BindSamplers(std::vector<Graphics::SamplerBinding>& samplerBindings) override
{
mCommands.emplace_back();
mCallStack.PushCall("BindTextures", "");
}
void BindSamplers(std::vector<Graphics::SamplerBinding>& samplerBindings) override
{
mCommands.emplace_back();
- mCommands.back().bindSamplers.samplerBindings = std::move(samplerBindings);
+ mCommands.back().data.bindSamplers.samplerBindings = std::move(samplerBindings);
mCallStack.PushCall("BindSamplers", "");
}
mCallStack.PushCall("BindSamplers", "");
}
{
mCommands.emplace_back();
mCommands.back().type = CommandType::BIND_INDEX_BUFFER;
{
mCommands.emplace_back();
mCommands.back().type = CommandType::BIND_INDEX_BUFFER;
- mCommands.back().bindIndexBuffer.buffer = static_cast<const TestGraphicsBuffer*>(&buffer);
- mCommands.back().bindIndexBuffer.offset = offset;
- mCommands.back().bindIndexBuffer.format = format;
+ mCommands.back().data.bindIndexBuffer.buffer = static_cast<const TestGraphicsBuffer*>(&buffer);
+ mCommands.back().data.bindIndexBuffer.offset = offset;
+ mCommands.back().data.bindIndexBuffer.format = format;
mCallStack.PushCall("BindIndexBuffer", "");
}
mCallStack.PushCall("BindIndexBuffer", "");
}
{
mCommands.emplace_back();
mCommands.back().type = CommandType::DRAW;
{
mCommands.emplace_back();
mCommands.back().type = CommandType::DRAW;
- auto& cmd = mCommands.back().draw;
+ auto& cmd = mCommands.back().data.draw;
cmd.type = DrawCallDescriptor::Type::DRAW;
cmd.draw.vertexCount = vertexCount;
cmd.draw.instanceCount = instanceCount;
cmd.type = DrawCallDescriptor::Type::DRAW;
cmd.draw.vertexCount = vertexCount;
cmd.draw.instanceCount = instanceCount;
{
mCommands.emplace_back();
mCommands.back().type = CommandType::DRAW_INDEXED;
{
mCommands.emplace_back();
mCommands.back().type = CommandType::DRAW_INDEXED;
- auto& cmd = mCommands.back().draw;
+ auto& cmd = mCommands.back().data.draw;
cmd.type = DrawCallDescriptor::Type::DRAW_INDEXED;
cmd.drawIndexed.firstIndex = firstIndex;
cmd.drawIndexed.firstInstance = firstInstance;
cmd.type = DrawCallDescriptor::Type::DRAW_INDEXED;
cmd.drawIndexed.firstIndex = firstIndex;
cmd.drawIndexed.firstInstance = firstInstance;
{
mCommands.emplace_back();
mCommands.back().type = CommandType::DRAW_INDEXED_INDIRECT;
{
mCommands.emplace_back();
mCommands.back().type = CommandType::DRAW_INDEXED_INDIRECT;
- auto& cmd = mCommands.back().draw;
+ auto& cmd = mCommands.back().data.draw;
cmd.type = DrawCallDescriptor::Type::DRAW_INDEXED_INDIRECT;
cmd.drawIndexedIndirect.buffer = static_cast<const TestGraphicsBuffer*>(&buffer);
cmd.drawIndexedIndirect.offset = offset;
cmd.type = DrawCallDescriptor::Type::DRAW_INDEXED_INDIRECT;
cmd.drawIndexedIndirect.buffer = static_cast<const TestGraphicsBuffer*>(&buffer);
cmd.drawIndexedIndirect.offset = offset;
if(!value.empty())
{
// must be fixed
if(!value.empty())
{
// must be fixed
- for (auto &binding : value[0]->bindTextures.textureBindings)
+ for (auto &binding : value[0]->data.bindTextures.textureBindings)
auto bindIndexBufferCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_INDEX_BUFFER);
if (!bindIndexBufferCmds.empty())
{
auto bindIndexBufferCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_INDEX_BUFFER);
if (!bindIndexBufferCmds.empty())
{
- auto &indexBufferBinding = bindIndexBufferCmds[0]->bindIndexBuffer;
+ auto &indexBufferBinding = bindIndexBufferCmds[0]->data.bindIndexBuffer;
if (indexBufferBinding.buffer)
{
auto buffer = Uncast<TestGraphicsBuffer>(indexBufferBinding.buffer);
if (indexBufferBinding.buffer)
{
auto buffer = Uncast<TestGraphicsBuffer>(indexBufferBinding.buffer);
auto bindVertexBufferCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_VERTEX_BUFFERS);
if (!bindVertexBufferCmds.empty())
{
auto bindVertexBufferCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_VERTEX_BUFFERS);
if (!bindVertexBufferCmds.empty())
{
- for (auto &binding : bindVertexBufferCmds[0]->bindVertexBuffers.vertexBufferBindings)
+ for (auto &binding : bindVertexBufferCmds[0]->data.bindVertexBuffers.vertexBufferBindings)
{
auto graphicsBuffer = binding.buffer;
auto vertexBuffer = Uncast<TestGraphicsBuffer>(graphicsBuffer);
{
auto graphicsBuffer = binding.buffer;
auto vertexBuffer = Uncast<TestGraphicsBuffer>(graphicsBuffer);
auto bindPipelineCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_PIPELINE);
if (!bindPipelineCmds.empty())
{
auto bindPipelineCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_PIPELINE);
if (!bindPipelineCmds.empty())
{
- auto pipeline = bindPipelineCmds[0]->bindPipeline.pipeline;
+ auto pipeline = bindPipelineCmds[0]->data.bindPipeline.pipeline;
auto &vi = pipeline->vertexInputState;
for (auto &attribute : vi.attributes)
{
auto &vi = pipeline->vertexInputState;
for (auto &attribute : vi.attributes)
{
auto bindUniformBuffersCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_UNIFORM_BUFFER);
if (!bindUniformBuffersCmds.empty())
{
auto bindUniformBuffersCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_UNIFORM_BUFFER);
if (!bindUniformBuffersCmds.empty())
{
- auto buffer = bindUniformBuffersCmds[0]->bindUniformBuffers.standaloneUniformsBufferBinding;
+ auto buffer = bindUniformBuffersCmds[0]->data.bindUniformBuffers.standaloneUniformsBufferBinding;
// based on reflection, issue gl calls
buffer.buffer->BindAsUniformBuffer( static_cast<const TestGraphicsProgram*>(pipeline->programState.program) );
// based on reflection, issue gl calls
buffer.buffer->BindAsUniformBuffer( static_cast<const TestGraphicsProgram*>(pipeline->programState.program) );
- if (drawCmds[0]->draw.type == DrawCallDescriptor::Type::DRAW_INDEXED )
+ if (drawCmds[0]->data.draw.type == DrawCallDescriptor::Type::DRAW_INDEXED )
{
mGl.DrawElements(GetTopology(topology),
{
mGl.DrawElements(GetTopology(topology),
- static_cast<GLsizei>(drawCmds[0]->draw.drawIndexed.indexCount),
+ static_cast<GLsizei>(drawCmds[0]->data.draw.drawIndexed.indexCount),
- reinterpret_cast<void *>(drawCmds[0]->draw.drawIndexed.firstIndex));
+ reinterpret_cast<void *>(drawCmds[0]->data.draw.drawIndexed.firstIndex));
- mGl.DrawArrays(GetTopology(topology), 0, drawCmds[0]->draw.draw.vertexCount);
+ mGl.DrawArrays(GetTopology(topology), 0, drawCmds[0]->data.draw.draw.vertexCount);
TestGraphicsCommandBuffer* cmdBuf = static_cast<TestGraphicsCommandBuffer*>((submissions[0].cmdBuffer[0]));
//auto pipeline = cmdBuf->mPipeline;
auto result = cmdBuf->GetCommandsByType( 0 | CommandType::BIND_PIPELINE );
TestGraphicsCommandBuffer* cmdBuf = static_cast<TestGraphicsCommandBuffer*>((submissions[0].cmdBuffer[0]));
//auto pipeline = cmdBuf->mPipeline;
auto result = cmdBuf->GetCommandsByType( 0 | CommandType::BIND_PIPELINE );
- auto pipeline = result[0]->bindPipeline.pipeline;
+ auto pipeline = result[0]->data.bindPipeline.pipeline;