author | Nicolas Silva <nical@mozilla.com> |
Tue, 08 Apr 2014 14:50:41 +0200 | |
changeset 177565 | 646738ed649406c648c121e36523ba2704f68834 |
parent 177564 | ed66b387798ada63dbabbc45f4d2b547ae6fc9b7 |
child 177566 | 6b1ca7b19fb7c43c91848faec41662077993a272 |
push id | 26556 |
push user | ryanvm@gmail.com |
push date | Tue, 08 Apr 2014 22:16:57 +0000 |
treeherder | mozilla-central@5811efc11011 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mattwoodrow |
bugs | 993360 |
milestone | 31.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
|
--- a/gfx/layers/d3d11/TextureD3D11.cpp +++ b/gfx/layers/d3d11/TextureD3D11.cpp @@ -168,16 +168,19 @@ TextureClientD3D11::~TextureClientD3D11( UnlockD3DTexture(mTexture.get()); } #endif } bool TextureClientD3D11::Lock(OpenMode aMode) { + if (!mTexture) { + return false; + } MOZ_ASSERT(!mIsLocked, "The Texture is already locked!"); LockD3DTexture(mTexture.get()); mIsLocked = true; if (mNeedsClear) { mDrawTarget = GetAsDrawTarget(); mDrawTarget->ClearRect(Rect(0, 0, GetSize().width, GetSize().height)); mNeedsClear = false; @@ -185,16 +188,17 @@ TextureClientD3D11::Lock(OpenMode aMode) return true; } void TextureClientD3D11::Unlock() { MOZ_ASSERT(mIsLocked, "Unlocked called while the texture is not locked!"); + if (mDrawTarget) { // see the comment on TextureClientDrawTarget::GetAsDrawTarget. // This DrawTarget is internal to the TextureClient and is only exposed to the // outside world between Lock() and Unlock(). This assertion checks that no outside // reference remains by the time Unlock() is called. MOZ_ASSERT(mDrawTarget->refCount() == 1); mDrawTarget->Flush(); } @@ -205,16 +209,20 @@ TextureClientD3D11::Unlock() mIsLocked = false; } TemporaryRef<DrawTarget> TextureClientD3D11::GetAsDrawTarget() { MOZ_ASSERT(mIsLocked, "Calling TextureClient::GetAsDrawTarget without locking :("); + if (!mTexture) { + return nullptr; + } + if (mDrawTarget) { return mDrawTarget; } mDrawTarget = Factory::CreateDrawTargetForD3D10Texture(mTexture, mFormat); return mDrawTarget; }