Bug 1344433 - Remove HasDXInterop(), but not HasDXInterop2(). - r=daoshengmu draft
authorJeff Gilbert <jgilbert@mozilla.com>
Thu, 02 Mar 2017 13:10:32 -0800
changeset 493547 c65bc0928bbede0a6c94cfa2a812a05d3afe8296
parent 488892 c7e5e32cae0a3c388b03fb2117d4d5f137be3827
child 493548 9ea84c5270ce98b0905c40bb5511bc29e56e28d3
push id47799
push userbmo:jgilbert@mozilla.com
push dateSat, 04 Mar 2017 22:02:43 +0000
reviewersdaoshengmu
bugs1344433
milestone54.0a1
Bug 1344433 - Remove HasDXInterop(), but not HasDXInterop2(). - r=daoshengmu MozReview-Commit-ID: 9OAvDSGuyca
gfx/gl/GLContextProviderWGL.cpp
gfx/gl/WGLLibrary.h
--- a/gfx/gl/GLContextProviderWGL.cpp
+++ b/gfx/gl/GLContextProviderWGL.cpp
@@ -215,41 +215,36 @@ WGLLibrary::EnsureInitialized()
             } else {
                 NS_ERROR("WGL supports ARB_create_context without supplying its functions.");
                 fCreateContextAttribs = nullptr;
             }
         }
 
         ////
 
-        mHasDXInterop = HasExtension(extString, "WGL_NV_DX_interop");
-        mHasDXInterop2 = HasExtension(extString, "WGL_NV_DX_interop2");
-
+        bool hasDXInterop2 = HasExtension(extString, "WGL_NV_DX_interop2");
         if (gfxVars::DXInterop2Blocked() &&
             !gfxPrefs::IgnoreDXInterop2Blacklist())
         {
-            mHasDXInterop2 = false;
+            hasDXInterop2 = false;
         }
 
-        if (mHasDXInterop || mHasDXInterop2) {
+        if (hasDXInterop2) {
             if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, &dxInteropSymbols[0],
                                               lookupFunc))
             {
                 NS_ERROR("WGL supports NV_DX_interop(2) without supplying its functions.");
                 fDXSetResourceShareHandle = nullptr;
                 fDXOpenDevice = nullptr;
                 fDXCloseDevice = nullptr;
                 fDXRegisterObject = nullptr;
                 fDXUnregisterObject = nullptr;
                 fDXObjectAccess = nullptr;
                 fDXLockObjects = nullptr;
                 fDXUnlockObjects = nullptr;
-
-                mHasDXInterop = false;
-                mHasDXInterop2 = false;
             }
         }
     }
 
     // reset back to the previous context, just in case
     fMakeCurrent(curDC, curCtx);
 
     if (mHasRobustness) {
--- a/gfx/gl/WGLLibrary.h
+++ b/gfx/gl/WGLLibrary.h
@@ -13,18 +13,16 @@ namespace gl {
 
 class WGLLibrary
 {
 public:
     WGLLibrary()
       : mInitialized(false)
       , mOGLLibrary(nullptr)
       , mHasRobustness(false)
-      , mHasDXInterop(false)
-      , mHasDXInterop2(false)
       , mWindow (0)
       , mWindowDC(0)
       , mWindowGLContext(0)
       , mWindowPixelFormat(0)
     {}
 
     typedef HGLRC (GLAPIENTRY * PFNWGLCREATECONTEXTPROC) (HDC);
     PFNWGLCREATECONTEXTPROC fCreateContext;
@@ -96,31 +94,28 @@ public:
     // BOOL wglDXUnlockObjectsNV(HANDLE hDevice, GLint count, HANDLE* hObjects);
     typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects);
     PFNWGLDXUNLOCKOBJECTSPROC fDXUnlockObjects;
 
     bool EnsureInitialized();
     HWND CreateDummyWindow(HDC* aWindowDC = nullptr);
 
     bool HasRobustness() const { return mHasRobustness; }
-    bool HasDXInterop() const { return mHasDXInterop; }
-    bool HasDXInterop2() const { return mHasDXInterop2; }
+    bool HasDXInterop2() const { return bool(fDXOpenDevice); }
     bool IsInitialized() const { return mInitialized; }
     HWND GetWindow() const { return mWindow; }
     HDC GetWindowDC() const {return mWindowDC; }
     HGLRC GetWindowGLContext() const {return mWindowGLContext; }
     int GetWindowPixelFormat() const { return mWindowPixelFormat; }
     PRLibrary* GetOGLLibrary() { return mOGLLibrary; }
 
 private:
     bool mInitialized;
     PRLibrary* mOGLLibrary;
     bool mHasRobustness;
-    bool mHasDXInterop;
-    bool mHasDXInterop2;
 
     HWND mWindow;
     HDC mWindowDC;
     HGLRC mWindowGLContext;
     int mWindowPixelFormat;
 
 };