I noticed that when doing a frame capture on Xcode that there were repeated setting of the viewport, winding mode, scissor rect, etc. that would customarily be done once, at the very start of the render. This appears to come from Renderer::beginRenderPass()
:
void Renderer::beginRenderPass(RenderCommand* cmd)
{
_commandBuffer->beginRenderPass(_renderPassDescriptor);
_commandBuffer->setViewport(_viewport.x, _viewport.y, _viewport.w, _viewport.h);
_commandBuffer->setCullMode(_cullMode);
_commandBuffer->setWinding(_winding);
_commandBuffer->setScissorRect(_scissorState.isEnabled, _scissorState.rect.x, _scissorState.rect.y, _scissorState.rect.width, _scissorState.rect.height);
setRenderPipeline(cmd->getPipelineDescriptor(), _renderPassDescriptor);
_commandBuffer->setStencilReferenceValue(_stencilRef);
}
Is it possible that we can remove these unnecessary calls from that method and put them somewhere else? I would imagine they are not required in OpenGL either?
What do people think?