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/SkGLContext.h" | 8 #include "gl/SkGLContext.h" |
9 #include "GrGLUtil.h" | 9 #include "GrGLUtil.h" |
10 #include "SkGpuFenceSync.h" | 10 #include "SkGpuFenceSync.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 | 72 |
73 fGL.reset(nullptr); | 73 fGL.reset(nullptr); |
74 } | 74 } |
75 | 75 |
76 void SkGLContext::makeCurrent() const { | 76 void SkGLContext::makeCurrent() const { |
77 this->onPlatformMakeCurrent(); | 77 this->onPlatformMakeCurrent(); |
78 } | 78 } |
79 | 79 |
80 void SkGLContext::swapBuffers() { | 80 void SkGLContext::swapBuffers() { |
| 81 this->onPlatformSwapBuffers(); |
| 82 } |
| 83 |
| 84 void SkGLContext::waitOnSyncOrSwap() { |
81 if (!fFenceSync) { | 85 if (!fFenceSync) { |
82 // Fallback on the platform SwapBuffers method for synchronization. This
may have no effect. | 86 // Fallback on the platform SwapBuffers method for synchronization. This
may have no effect. |
83 this->onPlatformSwapBuffers(); | 87 this->swapBuffers(); |
84 return; | 88 return; |
85 } | 89 } |
86 | 90 |
87 if (fFrameFences[fCurrentFenceIdx]) { | 91 if (fFrameFences[fCurrentFenceIdx]) { |
88 if (!fFenceSync->waitFence(fFrameFences[fCurrentFenceIdx], true)) { | 92 if (!fFenceSync->waitFence(fFrameFences[fCurrentFenceIdx], true)) { |
89 SkDebugf("WARNING: Wait failed for fence sync. Timings might not be
accurate.\n"); | 93 SkDebugf("WARNING: Wait failed for fence sync. Timings might not be
accurate.\n"); |
90 } | 94 } |
91 fFenceSync->deleteFence(fFrameFences[fCurrentFenceIdx]); | 95 fFenceSync->deleteFence(fFrameFences[fCurrentFenceIdx]); |
92 } | 96 } |
93 | 97 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_MIN_FIL
TER, | 177 GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_MIN_FIL
TER, |
174 GR_GL_NEAREST)); | 178 GR_GL_NEAREST)); |
175 GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_S, | 179 GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_S, |
176 GR_GL_CLAMP_TO_EDGE)); | 180 GR_GL_CLAMP_TO_EDGE)); |
177 GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_T, | 181 GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_T, |
178 GR_GL_CLAMP_TO_EDGE)); | 182 GR_GL_CLAMP_TO_EDGE)); |
179 GR_GL_CALL(fGL, TexImage2D(GR_GL_TEXTURE_RECTANGLE, 0, internalFormat, width
, height, 0, | 183 GR_GL_CALL(fGL, TexImage2D(GR_GL_TEXTURE_RECTANGLE, 0, internalFormat, width
, height, 0, |
180 externalFormat, externalType, data)); | 184 externalFormat, externalType, data)); |
181 return id; | 185 return id; |
182 } | 186 } |
OLD | NEW |