shairai / angleproject

Automatically exported from code.google.com/p/angleproject
Other
0 stars 0 forks source link

eglQueryContext() is not implemented #895

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
eglQueryContext() is not implemented, here a patch for adding the missing 
feature:

diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index 81910ff..26aa1ee 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -29,6 +29,7 @@
 #include "libANGLE/formatutils.h"
 #include "libANGLE/validationES.h"
 #include "libANGLE/renderer/Renderer.h"
+#include "libANGLE/Config.h"

 #include <sstream>
 #include <iterator>
@@ -36,7 +37,7 @@
 namespace gl
 {

-Context::Context(int clientVersion, const Context *shareContext, rx::Renderer 
*renderer, bool notifyResets, bool robustAccess)
+Context::Context(const egl::Config *config, int clientVersion, const Context 
*shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess)
     : mRenderer(renderer)
 {
     ASSERT(robustAccess == false);   // Unimplemented
@@ -46,6 +47,10 @@ Context::Context(int clientVersion, const Context 
*shareContext, rx::Renderer *r

     mClientVersion = clientVersion;

+    mConfigID = config->mConfigID;
+    mClientType = EGL_OPENGL_ES_API;
+    mRenderBuffer = EGL_NONE;
+
     mFenceNVHandleAllocator.setBaseHandle(0);

     if (shareContext != NULL)
@@ -186,6 +191,8 @@ void Context::makeCurrent(egl::Surface *surface)
                                                           mRenderer->createDefaultAttachment(GL_STENCIL, surface));

     setFramebufferZero(framebufferZero);
+
+    mRenderBuffer = surface->getRenderBuffer();
 }

 // NOTE: this function should not assume that this context is current!
@@ -1274,6 +1281,21 @@ int Context::getClientVersion() const
     return mClientVersion;
 }

+EGLint Context::getConfigID() const
+{
+    return mConfigID;
+}
+
+EGLenum Context::getClientType() const
+{
+    return mClientType;
+}
+
+EGLenum Context::getRenderBuffer()
+{
+    return mRenderBuffer;
+}
+
 const Caps &Context::getCaps() const
 {
     return mCaps;
diff --git a/src/libANGLE/Context.h b/src/libANGLE/Context.h
index 99bb170..0ed7f5d 100644
--- a/src/libANGLE/Context.h
+++ b/src/libANGLE/Context.h
@@ -34,6 +34,7 @@ class Renderer;
 namespace egl
 {
 class Surface;
+class Config;
 }

 namespace gl
@@ -57,7 +58,7 @@ class TransformFeedback;
 class Context
 {
   public:
-    Context(int clientVersion, const Context *shareContext, rx::Renderer 
*renderer, bool notifyResets, bool robustAccess);
+    Context(const egl::Config *config, int clientVersion, const Context 
*shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);

     virtual ~Context();

@@ -179,6 +180,10 @@ class Context

     virtual int getClientVersion() const;

+    EGLint getConfigID() const;
+    EGLenum getClientType() const;
+    EGLenum getRenderBuffer();
+
     const Caps &getCaps() const;
     const TextureCapsMap &getTextureCaps() const;
     const Extensions &getExtensions() const;
@@ -225,6 +230,10 @@ class Context

     int mClientVersion;

+    EGLint mConfigID;
+    EGLenum mClientType;
+    EGLenum mRenderBuffer;
+
     TextureMap mZeroTextures;

     typedef std::map<GLuint, Framebuffer*> FramebufferMap;
diff --git a/src/libANGLE/Display.cpp b/src/libANGLE/Display.cpp
index e83fa2e..47209fd 100644
--- a/src/libANGLE/Display.cpp
+++ b/src/libANGLE/Display.cpp
@@ -541,7 +541,7 @@ Error Display::createContext(EGLConfig configHandle, EGLint 
clientVersion, const
         return Error(EGL_BAD_CONFIG);
     }

-    gl::Context *context = new gl::Context(clientVersion, shareContext, 
mRenderer, notifyResets, robustAccess);
+    gl::Context *context = new gl::Context(configuration, clientVersion, 
shareContext, mRenderer, notifyResets, robustAccess);
     mContextSet.insert(context);

     *outContext = context;
diff --git a/src/libGLESv2/entry_points_egl.cpp 
b/src/libGLESv2/entry_points_egl.cpp
index 8f25c2e..b155133 100644
--- a/src/libGLESv2/entry_points_egl.cpp
+++ b/src/libGLESv2/entry_points_egl.cpp
@@ -739,10 +739,27 @@ EGLBoolean EGLAPIENTRY QueryContext(EGLDisplay dpy, 
EGLContext ctx, EGLint attri
         return EGL_FALSE;
     }

-    UNIMPLEMENTED();   // FIXME
+    switch (attribute)
+    {
+      case EGL_CONFIG_ID:
+        *value = context->getConfigID();
+        break;
+      case EGL_CONTEXT_CLIENT_TYPE:
+        *value = context->getClientType();
+        break;
+      case EGL_CONTEXT_CLIENT_VERSION:
+        *value = context->getClientVersion();
+        break;
+      case EGL_RENDER_BUFFER:
+        *value = context->getRenderBuffer();
+        break;
+      default:
+        SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+        return EGL_FALSE;
+    }

     SetGlobalError(Error(EGL_SUCCESS));
-    return 0;
+    return EGL_TRUE;
 }

 EGLBoolean EGLAPIENTRY WaitGL(void)

Original issue reported on code.google.com by regis.fe...@gmail.com on 24 Jan 2015 at 1:52

GoogleCodeExporter commented 9 years ago
We're unable to accept patches from contributors who haven't yet signed the 
contributor license agreement. Could you follow the steps at 
https://code.google.com/p/angleproject/wiki/ContributingCode for preparing and 
contributing your code? Step 4.1 of "Get Your Code Ready" covers the CLA, and 
"Life of a Change List" gives a walkthrough of how to submit your code to our 
code review tool for review & landing.

Original comment by shannonw...@chromium.org on 3 Feb 2015 at 6:58

GoogleCodeExporter commented 9 years ago
I have signed the CLA and uploaded a change list for review: 
https://chromium-review.googlesource.com/#/c/246490/
Thanks

Original comment by regis.fe...@gmail.com on 5 Feb 2015 at 12:30

GoogleCodeExporter commented 9 years ago
Here my about:gpu page.

Original comment by regis.fe...@gmail.com on 9 Feb 2015 at 6:37

Attachments:

GoogleCodeExporter commented 9 years ago
Opened issue 948 for the WebGL failures. Thanks for the contribution!

Original comment by jmad...@chromium.org on 16 Mar 2015 at 7:10