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 0eee6d4ce2ffff896be9cb3740e9047f70cea610..fea661a4084ac07a158f20fe162574be2613ce8c 100644 |
--- a/content/browser/gpu/browser_gpu_channel_host_factory.cc |
+++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc |
@@ -21,6 +21,7 @@ |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/gpu_data_manager.h" |
#include "content/public/common/content_client.h" |
+#include "gpu/GLES2/gl2extchromium.h" |
#include "ipc/ipc_channel_handle.h" |
#include "ipc/ipc_forwarding_message_filter.h" |
#include "ipc/message_filter.h" |
@@ -247,6 +248,31 @@ bool BrowserGpuChannelHostFactory::IsGpuMemoryBufferFactoryUsageEnabled( |
return g_enabled_gpu_memory_buffer_usages.Get().count(usage) != 0; |
} |
+// static |
+uint32 BrowserGpuChannelHostFactory::GetImageTextureTarget() { |
+ if (!IsGpuMemoryBufferFactoryUsageEnabled(gfx::GpuMemoryBuffer::MAP)) |
+ 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. |
+ gfx::GpuMemoryBufferType type = supported_types[0]; |
+ |
+ switch (type) { |
+ case gfx::SURFACE_TEXTURE_BUFFER: |
+ // Surface texture backed GPU memory buffers require |
+ // TEXTURE_EXTERNAL_OES. |
+ return GL_TEXTURE_EXTERNAL_OES; |
+ case gfx::IO_SURFACE_BUFFER: |
+ // IOSurface backed images require GL_TEXTURE_RECTANGLE_ARB. |
+ return GL_TEXTURE_RECTANGLE_ARB; |
+ default: |
+ return GL_TEXTURE_2D; |
+ } |
+} |
+ |
BrowserGpuChannelHostFactory::BrowserGpuChannelHostFactory() |
: gpu_client_id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
shutdown_event_(new base::WaitableEvent(true, false)), |