Bug 674731 - WebGL/ANGLE interop with D3D layers requests incorrect extension - r=bjacob
authorJeffrey Gilbert <jgilbert@mozilla.com>
Thu, 28 Jul 2011 16:37:58 -0400
changeset 73495 267ada59f86f2a956fb16756356035a9a3e9ccd0
parent 73494 45caaf30e1feb0ade08eb50bea386e9f8098dfe5
child 73496 6fd3e4c0082dd2e8eff2efa5a935ba3d1ccd9b99
child 104995 ec16c79255aa761216b370dd3b704c80bc8290ba
push idunknown
push userunknown
push dateunknown
reviewersbjacob
bugs674731
milestone8.0a1
Bug 674731 - WebGL/ANGLE interop with D3D layers requests incorrect extension - r=bjacob
gfx/layers/d3d10/CanvasLayerD3D10.cpp
gfx/thebes/GLContextProviderEGL.cpp
--- a/gfx/layers/d3d10/CanvasLayerD3D10.cpp
+++ b/gfx/layers/d3d10/CanvasLayerD3D10.cpp
@@ -112,17 +112,19 @@ CanvasLayerD3D10::Initialize(const Data&
 
   HANDLE shareHandle = mGLContext ? mGLContext->GetD3DShareHandle() : nsnull;
   if (shareHandle) {
     HRESULT hr = device()->OpenSharedResource(shareHandle, __uuidof(ID3D10Texture2D), getter_AddRefs(mTexture));
     if (SUCCEEDED(hr))
       mUsingSharedTexture = PR_TRUE;
   }
 
-  if (!mUsingSharedTexture) {
+  if (mUsingSharedTexture) {
+      mNeedsYFlip = PR_FALSE;
+  } else {
     CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, mBounds.width, mBounds.height, 1, 1);
     desc.Usage = D3D10_USAGE_DYNAMIC;
     desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
 
     HRESULT hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(mTexture));
     if (FAILED(hr)) {
       NS_WARNING("Failed to create texture for CanvasLayer!");
       return;
--- a/gfx/thebes/GLContextProviderEGL.cpp
+++ b/gfx/thebes/GLContextProviderEGL.cpp
@@ -234,17 +234,17 @@ public:
         : mInitialized(PR_FALSE),
           mEGLLibrary(nsnull)
     {
         mIsANGLE = PR_FALSE;
         mHave_EGL_KHR_image_base = PR_FALSE;
         mHave_EGL_KHR_image_pixmap = PR_FALSE;
         mHave_EGL_KHR_gl_texture_2D_image = PR_FALSE;
         mHave_EGL_KHR_lock_surface = PR_FALSE;
-        mHave_EGL_ANGLE_surface_d3d_share_handle = PR_FALSE;
+        mHave_EGL_ANGLE_surface_d3d_texture_2d_share_handle = PR_FALSE;
     }
 
     typedef EGLDisplay (GLAPIENTRY * pfnGetDisplay)(void *display_id);
     pfnGetDisplay fGetDisplay;
     typedef EGLContext (GLAPIENTRY * pfnGetCurrentContext)(void);
     pfnGetCurrentContext fGetCurrentContext;
     typedef EGLBoolean (GLAPIENTRY * pfnMakeCurrent)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
     pfnMakeCurrent fMakeCurrent;
@@ -477,26 +477,26 @@ public:
             mHave_EGL_KHR_image_pixmap = PR_FALSE;
             mHave_EGL_KHR_gl_texture_2D_image = PR_FALSE;
         }
 
         if (!fImageTargetTexture2DOES) {
             mHave_EGL_KHR_gl_texture_2D_image = PR_FALSE;
         }
 
-        if (strstr(extensions, "EGL_ANGLE_surface_d3d_share_handle")) {
+        if (strstr(extensions, "EGL_ANGLE_surface_d3d_texture_2d_share_handle")) {
             LibrarySymbolLoader::SymLoadStruct d3dSymbols[] = {
                 { (PRFuncPtr*) &fQuerySurfacePointerANGLE, { "eglQuerySurfacePointerANGLE", NULL } },
                 { NULL, { NULL } }
             };
 
             LibrarySymbolLoader::LoadSymbols(mEGLLibrary, &d3dSymbols[0],
                                              (LibrarySymbolLoader::PlatformLookupFunction)fGetProcAddress);
             if (fQuerySurfacePointerANGLE) {
-                mHave_EGL_ANGLE_surface_d3d_share_handle = PR_TRUE;
+                mHave_EGL_ANGLE_surface_d3d_texture_2d_share_handle = PR_TRUE;
             }
         }
 
         mInitialized = PR_TRUE;
         reporter.SetSuccessful();
         return PR_TRUE;
     }
 
@@ -519,18 +519,18 @@ public:
     PRBool HasKHRImageTexture2D() {
         return mHave_EGL_KHR_gl_texture_2D_image;
     }
 
     PRBool HasKHRLockSurface() {
         return mHave_EGL_KHR_lock_surface;
     }
 
-    PRBool HasANGLESurfaceD3DShareHandle() {
-        return mHave_EGL_ANGLE_surface_d3d_share_handle;
+    PRBool HasANGLESurfaceD3DTexture2DShareHandle() {
+        return mHave_EGL_ANGLE_surface_d3d_texture_2d_share_handle;
     }
 
     void
     DumpEGLConfig(EGLConfig cfg)
     {
         int attrval;
         int err;
 
@@ -602,17 +602,17 @@ private:
     EGLDisplay mEGLDisplay;
 
     PRPackedBool mIsANGLE;
 
     PRPackedBool mHave_EGL_KHR_image_base;
     PRPackedBool mHave_EGL_KHR_image_pixmap;
     PRPackedBool mHave_EGL_KHR_gl_texture_2D_image;
     PRPackedBool mHave_EGL_KHR_lock_surface;
-    PRPackedBool mHave_EGL_ANGLE_surface_d3d_share_handle;
+    PRPackedBool mHave_EGL_ANGLE_surface_d3d_texture_2d_share_handle;
 } sEGLLibrary;
 
 class GLContextEGL : public GLContext
 {
     friend class TextureImageEGL;
 
     static already_AddRefed<GLContextEGL>
     CreateGLContext(const ContextFormat& format,
@@ -893,17 +893,17 @@ public:
     void SetOffscreenSize(const gfxIntSize &aRequestedSize,
                           const gfxIntSize &aActualSize)
     {
         mOffscreenSize = aRequestedSize;
         mOffscreenActualSize = aActualSize;
     }
 
     void *GetD3DShareHandle() {
-        if (!sEGLLibrary.HasANGLESurfaceD3DShareHandle()) {
+        if (!sEGLLibrary.HasANGLESurfaceD3DTexture2DShareHandle()) {
             return nsnull;
         }
 
         void *h = nsnull;
 
 #ifndef EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE
 #define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
 #endif