Change-Id: Ibf4b75ba259dee161fef22fb45477e2753c527b7
{
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::SET_SCISSOR:
{
}
case CommandType::SET_SCISSOR:
{
- scissor.region = rhs.scissor.region;
+ data.scissor.region = rhs.data.scissor.region;
break;
}
case CommandType::SET_SCISSOR_TEST:
{
break;
}
case CommandType::SET_SCISSOR_TEST:
{
- scissorTest.enable = rhs.scissorTest.enable;
+ data.scissorTest.enable = rhs.data.scissorTest.enable;
break;
}
case CommandType::SET_VIEWPORT:
{
break;
}
case CommandType::SET_VIEWPORT:
{
- viewport.region = rhs.viewport.region;
+ data.viewport.region = rhs.data.viewport.region;
break;
}
case CommandType::SET_VIEWPORT_TEST:
{
break;
}
case CommandType::SET_VIEWPORT_TEST:
{
- viewportTest.enable = rhs.viewportTest.enable;
+ data.viewportTest.enable = rhs.data.viewportTest.enable;
{
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:
}
case CommandType::SET_SCISSOR:
{
}
case CommandType::SET_SCISSOR:
{
- scissor.region = rhs.scissor.region;
+ data.scissor.region = rhs.data.scissor.region;
break;
}
case CommandType::SET_SCISSOR_TEST:
{
break;
}
case CommandType::SET_SCISSOR_TEST:
{
- scissorTest.enable = rhs.scissorTest.enable;
+ data.scissorTest.enable = rhs.data.scissorTest.enable;
break;
}
case CommandType::SET_VIEWPORT:
{
break;
}
case CommandType::SET_VIEWPORT:
{
- viewport.region = rhs.viewport.region;
+ data.viewport.region = rhs.data.viewport.region;
break;
}
case CommandType::SET_VIEWPORT_TEST:
{
break;
}
case CommandType::SET_VIEWPORT_TEST:
{
- viewportTest.enable = rhs.viewportTest.enable;
+ data.viewportTest.enable = rhs.data.viewportTest.enable;
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;
{
bool enable;
} viewportTest;
{
bool enable;
} viewportTest;
};
class TestGraphicsCommandBuffer : public Graphics::CommandBuffer
};
class TestGraphicsCommandBuffer : public Graphics::CommandBuffer
{
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)
void BindPipeline(const Graphics::Pipeline& pipeline) override
{
mCommands.emplace_back();
void BindPipeline(const Graphics::Pipeline& pipeline) override
{
mCommands.emplace_back();
- mCommands.back().type = CommandType::BIND_PIPELINE;
- mCommands.back().bindPipeline.pipeline = static_cast<const TestGraphicsPipeline*>(&pipeline);
+ mCommands.back().type = CommandType::BIND_PIPELINE;
+ mCommands.back().data.bindPipeline.pipeline = static_cast<const TestGraphicsPipeline*>(&pipeline);
mCallStack.PushCall("BindPipeline", "");
}
void BindTextures(std::vector<Graphics::TextureBinding>& textureBindings) override
{
mCommands.emplace_back();
mCallStack.PushCall("BindPipeline", "");
}
void BindTextures(std::vector<Graphics::TextureBinding>& textureBindings) override
{
mCommands.emplace_back();
- mCommands.back().type = CommandType::BIND_TEXTURES;
- mCommands.back().bindTextures.textureBindings = std::move(textureBindings);
+ mCommands.back().type = CommandType::BIND_TEXTURES;
+ 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", "");
}
Graphics::Format format) override
{
mCommands.emplace_back();
Graphics::Format format) override
{
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().type = CommandType::BIND_INDEX_BUFFER;
+ 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;
mCallStack.PushCall("SetScissor", params.str(), params);
mCommands.emplace_back();
mCallStack.PushCall("SetScissor", params.str(), params);
mCommands.emplace_back();
- mCommands.back().type = CommandType::SET_SCISSOR;
- mCommands.back().scissor.region = value;
+ mCommands.back().type = CommandType::SET_SCISSOR;
+ mCommands.back().data.scissor.region = value;
}
void SetScissorTestEnable(bool value) override
}
void SetScissorTestEnable(bool value) override
mCallStack.PushCall("SetScissorTestEnable", params.str(), params);
mCommands.emplace_back();
mCallStack.PushCall("SetScissorTestEnable", params.str(), params);
mCommands.emplace_back();
- mCommands.back().type = CommandType::SET_SCISSOR_TEST;
- mCommands.back().scissorTest.enable = value;
+ mCommands.back().type = CommandType::SET_SCISSOR_TEST;
+ mCommands.back().data.scissorTest.enable = value;
}
void SetViewport(Graphics::Viewport value) override
}
void SetViewport(Graphics::Viewport value) override
mCallStack.PushCall("SetViewport", params.str(), params);
mCommands.emplace_back();
mCallStack.PushCall("SetViewport", params.str(), params);
mCommands.emplace_back();
- mCommands.back().type = CommandType::SET_VIEWPORT;
- mCommands.back().viewport.region = value;
+ mCommands.back().type = CommandType::SET_VIEWPORT;
+ mCommands.back().data.viewport.region = value;
}
void SetViewportEnable(bool value) override
}
void SetViewportEnable(bool value) override
mCallStack.PushCall("SetViewportEnable", params.str(), params);
mCommands.emplace_back();
mCallStack.PushCall("SetViewportEnable", params.str(), params);
mCommands.emplace_back();
- mCommands.back().type = CommandType::SET_VIEWPORT_TEST;
- mCommands.back().viewportTest.enable = value;
+ mCommands.back().type = CommandType::SET_VIEWPORT_TEST;
+ mCommands.back().data.viewportTest.enable = value;
}
[[nodiscard]] const std::vector<Command>& GetCommands() const
}
[[nodiscard]] const std::vector<Command>& GetCommands() const
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 scissorTestList = commandBuffer->GetCommandsByType(0 | CommandType::SET_SCISSOR_TEST);
if(!scissorTestList.empty())
{
auto scissorTestList = commandBuffer->GetCommandsByType(0 | CommandType::SET_SCISSOR_TEST);
if(!scissorTestList.empty())
{
- if(scissorTestList[0]->scissorTest.enable)
+ if(scissorTestList[0]->data.scissorTest.enable)
{
mGl.Enable(GL_SCISSOR_TEST);
scissorEnabled = true;
{
mGl.Enable(GL_SCISSOR_TEST);
scissorEnabled = true;
auto scissorList = commandBuffer->GetCommandsByType(0 | CommandType::SET_SCISSOR);
if(!scissorList.empty() && scissorEnabled)
{
auto scissorList = commandBuffer->GetCommandsByType(0 | CommandType::SET_SCISSOR);
if(!scissorList.empty() && scissorEnabled)
{
- auto& rect = scissorList[0]->scissor.region;
+ auto& rect = scissorList[0]->data.scissor.region;
mGl.Scissor(rect.x, rect.y, rect.width, rect.height);
}
auto viewportList = commandBuffer->GetCommandsByType(0 | CommandType::SET_VIEWPORT);
if(!viewportList.empty())
{
mGl.Scissor(rect.x, rect.y, rect.width, rect.height);
}
auto viewportList = commandBuffer->GetCommandsByType(0 | CommandType::SET_VIEWPORT);
if(!viewportList.empty())
{
- mGl.Viewport(viewportList[0]->viewport.region.x, viewportList[0]->viewport.region.y, viewportList[0]->viewport.region.width, viewportList[0]->viewport.region.height);
+ mGl.Viewport(viewportList[0]->data.viewport.region.x, viewportList[0]->data.viewport.region.y, viewportList[0]->data.viewport.region.width, viewportList[0]->data.viewport.region.height);
}
// ignore viewport enable
}
// ignore viewport enable
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);