Commit a254fa28 by Shahbaz Youssefi Committed by Commit Bot

Rename getCurrentDisplay to getDisplay

There is always only one display that can be associated with a context, so get*Current*Display is confusing. Bug: None Change-Id: Iff3a9fc5ad1154b046bb30d7f46a468802ba7fcc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1558958Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent af0301a8
...@@ -299,7 +299,7 @@ Context::Context(rx::EGLImplFactory *implFactory, ...@@ -299,7 +299,7 @@ Context::Context(rx::EGLImplFactory *implFactory,
mSurfacelessSupported(displayExtensions.surfacelessContext), mSurfacelessSupported(displayExtensions.surfacelessContext),
mExplicitContextAvailable(clientExtensions.explicitContext), mExplicitContextAvailable(clientExtensions.explicitContext),
mCurrentSurface(static_cast<egl::Surface *>(EGL_NO_SURFACE)), mCurrentSurface(static_cast<egl::Surface *>(EGL_NO_SURFACE)),
mCurrentDisplay(static_cast<egl::Display *>(EGL_NO_DISPLAY)), mDisplay(static_cast<egl::Display *>(EGL_NO_DISPLAY)),
mWebGLContext(GetWebGLContext(attribs)), mWebGLContext(GetWebGLContext(attribs)),
mBufferAccessValidationEnabled(false), mBufferAccessValidationEnabled(false),
mExtensionsEnabled(GetExtensionsEnabled(attribs, mWebGLContext)), mExtensionsEnabled(GetExtensionsEnabled(attribs, mWebGLContext)),
...@@ -570,7 +570,7 @@ EGLLabelKHR Context::getLabel() const ...@@ -570,7 +570,7 @@ EGLLabelKHR Context::getLabel() const
egl::Error Context::makeCurrent(egl::Display *display, egl::Surface *surface) egl::Error Context::makeCurrent(egl::Display *display, egl::Surface *surface)
{ {
mCurrentDisplay = display; mDisplay = display;
if (!mHasBeenCurrent) if (!mHasBeenCurrent)
{ {
...@@ -3235,8 +3235,8 @@ Extensions Context::generateSupportedExtensions() const ...@@ -3235,8 +3235,8 @@ Extensions Context::generateSupportedExtensions() const
} }
// If EGL_KHR_fence_sync is not enabled, don't expose GL_OES_EGL_sync. // If EGL_KHR_fence_sync is not enabled, don't expose GL_OES_EGL_sync.
ASSERT(mCurrentDisplay); ASSERT(mDisplay);
if (!mCurrentDisplay->getExtensions().fenceSync) if (!mDisplay->getExtensions().fenceSync)
{ {
supportedExtensions.eglSync = false; supportedExtensions.eglSync = false;
} }
......
...@@ -1796,7 +1796,7 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl ...@@ -1796,7 +1796,7 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
MemoryProgramCache *getMemoryProgramCache() const { return mMemoryProgramCache; } MemoryProgramCache *getMemoryProgramCache() const { return mMemoryProgramCache; }
bool hasBeenCurrent() const { return mHasBeenCurrent; } bool hasBeenCurrent() const { return mHasBeenCurrent; }
egl::Display *getCurrentDisplay() const { return mCurrentDisplay; } egl::Display *getDisplay() const { return mDisplay; }
egl::Surface *getCurrentDrawSurface() const { return mCurrentSurface; } egl::Surface *getCurrentDrawSurface() const { return mCurrentSurface; }
egl::Surface *getCurrentReadSurface() const { return mCurrentSurface; } egl::Surface *getCurrentReadSurface() const { return mCurrentSurface; }
...@@ -1988,7 +1988,7 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl ...@@ -1988,7 +1988,7 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
const bool mSurfacelessSupported; const bool mSurfacelessSupported;
const bool mExplicitContextAvailable; const bool mExplicitContextAvailable;
egl::Surface *mCurrentSurface; egl::Surface *mCurrentSurface;
egl::Display *mCurrentDisplay; egl::Display *mDisplay;
const bool mWebGLContext; const bool mWebGLContext;
bool mBufferAccessValidationEnabled; bool mBufferAccessValidationEnabled;
const bool mExtensionsEnabled; const bool mExtensionsEnabled;
......
...@@ -47,7 +47,7 @@ gl::ImageIndex GetImageIndex(EGLenum eglTarget, const egl::AttributeMap &attribs ...@@ -47,7 +47,7 @@ gl::ImageIndex GetImageIndex(EGLenum eglTarget, const egl::AttributeMap &attribs
const Display *DisplayFromContext(const gl::Context *context) const Display *DisplayFromContext(const gl::Context *context)
{ {
return (context ? context->getCurrentDisplay() : nullptr); return (context ? context->getDisplay() : nullptr);
} }
} // anonymous namespace } // anonymous namespace
......
...@@ -185,7 +185,7 @@ Error Surface::setIsCurrent(const gl::Context *context, bool isCurrent) ...@@ -185,7 +185,7 @@ Error Surface::setIsCurrent(const gl::Context *context, bool isCurrent)
return NoError(); return NoError();
} }
return releaseRef(context->getCurrentDisplay()); return releaseRef(context->getDisplay());
} }
Error Surface::releaseRef(const Display *display) Error Surface::releaseRef(const Display *display)
...@@ -435,7 +435,7 @@ Error Surface::releaseTexImageFromTexture(const gl::Context *context) ...@@ -435,7 +435,7 @@ Error Surface::releaseTexImageFromTexture(const gl::Context *context)
{ {
ASSERT(mTexture); ASSERT(mTexture);
mTexture = nullptr; mTexture = nullptr;
return releaseRef(context->getCurrentDisplay()); return releaseRef(context->getDisplay());
} }
gl::Extents Surface::getAttachmentSize(const gl::ImageIndex & /*target*/) const gl::Extents Surface::getAttachmentSize(const gl::ImageIndex & /*target*/) const
......
...@@ -107,11 +107,11 @@ gl::Context *Thread::getValidContext() const ...@@ -107,11 +107,11 @@ gl::Context *Thread::getValidContext() const
return mContext; return mContext;
} }
Display *Thread::getCurrentDisplay() const Display *Thread::getDisplay() const
{ {
if (mContext) if (mContext)
{ {
return mContext->getCurrentDisplay(); return mContext->getDisplay();
} }
return nullptr; return nullptr;
} }
......
...@@ -48,7 +48,7 @@ class Thread : public LabeledObject ...@@ -48,7 +48,7 @@ class Thread : public LabeledObject
Surface *getCurrentReadSurface() const; Surface *getCurrentReadSurface() const;
gl::Context *getContext() const; gl::Context *getContext() const;
gl::Context *getValidContext() const; gl::Context *getValidContext() const;
Display *getCurrentDisplay() const; Display *getDisplay() const;
private: private:
EGLLabelKHR mLabel; EGLLabelKHR mLabel;
......
...@@ -346,7 +346,7 @@ egl::Error SurfaceD3D::checkForOutOfDateSwapChain(DisplayD3D *displayD3D) ...@@ -346,7 +346,7 @@ egl::Error SurfaceD3D::checkForOutOfDateSwapChain(DisplayD3D *displayD3D)
egl::Error SurfaceD3D::swap(const gl::Context *context) egl::Error SurfaceD3D::swap(const gl::Context *context)
{ {
DisplayD3D *displayD3D = GetImplAs<DisplayD3D>(context->getCurrentDisplay()); DisplayD3D *displayD3D = GetImplAs<DisplayD3D>(context->getDisplay());
return swapRect(displayD3D, 0, 0, mWidth, mHeight); return swapRect(displayD3D, 0, 0, mWidth, mHeight);
} }
...@@ -356,7 +356,7 @@ egl::Error SurfaceD3D::postSubBuffer(const gl::Context *context, ...@@ -356,7 +356,7 @@ egl::Error SurfaceD3D::postSubBuffer(const gl::Context *context,
EGLint width, EGLint width,
EGLint height) EGLint height)
{ {
DisplayD3D *displayD3D = GetImplAs<DisplayD3D>(context->getCurrentDisplay()); DisplayD3D *displayD3D = GetImplAs<DisplayD3D>(context->getDisplay());
return swapRect(displayD3D, x, y, width, height); return swapRect(displayD3D, x, y, width, height);
} }
......
...@@ -681,14 +681,14 @@ egl::Error WindowSurfaceVk::swapWithDamage(const gl::Context *context, ...@@ -681,14 +681,14 @@ egl::Error WindowSurfaceVk::swapWithDamage(const gl::Context *context,
EGLint *rects, EGLint *rects,
EGLint n_rects) EGLint n_rects)
{ {
DisplayVk *displayVk = vk::GetImpl(context->getCurrentDisplay()); DisplayVk *displayVk = vk::GetImpl(context->getDisplay());
angle::Result result = swapImpl(displayVk, rects, n_rects); angle::Result result = swapImpl(displayVk, rects, n_rects);
return angle::ToEGL(result, displayVk, EGL_BAD_SURFACE); return angle::ToEGL(result, displayVk, EGL_BAD_SURFACE);
} }
egl::Error WindowSurfaceVk::swap(const gl::Context *context) egl::Error WindowSurfaceVk::swap(const gl::Context *context)
{ {
DisplayVk *displayVk = vk::GetImpl(context->getCurrentDisplay()); DisplayVk *displayVk = vk::GetImpl(context->getDisplay());
angle::Result result = swapImpl(displayVk, nullptr, 0); angle::Result result = swapImpl(displayVk, nullptr, 0);
return angle::ToEGL(result, displayVk, EGL_BAD_SURFACE); return angle::ToEGL(result, displayVk, EGL_BAD_SURFACE);
} }
......
...@@ -3364,8 +3364,8 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context, TextureType type, GLeg ...@@ -3364,8 +3364,8 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context, TextureType type, GLeg
egl::Image *imageObject = static_cast<egl::Image *>(image); egl::Image *imageObject = static_cast<egl::Image *>(image);
ASSERT(context->getCurrentDisplay()); ASSERT(context->getDisplay());
if (!context->getCurrentDisplay()->isValidImage(imageObject)) if (!context->getDisplay()->isValidImage(imageObject))
{ {
context->validationError(GL_INVALID_VALUE, kInvalidEGLImage); context->validationError(GL_INVALID_VALUE, kInvalidEGLImage);
return false; return false;
...@@ -3408,8 +3408,8 @@ bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context, ...@@ -3408,8 +3408,8 @@ bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context,
egl::Image *imageObject = static_cast<egl::Image *>(image); egl::Image *imageObject = static_cast<egl::Image *>(image);
ASSERT(context->getCurrentDisplay()); ASSERT(context->getDisplay());
if (!context->getCurrentDisplay()->isValidImage(imageObject)) if (!context->getDisplay()->isValidImage(imageObject))
{ {
context->validationError(GL_INVALID_VALUE, kInvalidEGLImage); context->validationError(GL_INVALID_VALUE, kInvalidEGLImage);
return false; return false;
......
...@@ -497,7 +497,7 @@ EGLDisplay EGLAPIENTRY EGL_GetCurrentDisplay(void) ...@@ -497,7 +497,7 @@ EGLDisplay EGLAPIENTRY EGL_GetCurrentDisplay(void)
thread->setSuccess(); thread->setSuccess();
if (thread->getContext() != nullptr) if (thread->getContext() != nullptr)
{ {
return thread->getContext()->getCurrentDisplay(); return thread->getContext()->getDisplay();
} }
return EGL_NO_DISPLAY; return EGL_NO_DISPLAY;
} }
...@@ -532,7 +532,7 @@ EGLBoolean EGLAPIENTRY EGL_WaitGL(void) ...@@ -532,7 +532,7 @@ EGLBoolean EGLAPIENTRY EGL_WaitGL(void)
EVENT("()"); EVENT("()");
Thread *thread = egl::GetCurrentThread(); Thread *thread = egl::GetCurrentThread();
egl::Display *display = thread->getCurrentDisplay(); egl::Display *display = thread->getDisplay();
ANGLE_EGL_TRY_RETURN(thread, ValidateDisplay(display), "eglWaitGL", GetDisplayIfValid(display), ANGLE_EGL_TRY_RETURN(thread, ValidateDisplay(display), "eglWaitGL", GetDisplayIfValid(display),
EGL_FALSE); EGL_FALSE);
...@@ -552,7 +552,7 @@ EGLBoolean EGLAPIENTRY EGL_WaitNative(EGLint engine) ...@@ -552,7 +552,7 @@ EGLBoolean EGLAPIENTRY EGL_WaitNative(EGLint engine)
EVENT("(EGLint engine = %d)", engine); EVENT("(EGLint engine = %d)", engine);
Thread *thread = egl::GetCurrentThread(); Thread *thread = egl::GetCurrentThread();
egl::Display *display = thread->getCurrentDisplay(); egl::Display *display = thread->getDisplay();
ANGLE_EGL_TRY_RETURN(thread, ValidateWaitNative(display, engine), "eglWaitNative", ANGLE_EGL_TRY_RETURN(thread, ValidateWaitNative(display, engine), "eglWaitNative",
GetThreadIfValid(thread), EGL_FALSE); GetThreadIfValid(thread), EGL_FALSE);
...@@ -779,7 +779,7 @@ EGLBoolean EGLAPIENTRY EGL_ReleaseThread(void) ...@@ -779,7 +779,7 @@ EGLBoolean EGLAPIENTRY EGL_ReleaseThread(void)
Surface *previousDraw = thread->getCurrentDrawSurface(); Surface *previousDraw = thread->getCurrentDrawSurface();
Surface *previousRead = thread->getCurrentReadSurface(); Surface *previousRead = thread->getCurrentReadSurface();
gl::Context *previousContext = thread->getContext(); gl::Context *previousContext = thread->getContext();
egl::Display *previousDisplay = thread->getCurrentDisplay(); egl::Display *previousDisplay = thread->getDisplay();
// Only call makeCurrent if the context or surfaces have changed. // Only call makeCurrent if the context or surfaces have changed.
if (previousDraw != EGL_NO_SURFACE || previousRead != EGL_NO_SURFACE || if (previousDraw != EGL_NO_SURFACE || previousRead != EGL_NO_SURFACE ||
...@@ -812,7 +812,7 @@ EGLBoolean EGLAPIENTRY EGL_WaitClient(void) ...@@ -812,7 +812,7 @@ EGLBoolean EGLAPIENTRY EGL_WaitClient(void)
EVENT("()"); EVENT("()");
Thread *thread = egl::GetCurrentThread(); Thread *thread = egl::GetCurrentThread();
egl::Display *display = thread->getCurrentDisplay(); egl::Display *display = thread->getDisplay();
gl::Context *context = thread->getContext(); gl::Context *context = thread->getContext();
ANGLE_EGL_TRY_RETURN(thread, ValidateDisplay(display), "eglWaitClient", ANGLE_EGL_TRY_RETURN(thread, ValidateDisplay(display), "eglWaitClient",
...@@ -851,7 +851,7 @@ EGLSync EGLAPIENTRY EGL_CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib ...@@ -851,7 +851,7 @@ EGLSync EGLAPIENTRY EGL_CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib
AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list); AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list);
gl::Context *currentContext = thread->getContext(); gl::Context *currentContext = thread->getContext();
egl::Display *currentDisplay = currentContext ? currentContext->getCurrentDisplay() : nullptr; egl::Display *currentDisplay = currentContext ? currentContext->getDisplay() : nullptr;
ANGLE_EGL_TRY_RETURN( ANGLE_EGL_TRY_RETURN(
thread, ValidateCreateSyncKHR(display, type, attributes, currentDisplay, currentContext), thread, ValidateCreateSyncKHR(display, type, attributes, currentDisplay, currentContext),
......
...@@ -891,7 +891,7 @@ ANGLE_EXPORT EGLSync EGLAPIENTRY EGL_CreateSyncKHR(EGLDisplay dpy, ...@@ -891,7 +891,7 @@ ANGLE_EXPORT EGLSync EGLAPIENTRY EGL_CreateSyncKHR(EGLDisplay dpy,
AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list); AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
gl::Context *currentContext = thread->getContext(); gl::Context *currentContext = thread->getContext();
egl::Display *currentDisplay = currentContext ? currentContext->getCurrentDisplay() : nullptr; egl::Display *currentDisplay = currentContext ? currentContext->getDisplay() : nullptr;
ANGLE_EGL_TRY_RETURN( ANGLE_EGL_TRY_RETURN(
thread, ValidateCreateSyncKHR(display, type, attributes, currentDisplay, currentContext), thread, ValidateCreateSyncKHR(display, type, attributes, currentDisplay, currentContext),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment