OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/gl/gl_context_osmesa.h" | 5 #include "ui/gl/gl_context_osmesa.h" |
6 | 6 |
7 #include <GL/osmesa.h> | 7 #include <GL/osmesa.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
11 #include "ui/gl/gl_bindings.h" | 11 #include "ui/gl/gl_bindings.h" |
12 #include "ui/gl/gl_surface.h" | 12 #include "ui/gl/gl_surface.h" |
13 | 13 |
14 namespace gl { | 14 namespace gl { |
15 | 15 |
16 GLContextOSMesa::GLContextOSMesa(GLShareGroup* share_group) | 16 GLContextOSMesa::GLContextOSMesa(GLShareGroup* share_group) |
17 : GLContextReal(share_group), | 17 : GLContextReal(share_group), |
18 context_(nullptr), | 18 context_(nullptr), |
19 is_released_(false) { | 19 is_released_(false) { |
20 } | 20 } |
21 | 21 |
22 bool GLContextOSMesa::Initialize(GLSurface* compatible_surface, | 22 bool GLContextOSMesa::Initialize(GLSurface* compatible_surface, |
23 const GLContextAttribs& attribs) { | 23 GpuPreference gpu_preference) { |
24 // webgl_compatibility_context and disabling bind_generates_resource are not | |
25 // supported. | |
26 DCHECK(!attribs.webgl_compatibility_context && | |
27 attribs.bind_generates_resource); | |
28 | |
29 DCHECK(!context_); | 24 DCHECK(!context_); |
30 | 25 |
31 OSMesaContext share_handle = static_cast<OSMesaContext>( | 26 OSMesaContext share_handle = static_cast<OSMesaContext>( |
32 share_group() ? share_group()->GetHandle() : nullptr); | 27 share_group() ? share_group()->GetHandle() : nullptr); |
33 | 28 |
34 GLuint format = 0; | 29 GLuint format = 0; |
35 switch (compatible_surface->GetFormat()) { | 30 switch (compatible_surface->GetFormat()) { |
36 case GLSurface::SURFACE_OSMESA_BGRA: | 31 case GLSurface::SURFACE_OSMESA_BGRA: |
37 format = OSMESA_BGRA; | 32 format = OSMESA_BGRA; |
38 break; | 33 break; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 142 |
148 void GLContextOSMesa::OnSetSwapInterval(int interval) { | 143 void GLContextOSMesa::OnSetSwapInterval(int interval) { |
149 DCHECK(IsCurrent(nullptr)); | 144 DCHECK(IsCurrent(nullptr)); |
150 } | 145 } |
151 | 146 |
152 GLContextOSMesa::~GLContextOSMesa() { | 147 GLContextOSMesa::~GLContextOSMesa() { |
153 Destroy(); | 148 Destroy(); |
154 } | 149 } |
155 | 150 |
156 } // namespace gl | 151 } // namespace gl |
OLD | NEW |