зеркало из https://github.com/AvaloniaUI/angle.git
Make egl::Sync a LabeledObject.
This allows us to return the Sync's label when validation fails for a Sync related entry point. BUG=angleproject:3643 Change-Id: I64e8a8855a2e3b51768c2b560fdc4696bb325351 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1687120 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
This commit is contained in:
Родитель
ecaebd0fc6
Коммит
62934322b6
|
@ -18,7 +18,9 @@ namespace egl
|
|||
{
|
||||
|
||||
Sync::Sync(rx::EGLImplFactory *factory, EGLenum type, const AttributeMap &attribs)
|
||||
: mFence(factory->createSync(attribs)), mType(type)
|
||||
: mFence(factory->createSync(attribs)),
|
||||
mLabel(nullptr),
|
||||
mType(type)
|
||||
{}
|
||||
|
||||
void Sync::onDestroy(const Display *display)
|
||||
|
@ -35,6 +37,16 @@ Error Sync::initialize(const Display *display, const gl::Context *context)
|
|||
return mFence->initialize(display, context, mType);
|
||||
}
|
||||
|
||||
void Sync::setLabel(EGLLabelKHR label)
|
||||
{
|
||||
mLabel = label;
|
||||
}
|
||||
|
||||
EGLLabelKHR Sync::getLabel() const
|
||||
{
|
||||
return mLabel;
|
||||
}
|
||||
|
||||
Error Sync::clientWait(const Display *display,
|
||||
const gl::Context *context,
|
||||
EGLint flags,
|
||||
|
|
|
@ -29,12 +29,15 @@ class Context;
|
|||
|
||||
namespace egl
|
||||
{
|
||||
class Sync final : public angle::RefCountObject<Display, angle::Result>
|
||||
class Sync final : public angle::RefCountObject<Display, angle::Result>, public LabeledObject
|
||||
{
|
||||
public:
|
||||
Sync(rx::EGLImplFactory *factory, EGLenum type, const AttributeMap &attribs);
|
||||
~Sync() override;
|
||||
|
||||
void setLabel(EGLLabelKHR label) override;
|
||||
EGLLabelKHR getLabel() const override;
|
||||
|
||||
void onDestroy(const Display *display) override;
|
||||
|
||||
Error initialize(const Display *display, const gl::Context *context);
|
||||
|
@ -52,6 +55,8 @@ class Sync final : public angle::RefCountObject<Display, angle::Result>
|
|||
private:
|
||||
std::unique_ptr<rx::EGLSyncImpl> mFence;
|
||||
|
||||
EGLLabelKHR mLabel;
|
||||
|
||||
EGLenum mType;
|
||||
static constexpr EGLint mCondition = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR;
|
||||
};
|
||||
|
|
|
@ -700,11 +700,9 @@ Error ValidateLabeledObject(Thread *thread,
|
|||
|
||||
case ObjectType::Sync:
|
||||
{
|
||||
ANGLE_TRY(ValidateDisplay(display));
|
||||
// TODO(geofflang): Implement sync objects. http://anglebug.com/2466
|
||||
UNIMPLEMENTED();
|
||||
return EglBadDisplay() << "Sync objects are unimplemented.";
|
||||
|
||||
Sync *sync = static_cast<Sync *>(object);
|
||||
ANGLE_TRY(ValidateSync(display, sync));
|
||||
*outLabeledObject = sync;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ Error ValidateConfig(const Display *display, const Config *config);
|
|||
Error ValidateContext(const Display *display, const gl::Context *context);
|
||||
Error ValidateImage(const Display *display, const Image *image);
|
||||
Error ValidateDevice(const Device *device);
|
||||
Error ValidateSync(const Device *device, const Sync *sync);
|
||||
Error ValidateSync(const Display *display, const Sync *sync);
|
||||
|
||||
// Return the requested object only if it is valid (otherwise nullptr)
|
||||
const Thread *GetThreadIfValid(const Thread *thread);
|
||||
|
|
|
@ -881,13 +881,13 @@ EGLint EGLAPIENTRY EGL_ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags
|
|||
egl::Sync *syncObject = static_cast<Sync *>(sync);
|
||||
|
||||
ANGLE_EGL_TRY_RETURN(thread, ValidateClientWaitSync(display, syncObject, flags, timeout),
|
||||
"eglClientWaitSync", GetDisplayIfValid(display), EGL_FALSE);
|
||||
"eglClientWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
|
||||
|
||||
gl::Context *currentContext = thread->getContext();
|
||||
EGLint syncStatus = EGL_FALSE;
|
||||
ANGLE_EGL_TRY_RETURN(
|
||||
thread, syncObject->clientWait(display, currentContext, flags, timeout, &syncStatus),
|
||||
"eglClientWaitSync", GetDisplayIfValid(display), EGL_FALSE);
|
||||
"eglClientWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
|
||||
|
||||
thread->setSuccess();
|
||||
return syncStatus;
|
||||
|
@ -909,11 +909,11 @@ EGLBoolean EGLAPIENTRY EGL_GetSyncAttrib(EGLDisplay dpy,
|
|||
egl::Sync *syncObject = static_cast<Sync *>(sync);
|
||||
|
||||
ANGLE_EGL_TRY_RETURN(thread, ValidateGetSyncAttrib(display, syncObject, attribute, value),
|
||||
"eglGetSyncAttrib", GetDisplayIfValid(display), EGL_FALSE);
|
||||
"eglGetSyncAttrib", GetSyncIfValid(display, syncObject), EGL_FALSE);
|
||||
|
||||
EGLint valueExt;
|
||||
ANGLE_EGL_TRY_RETURN(thread, GetSyncAttrib(display, syncObject, attribute, &valueExt),
|
||||
"eglGetSyncAttrib", GetDisplayIfValid(display), EGL_FALSE);
|
||||
"eglGetSyncAttrib", GetSyncIfValid(display, syncObject), EGL_FALSE);
|
||||
*value = valueExt;
|
||||
|
||||
thread->setSuccess();
|
||||
|
@ -1064,11 +1064,11 @@ EGLBoolean EGLAPIENTRY EGL_WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
|
|||
egl::Sync *syncObject = static_cast<Sync *>(sync);
|
||||
|
||||
ANGLE_EGL_TRY_RETURN(thread, ValidateWaitSync(display, context, syncObject, flags),
|
||||
"eglWaitSync", GetDisplayIfValid(display), EGL_FALSE);
|
||||
"eglWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
|
||||
|
||||
gl::Context *currentContext = thread->getContext();
|
||||
ANGLE_EGL_TRY_RETURN(thread, syncObject->serverWait(display, currentContext, flags),
|
||||
"eglWaitSync", GetDisplayIfValid(display), EGL_FALSE);
|
||||
"eglWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
|
||||
|
||||
thread->setSuccess();
|
||||
return EGL_TRUE;
|
||||
|
|
|
@ -938,13 +938,13 @@ ANGLE_EXPORT EGLint EGLAPIENTRY EGL_ClientWaitSyncKHR(EGLDisplay dpy,
|
|||
egl::Sync *syncObject = static_cast<Sync *>(sync);
|
||||
|
||||
ANGLE_EGL_TRY_RETURN(thread, ValidateClientWaitSync(display, syncObject, flags, timeout),
|
||||
"eglClientWaitSync", GetDisplayIfValid(display), EGL_FALSE);
|
||||
"eglClientWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
|
||||
|
||||
gl::Context *currentContext = thread->getContext();
|
||||
EGLint syncStatus = EGL_FALSE;
|
||||
ANGLE_EGL_TRY_RETURN(
|
||||
thread, syncObject->clientWait(display, currentContext, flags, timeout, &syncStatus),
|
||||
"eglClientWaitSync", GetDisplayIfValid(display), EGL_FALSE);
|
||||
"eglClientWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
|
||||
|
||||
thread->setSuccess();
|
||||
return syncStatus;
|
||||
|
@ -966,10 +966,10 @@ ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetSyncAttribKHR(EGLDisplay dpy,
|
|||
egl::Sync *syncObject = static_cast<Sync *>(sync);
|
||||
|
||||
ANGLE_EGL_TRY_RETURN(thread, ValidateGetSyncAttribKHR(display, syncObject, attribute, value),
|
||||
"eglGetSyncAttrib", GetDisplayIfValid(display), EGL_FALSE);
|
||||
"eglGetSyncAttrib", GetSyncIfValid(display, syncObject), EGL_FALSE);
|
||||
|
||||
ANGLE_EGL_TRY_RETURN(thread, GetSyncAttrib(display, syncObject, attribute, value),
|
||||
"eglGetSyncAttrib", GetDisplayIfValid(display), EGL_FALSE);
|
||||
"eglGetSyncAttrib", GetSyncIfValid(display, syncObject), EGL_FALSE);
|
||||
|
||||
thread->setSuccess();
|
||||
return EGL_TRUE;
|
||||
|
@ -989,11 +989,11 @@ ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_WaitSyncKHR(EGLDisplay dpy, EGLSync sync
|
|||
egl::Sync *syncObject = static_cast<Sync *>(sync);
|
||||
|
||||
ANGLE_EGL_TRY_RETURN(thread, ValidateWaitSync(display, context, syncObject, flags),
|
||||
"eglWaitSync", GetDisplayIfValid(display), EGL_FALSE);
|
||||
"eglWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
|
||||
|
||||
gl::Context *currentContext = thread->getContext();
|
||||
ANGLE_EGL_TRY_RETURN(thread, syncObject->serverWait(display, currentContext, flags),
|
||||
"eglWaitSync", GetDisplayIfValid(display), EGL_FALSE);
|
||||
"eglWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
|
||||
|
||||
thread->setSuccess();
|
||||
return EGL_TRUE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче