| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file is auto-generated from | 5 // This file is auto-generated from |
| 6 // gpu/command_buffer/build_gles2_cmd_buffer.py | 6 // gpu/command_buffer/build_gles2_cmd_buffer.py |
| 7 // DO NOT EDIT! | 7 // DO NOT EDIT! |
| 8 | 8 |
| 9 #include "ppapi/shared_impl/ppb_opengles2_shared.h" | 9 #include "ppapi/shared_impl/ppb_opengles2_shared.h" |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "gpu/command_buffer/client/gles2_implementation.h" | 12 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 13 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" | 13 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" |
| 14 #include "ppapi/thunk/enter.h" | 14 #include "ppapi/thunk/enter.h" |
| 15 | 15 |
| 16 namespace ppapi { | 16 namespace ppapi { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 typedef thunk::EnterResource<thunk::PPB_Graphics3D_API> Enter3D; |
| 21 |
| 22 gpu::gles2::GLES2Implementation* ToGles2Impl(Enter3D* enter) { |
| 23 CHECK(enter); |
| 24 CHECK(enter->succeeded()); |
| 25 return static_cast<PPB_Graphics3D_Shared*>(enter->object())->gles2_impl(); |
| 26 } |
| 27 |
| 20 gpu::gles2::GLES2Implementation* GetGLES(PP_Resource context) { | 28 gpu::gles2::GLES2Implementation* GetGLES(PP_Resource context) { |
| 21 thunk::EnterResource<thunk::PPB_Graphics3D_API> enter_g3d(context, false); | 29 thunk::EnterResource<thunk::PPB_Graphics3D_API> enter_g3d(context, false); |
| 22 DCHECK(enter_g3d.succeeded()); | 30 DCHECK(enter_g3d.succeeded()); |
| 23 return static_cast<PPB_Graphics3D_Shared*>(enter_g3d.object())->gles2_impl(); | 31 return static_cast<PPB_Graphics3D_Shared*>(enter_g3d.object())->gles2_impl(); |
| 24 } | 32 } |
| 25 | 33 |
| 26 void ActiveTexture(PP_Resource context_id, GLenum texture) { | 34 void ActiveTexture(PP_Resource context_id, GLenum texture) { |
| 27 GetGLES(context_id)->ActiveTexture(texture); | 35 Enter3D enter(context_id, true); |
| 36 if (enter.succeeded()) { |
| 37 ToGles2Impl(&enter)->ActiveTexture(texture); |
| 38 } |
| 28 } | 39 } |
| 29 | 40 |
| 30 void AttachShader(PP_Resource context_id, GLuint program, GLuint shader) { | 41 void AttachShader(PP_Resource context_id, GLuint program, GLuint shader) { |
| 31 GetGLES(context_id)->AttachShader(program, shader); | 42 Enter3D enter(context_id, true); |
| 43 if (enter.succeeded()) { |
| 44 ToGles2Impl(&enter)->AttachShader(program, shader); |
| 45 } |
| 32 } | 46 } |
| 33 | 47 |
| 34 void BindAttribLocation( | 48 void BindAttribLocation( |
| 35 PP_Resource context_id, GLuint program, GLuint index, const char* name) { | 49 PP_Resource context_id, GLuint program, GLuint index, const char* name) { |
| 36 GetGLES(context_id)->BindAttribLocation(program, index, name); | 50 Enter3D enter(context_id, true); |
| 51 if (enter.succeeded()) { |
| 52 ToGles2Impl(&enter)->BindAttribLocation(program, index, name); |
| 53 } |
| 37 } | 54 } |
| 38 | 55 |
| 39 void BindBuffer(PP_Resource context_id, GLenum target, GLuint buffer) { | 56 void BindBuffer(PP_Resource context_id, GLenum target, GLuint buffer) { |
| 40 GetGLES(context_id)->BindBuffer(target, buffer); | 57 Enter3D enter(context_id, true); |
| 58 if (enter.succeeded()) { |
| 59 ToGles2Impl(&enter)->BindBuffer(target, buffer); |
| 60 } |
| 41 } | 61 } |
| 42 | 62 |
| 43 void BindFramebuffer( | 63 void BindFramebuffer( |
| 44 PP_Resource context_id, GLenum target, GLuint framebuffer) { | 64 PP_Resource context_id, GLenum target, GLuint framebuffer) { |
| 45 GetGLES(context_id)->BindFramebuffer(target, framebuffer); | 65 Enter3D enter(context_id, true); |
| 66 if (enter.succeeded()) { |
| 67 ToGles2Impl(&enter)->BindFramebuffer(target, framebuffer); |
| 68 } |
| 46 } | 69 } |
| 47 | 70 |
| 48 void BindRenderbuffer( | 71 void BindRenderbuffer( |
| 49 PP_Resource context_id, GLenum target, GLuint renderbuffer) { | 72 PP_Resource context_id, GLenum target, GLuint renderbuffer) { |
| 50 GetGLES(context_id)->BindRenderbuffer(target, renderbuffer); | 73 Enter3D enter(context_id, true); |
| 74 if (enter.succeeded()) { |
| 75 ToGles2Impl(&enter)->BindRenderbuffer(target, renderbuffer); |
| 76 } |
| 51 } | 77 } |
| 52 | 78 |
| 53 void BindTexture(PP_Resource context_id, GLenum target, GLuint texture) { | 79 void BindTexture(PP_Resource context_id, GLenum target, GLuint texture) { |
| 54 GetGLES(context_id)->BindTexture(target, texture); | 80 Enter3D enter(context_id, true); |
| 81 if (enter.succeeded()) { |
| 82 ToGles2Impl(&enter)->BindTexture(target, texture); |
| 83 } |
| 55 } | 84 } |
| 56 | 85 |
| 57 void BlendColor( | 86 void BlendColor( |
| 58 PP_Resource context_id, GLclampf red, GLclampf green, GLclampf blue, | 87 PP_Resource context_id, GLclampf red, GLclampf green, GLclampf blue, |
| 59 GLclampf alpha) { | 88 GLclampf alpha) { |
| 60 GetGLES(context_id)->BlendColor(red, green, blue, alpha); | 89 Enter3D enter(context_id, true); |
| 90 if (enter.succeeded()) { |
| 91 ToGles2Impl(&enter)->BlendColor(red, green, blue, alpha); |
| 92 } |
| 61 } | 93 } |
| 62 | 94 |
| 63 void BlendEquation(PP_Resource context_id, GLenum mode) { | 95 void BlendEquation(PP_Resource context_id, GLenum mode) { |
| 64 GetGLES(context_id)->BlendEquation(mode); | 96 Enter3D enter(context_id, true); |
| 97 if (enter.succeeded()) { |
| 98 ToGles2Impl(&enter)->BlendEquation(mode); |
| 99 } |
| 65 } | 100 } |
| 66 | 101 |
| 67 void BlendEquationSeparate( | 102 void BlendEquationSeparate( |
| 68 PP_Resource context_id, GLenum modeRGB, GLenum modeAlpha) { | 103 PP_Resource context_id, GLenum modeRGB, GLenum modeAlpha) { |
| 69 GetGLES(context_id)->BlendEquationSeparate(modeRGB, modeAlpha); | 104 Enter3D enter(context_id, true); |
| 105 if (enter.succeeded()) { |
| 106 ToGles2Impl(&enter)->BlendEquationSeparate(modeRGB, modeAlpha); |
| 107 } |
| 70 } | 108 } |
| 71 | 109 |
| 72 void BlendFunc(PP_Resource context_id, GLenum sfactor, GLenum dfactor) { | 110 void BlendFunc(PP_Resource context_id, GLenum sfactor, GLenum dfactor) { |
| 73 GetGLES(context_id)->BlendFunc(sfactor, dfactor); | 111 Enter3D enter(context_id, true); |
| 112 if (enter.succeeded()) { |
| 113 ToGles2Impl(&enter)->BlendFunc(sfactor, dfactor); |
| 114 } |
| 74 } | 115 } |
| 75 | 116 |
| 76 void BlendFuncSeparate( | 117 void BlendFuncSeparate( |
| 77 PP_Resource context_id, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, | 118 PP_Resource context_id, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, |
| 78 GLenum dstAlpha) { | 119 GLenum dstAlpha) { |
| 79 GetGLES(context_id)->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); | 120 Enter3D enter(context_id, true); |
| 121 if (enter.succeeded()) { |
| 122 ToGles2Impl(&enter)->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); |
| 123 } |
| 80 } | 124 } |
| 81 | 125 |
| 82 void BufferData( | 126 void BufferData( |
| 83 PP_Resource context_id, GLenum target, GLsizeiptr size, const void* data, | 127 PP_Resource context_id, GLenum target, GLsizeiptr size, const void* data, |
| 84 GLenum usage) { | 128 GLenum usage) { |
| 85 GetGLES(context_id)->BufferData(target, size, data, usage); | 129 Enter3D enter(context_id, true); |
| 130 if (enter.succeeded()) { |
| 131 ToGles2Impl(&enter)->BufferData(target, size, data, usage); |
| 132 } |
| 86 } | 133 } |
| 87 | 134 |
| 88 void BufferSubData( | 135 void BufferSubData( |
| 89 PP_Resource context_id, GLenum target, GLintptr offset, GLsizeiptr size, | 136 PP_Resource context_id, GLenum target, GLintptr offset, GLsizeiptr size, |
| 90 const void* data) { | 137 const void* data) { |
| 91 GetGLES(context_id)->BufferSubData(target, offset, size, data); | 138 Enter3D enter(context_id, true); |
| 139 if (enter.succeeded()) { |
| 140 ToGles2Impl(&enter)->BufferSubData(target, offset, size, data); |
| 141 } |
| 92 } | 142 } |
| 93 | 143 |
| 94 GLenum CheckFramebufferStatus(PP_Resource context_id, GLenum target) { | 144 GLenum CheckFramebufferStatus(PP_Resource context_id, GLenum target) { |
| 95 return GetGLES(context_id)->CheckFramebufferStatus(target); | 145 Enter3D enter(context_id, true); |
| 146 if (enter.succeeded()) { |
| 147 return ToGles2Impl(&enter)->CheckFramebufferStatus(target); |
| 148 } else { |
| 149 return GL_INVALID_ENUM; |
| 150 } |
| 96 } | 151 } |
| 97 | 152 |
| 98 void Clear(PP_Resource context_id, GLbitfield mask) { | 153 void Clear(PP_Resource context_id, GLbitfield mask) { |
| 99 GetGLES(context_id)->Clear(mask); | 154 Enter3D enter(context_id, true); |
| 155 if (enter.succeeded()) { |
| 156 ToGles2Impl(&enter)->Clear(mask); |
| 157 } |
| 100 } | 158 } |
| 101 | 159 |
| 102 void ClearColor( | 160 void ClearColor( |
| 103 PP_Resource context_id, GLclampf red, GLclampf green, GLclampf blue, | 161 PP_Resource context_id, GLclampf red, GLclampf green, GLclampf blue, |
| 104 GLclampf alpha) { | 162 GLclampf alpha) { |
| 105 GetGLES(context_id)->ClearColor(red, green, blue, alpha); | 163 Enter3D enter(context_id, true); |
| 164 if (enter.succeeded()) { |
| 165 ToGles2Impl(&enter)->ClearColor(red, green, blue, alpha); |
| 166 } |
| 106 } | 167 } |
| 107 | 168 |
| 108 void ClearDepthf(PP_Resource context_id, GLclampf depth) { | 169 void ClearDepthf(PP_Resource context_id, GLclampf depth) { |
| 109 GetGLES(context_id)->ClearDepthf(depth); | 170 Enter3D enter(context_id, true); |
| 171 if (enter.succeeded()) { |
| 172 ToGles2Impl(&enter)->ClearDepthf(depth); |
| 173 } |
| 110 } | 174 } |
| 111 | 175 |
| 112 void ClearStencil(PP_Resource context_id, GLint s) { | 176 void ClearStencil(PP_Resource context_id, GLint s) { |
| 113 GetGLES(context_id)->ClearStencil(s); | 177 Enter3D enter(context_id, true); |
| 178 if (enter.succeeded()) { |
| 179 ToGles2Impl(&enter)->ClearStencil(s); |
| 180 } |
| 114 } | 181 } |
| 115 | 182 |
| 116 void ColorMask( | 183 void ColorMask( |
| 117 PP_Resource context_id, GLboolean red, GLboolean green, GLboolean blue, | 184 PP_Resource context_id, GLboolean red, GLboolean green, GLboolean blue, |
| 118 GLboolean alpha) { | 185 GLboolean alpha) { |
| 119 GetGLES(context_id)->ColorMask(red, green, blue, alpha); | 186 Enter3D enter(context_id, true); |
| 187 if (enter.succeeded()) { |
| 188 ToGles2Impl(&enter)->ColorMask(red, green, blue, alpha); |
| 189 } |
| 120 } | 190 } |
| 121 | 191 |
| 122 void CompileShader(PP_Resource context_id, GLuint shader) { | 192 void CompileShader(PP_Resource context_id, GLuint shader) { |
| 123 GetGLES(context_id)->CompileShader(shader); | 193 Enter3D enter(context_id, true); |
| 194 if (enter.succeeded()) { |
| 195 ToGles2Impl(&enter)->CompileShader(shader); |
| 196 } |
| 124 } | 197 } |
| 125 | 198 |
| 126 void CompressedTexImage2D( | 199 void CompressedTexImage2D( |
| 127 PP_Resource context_id, GLenum target, GLint level, GLenum internalformat, | 200 PP_Resource context_id, GLenum target, GLint level, GLenum internalformat, |
| 128 GLsizei width, GLsizei height, GLint border, GLsizei imageSize, | 201 GLsizei width, GLsizei height, GLint border, GLsizei imageSize, |
| 129 const void* data) { | 202 const void* data) { |
| 130 GetGLES( | 203 Enter3D enter(context_id, true); |
| 131 context_id)->CompressedTexImage2D( | 204 if (enter.succeeded()) { |
| 132 target, level, internalformat, width, height, border, imageSize, | 205 ToGles2Impl( |
| 133 data); | 206 &enter)->CompressedTexImage2D( |
| 207 target, level, internalformat, width, height, border, imageSize, |
| 208 data); |
| 209 } |
| 134 } | 210 } |
| 135 | 211 |
| 136 void CompressedTexSubImage2D( | 212 void CompressedTexSubImage2D( |
| 137 PP_Resource context_id, GLenum target, GLint level, GLint xoffset, | 213 PP_Resource context_id, GLenum target, GLint level, GLint xoffset, |
| 138 GLint yoffset, GLsizei width, GLsizei height, GLenum format, | 214 GLint yoffset, GLsizei width, GLsizei height, GLenum format, |
| 139 GLsizei imageSize, const void* data) { | 215 GLsizei imageSize, const void* data) { |
| 140 GetGLES( | 216 Enter3D enter(context_id, true); |
| 141 context_id)->CompressedTexSubImage2D( | 217 if (enter.succeeded()) { |
| 142 target, level, xoffset, yoffset, width, height, format, imageSize, | 218 ToGles2Impl( |
| 143 data); | 219 &enter)->CompressedTexSubImage2D( |
| 220 target, level, xoffset, yoffset, width, height, format, imageSize, |
| 221 data); |
| 222 } |
| 144 } | 223 } |
| 145 | 224 |
| 146 void CopyTexImage2D( | 225 void CopyTexImage2D( |
| 147 PP_Resource context_id, GLenum target, GLint level, GLenum internalformat, | 226 PP_Resource context_id, GLenum target, GLint level, GLenum internalformat, |
| 148 GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { | 227 GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { |
| 149 GetGLES( | 228 Enter3D enter(context_id, true); |
| 150 context_id)->CopyTexImage2D( | 229 if (enter.succeeded()) { |
| 151 target, level, internalformat, x, y, width, height, border); | 230 ToGles2Impl( |
| 231 &enter)->CopyTexImage2D( |
| 232 target, level, internalformat, x, y, width, height, border); |
| 233 } |
| 152 } | 234 } |
| 153 | 235 |
| 154 void CopyTexSubImage2D( | 236 void CopyTexSubImage2D( |
| 155 PP_Resource context_id, GLenum target, GLint level, GLint xoffset, | 237 PP_Resource context_id, GLenum target, GLint level, GLint xoffset, |
| 156 GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { | 238 GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { |
| 157 GetGLES( | 239 Enter3D enter(context_id, true); |
| 158 context_id)->CopyTexSubImage2D( | 240 if (enter.succeeded()) { |
| 159 target, level, xoffset, yoffset, x, y, width, height); | 241 ToGles2Impl( |
| 242 &enter)->CopyTexSubImage2D( |
| 243 target, level, xoffset, yoffset, x, y, width, height); |
| 244 } |
| 160 } | 245 } |
| 161 | 246 |
| 162 GLuint CreateProgram(PP_Resource context_id) { | 247 GLuint CreateProgram(PP_Resource context_id) { |
| 163 return GetGLES(context_id)->CreateProgram(); | 248 Enter3D enter(context_id, true); |
| 249 if (enter.succeeded()) { |
| 250 return ToGles2Impl(&enter)->CreateProgram(); |
| 251 } else { |
| 252 return 0; |
| 253 } |
| 164 } | 254 } |
| 165 | 255 |
| 166 GLuint CreateShader(PP_Resource context_id, GLenum type) { | 256 GLuint CreateShader(PP_Resource context_id, GLenum type) { |
| 167 return GetGLES(context_id)->CreateShader(type); | 257 Enter3D enter(context_id, true); |
| 258 if (enter.succeeded()) { |
| 259 return ToGles2Impl(&enter)->CreateShader(type); |
| 260 } else { |
| 261 return 0; |
| 262 } |
| 168 } | 263 } |
| 169 | 264 |
| 170 void CullFace(PP_Resource context_id, GLenum mode) { | 265 void CullFace(PP_Resource context_id, GLenum mode) { |
| 171 GetGLES(context_id)->CullFace(mode); | 266 Enter3D enter(context_id, true); |
| 267 if (enter.succeeded()) { |
| 268 ToGles2Impl(&enter)->CullFace(mode); |
| 269 } |
| 172 } | 270 } |
| 173 | 271 |
| 174 void DeleteBuffers(PP_Resource context_id, GLsizei n, const GLuint* buffers) { | 272 void DeleteBuffers(PP_Resource context_id, GLsizei n, const GLuint* buffers) { |
| 175 GetGLES(context_id)->DeleteBuffers(n, buffers); | 273 Enter3D enter(context_id, true); |
| 274 if (enter.succeeded()) { |
| 275 ToGles2Impl(&enter)->DeleteBuffers(n, buffers); |
| 276 } |
| 176 } | 277 } |
| 177 | 278 |
| 178 void DeleteFramebuffers( | 279 void DeleteFramebuffers( |
| 179 PP_Resource context_id, GLsizei n, const GLuint* framebuffers) { | 280 PP_Resource context_id, GLsizei n, const GLuint* framebuffers) { |
| 180 GetGLES(context_id)->DeleteFramebuffers(n, framebuffers); | 281 Enter3D enter(context_id, true); |
| 282 if (enter.succeeded()) { |
| 283 ToGles2Impl(&enter)->DeleteFramebuffers(n, framebuffers); |
| 284 } |
| 181 } | 285 } |
| 182 | 286 |
| 183 void DeleteProgram(PP_Resource context_id, GLuint program) { | 287 void DeleteProgram(PP_Resource context_id, GLuint program) { |
| 184 GetGLES(context_id)->DeleteProgram(program); | 288 Enter3D enter(context_id, true); |
| 289 if (enter.succeeded()) { |
| 290 ToGles2Impl(&enter)->DeleteProgram(program); |
| 291 } |
| 185 } | 292 } |
| 186 | 293 |
| 187 void DeleteRenderbuffers( | 294 void DeleteRenderbuffers( |
| 188 PP_Resource context_id, GLsizei n, const GLuint* renderbuffers) { | 295 PP_Resource context_id, GLsizei n, const GLuint* renderbuffers) { |
| 189 GetGLES(context_id)->DeleteRenderbuffers(n, renderbuffers); | 296 Enter3D enter(context_id, true); |
| 297 if (enter.succeeded()) { |
| 298 ToGles2Impl(&enter)->DeleteRenderbuffers(n, renderbuffers); |
| 299 } |
| 190 } | 300 } |
| 191 | 301 |
| 192 void DeleteShader(PP_Resource context_id, GLuint shader) { | 302 void DeleteShader(PP_Resource context_id, GLuint shader) { |
| 193 GetGLES(context_id)->DeleteShader(shader); | 303 Enter3D enter(context_id, true); |
| 304 if (enter.succeeded()) { |
| 305 ToGles2Impl(&enter)->DeleteShader(shader); |
| 306 } |
| 194 } | 307 } |
| 195 | 308 |
| 196 void DeleteTextures( | 309 void DeleteTextures( |
| 197 PP_Resource context_id, GLsizei n, const GLuint* textures) { | 310 PP_Resource context_id, GLsizei n, const GLuint* textures) { |
| 198 GetGLES(context_id)->DeleteTextures(n, textures); | 311 Enter3D enter(context_id, true); |
| 312 if (enter.succeeded()) { |
| 313 ToGles2Impl(&enter)->DeleteTextures(n, textures); |
| 314 } |
| 199 } | 315 } |
| 200 | 316 |
| 201 void DepthFunc(PP_Resource context_id, GLenum func) { | 317 void DepthFunc(PP_Resource context_id, GLenum func) { |
| 202 GetGLES(context_id)->DepthFunc(func); | 318 Enter3D enter(context_id, true); |
| 319 if (enter.succeeded()) { |
| 320 ToGles2Impl(&enter)->DepthFunc(func); |
| 321 } |
| 203 } | 322 } |
| 204 | 323 |
| 205 void DepthMask(PP_Resource context_id, GLboolean flag) { | 324 void DepthMask(PP_Resource context_id, GLboolean flag) { |
| 206 GetGLES(context_id)->DepthMask(flag); | 325 Enter3D enter(context_id, true); |
| 326 if (enter.succeeded()) { |
| 327 ToGles2Impl(&enter)->DepthMask(flag); |
| 328 } |
| 207 } | 329 } |
| 208 | 330 |
| 209 void DepthRangef(PP_Resource context_id, GLclampf zNear, GLclampf zFar) { | 331 void DepthRangef(PP_Resource context_id, GLclampf zNear, GLclampf zFar) { |
| 210 GetGLES(context_id)->DepthRangef(zNear, zFar); | 332 Enter3D enter(context_id, true); |
| 333 if (enter.succeeded()) { |
| 334 ToGles2Impl(&enter)->DepthRangef(zNear, zFar); |
| 335 } |
| 211 } | 336 } |
| 212 | 337 |
| 213 void DetachShader(PP_Resource context_id, GLuint program, GLuint shader) { | 338 void DetachShader(PP_Resource context_id, GLuint program, GLuint shader) { |
| 214 GetGLES(context_id)->DetachShader(program, shader); | 339 Enter3D enter(context_id, true); |
| 340 if (enter.succeeded()) { |
| 341 ToGles2Impl(&enter)->DetachShader(program, shader); |
| 342 } |
| 215 } | 343 } |
| 216 | 344 |
| 217 void Disable(PP_Resource context_id, GLenum cap) { | 345 void Disable(PP_Resource context_id, GLenum cap) { |
| 218 GetGLES(context_id)->Disable(cap); | 346 Enter3D enter(context_id, true); |
| 347 if (enter.succeeded()) { |
| 348 ToGles2Impl(&enter)->Disable(cap); |
| 349 } |
| 219 } | 350 } |
| 220 | 351 |
| 221 void DisableVertexAttribArray(PP_Resource context_id, GLuint index) { | 352 void DisableVertexAttribArray(PP_Resource context_id, GLuint index) { |
| 222 GetGLES(context_id)->DisableVertexAttribArray(index); | 353 Enter3D enter(context_id, true); |
| 354 if (enter.succeeded()) { |
| 355 ToGles2Impl(&enter)->DisableVertexAttribArray(index); |
| 356 } |
| 223 } | 357 } |
| 224 | 358 |
| 225 void DrawArrays( | 359 void DrawArrays( |
| 226 PP_Resource context_id, GLenum mode, GLint first, GLsizei count) { | 360 PP_Resource context_id, GLenum mode, GLint first, GLsizei count) { |
| 227 GetGLES(context_id)->DrawArrays(mode, first, count); | 361 Enter3D enter(context_id, true); |
| 362 if (enter.succeeded()) { |
| 363 ToGles2Impl(&enter)->DrawArrays(mode, first, count); |
| 364 } |
| 228 } | 365 } |
| 229 | 366 |
| 230 void DrawElements( | 367 void DrawElements( |
| 231 PP_Resource context_id, GLenum mode, GLsizei count, GLenum type, | 368 PP_Resource context_id, GLenum mode, GLsizei count, GLenum type, |
| 232 const void* indices) { | 369 const void* indices) { |
| 233 GetGLES(context_id)->DrawElements(mode, count, type, indices); | 370 Enter3D enter(context_id, true); |
| 371 if (enter.succeeded()) { |
| 372 ToGles2Impl(&enter)->DrawElements(mode, count, type, indices); |
| 373 } |
| 234 } | 374 } |
| 235 | 375 |
| 236 void Enable(PP_Resource context_id, GLenum cap) { | 376 void Enable(PP_Resource context_id, GLenum cap) { |
| 237 GetGLES(context_id)->Enable(cap); | 377 Enter3D enter(context_id, true); |
| 378 if (enter.succeeded()) { |
| 379 ToGles2Impl(&enter)->Enable(cap); |
| 380 } |
| 238 } | 381 } |
| 239 | 382 |
| 240 void EnableVertexAttribArray(PP_Resource context_id, GLuint index) { | 383 void EnableVertexAttribArray(PP_Resource context_id, GLuint index) { |
| 241 GetGLES(context_id)->EnableVertexAttribArray(index); | 384 Enter3D enter(context_id, true); |
| 385 if (enter.succeeded()) { |
| 386 ToGles2Impl(&enter)->EnableVertexAttribArray(index); |
| 387 } |
| 242 } | 388 } |
| 243 | 389 |
| 244 void Finish(PP_Resource context_id) { | 390 void Finish(PP_Resource context_id) { |
| 245 GetGLES(context_id)->Finish(); | 391 Enter3D enter(context_id, true); |
| 392 if (enter.succeeded()) { |
| 393 ToGles2Impl(&enter)->Finish(); |
| 394 } |
| 246 } | 395 } |
| 247 | 396 |
| 248 void Flush(PP_Resource context_id) { | 397 void Flush(PP_Resource context_id) { |
| 249 GetGLES(context_id)->Flush(); | 398 Enter3D enter(context_id, true); |
| 399 if (enter.succeeded()) { |
| 400 ToGles2Impl(&enter)->Flush(); |
| 401 } |
| 250 } | 402 } |
| 251 | 403 |
| 252 void FramebufferRenderbuffer( | 404 void FramebufferRenderbuffer( |
| 253 PP_Resource context_id, GLenum target, GLenum attachment, | 405 PP_Resource context_id, GLenum target, GLenum attachment, |
| 254 GLenum renderbuffertarget, GLuint renderbuffer) { | 406 GLenum renderbuffertarget, GLuint renderbuffer) { |
| 255 GetGLES( | 407 Enter3D enter(context_id, true); |
| 256 context_id)->FramebufferRenderbuffer( | 408 if (enter.succeeded()) { |
| 257 target, attachment, renderbuffertarget, renderbuffer); | 409 ToGles2Impl( |
| 410 &enter)->FramebufferRenderbuffer( |
| 411 target, attachment, renderbuffertarget, renderbuffer); |
| 412 } |
| 258 } | 413 } |
| 259 | 414 |
| 260 void FramebufferTexture2D( | 415 void FramebufferTexture2D( |
| 261 PP_Resource context_id, GLenum target, GLenum attachment, GLenum textarget, | 416 PP_Resource context_id, GLenum target, GLenum attachment, GLenum textarget, |
| 262 GLuint texture, GLint level) { | 417 GLuint texture, GLint level) { |
| 263 GetGLES( | 418 Enter3D enter(context_id, true); |
| 264 context_id)->FramebufferTexture2D( | 419 if (enter.succeeded()) { |
| 265 target, attachment, textarget, texture, level); | 420 ToGles2Impl( |
| 421 &enter)->FramebufferTexture2D( |
| 422 target, attachment, textarget, texture, level); |
| 423 } |
| 266 } | 424 } |
| 267 | 425 |
| 268 void FrontFace(PP_Resource context_id, GLenum mode) { | 426 void FrontFace(PP_Resource context_id, GLenum mode) { |
| 269 GetGLES(context_id)->FrontFace(mode); | 427 Enter3D enter(context_id, true); |
| 428 if (enter.succeeded()) { |
| 429 ToGles2Impl(&enter)->FrontFace(mode); |
| 430 } |
| 270 } | 431 } |
| 271 | 432 |
| 272 void GenBuffers(PP_Resource context_id, GLsizei n, GLuint* buffers) { | 433 void GenBuffers(PP_Resource context_id, GLsizei n, GLuint* buffers) { |
| 273 GetGLES(context_id)->GenBuffers(n, buffers); | 434 Enter3D enter(context_id, true); |
| 435 if (enter.succeeded()) { |
| 436 ToGles2Impl(&enter)->GenBuffers(n, buffers); |
| 437 } |
| 274 } | 438 } |
| 275 | 439 |
| 276 void GenerateMipmap(PP_Resource context_id, GLenum target) { | 440 void GenerateMipmap(PP_Resource context_id, GLenum target) { |
| 277 GetGLES(context_id)->GenerateMipmap(target); | 441 Enter3D enter(context_id, true); |
| 442 if (enter.succeeded()) { |
| 443 ToGles2Impl(&enter)->GenerateMipmap(target); |
| 444 } |
| 278 } | 445 } |
| 279 | 446 |
| 280 void GenFramebuffers(PP_Resource context_id, GLsizei n, GLuint* framebuffers) { | 447 void GenFramebuffers(PP_Resource context_id, GLsizei n, GLuint* framebuffers) { |
| 281 GetGLES(context_id)->GenFramebuffers(n, framebuffers); | 448 Enter3D enter(context_id, true); |
| 449 if (enter.succeeded()) { |
| 450 ToGles2Impl(&enter)->GenFramebuffers(n, framebuffers); |
| 451 } |
| 282 } | 452 } |
| 283 | 453 |
| 284 void GenRenderbuffers( | 454 void GenRenderbuffers( |
| 285 PP_Resource context_id, GLsizei n, GLuint* renderbuffers) { | 455 PP_Resource context_id, GLsizei n, GLuint* renderbuffers) { |
| 286 GetGLES(context_id)->GenRenderbuffers(n, renderbuffers); | 456 Enter3D enter(context_id, true); |
| 457 if (enter.succeeded()) { |
| 458 ToGles2Impl(&enter)->GenRenderbuffers(n, renderbuffers); |
| 459 } |
| 287 } | 460 } |
| 288 | 461 |
| 289 void GenTextures(PP_Resource context_id, GLsizei n, GLuint* textures) { | 462 void GenTextures(PP_Resource context_id, GLsizei n, GLuint* textures) { |
| 290 GetGLES(context_id)->GenTextures(n, textures); | 463 Enter3D enter(context_id, true); |
| 464 if (enter.succeeded()) { |
| 465 ToGles2Impl(&enter)->GenTextures(n, textures); |
| 466 } |
| 291 } | 467 } |
| 292 | 468 |
| 293 void GetActiveAttrib( | 469 void GetActiveAttrib( |
| 294 PP_Resource context_id, GLuint program, GLuint index, GLsizei bufsize, | 470 PP_Resource context_id, GLuint program, GLuint index, GLsizei bufsize, |
| 295 GLsizei* length, GLint* size, GLenum* type, char* name) { | 471 GLsizei* length, GLint* size, GLenum* type, char* name) { |
| 296 GetGLES( | 472 Enter3D enter(context_id, true); |
| 297 context_id)->GetActiveAttrib( | 473 if (enter.succeeded()) { |
| 298 program, index, bufsize, length, size, type, name); | 474 ToGles2Impl( |
| 475 &enter)->GetActiveAttrib( |
| 476 program, index, bufsize, length, size, type, name); |
| 477 } |
| 299 } | 478 } |
| 300 | 479 |
| 301 void GetActiveUniform( | 480 void GetActiveUniform( |
| 302 PP_Resource context_id, GLuint program, GLuint index, GLsizei bufsize, | 481 PP_Resource context_id, GLuint program, GLuint index, GLsizei bufsize, |
| 303 GLsizei* length, GLint* size, GLenum* type, char* name) { | 482 GLsizei* length, GLint* size, GLenum* type, char* name) { |
| 304 GetGLES( | 483 Enter3D enter(context_id, true); |
| 305 context_id)->GetActiveUniform( | 484 if (enter.succeeded()) { |
| 306 program, index, bufsize, length, size, type, name); | 485 ToGles2Impl( |
| 486 &enter)->GetActiveUniform( |
| 487 program, index, bufsize, length, size, type, name); |
| 488 } |
| 307 } | 489 } |
| 308 | 490 |
| 309 void GetAttachedShaders( | 491 void GetAttachedShaders( |
| 310 PP_Resource context_id, GLuint program, GLsizei maxcount, GLsizei* count, | 492 PP_Resource context_id, GLuint program, GLsizei maxcount, GLsizei* count, |
| 311 GLuint* shaders) { | 493 GLuint* shaders) { |
| 312 GetGLES(context_id)->GetAttachedShaders(program, maxcount, count, shaders); | 494 Enter3D enter(context_id, true); |
| 495 if (enter.succeeded()) { |
| 496 ToGles2Impl(&enter)->GetAttachedShaders(program, maxcount, count, shaders); |
| 497 } |
| 313 } | 498 } |
| 314 | 499 |
| 315 GLint GetAttribLocation( | 500 GLint GetAttribLocation( |
| 316 PP_Resource context_id, GLuint program, const char* name) { | 501 PP_Resource context_id, GLuint program, const char* name) { |
| 317 return GetGLES(context_id)->GetAttribLocation(program, name); | 502 Enter3D enter(context_id, true); |
| 503 if (enter.succeeded()) { |
| 504 return ToGles2Impl(&enter)->GetAttribLocation(program, name); |
| 505 } else { |
| 506 return 0; |
| 507 } |
| 318 } | 508 } |
| 319 | 509 |
| 320 void GetBooleanv(PP_Resource context_id, GLenum pname, GLboolean* params) { | 510 void GetBooleanv(PP_Resource context_id, GLenum pname, GLboolean* params) { |
| 321 GetGLES(context_id)->GetBooleanv(pname, params); | 511 Enter3D enter(context_id, true); |
| 512 if (enter.succeeded()) { |
| 513 ToGles2Impl(&enter)->GetBooleanv(pname, params); |
| 514 } |
| 322 } | 515 } |
| 323 | 516 |
| 324 void GetBufferParameteriv( | 517 void GetBufferParameteriv( |
| 325 PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { | 518 PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { |
| 326 GetGLES(context_id)->GetBufferParameteriv(target, pname, params); | 519 Enter3D enter(context_id, true); |
| 520 if (enter.succeeded()) { |
| 521 ToGles2Impl(&enter)->GetBufferParameteriv(target, pname, params); |
| 522 } |
| 327 } | 523 } |
| 328 | 524 |
| 329 GLenum GetError(PP_Resource context_id) { | 525 GLenum GetError(PP_Resource context_id) { |
| 330 return GetGLES(context_id)->GetError(); | 526 Enter3D enter(context_id, true); |
| 527 if (enter.succeeded()) { |
| 528 return ToGles2Impl(&enter)->GetError(); |
| 529 } else { |
| 530 return GL_INVALID_OPERATION; |
| 531 } |
| 331 } | 532 } |
| 332 | 533 |
| 333 void GetFloatv(PP_Resource context_id, GLenum pname, GLfloat* params) { | 534 void GetFloatv(PP_Resource context_id, GLenum pname, GLfloat* params) { |
| 334 GetGLES(context_id)->GetFloatv(pname, params); | 535 Enter3D enter(context_id, true); |
| 536 if (enter.succeeded()) { |
| 537 ToGles2Impl(&enter)->GetFloatv(pname, params); |
| 538 } |
| 335 } | 539 } |
| 336 | 540 |
| 337 void GetFramebufferAttachmentParameteriv( | 541 void GetFramebufferAttachmentParameteriv( |
| 338 PP_Resource context_id, GLenum target, GLenum attachment, GLenum pname, | 542 PP_Resource context_id, GLenum target, GLenum attachment, GLenum pname, |
| 339 GLint* params) { | 543 GLint* params) { |
| 340 GetGLES( | 544 Enter3D enter(context_id, true); |
| 341 context_id)->GetFramebufferAttachmentParameteriv( | 545 if (enter.succeeded()) { |
| 342 target, attachment, pname, params); | 546 ToGles2Impl( |
| 547 &enter)->GetFramebufferAttachmentParameteriv( |
| 548 target, attachment, pname, params); |
| 549 } |
| 343 } | 550 } |
| 344 | 551 |
| 345 void GetIntegerv(PP_Resource context_id, GLenum pname, GLint* params) { | 552 void GetIntegerv(PP_Resource context_id, GLenum pname, GLint* params) { |
| 346 GetGLES(context_id)->GetIntegerv(pname, params); | 553 Enter3D enter(context_id, true); |
| 554 if (enter.succeeded()) { |
| 555 ToGles2Impl(&enter)->GetIntegerv(pname, params); |
| 556 } |
| 347 } | 557 } |
| 348 | 558 |
| 349 void GetProgramiv( | 559 void GetProgramiv( |
| 350 PP_Resource context_id, GLuint program, GLenum pname, GLint* params) { | 560 PP_Resource context_id, GLuint program, GLenum pname, GLint* params) { |
| 351 GetGLES(context_id)->GetProgramiv(program, pname, params); | 561 Enter3D enter(context_id, true); |
| 562 if (enter.succeeded()) { |
| 563 ToGles2Impl(&enter)->GetProgramiv(program, pname, params); |
| 564 } |
| 352 } | 565 } |
| 353 | 566 |
| 354 void GetProgramInfoLog( | 567 void GetProgramInfoLog( |
| 355 PP_Resource context_id, GLuint program, GLsizei bufsize, GLsizei* length, | 568 PP_Resource context_id, GLuint program, GLsizei bufsize, GLsizei* length, |
| 356 char* infolog) { | 569 char* infolog) { |
| 357 GetGLES(context_id)->GetProgramInfoLog(program, bufsize, length, infolog); | 570 Enter3D enter(context_id, true); |
| 571 if (enter.succeeded()) { |
| 572 ToGles2Impl(&enter)->GetProgramInfoLog(program, bufsize, length, infolog); |
| 573 } |
| 358 } | 574 } |
| 359 | 575 |
| 360 void GetRenderbufferParameteriv( | 576 void GetRenderbufferParameteriv( |
| 361 PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { | 577 PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { |
| 362 GetGLES(context_id)->GetRenderbufferParameteriv(target, pname, params); | 578 Enter3D enter(context_id, true); |
| 579 if (enter.succeeded()) { |
| 580 ToGles2Impl(&enter)->GetRenderbufferParameteriv(target, pname, params); |
| 581 } |
| 363 } | 582 } |
| 364 | 583 |
| 365 void GetShaderiv( | 584 void GetShaderiv( |
| 366 PP_Resource context_id, GLuint shader, GLenum pname, GLint* params) { | 585 PP_Resource context_id, GLuint shader, GLenum pname, GLint* params) { |
| 367 GetGLES(context_id)->GetShaderiv(shader, pname, params); | 586 Enter3D enter(context_id, true); |
| 587 if (enter.succeeded()) { |
| 588 ToGles2Impl(&enter)->GetShaderiv(shader, pname, params); |
| 589 } |
| 368 } | 590 } |
| 369 | 591 |
| 370 void GetShaderInfoLog( | 592 void GetShaderInfoLog( |
| 371 PP_Resource context_id, GLuint shader, GLsizei bufsize, GLsizei* length, | 593 PP_Resource context_id, GLuint shader, GLsizei bufsize, GLsizei* length, |
| 372 char* infolog) { | 594 char* infolog) { |
| 373 GetGLES(context_id)->GetShaderInfoLog(shader, bufsize, length, infolog); | 595 Enter3D enter(context_id, true); |
| 596 if (enter.succeeded()) { |
| 597 ToGles2Impl(&enter)->GetShaderInfoLog(shader, bufsize, length, infolog); |
| 598 } |
| 374 } | 599 } |
| 375 | 600 |
| 376 void GetShaderPrecisionFormat( | 601 void GetShaderPrecisionFormat( |
| 377 PP_Resource context_id, GLenum shadertype, GLenum precisiontype, | 602 PP_Resource context_id, GLenum shadertype, GLenum precisiontype, |
| 378 GLint* range, GLint* precision) { | 603 GLint* range, GLint* precision) { |
| 379 GetGLES( | 604 Enter3D enter(context_id, true); |
| 380 context_id)->GetShaderPrecisionFormat( | 605 if (enter.succeeded()) { |
| 381 shadertype, precisiontype, range, precision); | 606 ToGles2Impl( |
| 607 &enter)->GetShaderPrecisionFormat( |
| 608 shadertype, precisiontype, range, precision); |
| 609 } |
| 382 } | 610 } |
| 383 | 611 |
| 384 void GetShaderSource( | 612 void GetShaderSource( |
| 385 PP_Resource context_id, GLuint shader, GLsizei bufsize, GLsizei* length, | 613 PP_Resource context_id, GLuint shader, GLsizei bufsize, GLsizei* length, |
| 386 char* source) { | 614 char* source) { |
| 387 GetGLES(context_id)->GetShaderSource(shader, bufsize, length, source); | 615 Enter3D enter(context_id, true); |
| 616 if (enter.succeeded()) { |
| 617 ToGles2Impl(&enter)->GetShaderSource(shader, bufsize, length, source); |
| 618 } |
| 388 } | 619 } |
| 389 | 620 |
| 390 const GLubyte* GetString(PP_Resource context_id, GLenum name) { | 621 const GLubyte* GetString(PP_Resource context_id, GLenum name) { |
| 391 return GetGLES(context_id)->GetString(name); | 622 Enter3D enter(context_id, true); |
| 623 if (enter.succeeded()) { |
| 624 return ToGles2Impl(&enter)->GetString(name); |
| 625 } else { |
| 626 return NULL; |
| 627 } |
| 392 } | 628 } |
| 393 | 629 |
| 394 void GetTexParameterfv( | 630 void GetTexParameterfv( |
| 395 PP_Resource context_id, GLenum target, GLenum pname, GLfloat* params) { | 631 PP_Resource context_id, GLenum target, GLenum pname, GLfloat* params) { |
| 396 GetGLES(context_id)->GetTexParameterfv(target, pname, params); | 632 Enter3D enter(context_id, true); |
| 633 if (enter.succeeded()) { |
| 634 ToGles2Impl(&enter)->GetTexParameterfv(target, pname, params); |
| 635 } |
| 397 } | 636 } |
| 398 | 637 |
| 399 void GetTexParameteriv( | 638 void GetTexParameteriv( |
| 400 PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { | 639 PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { |
| 401 GetGLES(context_id)->GetTexParameteriv(target, pname, params); | 640 Enter3D enter(context_id, true); |
| 641 if (enter.succeeded()) { |
| 642 ToGles2Impl(&enter)->GetTexParameteriv(target, pname, params); |
| 643 } |
| 402 } | 644 } |
| 403 | 645 |
| 404 void GetUniformfv( | 646 void GetUniformfv( |
| 405 PP_Resource context_id, GLuint program, GLint location, GLfloat* params) { | 647 PP_Resource context_id, GLuint program, GLint location, GLfloat* params) { |
| 406 GetGLES(context_id)->GetUniformfv(program, location, params); | 648 Enter3D enter(context_id, true); |
| 649 if (enter.succeeded()) { |
| 650 ToGles2Impl(&enter)->GetUniformfv(program, location, params); |
| 651 } |
| 407 } | 652 } |
| 408 | 653 |
| 409 void GetUniformiv( | 654 void GetUniformiv( |
| 410 PP_Resource context_id, GLuint program, GLint location, GLint* params) { | 655 PP_Resource context_id, GLuint program, GLint location, GLint* params) { |
| 411 GetGLES(context_id)->GetUniformiv(program, location, params); | 656 Enter3D enter(context_id, true); |
| 657 if (enter.succeeded()) { |
| 658 ToGles2Impl(&enter)->GetUniformiv(program, location, params); |
| 659 } |
| 412 } | 660 } |
| 413 | 661 |
| 414 GLint GetUniformLocation( | 662 GLint GetUniformLocation( |
| 415 PP_Resource context_id, GLuint program, const char* name) { | 663 PP_Resource context_id, GLuint program, const char* name) { |
| 416 return GetGLES(context_id)->GetUniformLocation(program, name); | 664 Enter3D enter(context_id, true); |
| 665 if (enter.succeeded()) { |
| 666 return ToGles2Impl(&enter)->GetUniformLocation(program, name); |
| 667 } else { |
| 668 return 0; |
| 669 } |
| 417 } | 670 } |
| 418 | 671 |
| 419 void GetVertexAttribfv( | 672 void GetVertexAttribfv( |
| 420 PP_Resource context_id, GLuint index, GLenum pname, GLfloat* params) { | 673 PP_Resource context_id, GLuint index, GLenum pname, GLfloat* params) { |
| 421 GetGLES(context_id)->GetVertexAttribfv(index, pname, params); | 674 Enter3D enter(context_id, true); |
| 675 if (enter.succeeded()) { |
| 676 ToGles2Impl(&enter)->GetVertexAttribfv(index, pname, params); |
| 677 } |
| 422 } | 678 } |
| 423 | 679 |
| 424 void GetVertexAttribiv( | 680 void GetVertexAttribiv( |
| 425 PP_Resource context_id, GLuint index, GLenum pname, GLint* params) { | 681 PP_Resource context_id, GLuint index, GLenum pname, GLint* params) { |
| 426 GetGLES(context_id)->GetVertexAttribiv(index, pname, params); | 682 Enter3D enter(context_id, true); |
| 683 if (enter.succeeded()) { |
| 684 ToGles2Impl(&enter)->GetVertexAttribiv(index, pname, params); |
| 685 } |
| 427 } | 686 } |
| 428 | 687 |
| 429 void GetVertexAttribPointerv( | 688 void GetVertexAttribPointerv( |
| 430 PP_Resource context_id, GLuint index, GLenum pname, void** pointer) { | 689 PP_Resource context_id, GLuint index, GLenum pname, void** pointer) { |
| 431 GetGLES(context_id)->GetVertexAttribPointerv(index, pname, pointer); | 690 Enter3D enter(context_id, true); |
| 691 if (enter.succeeded()) { |
| 692 ToGles2Impl(&enter)->GetVertexAttribPointerv(index, pname, pointer); |
| 693 } |
| 432 } | 694 } |
| 433 | 695 |
| 434 void Hint(PP_Resource context_id, GLenum target, GLenum mode) { | 696 void Hint(PP_Resource context_id, GLenum target, GLenum mode) { |
| 435 GetGLES(context_id)->Hint(target, mode); | 697 Enter3D enter(context_id, true); |
| 698 if (enter.succeeded()) { |
| 699 ToGles2Impl(&enter)->Hint(target, mode); |
| 700 } |
| 436 } | 701 } |
| 437 | 702 |
| 438 GLboolean IsBuffer(PP_Resource context_id, GLuint buffer) { | 703 GLboolean IsBuffer(PP_Resource context_id, GLuint buffer) { |
| 439 return GetGLES(context_id)->IsBuffer(buffer); | 704 Enter3D enter(context_id, true); |
| 705 if (enter.succeeded()) { |
| 706 return ToGles2Impl(&enter)->IsBuffer(buffer); |
| 707 } else { |
| 708 return GL_FALSE; |
| 709 } |
| 440 } | 710 } |
| 441 | 711 |
| 442 GLboolean IsEnabled(PP_Resource context_id, GLenum cap) { | 712 GLboolean IsEnabled(PP_Resource context_id, GLenum cap) { |
| 443 return GetGLES(context_id)->IsEnabled(cap); | 713 Enter3D enter(context_id, true); |
| 714 if (enter.succeeded()) { |
| 715 return ToGles2Impl(&enter)->IsEnabled(cap); |
| 716 } else { |
| 717 return GL_FALSE; |
| 718 } |
| 444 } | 719 } |
| 445 | 720 |
| 446 GLboolean IsFramebuffer(PP_Resource context_id, GLuint framebuffer) { | 721 GLboolean IsFramebuffer(PP_Resource context_id, GLuint framebuffer) { |
| 447 return GetGLES(context_id)->IsFramebuffer(framebuffer); | 722 Enter3D enter(context_id, true); |
| 723 if (enter.succeeded()) { |
| 724 return ToGles2Impl(&enter)->IsFramebuffer(framebuffer); |
| 725 } else { |
| 726 return GL_FALSE; |
| 727 } |
| 448 } | 728 } |
| 449 | 729 |
| 450 GLboolean IsProgram(PP_Resource context_id, GLuint program) { | 730 GLboolean IsProgram(PP_Resource context_id, GLuint program) { |
| 451 return GetGLES(context_id)->IsProgram(program); | 731 Enter3D enter(context_id, true); |
| 732 if (enter.succeeded()) { |
| 733 return ToGles2Impl(&enter)->IsProgram(program); |
| 734 } else { |
| 735 return GL_FALSE; |
| 736 } |
| 452 } | 737 } |
| 453 | 738 |
| 454 GLboolean IsRenderbuffer(PP_Resource context_id, GLuint renderbuffer) { | 739 GLboolean IsRenderbuffer(PP_Resource context_id, GLuint renderbuffer) { |
| 455 return GetGLES(context_id)->IsRenderbuffer(renderbuffer); | 740 Enter3D enter(context_id, true); |
| 741 if (enter.succeeded()) { |
| 742 return ToGles2Impl(&enter)->IsRenderbuffer(renderbuffer); |
| 743 } else { |
| 744 return GL_FALSE; |
| 745 } |
| 456 } | 746 } |
| 457 | 747 |
| 458 GLboolean IsShader(PP_Resource context_id, GLuint shader) { | 748 GLboolean IsShader(PP_Resource context_id, GLuint shader) { |
| 459 return GetGLES(context_id)->IsShader(shader); | 749 Enter3D enter(context_id, true); |
| 750 if (enter.succeeded()) { |
| 751 return ToGles2Impl(&enter)->IsShader(shader); |
| 752 } else { |
| 753 return GL_FALSE; |
| 754 } |
| 460 } | 755 } |
| 461 | 756 |
| 462 GLboolean IsTexture(PP_Resource context_id, GLuint texture) { | 757 GLboolean IsTexture(PP_Resource context_id, GLuint texture) { |
| 463 return GetGLES(context_id)->IsTexture(texture); | 758 Enter3D enter(context_id, true); |
| 759 if (enter.succeeded()) { |
| 760 return ToGles2Impl(&enter)->IsTexture(texture); |
| 761 } else { |
| 762 return GL_FALSE; |
| 763 } |
| 464 } | 764 } |
| 465 | 765 |
| 466 void LineWidth(PP_Resource context_id, GLfloat width) { | 766 void LineWidth(PP_Resource context_id, GLfloat width) { |
| 467 GetGLES(context_id)->LineWidth(width); | 767 Enter3D enter(context_id, true); |
| 768 if (enter.succeeded()) { |
| 769 ToGles2Impl(&enter)->LineWidth(width); |
| 770 } |
| 468 } | 771 } |
| 469 | 772 |
| 470 void LinkProgram(PP_Resource context_id, GLuint program) { | 773 void LinkProgram(PP_Resource context_id, GLuint program) { |
| 471 GetGLES(context_id)->LinkProgram(program); | 774 Enter3D enter(context_id, true); |
| 775 if (enter.succeeded()) { |
| 776 ToGles2Impl(&enter)->LinkProgram(program); |
| 777 } |
| 472 } | 778 } |
| 473 | 779 |
| 474 void PixelStorei(PP_Resource context_id, GLenum pname, GLint param) { | 780 void PixelStorei(PP_Resource context_id, GLenum pname, GLint param) { |
| 475 GetGLES(context_id)->PixelStorei(pname, param); | 781 Enter3D enter(context_id, true); |
| 782 if (enter.succeeded()) { |
| 783 ToGles2Impl(&enter)->PixelStorei(pname, param); |
| 784 } |
| 476 } | 785 } |
| 477 | 786 |
| 478 void PolygonOffset(PP_Resource context_id, GLfloat factor, GLfloat units) { | 787 void PolygonOffset(PP_Resource context_id, GLfloat factor, GLfloat units) { |
| 479 GetGLES(context_id)->PolygonOffset(factor, units); | 788 Enter3D enter(context_id, true); |
| 789 if (enter.succeeded()) { |
| 790 ToGles2Impl(&enter)->PolygonOffset(factor, units); |
| 791 } |
| 480 } | 792 } |
| 481 | 793 |
| 482 void ReadPixels( | 794 void ReadPixels( |
| 483 PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height, | 795 PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height, |
| 484 GLenum format, GLenum type, void* pixels) { | 796 GLenum format, GLenum type, void* pixels) { |
| 485 GetGLES(context_id)->ReadPixels(x, y, width, height, format, type, pixels); | 797 Enter3D enter(context_id, true); |
| 798 if (enter.succeeded()) { |
| 799 ToGles2Impl(&enter)->ReadPixels(x, y, width, height, format, type, pixels); |
| 800 } |
| 486 } | 801 } |
| 487 | 802 |
| 488 void ReleaseShaderCompiler(PP_Resource context_id) { | 803 void ReleaseShaderCompiler(PP_Resource context_id) { |
| 489 GetGLES(context_id)->ReleaseShaderCompiler(); | 804 Enter3D enter(context_id, true); |
| 805 if (enter.succeeded()) { |
| 806 ToGles2Impl(&enter)->ReleaseShaderCompiler(); |
| 807 } |
| 490 } | 808 } |
| 491 | 809 |
| 492 void RenderbufferStorage( | 810 void RenderbufferStorage( |
| 493 PP_Resource context_id, GLenum target, GLenum internalformat, GLsizei width, | 811 PP_Resource context_id, GLenum target, GLenum internalformat, GLsizei width, |
| 494 GLsizei height) { | 812 GLsizei height) { |
| 495 GetGLES( | 813 Enter3D enter(context_id, true); |
| 496 context_id)->RenderbufferStorage(target, internalformat, width, height); | 814 if (enter.succeeded()) { |
| 815 ToGles2Impl( |
| 816 &enter)->RenderbufferStorage(target, internalformat, width, height); |
| 817 } |
| 497 } | 818 } |
| 498 | 819 |
| 499 void SampleCoverage(PP_Resource context_id, GLclampf value, GLboolean invert) { | 820 void SampleCoverage(PP_Resource context_id, GLclampf value, GLboolean invert) { |
| 500 GetGLES(context_id)->SampleCoverage(value, invert); | 821 Enter3D enter(context_id, true); |
| 822 if (enter.succeeded()) { |
| 823 ToGles2Impl(&enter)->SampleCoverage(value, invert); |
| 824 } |
| 501 } | 825 } |
| 502 | 826 |
| 503 void Scissor( | 827 void Scissor( |
| 504 PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height) { | 828 PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height) { |
| 505 GetGLES(context_id)->Scissor(x, y, width, height); | 829 Enter3D enter(context_id, true); |
| 830 if (enter.succeeded()) { |
| 831 ToGles2Impl(&enter)->Scissor(x, y, width, height); |
| 832 } |
| 506 } | 833 } |
| 507 | 834 |
| 508 void ShaderBinary( | 835 void ShaderBinary( |
| 509 PP_Resource context_id, GLsizei n, const GLuint* shaders, | 836 PP_Resource context_id, GLsizei n, const GLuint* shaders, |
| 510 GLenum binaryformat, const void* binary, GLsizei length) { | 837 GLenum binaryformat, const void* binary, GLsizei length) { |
| 511 GetGLES(context_id)->ShaderBinary(n, shaders, binaryformat, binary, length); | 838 Enter3D enter(context_id, true); |
| 839 if (enter.succeeded()) { |
| 840 ToGles2Impl( |
| 841 &enter)->ShaderBinary(n, shaders, binaryformat, binary, length); |
| 842 } |
| 512 } | 843 } |
| 513 | 844 |
| 514 void ShaderSource( | 845 void ShaderSource( |
| 515 PP_Resource context_id, GLuint shader, GLsizei count, const char** str, | 846 PP_Resource context_id, GLuint shader, GLsizei count, const char** str, |
| 516 const GLint* length) { | 847 const GLint* length) { |
| 517 GetGLES(context_id)->ShaderSource(shader, count, str, length); | 848 Enter3D enter(context_id, true); |
| 849 if (enter.succeeded()) { |
| 850 ToGles2Impl( |
| 851 &enter)->ShaderSource( |
| 852 shader, count, const_cast<const char* const*>(str), length); |
| 853 } |
| 518 } | 854 } |
| 519 | 855 |
| 520 void StencilFunc(PP_Resource context_id, GLenum func, GLint ref, GLuint mask) { | 856 void StencilFunc(PP_Resource context_id, GLenum func, GLint ref, GLuint mask) { |
| 521 GetGLES(context_id)->StencilFunc(func, ref, mask); | 857 Enter3D enter(context_id, true); |
| 858 if (enter.succeeded()) { |
| 859 ToGles2Impl(&enter)->StencilFunc(func, ref, mask); |
| 860 } |
| 522 } | 861 } |
| 523 | 862 |
| 524 void StencilFuncSeparate( | 863 void StencilFuncSeparate( |
| 525 PP_Resource context_id, GLenum face, GLenum func, GLint ref, GLuint mask) { | 864 PP_Resource context_id, GLenum face, GLenum func, GLint ref, GLuint mask) { |
| 526 GetGLES(context_id)->StencilFuncSeparate(face, func, ref, mask); | 865 Enter3D enter(context_id, true); |
| 866 if (enter.succeeded()) { |
| 867 ToGles2Impl(&enter)->StencilFuncSeparate(face, func, ref, mask); |
| 868 } |
| 527 } | 869 } |
| 528 | 870 |
| 529 void StencilMask(PP_Resource context_id, GLuint mask) { | 871 void StencilMask(PP_Resource context_id, GLuint mask) { |
| 530 GetGLES(context_id)->StencilMask(mask); | 872 Enter3D enter(context_id, true); |
| 873 if (enter.succeeded()) { |
| 874 ToGles2Impl(&enter)->StencilMask(mask); |
| 875 } |
| 531 } | 876 } |
| 532 | 877 |
| 533 void StencilMaskSeparate(PP_Resource context_id, GLenum face, GLuint mask) { | 878 void StencilMaskSeparate(PP_Resource context_id, GLenum face, GLuint mask) { |
| 534 GetGLES(context_id)->StencilMaskSeparate(face, mask); | 879 Enter3D enter(context_id, true); |
| 880 if (enter.succeeded()) { |
| 881 ToGles2Impl(&enter)->StencilMaskSeparate(face, mask); |
| 882 } |
| 535 } | 883 } |
| 536 | 884 |
| 537 void StencilOp( | 885 void StencilOp( |
| 538 PP_Resource context_id, GLenum fail, GLenum zfail, GLenum zpass) { | 886 PP_Resource context_id, GLenum fail, GLenum zfail, GLenum zpass) { |
| 539 GetGLES(context_id)->StencilOp(fail, zfail, zpass); | 887 Enter3D enter(context_id, true); |
| 888 if (enter.succeeded()) { |
| 889 ToGles2Impl(&enter)->StencilOp(fail, zfail, zpass); |
| 890 } |
| 540 } | 891 } |
| 541 | 892 |
| 542 void StencilOpSeparate( | 893 void StencilOpSeparate( |
| 543 PP_Resource context_id, GLenum face, GLenum fail, GLenum zfail, | 894 PP_Resource context_id, GLenum face, GLenum fail, GLenum zfail, |
| 544 GLenum zpass) { | 895 GLenum zpass) { |
| 545 GetGLES(context_id)->StencilOpSeparate(face, fail, zfail, zpass); | 896 Enter3D enter(context_id, true); |
| 897 if (enter.succeeded()) { |
| 898 ToGles2Impl(&enter)->StencilOpSeparate(face, fail, zfail, zpass); |
| 899 } |
| 546 } | 900 } |
| 547 | 901 |
| 548 void TexImage2D( | 902 void TexImage2D( |
| 549 PP_Resource context_id, GLenum target, GLint level, GLint internalformat, | 903 PP_Resource context_id, GLenum target, GLint level, GLint internalformat, |
| 550 GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, | 904 GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, |
| 551 const void* pixels) { | 905 const void* pixels) { |
| 552 GetGLES( | 906 Enter3D enter(context_id, true); |
| 553 context_id)->TexImage2D( | 907 if (enter.succeeded()) { |
| 554 target, level, internalformat, width, height, border, format, type, | 908 ToGles2Impl( |
| 555 pixels); | 909 &enter)->TexImage2D( |
| 910 target, level, internalformat, width, height, border, format, type, |
| 911 pixels); |
| 912 } |
| 556 } | 913 } |
| 557 | 914 |
| 558 void TexParameterf( | 915 void TexParameterf( |
| 559 PP_Resource context_id, GLenum target, GLenum pname, GLfloat param) { | 916 PP_Resource context_id, GLenum target, GLenum pname, GLfloat param) { |
| 560 GetGLES(context_id)->TexParameterf(target, pname, param); | 917 Enter3D enter(context_id, true); |
| 918 if (enter.succeeded()) { |
| 919 ToGles2Impl(&enter)->TexParameterf(target, pname, param); |
| 920 } |
| 561 } | 921 } |
| 562 | 922 |
| 563 void TexParameterfv( | 923 void TexParameterfv( |
| 564 PP_Resource context_id, GLenum target, GLenum pname, | 924 PP_Resource context_id, GLenum target, GLenum pname, |
| 565 const GLfloat* params) { | 925 const GLfloat* params) { |
| 566 GetGLES(context_id)->TexParameterfv(target, pname, params); | 926 Enter3D enter(context_id, true); |
| 927 if (enter.succeeded()) { |
| 928 ToGles2Impl(&enter)->TexParameterfv(target, pname, params); |
| 929 } |
| 567 } | 930 } |
| 568 | 931 |
| 569 void TexParameteri( | 932 void TexParameteri( |
| 570 PP_Resource context_id, GLenum target, GLenum pname, GLint param) { | 933 PP_Resource context_id, GLenum target, GLenum pname, GLint param) { |
| 571 GetGLES(context_id)->TexParameteri(target, pname, param); | 934 Enter3D enter(context_id, true); |
| 935 if (enter.succeeded()) { |
| 936 ToGles2Impl(&enter)->TexParameteri(target, pname, param); |
| 937 } |
| 572 } | 938 } |
| 573 | 939 |
| 574 void TexParameteriv( | 940 void TexParameteriv( |
| 575 PP_Resource context_id, GLenum target, GLenum pname, const GLint* params) { | 941 PP_Resource context_id, GLenum target, GLenum pname, const GLint* params) { |
| 576 GetGLES(context_id)->TexParameteriv(target, pname, params); | 942 Enter3D enter(context_id, true); |
| 943 if (enter.succeeded()) { |
| 944 ToGles2Impl(&enter)->TexParameteriv(target, pname, params); |
| 945 } |
| 577 } | 946 } |
| 578 | 947 |
| 579 void TexSubImage2D( | 948 void TexSubImage2D( |
| 580 PP_Resource context_id, GLenum target, GLint level, GLint xoffset, | 949 PP_Resource context_id, GLenum target, GLint level, GLint xoffset, |
| 581 GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, | 950 GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, |
| 582 const void* pixels) { | 951 const void* pixels) { |
| 583 GetGLES( | 952 Enter3D enter(context_id, true); |
| 584 context_id)->TexSubImage2D( | 953 if (enter.succeeded()) { |
| 585 target, level, xoffset, yoffset, width, height, format, type, | 954 ToGles2Impl( |
| 586 pixels); | 955 &enter)->TexSubImage2D( |
| 956 target, level, xoffset, yoffset, width, height, format, type, |
| 957 pixels); |
| 958 } |
| 587 } | 959 } |
| 588 | 960 |
| 589 void Uniform1f(PP_Resource context_id, GLint location, GLfloat x) { | 961 void Uniform1f(PP_Resource context_id, GLint location, GLfloat x) { |
| 590 GetGLES(context_id)->Uniform1f(location, x); | 962 Enter3D enter(context_id, true); |
| 963 if (enter.succeeded()) { |
| 964 ToGles2Impl(&enter)->Uniform1f(location, x); |
| 965 } |
| 591 } | 966 } |
| 592 | 967 |
| 593 void Uniform1fv( | 968 void Uniform1fv( |
| 594 PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { | 969 PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { |
| 595 GetGLES(context_id)->Uniform1fv(location, count, v); | 970 Enter3D enter(context_id, true); |
| 971 if (enter.succeeded()) { |
| 972 ToGles2Impl(&enter)->Uniform1fv(location, count, v); |
| 973 } |
| 596 } | 974 } |
| 597 | 975 |
| 598 void Uniform1i(PP_Resource context_id, GLint location, GLint x) { | 976 void Uniform1i(PP_Resource context_id, GLint location, GLint x) { |
| 599 GetGLES(context_id)->Uniform1i(location, x); | 977 Enter3D enter(context_id, true); |
| 978 if (enter.succeeded()) { |
| 979 ToGles2Impl(&enter)->Uniform1i(location, x); |
| 980 } |
| 600 } | 981 } |
| 601 | 982 |
| 602 void Uniform1iv( | 983 void Uniform1iv( |
| 603 PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { | 984 PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { |
| 604 GetGLES(context_id)->Uniform1iv(location, count, v); | 985 Enter3D enter(context_id, true); |
| 986 if (enter.succeeded()) { |
| 987 ToGles2Impl(&enter)->Uniform1iv(location, count, v); |
| 988 } |
| 605 } | 989 } |
| 606 | 990 |
| 607 void Uniform2f(PP_Resource context_id, GLint location, GLfloat x, GLfloat y) { | 991 void Uniform2f(PP_Resource context_id, GLint location, GLfloat x, GLfloat y) { |
| 608 GetGLES(context_id)->Uniform2f(location, x, y); | 992 Enter3D enter(context_id, true); |
| 993 if (enter.succeeded()) { |
| 994 ToGles2Impl(&enter)->Uniform2f(location, x, y); |
| 995 } |
| 609 } | 996 } |
| 610 | 997 |
| 611 void Uniform2fv( | 998 void Uniform2fv( |
| 612 PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { | 999 PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { |
| 613 GetGLES(context_id)->Uniform2fv(location, count, v); | 1000 Enter3D enter(context_id, true); |
| 1001 if (enter.succeeded()) { |
| 1002 ToGles2Impl(&enter)->Uniform2fv(location, count, v); |
| 1003 } |
| 614 } | 1004 } |
| 615 | 1005 |
| 616 void Uniform2i(PP_Resource context_id, GLint location, GLint x, GLint y) { | 1006 void Uniform2i(PP_Resource context_id, GLint location, GLint x, GLint y) { |
| 617 GetGLES(context_id)->Uniform2i(location, x, y); | 1007 Enter3D enter(context_id, true); |
| 1008 if (enter.succeeded()) { |
| 1009 ToGles2Impl(&enter)->Uniform2i(location, x, y); |
| 1010 } |
| 618 } | 1011 } |
| 619 | 1012 |
| 620 void Uniform2iv( | 1013 void Uniform2iv( |
| 621 PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { | 1014 PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { |
| 622 GetGLES(context_id)->Uniform2iv(location, count, v); | 1015 Enter3D enter(context_id, true); |
| 1016 if (enter.succeeded()) { |
| 1017 ToGles2Impl(&enter)->Uniform2iv(location, count, v); |
| 1018 } |
| 623 } | 1019 } |
| 624 | 1020 |
| 625 void Uniform3f( | 1021 void Uniform3f( |
| 626 PP_Resource context_id, GLint location, GLfloat x, GLfloat y, GLfloat z) { | 1022 PP_Resource context_id, GLint location, GLfloat x, GLfloat y, GLfloat z) { |
| 627 GetGLES(context_id)->Uniform3f(location, x, y, z); | 1023 Enter3D enter(context_id, true); |
| 1024 if (enter.succeeded()) { |
| 1025 ToGles2Impl(&enter)->Uniform3f(location, x, y, z); |
| 1026 } |
| 628 } | 1027 } |
| 629 | 1028 |
| 630 void Uniform3fv( | 1029 void Uniform3fv( |
| 631 PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { | 1030 PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { |
| 632 GetGLES(context_id)->Uniform3fv(location, count, v); | 1031 Enter3D enter(context_id, true); |
| 1032 if (enter.succeeded()) { |
| 1033 ToGles2Impl(&enter)->Uniform3fv(location, count, v); |
| 1034 } |
| 633 } | 1035 } |
| 634 | 1036 |
| 635 void Uniform3i( | 1037 void Uniform3i( |
| 636 PP_Resource context_id, GLint location, GLint x, GLint y, GLint z) { | 1038 PP_Resource context_id, GLint location, GLint x, GLint y, GLint z) { |
| 637 GetGLES(context_id)->Uniform3i(location, x, y, z); | 1039 Enter3D enter(context_id, true); |
| 1040 if (enter.succeeded()) { |
| 1041 ToGles2Impl(&enter)->Uniform3i(location, x, y, z); |
| 1042 } |
| 638 } | 1043 } |
| 639 | 1044 |
| 640 void Uniform3iv( | 1045 void Uniform3iv( |
| 641 PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { | 1046 PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { |
| 642 GetGLES(context_id)->Uniform3iv(location, count, v); | 1047 Enter3D enter(context_id, true); |
| 1048 if (enter.succeeded()) { |
| 1049 ToGles2Impl(&enter)->Uniform3iv(location, count, v); |
| 1050 } |
| 643 } | 1051 } |
| 644 | 1052 |
| 645 void Uniform4f( | 1053 void Uniform4f( |
| 646 PP_Resource context_id, GLint location, GLfloat x, GLfloat y, GLfloat z, | 1054 PP_Resource context_id, GLint location, GLfloat x, GLfloat y, GLfloat z, |
| 647 GLfloat w) { | 1055 GLfloat w) { |
| 648 GetGLES(context_id)->Uniform4f(location, x, y, z, w); | 1056 Enter3D enter(context_id, true); |
| 1057 if (enter.succeeded()) { |
| 1058 ToGles2Impl(&enter)->Uniform4f(location, x, y, z, w); |
| 1059 } |
| 649 } | 1060 } |
| 650 | 1061 |
| 651 void Uniform4fv( | 1062 void Uniform4fv( |
| 652 PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { | 1063 PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) { |
| 653 GetGLES(context_id)->Uniform4fv(location, count, v); | 1064 Enter3D enter(context_id, true); |
| 1065 if (enter.succeeded()) { |
| 1066 ToGles2Impl(&enter)->Uniform4fv(location, count, v); |
| 1067 } |
| 654 } | 1068 } |
| 655 | 1069 |
| 656 void Uniform4i( | 1070 void Uniform4i( |
| 657 PP_Resource context_id, GLint location, GLint x, GLint y, GLint z, | 1071 PP_Resource context_id, GLint location, GLint x, GLint y, GLint z, |
| 658 GLint w) { | 1072 GLint w) { |
| 659 GetGLES(context_id)->Uniform4i(location, x, y, z, w); | 1073 Enter3D enter(context_id, true); |
| 1074 if (enter.succeeded()) { |
| 1075 ToGles2Impl(&enter)->Uniform4i(location, x, y, z, w); |
| 1076 } |
| 660 } | 1077 } |
| 661 | 1078 |
| 662 void Uniform4iv( | 1079 void Uniform4iv( |
| 663 PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { | 1080 PP_Resource context_id, GLint location, GLsizei count, const GLint* v) { |
| 664 GetGLES(context_id)->Uniform4iv(location, count, v); | 1081 Enter3D enter(context_id, true); |
| 1082 if (enter.succeeded()) { |
| 1083 ToGles2Impl(&enter)->Uniform4iv(location, count, v); |
| 1084 } |
| 665 } | 1085 } |
| 666 | 1086 |
| 667 void UniformMatrix2fv( | 1087 void UniformMatrix2fv( |
| 668 PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose, | 1088 PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose, |
| 669 const GLfloat* value) { | 1089 const GLfloat* value) { |
| 670 GetGLES(context_id)->UniformMatrix2fv(location, count, transpose, value); | 1090 Enter3D enter(context_id, true); |
| 1091 if (enter.succeeded()) { |
| 1092 ToGles2Impl(&enter)->UniformMatrix2fv(location, count, transpose, value); |
| 1093 } |
| 671 } | 1094 } |
| 672 | 1095 |
| 673 void UniformMatrix3fv( | 1096 void UniformMatrix3fv( |
| 674 PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose, | 1097 PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose, |
| 675 const GLfloat* value) { | 1098 const GLfloat* value) { |
| 676 GetGLES(context_id)->UniformMatrix3fv(location, count, transpose, value); | 1099 Enter3D enter(context_id, true); |
| 1100 if (enter.succeeded()) { |
| 1101 ToGles2Impl(&enter)->UniformMatrix3fv(location, count, transpose, value); |
| 1102 } |
| 677 } | 1103 } |
| 678 | 1104 |
| 679 void UniformMatrix4fv( | 1105 void UniformMatrix4fv( |
| 680 PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose, | 1106 PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose, |
| 681 const GLfloat* value) { | 1107 const GLfloat* value) { |
| 682 GetGLES(context_id)->UniformMatrix4fv(location, count, transpose, value); | 1108 Enter3D enter(context_id, true); |
| 1109 if (enter.succeeded()) { |
| 1110 ToGles2Impl(&enter)->UniformMatrix4fv(location, count, transpose, value); |
| 1111 } |
| 683 } | 1112 } |
| 684 | 1113 |
| 685 void UseProgram(PP_Resource context_id, GLuint program) { | 1114 void UseProgram(PP_Resource context_id, GLuint program) { |
| 686 GetGLES(context_id)->UseProgram(program); | 1115 Enter3D enter(context_id, true); |
| 1116 if (enter.succeeded()) { |
| 1117 ToGles2Impl(&enter)->UseProgram(program); |
| 1118 } |
| 687 } | 1119 } |
| 688 | 1120 |
| 689 void ValidateProgram(PP_Resource context_id, GLuint program) { | 1121 void ValidateProgram(PP_Resource context_id, GLuint program) { |
| 690 GetGLES(context_id)->ValidateProgram(program); | 1122 Enter3D enter(context_id, true); |
| 1123 if (enter.succeeded()) { |
| 1124 ToGles2Impl(&enter)->ValidateProgram(program); |
| 1125 } |
| 691 } | 1126 } |
| 692 | 1127 |
| 693 void VertexAttrib1f(PP_Resource context_id, GLuint indx, GLfloat x) { | 1128 void VertexAttrib1f(PP_Resource context_id, GLuint indx, GLfloat x) { |
| 694 GetGLES(context_id)->VertexAttrib1f(indx, x); | 1129 Enter3D enter(context_id, true); |
| 1130 if (enter.succeeded()) { |
| 1131 ToGles2Impl(&enter)->VertexAttrib1f(indx, x); |
| 1132 } |
| 695 } | 1133 } |
| 696 | 1134 |
| 697 void VertexAttrib1fv( | 1135 void VertexAttrib1fv( |
| 698 PP_Resource context_id, GLuint indx, const GLfloat* values) { | 1136 PP_Resource context_id, GLuint indx, const GLfloat* values) { |
| 699 GetGLES(context_id)->VertexAttrib1fv(indx, values); | 1137 Enter3D enter(context_id, true); |
| 1138 if (enter.succeeded()) { |
| 1139 ToGles2Impl(&enter)->VertexAttrib1fv(indx, values); |
| 1140 } |
| 700 } | 1141 } |
| 701 | 1142 |
| 702 void VertexAttrib2f( | 1143 void VertexAttrib2f( |
| 703 PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y) { | 1144 PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y) { |
| 704 GetGLES(context_id)->VertexAttrib2f(indx, x, y); | 1145 Enter3D enter(context_id, true); |
| 1146 if (enter.succeeded()) { |
| 1147 ToGles2Impl(&enter)->VertexAttrib2f(indx, x, y); |
| 1148 } |
| 705 } | 1149 } |
| 706 | 1150 |
| 707 void VertexAttrib2fv( | 1151 void VertexAttrib2fv( |
| 708 PP_Resource context_id, GLuint indx, const GLfloat* values) { | 1152 PP_Resource context_id, GLuint indx, const GLfloat* values) { |
| 709 GetGLES(context_id)->VertexAttrib2fv(indx, values); | 1153 Enter3D enter(context_id, true); |
| 1154 if (enter.succeeded()) { |
| 1155 ToGles2Impl(&enter)->VertexAttrib2fv(indx, values); |
| 1156 } |
| 710 } | 1157 } |
| 711 | 1158 |
| 712 void VertexAttrib3f( | 1159 void VertexAttrib3f( |
| 713 PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y, GLfloat z) { | 1160 PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y, GLfloat z) { |
| 714 GetGLES(context_id)->VertexAttrib3f(indx, x, y, z); | 1161 Enter3D enter(context_id, true); |
| 1162 if (enter.succeeded()) { |
| 1163 ToGles2Impl(&enter)->VertexAttrib3f(indx, x, y, z); |
| 1164 } |
| 715 } | 1165 } |
| 716 | 1166 |
| 717 void VertexAttrib3fv( | 1167 void VertexAttrib3fv( |
| 718 PP_Resource context_id, GLuint indx, const GLfloat* values) { | 1168 PP_Resource context_id, GLuint indx, const GLfloat* values) { |
| 719 GetGLES(context_id)->VertexAttrib3fv(indx, values); | 1169 Enter3D enter(context_id, true); |
| 1170 if (enter.succeeded()) { |
| 1171 ToGles2Impl(&enter)->VertexAttrib3fv(indx, values); |
| 1172 } |
| 720 } | 1173 } |
| 721 | 1174 |
| 722 void VertexAttrib4f( | 1175 void VertexAttrib4f( |
| 723 PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y, GLfloat z, | 1176 PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y, GLfloat z, |
| 724 GLfloat w) { | 1177 GLfloat w) { |
| 725 GetGLES(context_id)->VertexAttrib4f(indx, x, y, z, w); | 1178 Enter3D enter(context_id, true); |
| 1179 if (enter.succeeded()) { |
| 1180 ToGles2Impl(&enter)->VertexAttrib4f(indx, x, y, z, w); |
| 1181 } |
| 726 } | 1182 } |
| 727 | 1183 |
| 728 void VertexAttrib4fv( | 1184 void VertexAttrib4fv( |
| 729 PP_Resource context_id, GLuint indx, const GLfloat* values) { | 1185 PP_Resource context_id, GLuint indx, const GLfloat* values) { |
| 730 GetGLES(context_id)->VertexAttrib4fv(indx, values); | 1186 Enter3D enter(context_id, true); |
| 1187 if (enter.succeeded()) { |
| 1188 ToGles2Impl(&enter)->VertexAttrib4fv(indx, values); |
| 1189 } |
| 731 } | 1190 } |
| 732 | 1191 |
| 733 void VertexAttribPointer( | 1192 void VertexAttribPointer( |
| 734 PP_Resource context_id, GLuint indx, GLint size, GLenum type, | 1193 PP_Resource context_id, GLuint indx, GLint size, GLenum type, |
| 735 GLboolean normalized, GLsizei stride, const void* ptr) { | 1194 GLboolean normalized, GLsizei stride, const void* ptr) { |
| 736 GetGLES( | 1195 Enter3D enter(context_id, true); |
| 737 context_id)->VertexAttribPointer( | 1196 if (enter.succeeded()) { |
| 738 indx, size, type, normalized, stride, ptr); | 1197 ToGles2Impl( |
| 1198 &enter)->VertexAttribPointer( |
| 1199 indx, size, type, normalized, stride, ptr); |
| 1200 } |
| 739 } | 1201 } |
| 740 | 1202 |
| 741 void Viewport( | 1203 void Viewport( |
| 742 PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height) { | 1204 PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height) { |
| 743 GetGLES(context_id)->Viewport(x, y, width, height); | 1205 Enter3D enter(context_id, true); |
| 1206 if (enter.succeeded()) { |
| 1207 ToGles2Impl(&enter)->Viewport(x, y, width, height); |
| 1208 } |
| 744 } | 1209 } |
| 745 | 1210 |
| 746 void BlitFramebufferEXT( | 1211 void BlitFramebufferEXT( |
| 747 PP_Resource context_id, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, | 1212 PP_Resource context_id, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, |
| 748 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, | 1213 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, |
| 749 GLenum filter) { | 1214 GLenum filter) { |
| 750 GetGLES( | 1215 Enter3D enter(context_id, true); |
| 751 context_id)->BlitFramebufferEXT( | 1216 if (enter.succeeded()) { |
| 752 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, | 1217 ToGles2Impl( |
| 753 filter); | 1218 &enter)->BlitFramebufferEXT( |
| 1219 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, |
| 1220 filter); |
| 1221 } |
| 754 } | 1222 } |
| 755 | 1223 |
| 756 void RenderbufferStorageMultisampleEXT( | 1224 void RenderbufferStorageMultisampleEXT( |
| 757 PP_Resource context_id, GLenum target, GLsizei samples, | 1225 PP_Resource context_id, GLenum target, GLsizei samples, |
| 758 GLenum internalformat, GLsizei width, GLsizei height) { | 1226 GLenum internalformat, GLsizei width, GLsizei height) { |
| 759 GetGLES( | 1227 Enter3D enter(context_id, true); |
| 760 context_id)->RenderbufferStorageMultisampleEXT( | 1228 if (enter.succeeded()) { |
| 761 target, samples, internalformat, width, height); | 1229 ToGles2Impl( |
| 1230 &enter)->RenderbufferStorageMultisampleEXT( |
| 1231 target, samples, internalformat, width, height); |
| 1232 } |
| 762 } | 1233 } |
| 763 | 1234 |
| 764 void GenQueriesEXT(PP_Resource context_id, GLsizei n, GLuint* queries) { | 1235 void GenQueriesEXT(PP_Resource context_id, GLsizei n, GLuint* queries) { |
| 765 GetGLES(context_id)->GenQueriesEXT(n, queries); | 1236 Enter3D enter(context_id, true); |
| 1237 if (enter.succeeded()) { |
| 1238 ToGles2Impl(&enter)->GenQueriesEXT(n, queries); |
| 1239 } |
| 766 } | 1240 } |
| 767 | 1241 |
| 768 void DeleteQueriesEXT( | 1242 void DeleteQueriesEXT( |
| 769 PP_Resource context_id, GLsizei n, const GLuint* queries) { | 1243 PP_Resource context_id, GLsizei n, const GLuint* queries) { |
| 770 GetGLES(context_id)->DeleteQueriesEXT(n, queries); | 1244 Enter3D enter(context_id, true); |
| 1245 if (enter.succeeded()) { |
| 1246 ToGles2Impl(&enter)->DeleteQueriesEXT(n, queries); |
| 1247 } |
| 771 } | 1248 } |
| 772 | 1249 |
| 773 GLboolean IsQueryEXT(PP_Resource context_id, GLuint id) { | 1250 GLboolean IsQueryEXT(PP_Resource context_id, GLuint id) { |
| 774 return GetGLES(context_id)->IsQueryEXT(id); | 1251 Enter3D enter(context_id, true); |
| 1252 if (enter.succeeded()) { |
| 1253 return ToGles2Impl(&enter)->IsQueryEXT(id); |
| 1254 } else { |
| 1255 return GL_FALSE; |
| 1256 } |
| 775 } | 1257 } |
| 776 | 1258 |
| 777 void BeginQueryEXT(PP_Resource context_id, GLenum target, GLuint id) { | 1259 void BeginQueryEXT(PP_Resource context_id, GLenum target, GLuint id) { |
| 778 GetGLES(context_id)->BeginQueryEXT(target, id); | 1260 Enter3D enter(context_id, true); |
| 1261 if (enter.succeeded()) { |
| 1262 ToGles2Impl(&enter)->BeginQueryEXT(target, id); |
| 1263 } |
| 779 } | 1264 } |
| 780 | 1265 |
| 781 void EndQueryEXT(PP_Resource context_id, GLenum target) { | 1266 void EndQueryEXT(PP_Resource context_id, GLenum target) { |
| 782 GetGLES(context_id)->EndQueryEXT(target); | 1267 Enter3D enter(context_id, true); |
| 1268 if (enter.succeeded()) { |
| 1269 ToGles2Impl(&enter)->EndQueryEXT(target); |
| 1270 } |
| 783 } | 1271 } |
| 784 | 1272 |
| 785 void GetQueryivEXT( | 1273 void GetQueryivEXT( |
| 786 PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { | 1274 PP_Resource context_id, GLenum target, GLenum pname, GLint* params) { |
| 787 GetGLES(context_id)->GetQueryivEXT(target, pname, params); | 1275 Enter3D enter(context_id, true); |
| 1276 if (enter.succeeded()) { |
| 1277 ToGles2Impl(&enter)->GetQueryivEXT(target, pname, params); |
| 1278 } |
| 788 } | 1279 } |
| 789 | 1280 |
| 790 void GetQueryObjectuivEXT( | 1281 void GetQueryObjectuivEXT( |
| 791 PP_Resource context_id, GLuint id, GLenum pname, GLuint* params) { | 1282 PP_Resource context_id, GLuint id, GLenum pname, GLuint* params) { |
| 792 GetGLES(context_id)->GetQueryObjectuivEXT(id, pname, params); | 1283 Enter3D enter(context_id, true); |
| 1284 if (enter.succeeded()) { |
| 1285 ToGles2Impl(&enter)->GetQueryObjectuivEXT(id, pname, params); |
| 1286 } |
| 793 } | 1287 } |
| 794 | 1288 |
| 795 GLboolean EnableFeatureCHROMIUM(PP_Resource context_id, const char* feature) { | 1289 GLboolean EnableFeatureCHROMIUM(PP_Resource context_id, const char* feature) { |
| 796 return GetGLES(context_id)->EnableFeatureCHROMIUM(feature); | 1290 Enter3D enter(context_id, true); |
| 1291 if (enter.succeeded()) { |
| 1292 return ToGles2Impl(&enter)->EnableFeatureCHROMIUM(feature); |
| 1293 } else { |
| 1294 return GL_FALSE; |
| 1295 } |
| 797 } | 1296 } |
| 798 | 1297 |
| 799 void* MapBufferSubDataCHROMIUM( | 1298 void* MapBufferSubDataCHROMIUM( |
| 800 PP_Resource context_id, GLuint target, GLintptr offset, GLsizeiptr size, | 1299 PP_Resource context_id, GLuint target, GLintptr offset, GLsizeiptr size, |
| 801 GLenum access) { | 1300 GLenum access) { |
| 802 return GetGLES( | 1301 Enter3D enter(context_id, true); |
| 803 context_id)->MapBufferSubDataCHROMIUM(target, offset, size, access); | 1302 if (enter.succeeded()) { |
| 1303 return ToGles2Impl( |
| 1304 &enter)->MapBufferSubDataCHROMIUM(target, offset, size, access); |
| 1305 } else { |
| 1306 return NULL; |
| 1307 } |
| 804 } | 1308 } |
| 805 | 1309 |
| 806 void UnmapBufferSubDataCHROMIUM(PP_Resource context_id, const void* mem) { | 1310 void UnmapBufferSubDataCHROMIUM(PP_Resource context_id, const void* mem) { |
| 807 GetGLES(context_id)->UnmapBufferSubDataCHROMIUM(mem); | 1311 Enter3D enter(context_id, true); |
| 1312 if (enter.succeeded()) { |
| 1313 ToGles2Impl(&enter)->UnmapBufferSubDataCHROMIUM(mem); |
| 1314 } |
| 808 } | 1315 } |
| 809 | 1316 |
| 810 void* MapTexSubImage2DCHROMIUM( | 1317 void* MapTexSubImage2DCHROMIUM( |
| 811 PP_Resource context_id, GLenum target, GLint level, GLint xoffset, | 1318 PP_Resource context_id, GLenum target, GLint level, GLint xoffset, |
| 812 GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, | 1319 GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, |
| 813 GLenum access) { | 1320 GLenum access) { |
| 814 return GetGLES( | 1321 Enter3D enter(context_id, true); |
| 815 context_id)->MapTexSubImage2DCHROMIUM( | 1322 if (enter.succeeded()) { |
| 816 target, level, xoffset, yoffset, width, height, format, type, | 1323 return ToGles2Impl( |
| 817 access); | 1324 &enter)->MapTexSubImage2DCHROMIUM( |
| 1325 target, level, xoffset, yoffset, width, height, format, type, |
| 1326 access); |
| 1327 } else { |
| 1328 return NULL; |
| 1329 } |
| 818 } | 1330 } |
| 819 | 1331 |
| 820 void UnmapTexSubImage2DCHROMIUM(PP_Resource context_id, const void* mem) { | 1332 void UnmapTexSubImage2DCHROMIUM(PP_Resource context_id, const void* mem) { |
| 821 GetGLES(context_id)->UnmapTexSubImage2DCHROMIUM(mem); | 1333 Enter3D enter(context_id, true); |
| 1334 if (enter.succeeded()) { |
| 1335 ToGles2Impl(&enter)->UnmapTexSubImage2DCHROMIUM(mem); |
| 1336 } |
| 822 } | 1337 } |
| 823 | 1338 |
| 824 void DrawArraysInstancedANGLE( | 1339 void DrawArraysInstancedANGLE( |
| 825 PP_Resource context_id, GLenum mode, GLint first, GLsizei count, | 1340 PP_Resource context_id, GLenum mode, GLint first, GLsizei count, |
| 826 GLsizei primcount) { | 1341 GLsizei primcount) { |
| 827 GetGLES(context_id)->DrawArraysInstancedANGLE(mode, first, count, primcount); | 1342 Enter3D enter(context_id, true); |
| 1343 if (enter.succeeded()) { |
| 1344 ToGles2Impl( |
| 1345 &enter)->DrawArraysInstancedANGLE(mode, first, count, primcount); |
| 1346 } |
| 828 } | 1347 } |
| 829 | 1348 |
| 830 void DrawElementsInstancedANGLE( | 1349 void DrawElementsInstancedANGLE( |
| 831 PP_Resource context_id, GLenum mode, GLsizei count, GLenum type, | 1350 PP_Resource context_id, GLenum mode, GLsizei count, GLenum type, |
| 832 const void* indices, GLsizei primcount) { | 1351 const void* indices, GLsizei primcount) { |
| 833 GetGLES( | 1352 Enter3D enter(context_id, true); |
| 834 context_id)->DrawElementsInstancedANGLE( | 1353 if (enter.succeeded()) { |
| 835 mode, count, type, indices, primcount); | 1354 ToGles2Impl( |
| 1355 &enter)->DrawElementsInstancedANGLE( |
| 1356 mode, count, type, indices, primcount); |
| 1357 } |
| 836 } | 1358 } |
| 837 | 1359 |
| 838 void VertexAttribDivisorANGLE( | 1360 void VertexAttribDivisorANGLE( |
| 839 PP_Resource context_id, GLuint index, GLuint divisor) { | 1361 PP_Resource context_id, GLuint index, GLuint divisor) { |
| 840 GetGLES(context_id)->VertexAttribDivisorANGLE(index, divisor); | 1362 Enter3D enter(context_id, true); |
| 1363 if (enter.succeeded()) { |
| 1364 ToGles2Impl(&enter)->VertexAttribDivisorANGLE(index, divisor); |
| 1365 } |
| 841 } | 1366 } |
| 842 | 1367 |
| 843 } // namespace | 1368 } // namespace |
| 844 const PPB_OpenGLES2* PPB_OpenGLES2_Shared::GetInterface() { | 1369 const PPB_OpenGLES2* PPB_OpenGLES2_Shared::GetInterface() { |
| 845 static const struct PPB_OpenGLES2 ppb_opengles2 = { | 1370 static const struct PPB_OpenGLES2 ppb_opengles2 = { |
| 846 &ActiveTexture, | 1371 &ActiveTexture, |
| 847 &AttachShader, | 1372 &AttachShader, |
| 848 &BindAttribLocation, | 1373 &BindAttribLocation, |
| 849 &BindBuffer, | 1374 &BindBuffer, |
| 850 &BindFramebuffer, | 1375 &BindFramebuffer, |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 &DeleteQueriesEXT, | 1554 &DeleteQueriesEXT, |
| 1030 &IsQueryEXT, | 1555 &IsQueryEXT, |
| 1031 &BeginQueryEXT, | 1556 &BeginQueryEXT, |
| 1032 &EndQueryEXT, | 1557 &EndQueryEXT, |
| 1033 &GetQueryivEXT, | 1558 &GetQueryivEXT, |
| 1034 &GetQueryObjectuivEXT | 1559 &GetQueryObjectuivEXT |
| 1035 }; | 1560 }; |
| 1036 return &ppb_opengles2; | 1561 return &ppb_opengles2; |
| 1037 } | 1562 } |
| 1038 } // namespace ppapi | 1563 } // namespace ppapi |
| OLD | NEW |