Bug 1265824 - Don't use client storage for overly large textures r?mstange
See comment for details.
MozReview-Commit-ID: 7N2i2Za8nY7
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -1231,20 +1231,25 @@ TextureClient::CreateFromSurface(KnowsCo
already_AddRefed<TextureClient>
TextureClient::CreateForRawBufferAccess(KnowsCompositor* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
gfx::BackendType aMoz2DBackend,
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();
return CreateForRawBufferAccess(aAllocator->GetTextureForwarder(),
aFormat, aSize, aMoz2DBackend,
aAllocator->GetCompositorBackendType(),
- aAllocator->SupportsTextureDirectMapping(),
+ supportsTextureDirectMapping,
aTextureFlags, aAllocFlags);
}
// static
already_AddRefed<TextureClient>
TextureClient::CreateForRawBufferAccess(LayersIPCChannel* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,