1 // 2 // Copyright 2016 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 // FenceNVVk.cpp: 7 // Implements the class methods for FenceNVVk. 8 // 9 10 #include "libANGLE/renderer/vulkan/FenceNVVk.h" 11 12 #include "common/debug.h" 13 #include "libANGLE/Context.h" 14 #include "libANGLE/renderer/vulkan/ContextVk.h" 15 #include "libANGLE/renderer/vulkan/vk_utils.h" 16 17 namespace rx 18 { 19 FenceNVVk()20FenceNVVk::FenceNVVk() : FenceNVImpl() {} 21 ~FenceNVVk()22FenceNVVk::~FenceNVVk() {} 23 onDestroy(const gl::Context * context)24void FenceNVVk::onDestroy(const gl::Context *context) 25 { 26 mFenceSync.releaseToRenderer(vk::GetImpl(context)->getRenderer()); 27 } 28 set(const gl::Context * context,GLenum condition)29angle::Result FenceNVVk::set(const gl::Context *context, GLenum condition) 30 { 31 ASSERT(condition == GL_ALL_COMPLETED_NV); 32 return mFenceSync.initialize(vk::GetImpl(context)); 33 } 34 test(const gl::Context * context,GLboolean * outFinished)35angle::Result FenceNVVk::test(const gl::Context *context, GLboolean *outFinished) 36 { 37 bool signaled = false; 38 ANGLE_TRY(mFenceSync.getStatus(vk::GetImpl(context), &signaled)); 39 40 ASSERT(outFinished); 41 *outFinished = signaled ? GL_TRUE : GL_FALSE; 42 return angle::Result::Continue; 43 } 44 finish(const gl::Context * context)45angle::Result FenceNVVk::finish(const gl::Context *context) 46 { 47 VkResult outResult; 48 ContextVk *contextVk = vk::GetImpl(context); 49 return mFenceSync.clientWait(contextVk, contextVk, true, UINT64_MAX, &outResult); 50 } 51 52 } // namespace rx 53