+ // based on reflection, issue gl calls
+ buffer.buffer->BindAsUniformBuffer(static_cast<const TestGraphicsProgram*>(currentPipeline->programState.program));
+ break;
+ }
+ case CommandType::BIND_SAMPLERS:
+ {
+ break;
+ }
+ case CommandType::BIND_PIPELINE:
+ {
+ currentPipeline = Uncast<TestGraphicsPipeline>(cmd.data.bindPipeline.pipeline);
+ BindPipeline(currentPipeline);
+ break;
+ }
+ case CommandType::DRAW:
+ {
+ mGl.DrawArrays(GetTopology(currentPipeline->inputAssemblyState.topology),
+ 0,
+ cmd.data.draw.draw.vertexCount);
+ break;
+ }
+ case CommandType::DRAW_INDEXED:
+ {
+ mGl.DrawElements(GetTopology(currentPipeline->inputAssemblyState.topology),
+ static_cast<GLsizei>(cmd.data.draw.drawIndexed.indexCount),
+ GL_UNSIGNED_SHORT,
+ reinterpret_cast<void*>(cmd.data.draw.drawIndexed.firstIndex));
+ break;
+ }
+ case CommandType::DRAW_INDEXED_INDIRECT:
+ {
+ mGl.DrawElements(GetTopology(currentPipeline->inputAssemblyState.topology),
+ static_cast<GLsizei>(cmd.data.draw.drawIndexed.indexCount),
+ GL_UNSIGNED_SHORT,
+ reinterpret_cast<void*>(cmd.data.draw.drawIndexed.firstIndex));
+ break;
+ }
+ case CommandType::SET_SCISSOR:
+ {
+ if(scissorEnabled)
+ {
+ auto& rect = cmd.data.scissor.region;
+ mGl.Scissor(rect.x, rect.y, rect.width, rect.height);
+ }
+ break;
+ }
+ case CommandType::SET_SCISSOR_TEST:
+ {
+ if(cmd.data.scissorTest.enable)
+ {
+ mGl.Enable(GL_SCISSOR_TEST);
+ scissorEnabled = true;
+ }
+ else
+ {
+ mGl.Disable(GL_SCISSOR_TEST);
+ scissorEnabled = false;
+ }
+ break;
+ }
+ case CommandType::SET_VIEWPORT_TEST:
+ {
+ break;
+ }
+ case CommandType::SET_VIEWPORT: // @todo Consider correcting for orientation here?
+ {
+ auto& rect = cmd.data.viewport.region;
+ mGl.Viewport(rect.x, rect.y, rect.width, rect.height);
+ break;
+ }
+ case CommandType::EXECUTE_COMMAND_BUFFERS:
+ {
+ // Process secondary command buffers
+ for(auto& buf : cmd.data.executeCommandBuffers.buffers)
+ {
+ ProcessCommandBuffer(*Uncast<TestGraphicsCommandBuffer>(buf));
+ }
+ break;
+ }
+ case CommandType::BEGIN_RENDER_PASS:
+ {
+ auto renderTarget = Uncast<TestGraphicsRenderTarget>(cmd.data.beginRenderPass.renderTarget);