| 749 | /* ----- Pipeline States ----- */ |
| 750 | |
| 751 | void VKCommandBuffer::SetPipelineState(PipelineState& pipelineState) |
| 752 | { |
| 753 | /* Bind native PSO */ |
| 754 | auto& pipelineStateVK = LLGL_CAST(VKPipelineState&, pipelineState); |
| 755 | vkCmdBindPipeline(commandBuffer_, pipelineStateVK.GetBindPoint(), pipelineStateVK.GetVkPipeline()); |
| 756 | |
| 757 | /* Handle special case for graphics PSOs */ |
| 758 | if (pipelineStateVK.GetBindPoint() == VK_PIPELINE_BIND_POINT_GRAPHICS) |
| 759 | { |
| 760 | auto& graphicsPSO = LLGL_CAST(VKGraphicsPSO&, pipelineStateVK); |
| 761 | |
| 762 | /* Scissor rectangle must be updated (if scissor test is disabled) */ |
| 763 | scissorEnabled_ = graphicsPSO.IsScissorEnabled(); |
| 764 | if (!scissorEnabled_ && scissorRectInvalidated_ && graphicsPSO.HasDynamicScissor()) |
| 765 | { |
| 766 | /* Set scissor to render target resolution */ |
| 767 | VkRect2D scissorRect; |
| 768 | { |
| 769 | scissorRect.offset = { 0, 0 }; |
| 770 | scissorRect.extent = framebufferExtent_; |
| 771 | } |
| 772 | vkCmdSetScissor(commandBuffer_, 0, 1, &scissorRect); |
| 773 | |
| 774 | /* Avoid scissor update with each graphics pipeline binding (as long as render pass does not change) */ |
| 775 | scissorRectInvalidated_ = false; |
| 776 | } |
| 777 | } |
| 778 | } |
| 779 | |
| 780 | void VKCommandBuffer::SetBlendFactor(const ColorRGBAf& color) |
| 781 | { |