diff --git a/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp b/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp index b0bb1c733..6bf6ecf81 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp @@ -649,22 +649,6 @@ void GPUContextVulkan::UpdateDescriptorSets(ComputePipelineStateVulkan* pipeline } } -void GPUContextVulkan::BindPipeline() -{ - if (_psDirtyFlag && _currentState && (_rtDepth || _rtCount)) - { - // Clear flag - _psDirtyFlag = false; - - // Change state - const auto cmdBuffer = _cmdBufferManager->GetCmdBuffer(); - const auto pipeline = _currentState->GetState(_renderPass); - vkCmdBindPipeline(cmdBuffer->GetHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); - - RENDER_STAT_PS_STATE_CHANGE(); - } -} - void GPUContextVulkan::OnDrawCall() { GPUPipelineStateVulkan* pipelineState = _currentState; @@ -704,7 +688,15 @@ void GPUContextVulkan::OnDrawCall() BeginRenderPass(); } - BindPipeline(); + // Bind pipeline + if (_psDirtyFlag && _currentState && (_rtDepth || _rtCount)) + { + _psDirtyFlag = false; + const auto cmdBuffer = _cmdBufferManager->GetCmdBuffer(); + const auto pipeline = _currentState->GetState(_renderPass); + vkCmdBindPipeline(cmdBuffer->GetHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); + RENDER_STAT_PS_STATE_CHANGE(); + } //UpdateDynamicStates(); @@ -1104,9 +1096,7 @@ void GPUContextVulkan::Dispatch(GPUShaderProgramCS* shader, uint32 threadGroupCo EndRenderPass(); auto pipelineState = shaderVulkan->GetOrCreateState(); - UpdateDescriptorSets(pipelineState); - FlushBarriers(); // Bind pipeline @@ -1141,10 +1131,8 @@ void GPUContextVulkan::DispatchIndirect(GPUShaderProgramCS* shader, GPUBuffer* b EndRenderPass(); auto pipelineState = shaderVulkan->GetOrCreateState(); - UpdateDescriptorSets(pipelineState); AddBufferBarrier(bufferForArgsVulkan, VK_ACCESS_INDIRECT_COMMAND_READ_BIT); - FlushBarriers(); // Bind pipeline diff --git a/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.h b/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.h index 63224b2d0..4d63e5854 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.h +++ b/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.h @@ -160,7 +160,6 @@ private: void UpdateDescriptorSets(const struct SpirvShaderDescriptorInfo& descriptorInfo, class DescriptorSetWriterVulkan& dsWriter, bool& needsWrite); void UpdateDescriptorSets(GPUPipelineStateVulkan* pipelineState); void UpdateDescriptorSets(ComputePipelineStateVulkan* pipelineState); - void BindPipeline(); void OnDrawCall(); public: