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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 void SkGLContext::testAbandon() { | 98 void SkGLContext::testAbandon() { |
99 if (fGL) { | 99 if (fGL) { |
100 fGL->abandon(); | 100 fGL->abandon(); |
101 } | 101 } |
102 if (fFenceSync) { | 102 if (fFenceSync) { |
103 memset(fFrameFences, 0, sizeof(fFrameFences)); | 103 memset(fFrameFences, 0, sizeof(fFrameFences)); |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 SkGLContext::GLFenceSync* SkGLContext::GLFenceSync::CreateIfSupported(const SkGL
Context* ctx) { | 107 SkGLContext::GLFenceSync* SkGLContext::GLFenceSync::CreateIfSupported(const SkGL
Context* ctx) { |
108 SkAutoTDelete<GLFenceSync> ret(SkNEW(GLFenceSync)); | 108 SkAutoTDelete<GLFenceSync> ret(new GLFenceSync); |
109 | 109 |
110 if (kGL_GrGLStandard == ctx->gl()->fStandard) { | 110 if (kGL_GrGLStandard == ctx->gl()->fStandard) { |
111 const GrGLubyte* versionStr; | 111 const GrGLubyte* versionStr; |
112 SK_GL_RET(*ctx, versionStr, GetString(GR_GL_VERSION)); | 112 SK_GL_RET(*ctx, versionStr, GetString(GR_GL_VERSION)); |
113 GrGLVersion version = GrGLGetVersionFromString(reinterpret_cast<const ch
ar*>(versionStr)); | 113 GrGLVersion version = GrGLGetVersionFromString(reinterpret_cast<const ch
ar*>(versionStr)); |
114 if (version < GR_GL_VER(3,2) && !ctx->gl()->hasExtension("GL_ARB_sync"))
{ | 114 if (version < GR_GL_VER(3,2) && !ctx->gl()->hasExtension("GL_ARB_sync"))
{ |
115 return NULL; | 115 return NULL; |
116 } | 116 } |
117 ret->fGLFenceSync = reinterpret_cast<GLFenceSyncProc>( | 117 ret->fGLFenceSync = reinterpret_cast<GLFenceSyncProc>( |
118 ctx->onPlatformGetProcAddress("glFenceSync")); | 118 ctx->onPlatformGetProcAddress("glFenceSync")); |
(...skipping 26 matching lines...) Expand all Loading... |
145 | 145 |
146 bool SkGLContext::GLFenceSync::flushAndWaitFence(SkPlatformGpuFence fence) const
{ | 146 bool SkGLContext::GLFenceSync::flushAndWaitFence(SkPlatformGpuFence fence) const
{ |
147 GLsync glsync = static_cast<GLsync>(fence); | 147 GLsync glsync = static_cast<GLsync>(fence); |
148 return GL_WAIT_FAILED != fGLClientWaitSync(glsync, GL_SYNC_FLUSH_COMMANDS_BI
T, -1); | 148 return GL_WAIT_FAILED != fGLClientWaitSync(glsync, GL_SYNC_FLUSH_COMMANDS_BI
T, -1); |
149 } | 149 } |
150 | 150 |
151 void SkGLContext::GLFenceSync::deleteFence(SkPlatformGpuFence fence) const { | 151 void SkGLContext::GLFenceSync::deleteFence(SkPlatformGpuFence fence) const { |
152 GLsync glsync = static_cast<GLsync>(fence); | 152 GLsync glsync = static_cast<GLsync>(fence); |
153 fGLDeleteSync(glsync); | 153 fGLDeleteSync(glsync); |
154 } | 154 } |
OLD | NEW |