Bug 1265824 - Pass the texture direct mapping info to all texture creating functions r=mattwoodrow
The client side can't get the GL context in CompositorOGL. So, it can't know the texture direct mapping capability directly. This patch adds the texture direct mapping info in TextureFactoryIdentifier. Then, the client side could get the info form the TextureFactoryIdentifier. MozReview-Commit-ID: KEazDVg0p9Y
This commit is contained in:
@@ -660,7 +660,9 @@ TextureClient::UpdateFromSurface(gfx::SourceSurface* aSurface)
|
||||
|
||||
|
||||
already_AddRefed<TextureClient>
|
||||
TextureClient::CreateSimilar(LayersBackend aLayersBackend, TextureFlags aFlags, TextureAllocationFlags aAllocFlags) const
|
||||
TextureClient::CreateSimilar(LayersBackend aLayersBackend,
|
||||
TextureFlags aFlags,
|
||||
TextureAllocationFlags aAllocFlags) const
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
||||
@@ -670,7 +672,10 @@ TextureClient::CreateSimilar(LayersBackend aLayersBackend, TextureFlags aFlags,
|
||||
}
|
||||
|
||||
LockActor();
|
||||
TextureData* data = mData->CreateSimilar(mAllocator, aLayersBackend, aFlags, aAllocFlags);
|
||||
TextureData* data = mData->CreateSimilar(mAllocator,
|
||||
aLayersBackend,
|
||||
aFlags,
|
||||
aAllocFlags);
|
||||
UnlockActor();
|
||||
|
||||
if (!data) {
|
||||
@@ -1060,6 +1065,9 @@ TextureClient::CreateForDrawing(KnowsCompositor* aAllocator,
|
||||
TextureAllocationFlags aAllocFlags)
|
||||
{
|
||||
LayersBackend layersBackend = aAllocator->GetCompositorBackendType();
|
||||
if (aAllocator->SupportsTextureDirectMapping()) {
|
||||
aAllocFlags = TextureAllocationFlags(aAllocFlags | ALLOC_ALLOW_DIRECT_MAPPING);
|
||||
}
|
||||
return TextureClient::CreateForDrawing(aAllocator->GetTextureForwarder(),
|
||||
aFormat, aSize,
|
||||
layersBackend,
|
||||
@@ -1226,6 +1234,16 @@ TextureClient::CreateForRawBufferAccess(KnowsCompositor* aAllocator,
|
||||
TextureFlags aTextureFlags,
|
||||
TextureAllocationFlags aAllocFlags)
|
||||
{
|
||||
// If we exceed the max texture size for the GPU, then just fall back to no
|
||||
// texture direct mapping. If it becomes a problem we can implement tiling
|
||||
// logic inside DirectMapTextureSource to allow this.
|
||||
bool supportsTextureDirectMapping = aAllocator->SupportsTextureDirectMapping() &&
|
||||
std::max(aSize.width, aSize.height) <= aAllocator->GetMaxTextureSize();
|
||||
if (supportsTextureDirectMapping) {
|
||||
aAllocFlags = TextureAllocationFlags(aAllocFlags | ALLOC_ALLOW_DIRECT_MAPPING);
|
||||
} else {
|
||||
aAllocFlags = TextureAllocationFlags(aAllocFlags & ~ALLOC_ALLOW_DIRECT_MAPPING);
|
||||
}
|
||||
return CreateForRawBufferAccess(aAllocator->GetTextureForwarder(),
|
||||
aFormat, aSize, aMoz2DBackend,
|
||||
aAllocator->GetCompositorBackendType(),
|
||||
|
||||
Reference in New Issue
Block a user