summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/libANGLE/renderer/gl/egl/SurfaceEGL.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/egl/SurfaceEGL.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/egl/SurfaceEGL.cpp')
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/gl/egl/SurfaceEGL.cpp132
1 files changed, 132 insertions, 0 deletions
diff --git a/gfx/angle/src/libANGLE/renderer/gl/egl/SurfaceEGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/egl/SurfaceEGL.cpp
new file mode 100755
index 000000000..693b61c9c
--- /dev/null
+++ b/gfx/angle/src/libANGLE/renderer/gl/egl/SurfaceEGL.cpp
@@ -0,0 +1,132 @@
+//
+// Copyright (c) 2016 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.
+//
+
+// SurfaceEGL.cpp: EGL implementation of egl::Surface
+
+#include "libANGLE/renderer/gl/egl/SurfaceEGL.h"
+
+#include "common/debug.h"
+
+namespace rx
+{
+
+SurfaceEGL::SurfaceEGL(const egl::SurfaceState &state,
+ const FunctionsEGL *egl,
+ EGLConfig config,
+ const std::vector<EGLint> &attribList,
+ EGLContext context,
+ RendererGL *renderer)
+ : SurfaceGL(state, renderer),
+ mEGL(egl),
+ mConfig(config),
+ mAttribList(attribList),
+ mSurface(EGL_NO_SURFACE),
+ mContext(context)
+{
+}
+
+SurfaceEGL::~SurfaceEGL()
+{
+ if (mSurface != EGL_NO_SURFACE)
+ {
+ EGLBoolean success = mEGL->destroySurface(mSurface);
+ ASSERT(success == EGL_TRUE);
+ }
+}
+
+egl::Error SurfaceEGL::makeCurrent()
+{
+ EGLBoolean success = mEGL->makeCurrent(mSurface, mContext);
+ if (success == EGL_FALSE)
+ {
+ return egl::Error(mEGL->getError(), "eglMakeCurrent failed");
+ }
+ return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error SurfaceEGL::swap()
+{
+ EGLBoolean success = mEGL->swapBuffers(mSurface);
+ if (success == EGL_FALSE)
+ {
+ return egl::Error(mEGL->getError(), "eglSwapBuffers failed");
+ }
+ return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error SurfaceEGL::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height)
+{
+ UNIMPLEMENTED();
+ return egl::Error(EGL_BAD_SURFACE);
+}
+
+egl::Error SurfaceEGL::querySurfacePointerANGLE(EGLint attribute, void **value)
+{
+ UNIMPLEMENTED();
+ return egl::Error(EGL_BAD_SURFACE);
+}
+
+egl::Error SurfaceEGL::bindTexImage(gl::Texture *texture, EGLint buffer)
+{
+ EGLBoolean success = mEGL->bindTexImage(mSurface, buffer);
+ if (success == EGL_FALSE)
+ {
+ return egl::Error(mEGL->getError(), "eglBindTexImage failed");
+ }
+ return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error SurfaceEGL::releaseTexImage(EGLint buffer)
+{
+ EGLBoolean success = mEGL->releaseTexImage(mSurface, buffer);
+ if (success == EGL_FALSE)
+ {
+ return egl::Error(mEGL->getError(), "eglReleaseTexImage failed");
+ }
+ return egl::Error(EGL_SUCCESS);
+}
+
+void SurfaceEGL::setSwapInterval(EGLint interval)
+{
+ EGLBoolean success = mEGL->swapInterval(interval);
+ if (success == EGL_FALSE)
+ {
+ ERR("eglSwapInterval error 0x%04x", mEGL->getError());
+ ASSERT(false);
+ }
+}
+
+EGLint SurfaceEGL::getWidth() const
+{
+ EGLint value;
+ EGLBoolean success = mEGL->querySurface(mSurface, EGL_WIDTH, &value);
+ ASSERT(success == EGL_TRUE);
+ return value;
+}
+
+EGLint SurfaceEGL::getHeight() const
+{
+ EGLint value;
+ EGLBoolean success = mEGL->querySurface(mSurface, EGL_HEIGHT, &value);
+ ASSERT(success == EGL_TRUE);
+ return value;
+}
+
+EGLint SurfaceEGL::isPostSubBufferSupported() const
+{
+ UNIMPLEMENTED();
+ return 0;
+}
+
+EGLint SurfaceEGL::getSwapBehavior() const
+{
+ EGLint value;
+ EGLBoolean success = mEGL->querySurface(mSurface, EGL_SWAP_BEHAVIOR, &value);
+ ASSERT(success == EGL_TRUE);
+ return value;
+}
+
+} // namespace rx