+ mGl.BlendFuncSeparate(GetBlendFactor(colorBlendState.srcColorBlendFactor),
+ GetBlendFactor(colorBlendState.dstColorBlendFactor),
+ GetBlendFactor(colorBlendState.srcAlphaBlendFactor),
+ GetBlendFactor(colorBlendState.dstAlphaBlendFactor));
+ if(colorBlendState.colorBlendOp != colorBlendState.alphaBlendOp)
+ {
+ mGl.BlendEquationSeparate(GetBlendOp(colorBlendState.colorBlendOp), GetBlendOp(colorBlendState.alphaBlendOp));
+ }
+ else
+ {
+ mGl.BlendEquation(GetBlendOp(colorBlendState.colorBlendOp));
+ }
+ mGl.BlendColor(colorBlendState.blendConstants[0],
+ colorBlendState.blendConstants[1],
+ colorBlendState.blendConstants[2],
+ colorBlendState.blendConstants[3]);
+ }
+ else
+ {
+ mGl.Disable(GL_BLEND);
+ }
+
+ // draw call
+ auto topology = pipeline->inputAssemblyState.topology;
+
+ // UniformBuffer binding (once we know pipeline)
+ auto bindUniformBuffersCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_UNIFORM_BUFFER);
+ if(!bindUniformBuffersCmds.empty())
+ {
+ auto buffer = bindUniformBuffersCmds[0]->data.bindUniformBuffers.standaloneUniformsBufferBinding;
+
+ // based on reflection, issue gl calls
+ buffer.buffer->BindAsUniformBuffer(static_cast<const TestGraphicsProgram*>(pipeline->programState.program));
+ }
+
+ auto drawCmds = commandBuffer->GetCommandsByType(0 |
+ CommandType::DRAW |
+ CommandType::DRAW_INDEXED_INDIRECT |
+ CommandType::DRAW_INDEXED);
+
+ if(!drawCmds.empty())
+ {
+ if(drawCmds[0]->data.draw.type == DrawCallDescriptor::Type::DRAW_INDEXED)
+ {
+ mGl.DrawElements(GetTopology(topology),
+ static_cast<GLsizei>(drawCmds[0]->data.draw.drawIndexed.indexCount),
+ GL_UNSIGNED_SHORT,
+ reinterpret_cast<void*>(drawCmds[0]->data.draw.drawIndexed.firstIndex));
+ }
+ else
+ {
+ mGl.DrawArrays(GetTopology(topology), 0, drawCmds[0]->data.draw.draw.vertexCount);
+ }
+ }
+ // attribute clear
+ for(auto& attribute : vi.attributes)
+ {
+ mGl.DisableVertexAttribArray(attribute.location);
+ }