OLD | NEW |
---|---|
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 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 if (!fGL->validate(bindingInUse) || !fExtensions.init(bindingInUse, fGL) ) { | 44 if (!fGL->validate(bindingInUse) || !fExtensions.init(bindingInUse, fGL) ) { |
45 fGL = NULL; | 45 fGL = NULL; |
46 this->destroyGLContext(); | 46 this->destroyGLContext(); |
47 return false; | 47 return false; |
48 } | 48 } |
49 | 49 |
50 SK_GL_RET(*this, temp, GetString(GR_GL_VERSION)); | 50 SK_GL_RET(*this, temp, GetString(GR_GL_VERSION)); |
51 const char* versionStr = reinterpret_cast<const char*>(temp); | 51 const char* versionStr = reinterpret_cast<const char*>(temp); |
52 GrGLVersion version = GrGLGetVersionFromString(versionStr); | 52 GrGLVersion version = GrGLGetVersionFromString(versionStr); |
53 | 53 |
54 #ifdef SK_DEBUG | |
bsalomon
2013/11/07 15:06:59
This file should only be used in our test programs
slavi
2013/11/07 20:53:29
Done.
| |
54 // clear any existing GL erorrs | 55 // clear any existing GL erorrs |
55 GrGLenum error; | 56 GrGLenum error; |
56 do { | 57 do { |
57 SK_GL_RET(*this, error, GetError()); | 58 SK_GL_RET(*this, error, GetError()); |
58 } while (GR_GL_NO_ERROR != error); | 59 } while (GR_GL_NO_ERROR != error); |
60 #endif | |
59 | 61 |
60 SK_GL(*this, GenFramebuffers(1, &fFBO)); | 62 SK_GL(*this, GenFramebuffers(1, &fFBO)); |
61 SK_GL(*this, BindFramebuffer(GR_GL_FRAMEBUFFER, fFBO)); | 63 SK_GL(*this, BindFramebuffer(GR_GL_FRAMEBUFFER, fFBO)); |
62 SK_GL(*this, GenRenderbuffers(1, &fColorBufferID)); | 64 SK_GL(*this, GenRenderbuffers(1, &fColorBufferID)); |
63 SK_GL(*this, BindRenderbuffer(GR_GL_RENDERBUFFER, fColorBufferID)); | 65 SK_GL(*this, BindRenderbuffer(GR_GL_RENDERBUFFER, fColorBufferID)); |
64 if (kES_GrGLBinding == bindingInUse) { | 66 if (kES_GrGLBinding == bindingInUse) { |
65 SK_GL(*this, RenderbufferStorage(GR_GL_RENDERBUFFER, | 67 SK_GL(*this, RenderbufferStorage(GR_GL_RENDERBUFFER, |
66 GR_GL_RGBA8, | 68 GR_GL_RGBA8, |
67 width, height)); | 69 width, height)); |
68 } else { | 70 } else { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 width, height)); | 114 width, height)); |
113 } | 115 } |
114 SK_GL(*this, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 116 SK_GL(*this, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
115 GR_GL_STENCIL_ATTACHMENT, | 117 GR_GL_STENCIL_ATTACHMENT, |
116 GR_GL_RENDERBUFFER, | 118 GR_GL_RENDERBUFFER, |
117 fDepthStencilBufferID)); | 119 fDepthStencilBufferID)); |
118 SK_GL(*this, Viewport(0, 0, width, height)); | 120 SK_GL(*this, Viewport(0, 0, width, height)); |
119 SK_GL(*this, ClearStencil(0)); | 121 SK_GL(*this, ClearStencil(0)); |
120 SK_GL(*this, Clear(GR_GL_STENCIL_BUFFER_BIT)); | 122 SK_GL(*this, Clear(GR_GL_STENCIL_BUFFER_BIT)); |
121 | 123 |
124 #ifdef SK_DEBUG | |
122 SK_GL_RET(*this, error, GetError()); | 125 SK_GL_RET(*this, error, GetError()); |
123 GrGLenum status; | 126 GrGLenum status; |
124 SK_GL_RET(*this, status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); | 127 SK_GL_RET(*this, status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); |
125 | 128 |
126 if (GR_GL_FRAMEBUFFER_COMPLETE != status || | 129 if (GR_GL_FRAMEBUFFER_COMPLETE != status || |
127 GR_GL_NO_ERROR != error) { | 130 GR_GL_NO_ERROR != error) { |
128 fFBO = 0; | 131 fFBO = 0; |
129 fColorBufferID = 0; | 132 fColorBufferID = 0; |
130 fDepthStencilBufferID = 0; | 133 fDepthStencilBufferID = 0; |
131 fGL->unref(); | 134 fGL->unref(); |
132 fGL = NULL; | 135 fGL = NULL; |
133 this->destroyGLContext(); | 136 this->destroyGLContext(); |
134 return false; | 137 return false; |
135 } else { | 138 } else { |
136 return true; | 139 return true; |
137 } | 140 } |
141 #else | |
142 return true; | |
143 #endif | |
138 } | 144 } |
139 return false; | 145 return false; |
140 } | 146 } |
OLD | NEW |