Bug 1404518 - Return when OpenSharedTexture is false; r?jgilbert
MozReview-Commit-ID: EIChMhAt5Hk
--- 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