Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: src/gpu/gl/SkGLContextHelper.cpp

Issue 319043005: Support using OpenGL ES context on desktop (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add docs Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "gl/SkGLContextHelper.h" 8 #include "gl/SkGLContextHelper.h"
9 #include "GrGLUtil.h" 9 #include "GrGLUtil.h"
10 10
11 SkGLContextHelper::SkGLContextHelper() 11 SkGLContextHelper::SkGLContextHelper()
12 : fFBO(0) 12 : fFBO(0)
13 , fColorBufferID(0) 13 , fColorBufferID(0)
14 , fDepthStencilBufferID(0) 14 , fDepthStencilBufferID(0)
15 , fGL(NULL) { 15 , fGL(NULL) {
16 } 16 }
17 17
18 SkGLContextHelper::~SkGLContextHelper() { 18 SkGLContextHelper::~SkGLContextHelper() {
19 19
20 if (fGL) { 20 if (fGL) {
21 // TODO: determine why DeleteFramebuffers is generating a GL error in te sts 21 // TODO: determine why DeleteFramebuffers is generating a GL error in te sts
22 SK_GL_NOERRCHECK(*this, DeleteFramebuffers(1, &fFBO)); 22 SK_GL_NOERRCHECK(*this, DeleteFramebuffers(1, &fFBO));
23 SK_GL_NOERRCHECK(*this, DeleteRenderbuffers(1, &fColorBufferID)); 23 SK_GL_NOERRCHECK(*this, DeleteRenderbuffers(1, &fColorBufferID));
24 SK_GL_NOERRCHECK(*this, DeleteRenderbuffers(1, &fDepthStencilBufferID)); 24 SK_GL_NOERRCHECK(*this, DeleteRenderbuffers(1, &fDepthStencilBufferID));
25 } 25 }
26 26
27 SkSafeUnref(fGL); 27 SkSafeUnref(fGL);
28 } 28 }
29 29
30 bool SkGLContextHelper::init(int width, int height) { 30 bool SkGLContextHelper::init(GrGLStandard forcedGpuAPI, int width,
31 int height) {
31 if (fGL) { 32 if (fGL) {
32 fGL->unref(); 33 fGL->unref();
33 this->destroyGLContext(); 34 this->destroyGLContext();
34 } 35 }
35 36
36 fGL = this->createGLContext(); 37 fGL = this->createGLContext(forcedGpuAPI);
37 if (fGL) { 38 if (fGL) {
38 const GrGLubyte* temp; 39 const GrGLubyte* temp;
39 40
40 if (!fGL->validate()) { 41 if (!fGL->validate()) {
41 fGL = NULL; 42 fGL = NULL;
42 this->destroyGLContext(); 43 this->destroyGLContext();
43 return false; 44 return false;
44 } 45 }
45 46
46 SK_GL_RET(*this, temp, GetString(GR_GL_VERSION)); 47 SK_GL_RET(*this, temp, GetString(GR_GL_VERSION));
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 fGL->unref(); 127 fGL->unref();
127 fGL = NULL; 128 fGL = NULL;
128 this->destroyGLContext(); 129 this->destroyGLContext();
129 return false; 130 return false;
130 } else { 131 } else {
131 return true; 132 return true;
132 } 133 }
133 } 134 }
134 return false; 135 return false;
135 } 136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698