| Index: content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| index 205542cdc81e918839841fbbeb55d99e16c6cadd..b150d0762503d587a8d0c3bd12befdf9aa6184c8 100644
|
| --- a/content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| +++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| @@ -254,17 +254,23 @@ bool BrowserGpuChannelHostFactory::IsGpuMemoryBufferFactoryUsageEnabled(
|
| }
|
|
|
| // static
|
| -uint32 BrowserGpuChannelHostFactory::GetImageTextureTarget() {
|
| - if (!IsGpuMemoryBufferFactoryUsageEnabled(gfx::GpuMemoryBuffer::MAP))
|
| +uint32 BrowserGpuChannelHostFactory::GetImageTextureTarget(
|
| + gfx::GpuMemoryBuffer::Format format,
|
| + gfx::GpuMemoryBuffer::Usage usage) {
|
| + if (!IsGpuMemoryBufferFactoryUsageEnabled(usage))
|
| return GL_TEXTURE_2D;
|
|
|
| std::vector<gfx::GpuMemoryBufferType> supported_types;
|
| GpuMemoryBufferFactory::GetSupportedTypes(&supported_types);
|
| DCHECK(!supported_types.empty());
|
|
|
| - // The GPU service will always use the preferred type.
|
| + // The GPU service will always use the preferred type, if the |format| and
|
| + // |usage| allows.
|
| gfx::GpuMemoryBufferType type = supported_types[0];
|
|
|
| + if (!IsGpuMemoryBufferConfigurationSupportedInternal(format, usage, type))
|
| + return GL_TEXTURE_2D;
|
| +
|
| switch (type) {
|
| case gfx::SURFACE_TEXTURE_BUFFER:
|
| case gfx::OZONE_NATIVE_BUFFER:
|
| @@ -471,11 +477,24 @@ bool BrowserGpuChannelHostFactory::IsGpuMemoryBufferConfigurationSupported(
|
| if (!IsGpuMemoryBufferFactoryUsageEnabled(usage))
|
| return false;
|
|
|
| - // Preferred type is always used by factory.
|
| std::vector<gfx::GpuMemoryBufferType> supported_types;
|
| GpuMemoryBufferFactory::GetSupportedTypes(&supported_types);
|
| DCHECK(!supported_types.empty());
|
| - switch (supported_types[0]) {
|
| +
|
| + // The GPU service will always use the preferred type, if the |format| and
|
| + // |usage| allows.
|
| + gfx::GpuMemoryBufferType type = supported_types[0];
|
| +
|
| + return IsGpuMemoryBufferConfigurationSupportedInternal(format, usage, type);
|
| +}
|
| +
|
| +// static
|
| +bool BrowserGpuChannelHostFactory::
|
| + IsGpuMemoryBufferConfigurationSupportedInternal(
|
| + gfx::GpuMemoryBuffer::Format format,
|
| + gfx::GpuMemoryBuffer::Usage usage,
|
| + gfx::GpuMemoryBufferType type) {
|
| + switch (type) {
|
| case gfx::SHARED_MEMORY_BUFFER:
|
| // Shared memory buffers must be created in-process.
|
| return false;
|
|
|