diff --git a/drape/metal/metal_cleaner.mm b/drape/metal/metal_cleaner.mm index a79633fb44..9e7f8f8894 100644 --- a/drape/metal/metal_cleaner.mm +++ b/drape/metal/metal_cleaner.mm @@ -57,13 +57,13 @@ void MetalCleaner::RenderQuad(ref_ptr metalContext, id program) { id pipelineState = metalContext->GetPipelineState(program, false /* blendingEnabled */); - if (pipelineState != nil) - { - [encoder setRenderPipelineState:pipelineState]; - - [encoder setVertexBuffer:m_buffer offset:0 atIndex:0]; - [encoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4]; - } + if (pipelineState == nil) + return; + + [encoder setRenderPipelineState:pipelineState]; + + [encoder setVertexBuffer:m_buffer offset:0 atIndex:0]; + [encoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4]; } void MetalCleaner::ClearDepth(ref_ptr context, id encoder) diff --git a/drape/metal/metal_mesh_object_impl.mm b/drape/metal/metal_mesh_object_impl.mm index dbaaffb260..7951f74cfc 100644 --- a/drape/metal/metal_mesh_object_impl.mm +++ b/drape/metal/metal_mesh_object_impl.mm @@ -85,15 +85,15 @@ public: void DrawPrimitives(ref_ptr context, uint32_t verticesCount) override { ref_ptr metalContext = context; - if (metalContext->HasAppliedPipelineState()) - { - id encoder = metalContext->GetCommandEncoder(); - for (size_t i = 0; i < m_geometryBuffers.size(); i++) - [encoder setVertexBuffer:m_geometryBuffers[i] offset:0 atIndex:i]; - - [encoder drawPrimitives:GetPrimitiveType(m_mesh->m_drawPrimitive) vertexStart:0 - vertexCount:verticesCount]; - } + if (!metalContext->HasAppliedPipelineState()) + return; + + id encoder = metalContext->GetCommandEncoder(); + for (size_t i = 0; i < m_geometryBuffers.size(); i++) + [encoder setVertexBuffer:m_geometryBuffers[i] offset:0 atIndex:i]; + + [encoder drawPrimitives:GetPrimitiveType(m_mesh->m_drawPrimitive) vertexStart:0 + vertexCount:verticesCount]; } private: