Bug 1404518 - Return when OpenSharedTexture is false; r=jgilbert
authorDaosheng Mu <daoshengmu@gmail.com>
Mon, 02 Oct 2017 14:32:07 +0800
changeset 384106 f936f29ab4156804612bcc40068ee3c6e9bd5379
parent 384105 747862bc5edb9495b95f03d3f98c06db5be36609
child 384107 2369eb303658c724e18641134c725ecb2f8b6cf6
push id32619
push userarchaeopteryx@coole-files.de
push dateTue, 03 Oct 2017 09:41:33 +0000
treeherdermozilla-central@14841c4d8a97 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1404518
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1404518 - Return when OpenSharedTexture is false; r=jgilbert 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 false;
     }
 
     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