diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /gfx/angle/checkout/src/libANGLE/Fence.cpp | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/angle/checkout/src/libANGLE/Fence.cpp')
-rw-r--r-- | gfx/angle/checkout/src/libANGLE/Fence.cpp | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/gfx/angle/checkout/src/libANGLE/Fence.cpp b/gfx/angle/checkout/src/libANGLE/Fence.cpp new file mode 100644 index 0000000000..50c6948fb6 --- /dev/null +++ b/gfx/angle/checkout/src/libANGLE/Fence.cpp @@ -0,0 +1,117 @@ +// +// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// Fence.cpp: Implements the gl::FenceNV and gl::Sync classes. + +#include "libANGLE/Fence.h" + +#include "angle_gl.h" + +#include "common/utilities.h" +#include "libANGLE/renderer/FenceNVImpl.h" +#include "libANGLE/renderer/SyncImpl.h" + +namespace gl +{ + +FenceNV::FenceNV(rx::FenceNVImpl *impl) + : mFence(impl), mIsSet(false), mStatus(GL_FALSE), mCondition(GL_NONE) +{} + +FenceNV::~FenceNV() +{ + SafeDelete(mFence); +} + +angle::Result FenceNV::set(const Context *context, GLenum condition) +{ + ANGLE_TRY(mFence->set(context, condition)); + + mCondition = condition; + mStatus = GL_FALSE; + mIsSet = true; + + return angle::Result::Continue; +} + +angle::Result FenceNV::test(const Context *context, GLboolean *outResult) +{ + // Flush the command buffer by default + ANGLE_TRY(mFence->test(context, &mStatus)); + + *outResult = mStatus; + return angle::Result::Continue; +} + +angle::Result FenceNV::finish(const Context *context) +{ + ASSERT(mIsSet); + + ANGLE_TRY(mFence->finish(context)); + + mStatus = GL_TRUE; + + return angle::Result::Continue; +} + +Sync::Sync(rx::SyncImpl *impl, GLuint id) + : RefCountObject(id), + mFence(impl), + mLabel(), + mCondition(GL_SYNC_GPU_COMMANDS_COMPLETE), + mFlags(0) +{} + +void Sync::onDestroy(const Context *context) +{ + ASSERT(mFence); + mFence->onDestroy(context); +} + +Sync::~Sync() +{ + SafeDelete(mFence); +} + +void Sync::setLabel(const Context *context, const std::string &label) +{ + mLabel = label; +} + +const std::string &Sync::getLabel() const +{ + return mLabel; +} + +angle::Result Sync::set(const Context *context, GLenum condition, GLbitfield flags) +{ + ANGLE_TRY(mFence->set(context, condition, flags)); + + mCondition = condition; + mFlags = flags; + return angle::Result::Continue; +} + +angle::Result Sync::clientWait(const Context *context, + GLbitfield flags, + GLuint64 timeout, + GLenum *outResult) +{ + ASSERT(mCondition != GL_NONE); + return mFence->clientWait(context, flags, timeout, outResult); +} + +angle::Result Sync::serverWait(const Context *context, GLbitfield flags, GLuint64 timeout) +{ + return mFence->serverWait(context, flags, timeout); +} + +angle::Result Sync::getStatus(const Context *context, GLint *outResult) const +{ + return mFence->getStatus(context, outResult); +} + +} // namespace gl |