| 831 | } |
| 832 | |
| 833 | void Renderer::beginRenderPass() |
| 834 | { |
| 835 | _commandBuffer->beginRenderPass(_currentRT, _renderPassDesc); |
| 836 | |
| 837 | // Disable depth/stencil access if render target has no relevant attachments. |
| 838 | auto depthStencil = _dsDesc; |
| 839 | if (!_currentRT->isDefaultRenderTarget()) |
| 840 | { |
| 841 | if (!_currentRT->_depth) |
| 842 | depthStencil.removeFlag(DepthStencilFlags::DEPTH_TEST | DepthStencilFlags::DEPTH_WRITE); |
| 843 | if (!_currentRT->_stencil) |
| 844 | depthStencil.removeFlag(DepthStencilFlags::STENCIL_TEST); |
| 845 | } |
| 846 | |
| 847 | _commandBuffer->updateDepthStencilState(depthStencil); |
| 848 | _commandBuffer->setStencilReferenceValue(_stencilRef); |
| 849 | |
| 850 | _commandBuffer->setViewport(_viewport.x, _viewport.y, _viewport.width, _viewport.height); |
| 851 | _commandBuffer->setCullMode(_cullMode); |
| 852 | _commandBuffer->setWinding(_winding); |
| 853 | _commandBuffer->setScissorRect(_scissorState.isEnabled, _scissorState.rect.x, _scissorState.rect.y, |
| 854 | _scissorState.rect.width, _scissorState.rect.height); |
| 855 | } |
| 856 | |
| 857 | void Renderer::endRenderPass() |
| 858 | { |
no test coverage detected