OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/gl/init/gl_factory.h" | 5 #include "ui/gl/init/gl_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
9 #include "ui/gl/gl_context.h" | 9 #include "ui/gl/gl_context.h" |
10 #include "ui/gl/gl_context_egl.h" | 10 #include "ui/gl/gl_context_egl.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 NOTREACHED(); | 41 NOTREACHED(); |
42 } | 42 } |
43 return nullptr; | 43 return nullptr; |
44 } | 44 } |
45 | 45 |
46 scoped_refptr<GLSurface> CreateDefaultOffscreenGLSurface( | 46 scoped_refptr<GLSurface> CreateDefaultOffscreenGLSurface( |
47 const gfx::Size& size) { | 47 const gfx::Size& size) { |
48 switch (GetGLImplementation()) { | 48 switch (GetGLImplementation()) { |
49 case kGLImplementationOSMesaGL: | 49 case kGLImplementationOSMesaGL: |
50 return InitializeGLSurface( | 50 return InitializeGLSurface( |
51 new GLSurfaceOSMesa(GLSurface::SURFACE_OSMESA_BGRA, size)); | 51 new GLSurfaceOSMesa( |
| 52 GLSurfaceFormat(GLSurfaceFormat::PIXEL_LAYOUT_BGRA), size)); |
52 case kGLImplementationMockGL: | 53 case kGLImplementationMockGL: |
53 return InitializeGLSurface(new GLSurfaceStub); | 54 return InitializeGLSurface(new GLSurfaceStub); |
54 default: | 55 default: |
55 NOTREACHED(); | 56 NOTREACHED(); |
56 } | 57 } |
57 return nullptr; | 58 return nullptr; |
58 } | 59 } |
59 | 60 |
60 } // namespace | 61 } // namespace |
61 | 62 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 125 |
125 if (HasGLOzone()) | 126 if (HasGLOzone()) |
126 return GetGLOzone()->CreateSurfacelessViewGLSurface(window); | 127 return GetGLOzone()->CreateSurfacelessViewGLSurface(window); |
127 | 128 |
128 // TODO(kylechar): This is deprecated and can be removed once all Ozone | 129 // TODO(kylechar): This is deprecated and can be removed once all Ozone |
129 // platforms use GLOzone instead. | 130 // platforms use GLOzone instead. |
130 return GetSurfaceFactoryOzone()->CreateSurfacelessViewGLSurface( | 131 return GetSurfaceFactoryOzone()->CreateSurfacelessViewGLSurface( |
131 GetGLImplementation(), window); | 132 GetGLImplementation(), window); |
132 } | 133 } |
133 | 134 |
134 scoped_refptr<GLSurface> CreateOffscreenGLSurface(const gfx::Size& size) { | 135 scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat( |
| 136 const gfx::Size& size, GLSurfaceFormat format) { |
135 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface"); | 137 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface"); |
136 | 138 |
| 139 if (!format.IsDefault()) { |
| 140 NOTREACHED() << "FATAL: Ozone only supports default-format surfaces."; |
| 141 return nullptr; |
| 142 } |
| 143 |
137 if (HasGLOzone()) | 144 if (HasGLOzone()) |
138 return GetGLOzone()->CreateOffscreenGLSurface(size); | 145 return GetGLOzone()->CreateOffscreenGLSurface(size); |
139 | 146 |
140 if (HasDefaultImplementation(GetGLImplementation())) | 147 if (HasDefaultImplementation(GetGLImplementation())) |
141 return CreateDefaultOffscreenGLSurface(size); | 148 return CreateDefaultOffscreenGLSurface(size); |
142 | 149 |
143 // TODO(kylechar): This is deprecated and can be removed once all Ozone | 150 // TODO(kylechar): This is deprecated and can be removed once all Ozone |
144 // platforms use GLOzone instead. | 151 // platforms use GLOzone instead. |
145 return GetSurfaceFactoryOzone()->CreateOffscreenGLSurface( | 152 return GetSurfaceFactoryOzone()->CreateOffscreenGLSurface( |
146 GetGLImplementation(), size); | 153 GetGLImplementation(), size); |
147 } | 154 } |
148 | 155 |
149 } // namespace init | 156 } // namespace init |
150 } // namespace gl | 157 } // namespace gl |
OLD | NEW |