author | Nicolas Silva <nical@mozilla.com> |
Mon, 20 Jan 2014 14:52:12 +0100 | |
changeset 164293 | 3a346b879068bf3eb9a3926ad093cc8c87cbeca0 |
parent 164292 | 36e3f8f6db5321f7e43636a097b6c2d35b978e8a |
child 164294 | 33c8a44c091b3548257b4d1b6ec27afbebb506b8 |
push id | 38665 |
push user | nsilva@mozilla.com |
push date | Mon, 20 Jan 2014 13:52:29 +0000 |
treeherder | mozilla-inbound@3a346b879068 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | nrc |
bugs | 957560 |
milestone | 29.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
|
gfx/layers/d3d11/TextureD3D11.cpp | file | annotate | diff | comparison | revisions | |
gfx/layers/d3d9/TextureD3D9.cpp | file | annotate | diff | comparison | revisions |
--- a/gfx/layers/d3d11/TextureD3D11.cpp +++ b/gfx/layers/d3d11/TextureD3D11.cpp @@ -181,17 +181,17 @@ TextureClientD3D11::GetAsDrawTarget() return mDrawTarget; } mDrawTarget = Factory::CreateDrawTargetForD3D10Texture(mTexture, mFormat); return mDrawTarget; } bool -TextureClientD3D11::AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags) +TextureClientD3D11::AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags aFlags) { mSize = aSize; ID3D10Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D10Device(); CD3D10_TEXTURE2D_DESC newDesc(SurfaceFormatToDXGIFormat(mFormat), aSize.width, aSize.height, 1, 1, D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE); @@ -199,16 +199,24 @@ TextureClientD3D11::AllocateForSurface(g HRESULT hr = device->CreateTexture2D(&newDesc, nullptr, byRef(mTexture)); if (FAILED(hr)) { LOGD3D11("Error creating texture for client!"); return false; } + if (aFlags & ALLOC_CLEAR_BUFFER) { + DebugOnly<bool> locked = Lock(OPEN_WRITE_ONLY); + MOZ_ASSERT(locked); + RefPtr<DrawTarget> dt = GetAsDrawTarget(); + dt->ClearRect(Rect(0, 0, GetSize().width, GetSize().height)); + Unlock(); + } + return true; } bool TextureClientD3D11::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) { if (!IsAllocated()) { return false;
--- a/gfx/layers/d3d9/TextureD3D9.cpp +++ b/gfx/layers/d3d9/TextureD3D9.cpp @@ -1346,16 +1346,24 @@ CairoTextureClientD3D9::AllocateForSurfa DeviceManagerD3D9* deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager(); if (!deviceManager || !(mTexture = deviceManager->CreateTexture(mSize, format, D3DPOOL_SYSTEMMEM, nullptr))) { NS_WARNING("Could not create d3d9 texture"); return false; } + if (aFlags & ALLOC_CLEAR_BUFFER) { + DebugOnly<bool> locked = Lock(OPEN_WRITE_ONLY); + MOZ_ASSERT(locked); + RefPtr<DrawTarget> dt = GetAsDrawTarget(); + dt->ClearRect(Rect(0, 0, GetSize().width, GetSize().height)); + Unlock(); + } + MOZ_ASSERT(mTexture); return true; } TextureClientData* CairoTextureClientD3D9::DropTextureData() { TextureClientData* data = new D3D9TextureClientData(mTexture);