summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/libANGLE/renderer/gl/DisplayGL.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /gfx/angle/src/libANGLE/renderer/gl/DisplayGL.cpp
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'gfx/angle/src/libANGLE/renderer/gl/DisplayGL.cpp')
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/gl/DisplayGL.cpp103
1 files changed, 103 insertions, 0 deletions
diff --git a/gfx/angle/src/libANGLE/renderer/gl/DisplayGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/DisplayGL.cpp
new file mode 100755
index 000000000..30c5c7b4e
--- /dev/null
+++ b/gfx/angle/src/libANGLE/renderer/gl/DisplayGL.cpp
@@ -0,0 +1,103 @@
+//
+// Copyright (c) 2015 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.
+//
+
+// DisplayGL.h: GL implementation of egl::Display
+
+#include "libANGLE/renderer/gl/DisplayGL.h"
+
+#include "libANGLE/AttributeMap.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/renderer/gl/ContextGL.h"
+#include "libANGLE/renderer/gl/RendererGL.h"
+#include "libANGLE/renderer/gl/StateManagerGL.h"
+#include "libANGLE/renderer/gl/SurfaceGL.h"
+
+#include <EGL/eglext.h>
+
+namespace rx
+{
+
+DisplayGL::DisplayGL() : mRenderer(nullptr), mCurrentDrawSurface(nullptr)
+{
+}
+
+DisplayGL::~DisplayGL()
+{
+}
+
+egl::Error DisplayGL::initialize(egl::Display *display)
+{
+ mRenderer = new RendererGL(getFunctionsGL(), display->getAttributeMap());
+
+ const gl::Version &maxVersion = mRenderer->getMaxSupportedESVersion();
+ if (maxVersion < gl::Version(2, 0))
+ {
+ return egl::Error(EGL_NOT_INITIALIZED, "OpenGL ES 2.0 is not supportable.");
+ }
+
+ return egl::Error(EGL_SUCCESS);
+}
+
+void DisplayGL::terminate()
+{
+ SafeDelete(mRenderer);
+}
+
+ImageImpl *DisplayGL::createImage(EGLenum target,
+ egl::ImageSibling *buffer,
+ const egl::AttributeMap &attribs)
+{
+ UNIMPLEMENTED();
+ return nullptr;
+}
+
+ContextImpl *DisplayGL::createContext(const gl::ContextState &state)
+{
+ ASSERT(mRenderer != nullptr);
+ return new ContextGL(state, mRenderer);
+}
+
+StreamProducerImpl *DisplayGL::createStreamProducerD3DTextureNV12(
+ egl::Stream::ConsumerType consumerType,
+ const egl::AttributeMap &attribs)
+{
+ UNIMPLEMENTED();
+ return nullptr;
+}
+
+egl::Error DisplayGL::makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context)
+{
+ // Notify the previous surface (if it still exists) that it is no longer current
+ if (mCurrentDrawSurface && mSurfaceSet.find(mCurrentDrawSurface) != mSurfaceSet.end())
+ {
+ ANGLE_TRY(GetImplAs<SurfaceGL>(mCurrentDrawSurface)->unMakeCurrent());
+ }
+ mCurrentDrawSurface = nullptr;
+
+ if (!drawSurface)
+ {
+ return egl::Error(EGL_SUCCESS);
+ }
+
+ // Pause transform feedback before making a new surface current, to workaround anglebug.com/1426
+ ContextGL *glContext = GetImplAs<ContextGL>(context);
+ glContext->getStateManager()->pauseTransformFeedback(context->getContextState());
+
+ SurfaceGL *glDrawSurface = GetImplAs<SurfaceGL>(drawSurface);
+ ANGLE_TRY(glDrawSurface->makeCurrent());
+ mCurrentDrawSurface = drawSurface;
+
+ return egl::Error(EGL_SUCCESS);
+}
+
+gl::Version DisplayGL::getMaxSupportedESVersion() const
+{
+ ASSERT(mRenderer != nullptr);
+ return mRenderer->getMaxSupportedESVersion();
+}
+}