mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1540581 - P15. Don't have base class methods return child ones. r=nical
Will make it easier to remove the unnecessary DXGITextureData object. Differential Revision: https://phabricator.services.mozilla.com/D26470 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
0ad54344df
commit
06f0f7ca33
@ -224,7 +224,7 @@ class D3D11TextureClientAllocationHelper
|
||||
|
||||
already_AddRefed<TextureClient> Allocate(
|
||||
KnowsCompositor* aAllocator) override {
|
||||
DXGITextureData* data =
|
||||
D3D11TextureData* data =
|
||||
D3D11TextureData::Create(mSize, mFormat, mAllocationFlags, mDevice);
|
||||
if (!data) {
|
||||
return nullptr;
|
||||
|
@ -1054,7 +1054,7 @@ already_AddRefed<TextureClient> TextureClient::CreateForDrawing(
|
||||
DeviceManagerDx::Get()->GetContentDevice())) &&
|
||||
aSize.width <= aMaxTextureSize && aSize.height <= aMaxTextureSize &&
|
||||
!(aAllocFlags & ALLOC_UPDATE_FROM_SURFACE)) {
|
||||
data = DXGITextureData::Create(aSize, aFormat, aAllocFlags);
|
||||
data = D3D11TextureData::Create(aSize, aFormat, aAllocFlags);
|
||||
}
|
||||
|
||||
if (aLayersBackend != LayersBackend::LAYERS_WR && !data &&
|
||||
|
@ -6,21 +6,21 @@
|
||||
|
||||
#include "TextureD3D11.h"
|
||||
#include "CompositorD3D11.h"
|
||||
#include "gfxContext.h"
|
||||
#include "Effects.h"
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#include "gfx2DGlue.h"
|
||||
#include "gfxPrefs.h"
|
||||
#include "PaintThread.h"
|
||||
#include "ReadbackManagerD3D11.h"
|
||||
#include "gfx2DGlue.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxPrefs.h"
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#include "mozilla/gfx/DataSurfaceHelpers.h"
|
||||
#include "mozilla/gfx/DeviceManagerDx.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
#include "mozilla/gfx/Logging.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
#include "mozilla/layers/CompositorBridgeChild.h"
|
||||
#include "mozilla/webrender/RenderD3D11TextureHostOGL.h"
|
||||
#include "mozilla/webrender/RenderThread.h"
|
||||
#include "mozilla/webrender/WebRenderAPI.h"
|
||||
#include "PaintThread.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -408,20 +408,28 @@ void DXGITextureData::GetSubDescriptor(GPUVideoSubDescriptor* const aOutDesc) {
|
||||
*aOutDesc = std::move(ret);
|
||||
}
|
||||
|
||||
DXGITextureData* DXGITextureData::Create(IntSize aSize, SurfaceFormat aFormat,
|
||||
TextureAllocationFlags aFlags) {
|
||||
D3D11TextureData* D3D11TextureData::Create(IntSize aSize, SurfaceFormat aFormat,
|
||||
TextureAllocationFlags aFlags,
|
||||
ID3D11Device* aDevice) {
|
||||
return Create(aSize, aFormat, nullptr, aFlags, aDevice);
|
||||
}
|
||||
|
||||
D3D11TextureData* D3D11TextureData::Create(SourceSurface* aSurface,
|
||||
TextureAllocationFlags aFlags,
|
||||
ID3D11Device* aDevice) {
|
||||
return Create(aSurface->GetSize(), aSurface->GetFormat(), aSurface, aFlags,
|
||||
aDevice);
|
||||
}
|
||||
|
||||
D3D11TextureData* D3D11TextureData::Create(IntSize aSize, SurfaceFormat aFormat,
|
||||
SourceSurface* aSurface,
|
||||
TextureAllocationFlags aFlags,
|
||||
ID3D11Device* aDevice) {
|
||||
if (aFormat == SurfaceFormat::A8) {
|
||||
// Currently we don't support A8 surfaces. Fallback.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return D3D11TextureData::Create(aSize, aFormat, aFlags);
|
||||
}
|
||||
|
||||
DXGITextureData* D3D11TextureData::Create(IntSize aSize, SurfaceFormat aFormat,
|
||||
SourceSurface* aSurface,
|
||||
TextureAllocationFlags aFlags,
|
||||
ID3D11Device* aDevice) {
|
||||
// Just grab any device. We never use the immediate context, so the devices
|
||||
// are fine to use from any thread.
|
||||
RefPtr<ID3D11Device> device = aDevice;
|
||||
@ -538,24 +546,6 @@ DXGITextureData* D3D11TextureData::Create(IntSize aSize, SurfaceFormat aFormat,
|
||||
return new D3D11TextureData(texture11, aSize, aFormat, aFlags);
|
||||
}
|
||||
|
||||
DXGITextureData* D3D11TextureData::Create(IntSize aSize, SurfaceFormat aFormat,
|
||||
TextureAllocationFlags aFlags,
|
||||
ID3D11Device* aDevice) {
|
||||
return D3D11TextureData::Create(aSize, aFormat, nullptr, aFlags, aDevice);
|
||||
}
|
||||
|
||||
DXGITextureData* D3D11TextureData::Create(SourceSurface* aSurface,
|
||||
TextureAllocationFlags aFlags,
|
||||
ID3D11Device* aDevice) {
|
||||
if (aSurface->GetFormat() == SurfaceFormat::A8) {
|
||||
// Currently we don't support A8 surfaces. Fallback.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return D3D11TextureData::Create(aSurface->GetSize(), aSurface->GetFormat(),
|
||||
aSurface, aFlags, aDevice);
|
||||
}
|
||||
|
||||
void D3D11TextureData::Deallocate(LayersIPCChannel* aAllocator) {
|
||||
mDrawTarget = nullptr;
|
||||
mTexture = nullptr;
|
||||
|
@ -51,9 +51,6 @@ class DXGITextureData : public TextureData {
|
||||
bool Serialize(SurfaceDescriptor& aOutDescrptor) override;
|
||||
void GetSubDescriptor(GPUVideoSubDescriptor* aOutDesc) override;
|
||||
|
||||
static DXGITextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
|
||||
TextureAllocationFlags aFlags);
|
||||
|
||||
gfx::YUVColorSpace GetYUVColorSpace() const { return mYUVColorSpace; }
|
||||
void SetYUVColorSpace(gfx::YUVColorSpace aColorSpace) {
|
||||
mYUVColorSpace = aColorSpace;
|
||||
@ -86,10 +83,10 @@ class DXGITextureData : public TextureData {
|
||||
class D3D11TextureData : public DXGITextureData {
|
||||
public:
|
||||
// If aDevice is null, use one provided by gfxWindowsPlatform.
|
||||
static DXGITextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
|
||||
static D3D11TextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
|
||||
TextureAllocationFlags aAllocFlags,
|
||||
ID3D11Device* aDevice = nullptr);
|
||||
static DXGITextureData* Create(gfx::SourceSurface* aSurface,
|
||||
static D3D11TextureData* Create(gfx::SourceSurface* aSurface,
|
||||
TextureAllocationFlags aAllocFlags,
|
||||
ID3D11Device* aDevice = nullptr);
|
||||
|
||||
@ -117,15 +114,14 @@ class D3D11TextureData : public DXGITextureData {
|
||||
return mAllocationFlags;
|
||||
}
|
||||
|
||||
virtual ~D3D11TextureData();
|
||||
|
||||
protected:
|
||||
virtual ~D3D11TextureData();
|
||||
D3D11TextureData(ID3D11Texture2D* aTexture, gfx::IntSize aSize,
|
||||
gfx::SurfaceFormat aFormat, TextureAllocationFlags aFlags);
|
||||
|
||||
void GetDXGIResource(IDXGIResource** aOutResource) override;
|
||||
|
||||
static DXGITextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
|
||||
static D3D11TextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
|
||||
gfx::SourceSurface* aSurface,
|
||||
TextureAllocationFlags aAllocFlags,
|
||||
ID3D11Device* aDevice = nullptr);
|
||||
|
@ -108,8 +108,8 @@ static already_AddRefed<TextureClient> CreateTextureClientWithBackend(
|
||||
if (aLayersBackend == LayersBackend::LAYERS_D3D11 &&
|
||||
(moz2DBackend == BackendType::DIRECT2D ||
|
||||
moz2DBackend == BackendType::DIRECT2D1_1)) {
|
||||
// Create DXGITextureData.
|
||||
data = DXGITextureData::Create(size, format, allocFlags);
|
||||
// Create D3D11TextureData.
|
||||
data = D3D11TextureData::Create(size, format, allocFlags);
|
||||
} else if (!data && format == SurfaceFormat::B8G8R8X8 &&
|
||||
moz2DBackend == BackendType::CAIRO) {
|
||||
// Create DIBTextureData.
|
||||
|
Loading…
Reference in New Issue
Block a user