| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/output/delegating_renderer.h" | 5 #include "cc/output/delegating_renderer.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 context3d->pushGroupMarkerEXT("CompositorContext"); | 73 context3d->pushGroupMarkerEXT("CompositorContext"); |
| 74 | 74 |
| 75 std::string extensions_string = | 75 std::string extensions_string = |
| 76 UTF16ToASCII(context3d->getString(GL_EXTENSIONS)); | 76 UTF16ToASCII(context3d->getString(GL_EXTENSIONS)); |
| 77 | 77 |
| 78 std::vector<std::string> extensions; | 78 std::vector<std::string> extensions; |
| 79 base::SplitString(extensions_string, ' ', &extensions); | 79 base::SplitString(extensions_string, ' ', &extensions); |
| 80 | 80 |
| 81 // TODO(danakj): We need non-GPU-specific paths for these things. This | 81 // TODO(danakj): We need non-GPU-specific paths for these things. This |
| 82 // renderer shouldn't need to use context3d extensions directly. | 82 // renderer shouldn't need to use context3d extensions directly. |
| 83 bool has_read_bgra = true; | 83 bool has_read_bgra = false; |
| 84 bool has_set_visibility = true; | 84 bool has_set_visibility = false; |
| 85 bool has_io_surface = true; | 85 bool has_io_surface = false; |
| 86 bool has_arb_texture_rect = true; | 86 bool has_arb_texture_rect = false; |
| 87 bool has_egl_image = true; | 87 bool has_egl_image = false; |
| 88 bool has_map_image = false; |
| 88 for (size_t i = 0; i < extensions.size(); ++i) { | 89 for (size_t i = 0; i < extensions.size(); ++i) { |
| 89 if (extensions[i] == "GL_EXT_read_format_bgra") | 90 if (extensions[i] == "GL_EXT_read_format_bgra") { |
| 90 has_read_bgra = true; | 91 has_read_bgra = true; |
| 91 else if (extensions[i] == "GL_CHROMIUM_set_visibility") | 92 } else if (extensions[i] == "GL_CHROMIUM_set_visibility") { |
| 92 has_set_visibility = true; | 93 has_set_visibility = true; |
| 93 else if (extensions[i] == "GL_CHROMIUM_iosurface") | 94 } else if (extensions[i] == "GL_CHROMIUM_iosurface") { |
| 94 has_io_surface = true; | 95 has_io_surface = true; |
| 95 else if (extensions[i] == "GL_ARB_texture_rectangle") | 96 } else if (extensions[i] == "GL_ARB_texture_rectangle") { |
| 96 has_arb_texture_rect = true; | 97 has_arb_texture_rect = true; |
| 97 else if (extensions[i] == "GL_OES_EGL_image_external") | 98 } else if (extensions[i] == "GL_OES_EGL_image_external") { |
| 98 has_egl_image = true; | 99 has_egl_image = true; |
| 100 } else if (extensions[i] == "GL_CHROMIUM_map_image") { |
| 101 has_map_image = true; |
| 102 } |
| 99 } | 103 } |
| 100 | 104 |
| 101 if (has_io_surface) | 105 if (has_io_surface) |
| 102 DCHECK(has_arb_texture_rect); | 106 DCHECK(has_arb_texture_rect); |
| 103 | 107 |
| 104 capabilities_.using_accelerated_painting = | 108 capabilities_.using_accelerated_painting = |
| 105 Settings().accelerate_painting && | 109 Settings().accelerate_painting && |
| 106 capabilities_.best_texture_format == GL_BGRA_EXT && | 110 capabilities_.best_texture_format == GL_BGRA_EXT && |
| 107 has_read_bgra; | 111 has_read_bgra; |
| 108 | 112 |
| 109 // TODO(piman): loop visibility to GPU process? | 113 // TODO(piman): loop visibility to GPU process? |
| 110 capabilities_.using_set_visibility = has_set_visibility; | 114 capabilities_.using_set_visibility = has_set_visibility; |
| 111 | 115 |
| 112 // TODO(danakj): Support GpuMemoryManager. | 116 // TODO(danakj): Support GpuMemoryManager. |
| 113 capabilities_.using_gpu_memory_manager = false; | 117 capabilities_.using_gpu_memory_manager = false; |
| 114 | 118 |
| 115 capabilities_.using_egl_image = has_egl_image; | 119 capabilities_.using_egl_image = has_egl_image; |
| 116 | 120 |
| 121 capabilities_.using_map_image = has_map_image; |
| 122 |
| 117 return true; | 123 return true; |
| 118 } | 124 } |
| 119 | 125 |
| 120 DelegatingRenderer::~DelegatingRenderer() {} | 126 DelegatingRenderer::~DelegatingRenderer() {} |
| 121 | 127 |
| 122 const RendererCapabilities& DelegatingRenderer::Capabilities() const { | 128 const RendererCapabilities& DelegatingRenderer::Capabilities() const { |
| 123 return capabilities_; | 129 return capabilities_; |
| 124 } | 130 } |
| 125 | 131 |
| 126 bool DelegatingRenderer::CanReadPixels() const { return false; } | 132 bool DelegatingRenderer::CanReadPixels() const { return false; } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 if (!context3d) | 186 if (!context3d) |
| 181 return false; | 187 return false; |
| 182 return context3d->getGraphicsResetStatusARB() != GL_NO_ERROR; | 188 return context3d->getGraphicsResetStatusARB() != GL_NO_ERROR; |
| 183 } | 189 } |
| 184 | 190 |
| 185 void DelegatingRenderer::SetVisible(bool visible) { | 191 void DelegatingRenderer::SetVisible(bool visible) { |
| 186 visible_ = visible; | 192 visible_ = visible; |
| 187 } | 193 } |
| 188 | 194 |
| 189 } // namespace cc | 195 } // namespace cc |
| OLD | NEW |