Commit 1c9ecfd7 by Jamie Madill

Add querySurfacePointerANGLE method to Surface.

This method will more closely match the desktop GL implementation. BUG=angle:795 Change-Id: I796b46bb6e8e895dad8d9824e8405edcc12e8a4f Reviewed-on: https://chromium-review.googlesource.com/228915Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 55573e13
...@@ -8,17 +8,16 @@ ...@@ -8,17 +8,16 @@
// such as the client area of a window, including any back buffers. // such as the client area of a window, including any back buffers.
// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3. // Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
#include <tchar.h>
#include <algorithm>
#include "libANGLE/Surface.h" #include "libANGLE/Surface.h"
#include "common/debug.h" #include "common/debug.h"
#include "libANGLE/Display.h"
#include "libANGLE/Texture.h" #include "libANGLE/Texture.h"
#include "libANGLE/renderer/SwapChain.h" #include "libANGLE/renderer/SwapChain.h"
#include "libANGLE/Display.h" #include <algorithm>
#include <tchar.h>
#include <EGL/eglext.h>
//TODO(jmadill): phase this out //TODO(jmadill): phase this out
#include "libANGLE/renderer/d3d/RendererD3D.h" #include "libANGLE/renderer/d3d/RendererD3D.h"
...@@ -382,6 +381,14 @@ Error Surface::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) ...@@ -382,6 +381,14 @@ Error Surface::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height)
return swapRect(x, y, width, height); return swapRect(x, y, width, height);
} }
Error Surface::querySurfacePointerANGLE(EGLint attribute, void **value)
{
// TODO(jmadill): MANGLE refactor
ASSERT(attribute == EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE);
*value = mSwapChain->getShareHandle();
return Error(EGL_SUCCESS);
}
EGLint Surface::isPostSubBufferSupported() const EGLint Surface::isPostSubBufferSupported() const
{ {
return mPostSubBufferSupported; return mPostSubBufferSupported;
......
...@@ -50,6 +50,7 @@ class Surface ...@@ -50,6 +50,7 @@ class Surface
EGLNativeWindowType getWindowHandle(); EGLNativeWindowType getWindowHandle();
Error swap(); Error swap();
Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height); Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height);
Error querySurfacePointerANGLE(EGLint attribute, void **value);
virtual EGLint isPostSubBufferSupported() const; virtual EGLint isPostSubBufferSupported() const;
......
...@@ -598,21 +598,19 @@ EGLBoolean __stdcall eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surf ...@@ -598,21 +598,19 @@ EGLBoolean __stdcall eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surf
return EGL_FALSE; return EGL_FALSE;
} }
// validate the attribute parameter
switch (attribute) switch (attribute)
{ {
case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE: case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
{
rx::SwapChain *swapchain = eglSurface->getSwapChain();
*value = (void*) (swapchain ? swapchain->getShareHandle() : NULL);
}
break; break;
default: default:
recordError(egl::Error(EGL_BAD_ATTRIBUTE)); recordError(egl::Error(EGL_BAD_ATTRIBUTE));
return EGL_FALSE; return EGL_FALSE;
} }
recordError(egl::Error(EGL_SUCCESS)); egl::Error error = eglSurface->querySurfacePointerANGLE(attribute, value);
return EGL_TRUE; recordError(error);
return (error.isError() ? EGL_FALSE : EGL_TRUE);
} }
EGLBoolean __stdcall eglBindAPI(EGLenum api) EGLBoolean __stdcall eglBindAPI(EGLenum api)
......
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