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