summaryrefslogtreecommitdiffstats
path: root/ui/gl/gpu_switching_manager.cc
diff options
context:
space:
mode:
authordongseong.hwang <dongseong.hwang@intel.com>2014-12-08 02:41:55 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-08 10:43:24 +0000
commit72183b04964ecf5d8925dcf63335c4b5dc0e47ae (patch)
tree2a34294972a6b0d4f571afc8945ef51edaf806a4 /ui/gl/gpu_switching_manager.cc
parent447b8b18c9104a9be7ca95a7ccc346bf2f0c985d (diff)
downloadchromium_src-72183b04964ecf5d8925dcf63335c4b5dc0e47ae.zip
chromium_src-72183b04964ecf5d8925dcf63335c4b5dc0e47ae.tar.gz
chromium_src-72183b04964ecf5d8925dcf63335c4b5dc0e47ae.tar.bz2
cc: zero/one-copy based on shared memory on IOS uses GL_TEXTURE_2D, not GL_TEXTURE_RECTANGLE_ARB.
GL_TEXTURE_RECTANGLE_ARB is needed for only IOSurface backed images like GL_TEXTURE_EXTERNAL_OES is needed for only surface texture backed images on Android. Replace switches::kUseImageExternal with switches::kUseImageTextureTarget in order to let cc know what is proper texture target backed image. Review URL: https://codereview.chromium.org/766663005 Cr-Commit-Position: refs/heads/master@{#307214}
Diffstat (limited to 'ui/gl/gpu_switching_manager.cc')
-rw-r--r--ui/gl/gpu_switching_manager.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/ui/gl/gpu_switching_manager.cc b/ui/gl/gpu_switching_manager.cc
index f904629..020592f 100644
--- a/ui/gl/gpu_switching_manager.cc
+++ b/ui/gl/gpu_switching_manager.cc
@@ -9,12 +9,19 @@
#include "ui/gl/gl_switches.h"
#if defined(OS_MACOSX)
+#include <OpenGL/OpenGL.h>
#include "base/mac/mac_util.h"
#include "ui/gl/gl_context_cgl.h"
#endif // OS_MACOSX
namespace ui {
+struct GpuSwitchingManager::PlatformSpecific {
+#if defined(OS_MACOSX)
+ CGLPixelFormatObj discrete_pixel_format;
+#endif // OS_MACOSX
+};
+
// static
GpuSwitchingManager* GpuSwitchingManager::GetInstance() {
return Singleton<GpuSwitchingManager>::get();
@@ -25,16 +32,17 @@ GpuSwitchingManager::GpuSwitchingManager()
gpu_switching_option_set_(false),
supports_dual_gpus_(false),
supports_dual_gpus_set_(false),
- gpu_count_(0) {
+ gpu_count_(0),
+ platform_specific_(new PlatformSpecific) {
#if defined(OS_MACOSX)
- discrete_pixel_format_ = NULL;
+ platform_specific_->discrete_pixel_format = nullptr;
#endif // OS_MACOSX
}
GpuSwitchingManager::~GpuSwitchingManager() {
#if defined(OS_MACOSX)
- if (discrete_pixel_format_)
- CGLReleasePixelFormat(discrete_pixel_format_);
+ if (platform_specific_->discrete_pixel_format)
+ CGLReleasePixelFormat(platform_specific_->discrete_pixel_format);
#endif // OS_MACOSX
}
@@ -123,12 +131,13 @@ gfx::GpuPreference GpuSwitchingManager::AdjustGpuPreference(
#if defined(OS_MACOSX)
void GpuSwitchingManager::SwitchToDiscreteGpuMac() {
- if (discrete_pixel_format_)
+ if (platform_specific_->discrete_pixel_format)
return;
CGLPixelFormatAttribute attribs[1];
attribs[0] = static_cast<CGLPixelFormatAttribute>(0);
GLint num_pixel_formats = 0;
- CGLChoosePixelFormat(attribs, &discrete_pixel_format_, &num_pixel_formats);
+ CGLChoosePixelFormat(attribs, &platform_specific_->discrete_pixel_format,
+ &num_pixel_formats);
}
#endif // OS_MACOSX