// Copyright (C) 2009-2021, Panagiotis Christopoulos Charitos and contributors. // All rights reserved. // Code licensed under the BSD License. // http://www.anki3d.org/LICENSE #include #include #include #include #include #include namespace anki { FenceImpl::~FenceImpl() { class DeleteFenceCommand final : public GlCommand { public: GLsync m_fence; DeleteFenceCommand(GLsync fence) : m_fence(fence) { } Error operator()(GlState&) { glDeleteSync(m_fence); return Error::NONE; } }; if(m_fence) { GrManagerImpl& manager = static_cast(getManager()); RenderingThread& thread = manager.getRenderingThread(); if(!thread.isServerThread()) { CommandBufferPtr commands; commands = manager.newCommandBuffer(CommandBufferInitInfo()); static_cast(*commands).pushBackNewCommand(m_fence); static_cast(*commands).flush(); } else { glDeleteSync(m_fence); } } } } // end namespace anki