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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 } |
| 155 |
| 156 GrGLint SkGLContext::createTextureRectangle(int width, int height, GrGLenum inte
rnalFormat, |
| 157 GrGLenum externalFormat, GrGLenum ex
ternalType, |
| 158 GrGLvoid* data) { |
| 159 if (!(kGL_GrGLStandard == fGL->fStandard && GrGLGetVersion(fGL) >= GR_GL_VER
(3, 2)) && |
| 160 !fGL->fExtensions.has("GL_ARB_texture_rectangle")) { |
| 161 return 0; |
| 162 } |
| 163 GrGLuint id; |
| 164 GR_GL_CALL(fGL, GenTextures(1, &id)); |
| 165 GR_GL_CALL(fGL, BindTexture(GR_GL_TEXTURE_RECTANGLE, id)); |
| 166 GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_MAG_FIL
TER, |
| 167 GR_GL_NEAREST)); |
| 168 GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_MIN_FIL
TER, |
| 169 GR_GL_NEAREST)); |
| 170 GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_S, |
| 171 GR_GL_CLAMP_TO_EDGE)); |
| 172 GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_T, |
| 173 GR_GL_CLAMP_TO_EDGE)); |
| 174 GR_GL_CALL(fGL, TexImage2D(GR_GL_TEXTURE_RECTANGLE, 0, internalFormat, width
, height, 0, |
| 175 externalFormat, externalType, data)); |
| 176 return id; |
| 177 } |
OLD | NEW |