Bug 950235 - Pick the TextureHost backend in function of the surface descriptor type. r=mattwoodrow

This commit is contained in:
Nicolas Silva 2014-02-05 14:34:16 +01:00
parent 43932d63be
commit d1f33befde

View File

@ -167,27 +167,30 @@ TextureHost::Create(const SurfaceDescriptor& aDesc,
ISurfaceAllocator* aDeallocator,
TextureFlags aFlags)
{
switch (Compositor::GetBackend()) {
case LayersBackend::LAYERS_OPENGL:
switch (aDesc.type()) {
case SurfaceDescriptor::TSurfaceDescriptorShmem:
case SurfaceDescriptor::TSurfaceDescriptorMemory:
return CreateBackendIndependentTextureHost(aDesc, aDeallocator, aFlags);
case SurfaceDescriptor::TSharedTextureDescriptor:
case SurfaceDescriptor::TSurfaceDescriptorGralloc:
case SurfaceDescriptor::TNewSurfaceDescriptorGralloc:
case SurfaceDescriptor::TSurfaceStreamDescriptor:
return CreateTextureHostOGL(aDesc, aDeallocator, aFlags);
case LayersBackend::LAYERS_BASIC:
return CreateTextureHostBasic(aDesc, aDeallocator, aFlags);
#ifdef MOZ_WIDGET_GONK
case LayersBackend::LAYERS_NONE:
// Power on video reqests to allocate TextureHost,
// when Compositor is still not present. This is a very hacky workaround.
// See Bug 944420.
return CreateTextureHostOGL(aDesc, aDeallocator, aFlags);
#endif
case SurfaceDescriptor::TSurfaceDescriptorMacIOSurface:
if (Compositor::GetBackend() == LayersBackend::LAYERS_OPENGL) {
return CreateTextureHostOGL(aDesc, aDeallocator, aFlags);
} else {
return CreateTextureHostBasic(aDesc, aDeallocator, aFlags);
}
#ifdef XP_WIN
case LayersBackend::LAYERS_D3D11:
return CreateTextureHostD3D11(aDesc, aDeallocator, aFlags);
case LayersBackend::LAYERS_D3D9:
case SurfaceDescriptor::TSurfaceDescriptorD3D9:
case SurfaceDescriptor::TSurfaceDescriptorDIB:
return CreateTextureHostD3D9(aDesc, aDeallocator, aFlags);
case SurfaceDescriptor::TSurfaceDescriptorD3D10:
return CreateTextureHostD3D11(aDesc, aDeallocator, aFlags);
#endif
default:
MOZ_CRASH("Couldn't create texture host");
return nullptr;
MOZ_CRASH("Unsupported Surface type");
}
}