Bug 1404518 - Return when OpenSharedTexture is false. r=jgilbert, a=ritu
authorDaosheng Mu <daoshengmu@gmail.com>
Mon, 02 Oct 2017 14:32:07 +0800
changeset 432185 978e6322ec4c1c38e1d4eaf04ca0490bc5a427ee
parent 432184 f24a44f212b067dbf36366d0bbad292b8a75a08d
child 432186 4905b457c84c9184ef9866228c1c36419680d0e5
push id7897
push userryanvm@gmail.com
push dateThu, 05 Oct 2017 01:01:20 +0000
treeherdermozilla-beta@3d3e597d3b96 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, ritu
bugs1404518
milestone57.0
Bug 1404518 - Return when OpenSharedTexture is false. r=jgilbert, a=ritu MozReview-Commit-ID: EIChMhAt5Hk
gfx/gl/GLBlitHelperD3D.cpp
--- a/gfx/gl/GLBlitHelperD3D.cpp
+++ b/gfx/gl/GLBlitHelperD3D.cpp
@@ -54,17 +54,17 @@ StreamFromD3DTexture(ID3D11Texture2D* co
 
 static RefPtr<ID3D11Texture2D>
 OpenSharedTexture(ID3D11Device* const d3d, const WindowsHandle handle)
 {
     RefPtr<ID3D11Texture2D> tex;
     auto hr = d3d->OpenSharedResource((HANDLE)handle, __uuidof(ID3D11Texture2D),
                                       (void**)(ID3D11Texture2D**)getter_AddRefs(tex));
     if (FAILED(hr)) {
-        MOZ_ASSERT(false, "OpenSharedResource should not fail");
+        gfxCriticalError() << "Error code from OpenSharedResource: " << gfx::hexa(hr);
         return nullptr;
     }
     return tex;
 }
 
 // -------------------------------------
 
 class BindAnglePlanes final
@@ -260,16 +260,20 @@ GLBlitHelper::BlitDescriptor(const layer
 
     if (format != gfx::SurfaceFormat::NV12) {
         gfxCriticalError() << "Non-NV12 format for SurfaceDescriptorD3D10: "
                            << uint32_t(format);
         return nullptr;
     }
 
     const auto tex = OpenSharedTexture(d3d, handle);
+    if (!tex) {
+        MOZ_ASSERT(false, "Get a nullptr from OpenSharedResource.");
+        return false;
+    }
     const RefPtr<ID3D11Texture2D> texList[2] = { tex, tex };
     const EGLAttrib postAttribs0[] = {
         LOCAL_EGL_NATIVE_BUFFER_PLANE_OFFSET_IMG, 0,
         LOCAL_EGL_NONE
     };
     const EGLAttrib postAttribs1[] = {
         LOCAL_EGL_NATIVE_BUFFER_PLANE_OFFSET_IMG, 1,
         LOCAL_EGL_NONE