| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "base/logging.h" |
| 6 // gpu/command_buffer/build_gles2_cmd_buffer.py | 6 #include "mojo/examples/pepper_container_app/graphics_3d_resource.h" |
| 7 // It's formatted by clang-format using chromium coding style: | 7 #include "mojo/examples/pepper_container_app/thunk.h" |
| 8 // clang-format -i -style=chromium filename | 8 #include "mojo/public/gles2/gles2.h" |
| 9 // DO NOT EDIT! | 9 #include "ppapi/thunk/enter.h" |
| 10 #include "ppapi/thunk/ppb_graphics_3d_api.h" |
| 10 | 11 |
| 11 #include "ppapi/shared_impl/ppb_opengles2_shared.h" | 12 namespace mojo { |
| 12 | 13 namespace examples { |
| 13 #include "base/logging.h" | |
| 14 #include "gpu/command_buffer/client/gles2_implementation.h" | |
| 15 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" | |
| 16 #include "ppapi/thunk/enter.h" | |
| 17 | |
| 18 namespace ppapi { | |
| 19 | 14 |
| 20 namespace { | 15 namespace { |
| 21 | 16 |
| 22 typedef thunk::EnterResource<thunk::PPB_Graphics3D_API> Enter3D; | 17 typedef ppapi::thunk::EnterResource<ppapi::thunk::PPB_Graphics3D_API> Enter3D; |
| 23 | 18 |
| 24 gpu::gles2::GLES2Implementation* ToGles2Impl(Enter3D* enter) { | 19 bool IsBoundGraphics(Enter3D* enter) { |
| 25 DCHECK(enter); | 20 return enter->succeeded() && |
| 26 DCHECK(enter->succeeded()); | 21 static_cast<Graphics3DResource*>(enter->object())->IsBoundGraphics(); |
| 27 return static_cast<PPB_Graphics3D_Shared*>(enter->object())->gles2_impl(); | |
| 28 } | 22 } |
| 29 | 23 |
| 30 void ActiveTexture(PP_Resource context_id, GLenum texture) { | 24 void ActiveTexture(PP_Resource context_id, GLenum texture) { |
| 31 Enter3D enter(context_id, true); | 25 Enter3D enter(context_id, true); |
| 32 if (enter.succeeded()) { | 26 if (IsBoundGraphics(&enter)) { |
| 33 ToGles2Impl(&enter)->ActiveTexture(texture); | 27 glActiveTexture(texture); |
| 34 } | 28 } |
| 35 } | 29 } |
| 36 | 30 |
| 37 void AttachShader(PP_Resource context_id, GLuint program, GLuint shader) { | 31 void AttachShader(PP_Resource context_id, GLuint program, GLuint shader) { |
| 38 Enter3D enter(context_id, true); | 32 Enter3D enter(context_id, true); |
| 39 if (enter.succeeded()) { | 33 if (IsBoundGraphics(&enter)) { |
| 40 ToGles2Impl(&enter)->AttachShader(program, shader); | 34 glAttachShader(program, shader); |
| 41 } | 35 } |
| 42 } | 36 } |
| 43 | 37 |
| 44 void BindAttribLocation(PP_Resource context_id, | 38 void BindAttribLocation(PP_Resource context_id, |
| 45 GLuint program, | 39 GLuint program, |
| 46 GLuint index, | 40 GLuint index, |
| 47 const char* name) { | 41 const char* name) { |
| 48 Enter3D enter(context_id, true); | 42 Enter3D enter(context_id, true); |
| 49 if (enter.succeeded()) { | 43 if (IsBoundGraphics(&enter)) { |
| 50 ToGles2Impl(&enter)->BindAttribLocation(program, index, name); | 44 glBindAttribLocation(program, index, name); |
| 51 } | 45 } |
| 52 } | 46 } |
| 53 | 47 |
| 54 void BindBuffer(PP_Resource context_id, GLenum target, GLuint buffer) { | 48 void BindBuffer(PP_Resource context_id, GLenum target, GLuint buffer) { |
| 55 Enter3D enter(context_id, true); | 49 Enter3D enter(context_id, true); |
| 56 if (enter.succeeded()) { | 50 if (IsBoundGraphics(&enter)) { |
| 57 ToGles2Impl(&enter)->BindBuffer(target, buffer); | 51 glBindBuffer(target, buffer); |
| 58 } | 52 } |
| 59 } | 53 } |
| 60 | 54 |
| 61 void BindFramebuffer(PP_Resource context_id, | 55 void BindFramebuffer(PP_Resource context_id, |
| 62 GLenum target, | 56 GLenum target, |
| 63 GLuint framebuffer) { | 57 GLuint framebuffer) { |
| 64 Enter3D enter(context_id, true); | 58 Enter3D enter(context_id, true); |
| 65 if (enter.succeeded()) { | 59 if (IsBoundGraphics(&enter)) { |
| 66 ToGles2Impl(&enter)->BindFramebuffer(target, framebuffer); | 60 glBindFramebuffer(target, framebuffer); |
| 67 } | 61 } |
| 68 } | 62 } |
| 69 | 63 |
| 70 void BindRenderbuffer(PP_Resource context_id, | 64 void BindRenderbuffer(PP_Resource context_id, |
| 71 GLenum target, | 65 GLenum target, |
| 72 GLuint renderbuffer) { | 66 GLuint renderbuffer) { |
| 73 Enter3D enter(context_id, true); | 67 Enter3D enter(context_id, true); |
| 74 if (enter.succeeded()) { | 68 if (IsBoundGraphics(&enter)) { |
| 75 ToGles2Impl(&enter)->BindRenderbuffer(target, renderbuffer); | 69 glBindRenderbuffer(target, renderbuffer); |
| 76 } | 70 } |
| 77 } | 71 } |
| 78 | 72 |
| 79 void BindTexture(PP_Resource context_id, GLenum target, GLuint texture) { | 73 void BindTexture(PP_Resource context_id, GLenum target, GLuint texture) { |
| 80 Enter3D enter(context_id, true); | 74 Enter3D enter(context_id, true); |
| 81 if (enter.succeeded()) { | 75 if (IsBoundGraphics(&enter)) { |
| 82 ToGles2Impl(&enter)->BindTexture(target, texture); | 76 glBindTexture(target, texture); |
| 83 } | 77 } |
| 84 } | 78 } |
| 85 | 79 |
| 86 void BlendColor(PP_Resource context_id, | 80 void BlendColor(PP_Resource context_id, |
| 87 GLclampf red, | 81 GLclampf red, |
| 88 GLclampf green, | 82 GLclampf green, |
| 89 GLclampf blue, | 83 GLclampf blue, |
| 90 GLclampf alpha) { | 84 GLclampf alpha) { |
| 91 Enter3D enter(context_id, true); | 85 Enter3D enter(context_id, true); |
| 92 if (enter.succeeded()) { | 86 if (IsBoundGraphics(&enter)) { |
| 93 ToGles2Impl(&enter)->BlendColor(red, green, blue, alpha); | 87 glBlendColor(red, green, blue, alpha); |
| 94 } | 88 } |
| 95 } | 89 } |
| 96 | 90 |
| 97 void BlendEquation(PP_Resource context_id, GLenum mode) { | 91 void BlendEquation(PP_Resource context_id, GLenum mode) { |
| 98 Enter3D enter(context_id, true); | 92 Enter3D enter(context_id, true); |
| 99 if (enter.succeeded()) { | 93 if (IsBoundGraphics(&enter)) { |
| 100 ToGles2Impl(&enter)->BlendEquation(mode); | 94 glBlendEquation(mode); |
| 101 } | 95 } |
| 102 } | 96 } |
| 103 | 97 |
| 104 void BlendEquationSeparate(PP_Resource context_id, | 98 void BlendEquationSeparate(PP_Resource context_id, |
| 105 GLenum modeRGB, | 99 GLenum modeRGB, |
| 106 GLenum modeAlpha) { | 100 GLenum modeAlpha) { |
| 107 Enter3D enter(context_id, true); | 101 Enter3D enter(context_id, true); |
| 108 if (enter.succeeded()) { | 102 if (IsBoundGraphics(&enter)) { |
| 109 ToGles2Impl(&enter)->BlendEquationSeparate(modeRGB, modeAlpha); | 103 glBlendEquationSeparate(modeRGB, modeAlpha); |
| 110 } | 104 } |
| 111 } | 105 } |
| 112 | 106 |
| 113 void BlendFunc(PP_Resource context_id, GLenum sfactor, GLenum dfactor) { | 107 void BlendFunc(PP_Resource context_id, GLenum sfactor, GLenum dfactor) { |
| 114 Enter3D enter(context_id, true); | 108 Enter3D enter(context_id, true); |
| 115 if (enter.succeeded()) { | 109 if (IsBoundGraphics(&enter)) { |
| 116 ToGles2Impl(&enter)->BlendFunc(sfactor, dfactor); | 110 glBlendFunc(sfactor, dfactor); |
| 117 } | 111 } |
| 118 } | 112 } |
| 119 | 113 |
| 120 void BlendFuncSeparate(PP_Resource context_id, | 114 void BlendFuncSeparate(PP_Resource context_id, |
| 121 GLenum srcRGB, | 115 GLenum srcRGB, |
| 122 GLenum dstRGB, | 116 GLenum dstRGB, |
| 123 GLenum srcAlpha, | 117 GLenum srcAlpha, |
| 124 GLenum dstAlpha) { | 118 GLenum dstAlpha) { |
| 125 Enter3D enter(context_id, true); | 119 Enter3D enter(context_id, true); |
| 126 if (enter.succeeded()) { | 120 if (IsBoundGraphics(&enter)) { |
| 127 ToGles2Impl(&enter)->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); | 121 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); |
| 128 } | 122 } |
| 129 } | 123 } |
| 130 | 124 |
| 131 void BufferData(PP_Resource context_id, | 125 void BufferData(PP_Resource context_id, |
| 132 GLenum target, | 126 GLenum target, |
| 133 GLsizeiptr size, | 127 GLsizeiptr size, |
| 134 const void* data, | 128 const void* data, |
| 135 GLenum usage) { | 129 GLenum usage) { |
| 136 Enter3D enter(context_id, true); | 130 Enter3D enter(context_id, true); |
| 137 if (enter.succeeded()) { | 131 if (IsBoundGraphics(&enter)) { |
| 138 ToGles2Impl(&enter)->BufferData(target, size, data, usage); | 132 glBufferData(target, size, data, usage); |
| 139 } | 133 } |
| 140 } | 134 } |
| 141 | 135 |
| 142 void BufferSubData(PP_Resource context_id, | 136 void BufferSubData(PP_Resource context_id, |
| 143 GLenum target, | 137 GLenum target, |
| 144 GLintptr offset, | 138 GLintptr offset, |
| 145 GLsizeiptr size, | 139 GLsizeiptr size, |
| 146 const void* data) { | 140 const void* data) { |
| 147 Enter3D enter(context_id, true); | 141 Enter3D enter(context_id, true); |
| 148 if (enter.succeeded()) { | 142 if (IsBoundGraphics(&enter)) { |
| 149 ToGles2Impl(&enter)->BufferSubData(target, offset, size, data); | 143 glBufferSubData(target, offset, size, data); |
| 150 } | 144 } |
| 151 } | 145 } |
| 152 | 146 |
| 153 GLenum CheckFramebufferStatus(PP_Resource context_id, GLenum target) { | 147 GLenum CheckFramebufferStatus(PP_Resource context_id, GLenum target) { |
| 154 Enter3D enter(context_id, true); | 148 Enter3D enter(context_id, true); |
| 155 if (enter.succeeded()) { | 149 if (IsBoundGraphics(&enter)) { |
| 156 return ToGles2Impl(&enter)->CheckFramebufferStatus(target); | 150 return glCheckFramebufferStatus(target); |
| 157 } else { | 151 } else { |
| 158 return 0; | 152 return 0; |
| 159 } | 153 } |
| 160 } | 154 } |
| 161 | 155 |
| 162 void Clear(PP_Resource context_id, GLbitfield mask) { | 156 void Clear(PP_Resource context_id, GLbitfield mask) { |
| 163 Enter3D enter(context_id, true); | 157 Enter3D enter(context_id, true); |
| 164 if (enter.succeeded()) { | 158 if (IsBoundGraphics(&enter)) { |
| 165 ToGles2Impl(&enter)->Clear(mask); | 159 glClear(mask); |
| 166 } | 160 } |
| 167 } | 161 } |
| 168 | 162 |
| 169 void ClearColor(PP_Resource context_id, | 163 void ClearColor(PP_Resource context_id, |
| 170 GLclampf red, | 164 GLclampf red, |
| 171 GLclampf green, | 165 GLclampf green, |
| 172 GLclampf blue, | 166 GLclampf blue, |
| 173 GLclampf alpha) { | 167 GLclampf alpha) { |
| 174 Enter3D enter(context_id, true); | 168 Enter3D enter(context_id, true); |
| 175 if (enter.succeeded()) { | 169 if (IsBoundGraphics(&enter)) { |
| 176 ToGles2Impl(&enter)->ClearColor(red, green, blue, alpha); | 170 glClearColor(red, green, blue, alpha); |
| 177 } | 171 } |
| 178 } | 172 } |
| 179 | 173 |
| 180 void ClearDepthf(PP_Resource context_id, GLclampf depth) { | 174 void ClearDepthf(PP_Resource context_id, GLclampf depth) { |
| 181 Enter3D enter(context_id, true); | 175 Enter3D enter(context_id, true); |
| 182 if (enter.succeeded()) { | 176 if (IsBoundGraphics(&enter)) { |
| 183 ToGles2Impl(&enter)->ClearDepthf(depth); | 177 glClearDepthf(depth); |
| 184 } | 178 } |
| 185 } | 179 } |
| 186 | 180 |
| 187 void ClearStencil(PP_Resource context_id, GLint s) { | 181 void ClearStencil(PP_Resource context_id, GLint s) { |
| 188 Enter3D enter(context_id, true); | 182 Enter3D enter(context_id, true); |
| 189 if (enter.succeeded()) { | 183 if (IsBoundGraphics(&enter)) { |
| 190 ToGles2Impl(&enter)->ClearStencil(s); | 184 glClearStencil(s); |
| 191 } | 185 } |
| 192 } | 186 } |
| 193 | 187 |
| 194 void ColorMask(PP_Resource context_id, | 188 void ColorMask(PP_Resource context_id, |
| 195 GLboolean red, | 189 GLboolean red, |
| 196 GLboolean green, | 190 GLboolean green, |
| 197 GLboolean blue, | 191 GLboolean blue, |
| 198 GLboolean alpha) { | 192 GLboolean alpha) { |
| 199 Enter3D enter(context_id, true); | 193 Enter3D enter(context_id, true); |
| 200 if (enter.succeeded()) { | 194 if (IsBoundGraphics(&enter)) { |
| 201 ToGles2Impl(&enter)->ColorMask(red, green, blue, alpha); | 195 glColorMask(red, green, blue, alpha); |
| 202 } | 196 } |
| 203 } | 197 } |
| 204 | 198 |
| 205 void CompileShader(PP_Resource context_id, GLuint shader) { | 199 void CompileShader(PP_Resource context_id, GLuint shader) { |
| 206 Enter3D enter(context_id, true); | 200 Enter3D enter(context_id, true); |
| 207 if (enter.succeeded()) { | 201 if (IsBoundGraphics(&enter)) { |
| 208 ToGles2Impl(&enter)->CompileShader(shader); | 202 glCompileShader(shader); |
| 209 } | 203 } |
| 210 } | 204 } |
| 211 | 205 |
| 212 void CompressedTexImage2D(PP_Resource context_id, | 206 void CompressedTexImage2D(PP_Resource context_id, |
| 213 GLenum target, | 207 GLenum target, |
| 214 GLint level, | 208 GLint level, |
| 215 GLenum internalformat, | 209 GLenum internalformat, |
| 216 GLsizei width, | 210 GLsizei width, |
| 217 GLsizei height, | 211 GLsizei height, |
| 218 GLint border, | 212 GLint border, |
| 219 GLsizei imageSize, | 213 GLsizei imageSize, |
| 220 const void* data) { | 214 const void* data) { |
| 221 Enter3D enter(context_id, true); | 215 Enter3D enter(context_id, true); |
| 222 if (enter.succeeded()) { | 216 if (IsBoundGraphics(&enter)) { |
| 223 ToGles2Impl(&enter)->CompressedTexImage2D( | 217 glCompressedTexImage2D( |
| 224 target, level, internalformat, width, height, border, imageSize, data); | 218 target, level, internalformat, width, height, border, imageSize, data); |
| 225 } | 219 } |
| 226 } | 220 } |
| 227 | 221 |
| 228 void CompressedTexSubImage2D(PP_Resource context_id, | 222 void CompressedTexSubImage2D(PP_Resource context_id, |
| 229 GLenum target, | 223 GLenum target, |
| 230 GLint level, | 224 GLint level, |
| 231 GLint xoffset, | 225 GLint xoffset, |
| 232 GLint yoffset, | 226 GLint yoffset, |
| 233 GLsizei width, | 227 GLsizei width, |
| 234 GLsizei height, | 228 GLsizei height, |
| 235 GLenum format, | 229 GLenum format, |
| 236 GLsizei imageSize, | 230 GLsizei imageSize, |
| 237 const void* data) { | 231 const void* data) { |
| 238 Enter3D enter(context_id, true); | 232 Enter3D enter(context_id, true); |
| 239 if (enter.succeeded()) { | 233 if (IsBoundGraphics(&enter)) { |
| 240 ToGles2Impl(&enter)->CompressedTexSubImage2D(target, | 234 glCompressedTexSubImage2D(target, |
| 241 level, | 235 level, |
| 242 xoffset, | 236 xoffset, |
| 243 yoffset, | 237 yoffset, |
| 244 width, | 238 width, |
| 245 height, | 239 height, |
| 246 format, | 240 format, |
| 247 imageSize, | 241 imageSize, |
| 248 data); | 242 data); |
| 249 } | 243 } |
| 250 } | 244 } |
| 251 | 245 |
| 252 void CopyTexImage2D(PP_Resource context_id, | 246 void CopyTexImage2D(PP_Resource context_id, |
| 253 GLenum target, | 247 GLenum target, |
| 254 GLint level, | 248 GLint level, |
| 255 GLenum internalformat, | 249 GLenum internalformat, |
| 256 GLint x, | 250 GLint x, |
| 257 GLint y, | 251 GLint y, |
| 258 GLsizei width, | 252 GLsizei width, |
| 259 GLsizei height, | 253 GLsizei height, |
| 260 GLint border) { | 254 GLint border) { |
| 261 Enter3D enter(context_id, true); | 255 Enter3D enter(context_id, true); |
| 262 if (enter.succeeded()) { | 256 if (IsBoundGraphics(&enter)) { |
| 263 ToGles2Impl(&enter)->CopyTexImage2D( | 257 glCopyTexImage2D( |
| 264 target, level, internalformat, x, y, width, height, border); | 258 target, level, internalformat, x, y, width, height, border); |
| 265 } | 259 } |
| 266 } | 260 } |
| 267 | 261 |
| 268 void CopyTexSubImage2D(PP_Resource context_id, | 262 void CopyTexSubImage2D(PP_Resource context_id, |
| 269 GLenum target, | 263 GLenum target, |
| 270 GLint level, | 264 GLint level, |
| 271 GLint xoffset, | 265 GLint xoffset, |
| 272 GLint yoffset, | 266 GLint yoffset, |
| 273 GLint x, | 267 GLint x, |
| 274 GLint y, | 268 GLint y, |
| 275 GLsizei width, | 269 GLsizei width, |
| 276 GLsizei height) { | 270 GLsizei height) { |
| 277 Enter3D enter(context_id, true); | 271 Enter3D enter(context_id, true); |
| 278 if (enter.succeeded()) { | 272 if (IsBoundGraphics(&enter)) { |
| 279 ToGles2Impl(&enter)->CopyTexSubImage2D( | 273 glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); |
| 280 target, level, xoffset, yoffset, x, y, width, height); | |
| 281 } | 274 } |
| 282 } | 275 } |
| 283 | 276 |
| 284 GLuint CreateProgram(PP_Resource context_id) { | 277 GLuint CreateProgram(PP_Resource context_id) { |
| 285 Enter3D enter(context_id, true); | 278 Enter3D enter(context_id, true); |
| 286 if (enter.succeeded()) { | 279 if (IsBoundGraphics(&enter)) { |
| 287 return ToGles2Impl(&enter)->CreateProgram(); | 280 return glCreateProgram(); |
| 288 } else { | 281 } else { |
| 289 return 0; | 282 return 0; |
| 290 } | 283 } |
| 291 } | 284 } |
| 292 | 285 |
| 293 GLuint CreateShader(PP_Resource context_id, GLenum type) { | 286 GLuint CreateShader(PP_Resource context_id, GLenum type) { |
| 294 Enter3D enter(context_id, true); | 287 Enter3D enter(context_id, true); |
| 295 if (enter.succeeded()) { | 288 if (IsBoundGraphics(&enter)) { |
| 296 return ToGles2Impl(&enter)->CreateShader(type); | 289 return glCreateShader(type); |
| 297 } else { | 290 } else { |
| 298 return 0; | 291 return 0; |
| 299 } | 292 } |
| 300 } | 293 } |
| 301 | 294 |
| 302 void CullFace(PP_Resource context_id, GLenum mode) { | 295 void CullFace(PP_Resource context_id, GLenum mode) { |
| 303 Enter3D enter(context_id, true); | 296 Enter3D enter(context_id, true); |
| 304 if (enter.succeeded()) { | 297 if (IsBoundGraphics(&enter)) { |
| 305 ToGles2Impl(&enter)->CullFace(mode); | 298 glCullFace(mode); |
| 306 } | 299 } |
| 307 } | 300 } |
| 308 | 301 |
| 309 void DeleteBuffers(PP_Resource context_id, GLsizei n, const GLuint* buffers) { | 302 void DeleteBuffers(PP_Resource context_id, GLsizei n, const GLuint* buffers) { |
| 310 Enter3D enter(context_id, true); | 303 Enter3D enter(context_id, true); |
| 311 if (enter.succeeded()) { | 304 if (IsBoundGraphics(&enter)) { |
| 312 ToGles2Impl(&enter)->DeleteBuffers(n, buffers); | 305 glDeleteBuffers(n, buffers); |
| 313 } | 306 } |
| 314 } | 307 } |
| 315 | 308 |
| 316 void DeleteFramebuffers(PP_Resource context_id, | 309 void DeleteFramebuffers(PP_Resource context_id, |
| 317 GLsizei n, | 310 GLsizei n, |
| 318 const GLuint* framebuffers) { | 311 const GLuint* framebuffers) { |
| 319 Enter3D enter(context_id, true); | 312 Enter3D enter(context_id, true); |
| 320 if (enter.succeeded()) { | 313 if (IsBoundGraphics(&enter)) { |
| 321 ToGles2Impl(&enter)->DeleteFramebuffers(n, framebuffers); | 314 glDeleteFramebuffers(n, framebuffers); |
| 322 } | 315 } |
| 323 } | 316 } |
| 324 | 317 |
| 325 void DeleteProgram(PP_Resource context_id, GLuint program) { | 318 void DeleteProgram(PP_Resource context_id, GLuint program) { |
| 326 Enter3D enter(context_id, true); | 319 Enter3D enter(context_id, true); |
| 327 if (enter.succeeded()) { | 320 if (IsBoundGraphics(&enter)) { |
| 328 ToGles2Impl(&enter)->DeleteProgram(program); | 321 glDeleteProgram(program); |
| 329 } | 322 } |
| 330 } | 323 } |
| 331 | 324 |
| 332 void DeleteRenderbuffers(PP_Resource context_id, | 325 void DeleteRenderbuffers(PP_Resource context_id, |
| 333 GLsizei n, | 326 GLsizei n, |
| 334 const GLuint* renderbuffers) { | 327 const GLuint* renderbuffers) { |
| 335 Enter3D enter(context_id, true); | 328 Enter3D enter(context_id, true); |
| 336 if (enter.succeeded()) { | 329 if (IsBoundGraphics(&enter)) { |
| 337 ToGles2Impl(&enter)->DeleteRenderbuffers(n, renderbuffers); | 330 glDeleteRenderbuffers(n, renderbuffers); |
| 338 } | 331 } |
| 339 } | 332 } |
| 340 | 333 |
| 341 void DeleteShader(PP_Resource context_id, GLuint shader) { | 334 void DeleteShader(PP_Resource context_id, GLuint shader) { |
| 342 Enter3D enter(context_id, true); | 335 Enter3D enter(context_id, true); |
| 343 if (enter.succeeded()) { | 336 if (IsBoundGraphics(&enter)) { |
| 344 ToGles2Impl(&enter)->DeleteShader(shader); | 337 glDeleteShader(shader); |
| 345 } | 338 } |
| 346 } | 339 } |
| 347 | 340 |
| 348 void DeleteTextures(PP_Resource context_id, GLsizei n, const GLuint* textures) { | 341 void DeleteTextures(PP_Resource context_id, GLsizei n, const GLuint* textures) { |
| 349 Enter3D enter(context_id, true); | 342 Enter3D enter(context_id, true); |
| 350 if (enter.succeeded()) { | 343 if (IsBoundGraphics(&enter)) { |
| 351 ToGles2Impl(&enter)->DeleteTextures(n, textures); | 344 glDeleteTextures(n, textures); |
| 352 } | 345 } |
| 353 } | 346 } |
| 354 | 347 |
| 355 void DepthFunc(PP_Resource context_id, GLenum func) { | 348 void DepthFunc(PP_Resource context_id, GLenum func) { |
| 356 Enter3D enter(context_id, true); | 349 Enter3D enter(context_id, true); |
| 357 if (enter.succeeded()) { | 350 if (IsBoundGraphics(&enter)) { |
| 358 ToGles2Impl(&enter)->DepthFunc(func); | 351 glDepthFunc(func); |
| 359 } | 352 } |
| 360 } | 353 } |
| 361 | 354 |
| 362 void DepthMask(PP_Resource context_id, GLboolean flag) { | 355 void DepthMask(PP_Resource context_id, GLboolean flag) { |
| 363 Enter3D enter(context_id, true); | 356 Enter3D enter(context_id, true); |
| 364 if (enter.succeeded()) { | 357 if (IsBoundGraphics(&enter)) { |
| 365 ToGles2Impl(&enter)->DepthMask(flag); | 358 glDepthMask(flag); |
| 366 } | 359 } |
| 367 } | 360 } |
| 368 | 361 |
| 369 void DepthRangef(PP_Resource context_id, GLclampf zNear, GLclampf zFar) { | 362 void DepthRangef(PP_Resource context_id, GLclampf zNear, GLclampf zFar) { |
| 370 Enter3D enter(context_id, true); | 363 Enter3D enter(context_id, true); |
| 371 if (enter.succeeded()) { | 364 if (IsBoundGraphics(&enter)) { |
| 372 ToGles2Impl(&enter)->DepthRangef(zNear, zFar); | 365 glDepthRangef(zNear, zFar); |
| 373 } | 366 } |
| 374 } | 367 } |
| 375 | 368 |
| 376 void DetachShader(PP_Resource context_id, GLuint program, GLuint shader) { | 369 void DetachShader(PP_Resource context_id, GLuint program, GLuint shader) { |
| 377 Enter3D enter(context_id, true); | 370 Enter3D enter(context_id, true); |
| 378 if (enter.succeeded()) { | 371 if (IsBoundGraphics(&enter)) { |
| 379 ToGles2Impl(&enter)->DetachShader(program, shader); | 372 glDetachShader(program, shader); |
| 380 } | 373 } |
| 381 } | 374 } |
| 382 | 375 |
| 383 void Disable(PP_Resource context_id, GLenum cap) { | 376 void Disable(PP_Resource context_id, GLenum cap) { |
| 384 Enter3D enter(context_id, true); | 377 Enter3D enter(context_id, true); |
| 385 if (enter.succeeded()) { | 378 if (IsBoundGraphics(&enter)) { |
| 386 ToGles2Impl(&enter)->Disable(cap); | 379 glDisable(cap); |
| 387 } | 380 } |
| 388 } | 381 } |
| 389 | 382 |
| 390 void DisableVertexAttribArray(PP_Resource context_id, GLuint index) { | 383 void DisableVertexAttribArray(PP_Resource context_id, GLuint index) { |
| 391 Enter3D enter(context_id, true); | 384 Enter3D enter(context_id, true); |
| 392 if (enter.succeeded()) { | 385 if (IsBoundGraphics(&enter)) { |
| 393 ToGles2Impl(&enter)->DisableVertexAttribArray(index); | 386 glDisableVertexAttribArray(index); |
| 394 } | 387 } |
| 395 } | 388 } |
| 396 | 389 |
| 397 void DrawArrays(PP_Resource context_id, | 390 void DrawArrays(PP_Resource context_id, |
| 398 GLenum mode, | 391 GLenum mode, |
| 399 GLint first, | 392 GLint first, |
| 400 GLsizei count) { | 393 GLsizei count) { |
| 401 Enter3D enter(context_id, true); | 394 Enter3D enter(context_id, true); |
| 402 if (enter.succeeded()) { | 395 if (IsBoundGraphics(&enter)) { |
| 403 ToGles2Impl(&enter)->DrawArrays(mode, first, count); | 396 glDrawArrays(mode, first, count); |
| 404 } | 397 } |
| 405 } | 398 } |
| 406 | 399 |
| 407 void DrawElements(PP_Resource context_id, | 400 void DrawElements(PP_Resource context_id, |
| 408 GLenum mode, | 401 GLenum mode, |
| 409 GLsizei count, | 402 GLsizei count, |
| 410 GLenum type, | 403 GLenum type, |
| 411 const void* indices) { | 404 const void* indices) { |
| 412 Enter3D enter(context_id, true); | 405 Enter3D enter(context_id, true); |
| 413 if (enter.succeeded()) { | 406 if (IsBoundGraphics(&enter)) { |
| 414 ToGles2Impl(&enter)->DrawElements(mode, count, type, indices); | 407 glDrawElements(mode, count, type, indices); |
| 415 } | 408 } |
| 416 } | 409 } |
| 417 | 410 |
| 418 void Enable(PP_Resource context_id, GLenum cap) { | 411 void Enable(PP_Resource context_id, GLenum cap) { |
| 419 Enter3D enter(context_id, true); | 412 Enter3D enter(context_id, true); |
| 420 if (enter.succeeded()) { | 413 if (IsBoundGraphics(&enter)) { |
| 421 ToGles2Impl(&enter)->Enable(cap); | 414 glEnable(cap); |
| 422 } | 415 } |
| 423 } | 416 } |
| 424 | 417 |
| 425 void EnableVertexAttribArray(PP_Resource context_id, GLuint index) { | 418 void EnableVertexAttribArray(PP_Resource context_id, GLuint index) { |
| 426 Enter3D enter(context_id, true); | 419 Enter3D enter(context_id, true); |
| 427 if (enter.succeeded()) { | 420 if (IsBoundGraphics(&enter)) { |
| 428 ToGles2Impl(&enter)->EnableVertexAttribArray(index); | 421 glEnableVertexAttribArray(index); |
| 429 } | 422 } |
| 430 } | 423 } |
| 431 | 424 |
| 432 void Finish(PP_Resource context_id) { | 425 void Finish(PP_Resource context_id) { |
| 433 Enter3D enter(context_id, true); | 426 Enter3D enter(context_id, true); |
| 434 if (enter.succeeded()) { | 427 if (IsBoundGraphics(&enter)) { |
| 435 ToGles2Impl(&enter)->Finish(); | 428 glFinish(); |
| 436 } | 429 } |
| 437 } | 430 } |
| 438 | 431 |
| 439 void Flush(PP_Resource context_id) { | 432 void Flush(PP_Resource context_id) { |
| 440 Enter3D enter(context_id, true); | 433 Enter3D enter(context_id, true); |
| 441 if (enter.succeeded()) { | 434 if (IsBoundGraphics(&enter)) { |
| 442 ToGles2Impl(&enter)->Flush(); | 435 glFlush(); |
| 443 } | 436 } |
| 444 } | 437 } |
| 445 | 438 |
| 446 void FramebufferRenderbuffer(PP_Resource context_id, | 439 void FramebufferRenderbuffer(PP_Resource context_id, |
| 447 GLenum target, | 440 GLenum target, |
| 448 GLenum attachment, | 441 GLenum attachment, |
| 449 GLenum renderbuffertarget, | 442 GLenum renderbuffertarget, |
| 450 GLuint renderbuffer) { | 443 GLuint renderbuffer) { |
| 451 Enter3D enter(context_id, true); | 444 Enter3D enter(context_id, true); |
| 452 if (enter.succeeded()) { | 445 if (IsBoundGraphics(&enter)) { |
| 453 ToGles2Impl(&enter)->FramebufferRenderbuffer( | 446 glFramebufferRenderbuffer( |
| 454 target, attachment, renderbuffertarget, renderbuffer); | 447 target, attachment, renderbuffertarget, renderbuffer); |
| 455 } | 448 } |
| 456 } | 449 } |
| 457 | 450 |
| 458 void FramebufferTexture2D(PP_Resource context_id, | 451 void FramebufferTexture2D(PP_Resource context_id, |
| 459 GLenum target, | 452 GLenum target, |
| 460 GLenum attachment, | 453 GLenum attachment, |
| 461 GLenum textarget, | 454 GLenum textarget, |
| 462 GLuint texture, | 455 GLuint texture, |
| 463 GLint level) { | 456 GLint level) { |
| 464 Enter3D enter(context_id, true); | 457 Enter3D enter(context_id, true); |
| 465 if (enter.succeeded()) { | 458 if (IsBoundGraphics(&enter)) { |
| 466 ToGles2Impl(&enter) | 459 glFramebufferTexture2D(target, attachment, textarget, texture, level); |
| 467 ->FramebufferTexture2D(target, attachment, textarget, texture, level); | |
| 468 } | 460 } |
| 469 } | 461 } |
| 470 | 462 |
| 471 void FrontFace(PP_Resource context_id, GLenum mode) { | 463 void FrontFace(PP_Resource context_id, GLenum mode) { |
| 472 Enter3D enter(context_id, true); | 464 Enter3D enter(context_id, true); |
| 473 if (enter.succeeded()) { | 465 if (IsBoundGraphics(&enter)) { |
| 474 ToGles2Impl(&enter)->FrontFace(mode); | 466 glFrontFace(mode); |
| 475 } | 467 } |
| 476 } | 468 } |
| 477 | 469 |
| 478 void GenBuffers(PP_Resource context_id, GLsizei n, GLuint* buffers) { | 470 void GenBuffers(PP_Resource context_id, GLsizei n, GLuint* buffers) { |
| 479 Enter3D enter(context_id, true); | 471 Enter3D enter(context_id, true); |
| 480 if (enter.succeeded()) { | 472 if (IsBoundGraphics(&enter)) { |
| 481 ToGles2Impl(&enter)->GenBuffers(n, buffers); | 473 glGenBuffers(n, buffers); |
| 482 } | 474 } |
| 483 } | 475 } |
| 484 | 476 |
| 485 void GenerateMipmap(PP_Resource context_id, GLenum target) { | 477 void GenerateMipmap(PP_Resource context_id, GLenum target) { |
| 486 Enter3D enter(context_id, true); | 478 Enter3D enter(context_id, true); |
| 487 if (enter.succeeded()) { | 479 if (IsBoundGraphics(&enter)) { |
| 488 ToGles2Impl(&enter)->GenerateMipmap(target); | 480 glGenerateMipmap(target); |
| 489 } | 481 } |
| 490 } | 482 } |
| 491 | 483 |
| 492 void GenFramebuffers(PP_Resource context_id, GLsizei n, GLuint* framebuffers) { | 484 void GenFramebuffers(PP_Resource context_id, GLsizei n, GLuint* framebuffers) { |
| 493 Enter3D enter(context_id, true); | 485 Enter3D enter(context_id, true); |
| 494 if (enter.succeeded()) { | 486 if (IsBoundGraphics(&enter)) { |
| 495 ToGles2Impl(&enter)->GenFramebuffers(n, framebuffers); | 487 glGenFramebuffers(n, framebuffers); |
| 496 } | 488 } |
| 497 } | 489 } |
| 498 | 490 |
| 499 void GenRenderbuffers(PP_Resource context_id, | 491 void GenRenderbuffers(PP_Resource context_id, |
| 500 GLsizei n, | 492 GLsizei n, |
| 501 GLuint* renderbuffers) { | 493 GLuint* renderbuffers) { |
| 502 Enter3D enter(context_id, true); | 494 Enter3D enter(context_id, true); |
| 503 if (enter.succeeded()) { | 495 if (IsBoundGraphics(&enter)) { |
| 504 ToGles2Impl(&enter)->GenRenderbuffers(n, renderbuffers); | 496 glGenRenderbuffers(n, renderbuffers); |
| 505 } | 497 } |
| 506 } | 498 } |
| 507 | 499 |
| 508 void GenTextures(PP_Resource context_id, GLsizei n, GLuint* textures) { | 500 void GenTextures(PP_Resource context_id, GLsizei n, GLuint* textures) { |
| 509 Enter3D enter(context_id, true); | 501 Enter3D enter(context_id, true); |
| 510 if (enter.succeeded()) { | 502 if (IsBoundGraphics(&enter)) { |
| 511 ToGles2Impl(&enter)->GenTextures(n, textures); | 503 glGenTextures(n, textures); |
| 512 } | 504 } |
| 513 } | 505 } |
| 514 | 506 |
| 515 void GetActiveAttrib(PP_Resource context_id, | 507 void GetActiveAttrib(PP_Resource context_id, |
| 516 GLuint program, | 508 GLuint program, |
| 517 GLuint index, | 509 GLuint index, |
| 518 GLsizei bufsize, | 510 GLsizei bufsize, |
| 519 GLsizei* length, | 511 GLsizei* length, |
| 520 GLint* size, | 512 GLint* size, |
| 521 GLenum* type, | 513 GLenum* type, |
| 522 char* name) { | 514 char* name) { |
| 523 Enter3D enter(context_id, true); | 515 Enter3D enter(context_id, true); |
| 524 if (enter.succeeded()) { | 516 if (IsBoundGraphics(&enter)) { |
| 525 ToGles2Impl(&enter) | 517 glGetActiveAttrib(program, index, bufsize, length, size, type, name); |
| 526 ->GetActiveAttrib(program, index, bufsize, length, size, type, name); | |
| 527 } | 518 } |
| 528 } | 519 } |
| 529 | 520 |
| 530 void GetActiveUniform(PP_Resource context_id, | 521 void GetActiveUniform(PP_Resource context_id, |
| 531 GLuint program, | 522 GLuint program, |
| 532 GLuint index, | 523 GLuint index, |
| 533 GLsizei bufsize, | 524 GLsizei bufsize, |
| 534 GLsizei* length, | 525 GLsizei* length, |
| 535 GLint* size, | 526 GLint* size, |
| 536 GLenum* type, | 527 GLenum* type, |
| 537 char* name) { | 528 char* name) { |
| 538 Enter3D enter(context_id, true); | 529 Enter3D enter(context_id, true); |
| 539 if (enter.succeeded()) { | 530 if (IsBoundGraphics(&enter)) { |
| 540 ToGles2Impl(&enter) | 531 glGetActiveUniform(program, index, bufsize, length, size, type, name); |
| 541 ->GetActiveUniform(program, index, bufsize, length, size, type, name); | |
| 542 } | 532 } |
| 543 } | 533 } |
| 544 | 534 |
| 545 void GetAttachedShaders(PP_Resource context_id, | 535 void GetAttachedShaders(PP_Resource context_id, |
| 546 GLuint program, | 536 GLuint program, |
| 547 GLsizei maxcount, | 537 GLsizei maxcount, |
| 548 GLsizei* count, | 538 GLsizei* count, |
| 549 GLuint* shaders) { | 539 GLuint* shaders) { |
| 550 Enter3D enter(context_id, true); | 540 Enter3D enter(context_id, true); |
| 551 if (enter.succeeded()) { | 541 if (IsBoundGraphics(&enter)) { |
| 552 ToGles2Impl(&enter)->GetAttachedShaders(program, maxcount, count, shaders); | 542 glGetAttachedShaders(program, maxcount, count, shaders); |
| 553 } | 543 } |
| 554 } | 544 } |
| 555 | 545 |
| 556 GLint GetAttribLocation(PP_Resource context_id, | 546 GLint GetAttribLocation(PP_Resource context_id, |
| 557 GLuint program, | 547 GLuint program, |
| 558 const char* name) { | 548 const char* name) { |
| 559 Enter3D enter(context_id, true); | 549 Enter3D enter(context_id, true); |
| 560 if (enter.succeeded()) { | 550 if (IsBoundGraphics(&enter)) { |
| 561 return ToGles2Impl(&enter)->GetAttribLocation(program, name); | 551 return glGetAttribLocation(program, name); |
| 562 } else { | 552 } else { |
| 563 return -1; | 553 return -1; |
| 564 } | 554 } |
| 565 } | 555 } |
| 566 | 556 |
| 567 void GetBooleanv(PP_Resource context_id, GLenum pname, GLboolean* params) { | 557 void GetBooleanv(PP_Resource context_id, GLenum pname, GLboolean* params) { |
| 568 Enter3D enter(context_id, true); | 558 Enter3D enter(context_id, true); |
| 569 if (enter.succeeded()) { | 559 if (IsBoundGraphics(&enter)) { |
| 570 ToGles2Impl(&enter)->GetBooleanv(pname, params); | 560 glGetBooleanv(pname, params); |
| 571 } | 561 } |
| 572 } | 562 } |
| 573 | 563 |
| 574 void GetBufferParameteriv(PP_Resource context_id, | 564 void GetBufferParameteriv(PP_Resource context_id, |
| 575 GLenum target, | 565 GLenum target, |
| 576 GLenum pname, | 566 GLenum pname, |
| 577 GLint* params) { | 567 GLint* params) { |
| 578 Enter3D enter(context_id, true); | 568 Enter3D enter(context_id, true); |
| 579 if (enter.succeeded()) { | 569 if (IsBoundGraphics(&enter)) { |
| 580 ToGles2Impl(&enter)->GetBufferParameteriv(target, pname, params); | 570 glGetBufferParameteriv(target, pname, params); |
| 581 } | 571 } |
| 582 } | 572 } |
| 583 | 573 |
| 584 GLenum GetError(PP_Resource context_id) { | 574 GLenum GetError(PP_Resource context_id) { |
| 585 Enter3D enter(context_id, true); | 575 Enter3D enter(context_id, true); |
| 586 if (enter.succeeded()) { | 576 if (IsBoundGraphics(&enter)) { |
| 587 return ToGles2Impl(&enter)->GetError(); | 577 return glGetError(); |
| 588 } else { | 578 } else { |
| 589 return 0; | 579 return 0; |
| 590 } | 580 } |
| 591 } | 581 } |
| 592 | 582 |
| 593 void GetFloatv(PP_Resource context_id, GLenum pname, GLfloat* params) { | 583 void GetFloatv(PP_Resource context_id, GLenum pname, GLfloat* params) { |
| 594 Enter3D enter(context_id, true); | 584 Enter3D enter(context_id, true); |
| 595 if (enter.succeeded()) { | 585 if (IsBoundGraphics(&enter)) { |
| 596 ToGles2Impl(&enter)->GetFloatv(pname, params); | 586 glGetFloatv(pname, params); |
| 597 } | 587 } |
| 598 } | 588 } |
| 599 | 589 |
| 600 void GetFramebufferAttachmentParameteriv(PP_Resource context_id, | 590 void GetFramebufferAttachmentParameteriv(PP_Resource context_id, |
| 601 GLenum target, | 591 GLenum target, |
| 602 GLenum attachment, | 592 GLenum attachment, |
| 603 GLenum pname, | 593 GLenum pname, |
| 604 GLint* params) { | 594 GLint* params) { |
| 605 Enter3D enter(context_id, true); | 595 Enter3D enter(context_id, true); |
| 606 if (enter.succeeded()) { | 596 if (IsBoundGraphics(&enter)) { |
| 607 ToGles2Impl(&enter)->GetFramebufferAttachmentParameteriv( | 597 glGetFramebufferAttachmentParameteriv(target, attachment, pname, params); |
| 608 target, attachment, pname, params); | |
| 609 } | 598 } |
| 610 } | 599 } |
| 611 | 600 |
| 612 void GetIntegerv(PP_Resource context_id, GLenum pname, GLint* params) { | 601 void GetIntegerv(PP_Resource context_id, GLenum pname, GLint* params) { |
| 613 Enter3D enter(context_id, true); | 602 Enter3D enter(context_id, true); |
| 614 if (enter.succeeded()) { | 603 if (IsBoundGraphics(&enter)) { |
| 615 ToGles2Impl(&enter)->GetIntegerv(pname, params); | 604 glGetIntegerv(pname, params); |
| 616 } | 605 } |
| 617 } | 606 } |
| 618 | 607 |
| 619 void GetProgramiv(PP_Resource context_id, | 608 void GetProgramiv(PP_Resource context_id, |
| 620 GLuint program, | 609 GLuint program, |
| 621 GLenum pname, | 610 GLenum pname, |
| 622 GLint* params) { | 611 GLint* params) { |
| 623 Enter3D enter(context_id, true); | 612 Enter3D enter(context_id, true); |
| 624 if (enter.succeeded()) { | 613 if (IsBoundGraphics(&enter)) { |
| 625 ToGles2Impl(&enter)->GetProgramiv(program, pname, params); | 614 glGetProgramiv(program, pname, params); |
| 626 } | 615 } |
| 627 } | 616 } |
| 628 | 617 |
| 629 void GetProgramInfoLog(PP_Resource context_id, | 618 void GetProgramInfoLog(PP_Resource context_id, |
| 630 GLuint program, | 619 GLuint program, |
| 631 GLsizei bufsize, | 620 GLsizei bufsize, |
| 632 GLsizei* length, | 621 GLsizei* length, |
| 633 char* infolog) { | 622 char* infolog) { |
| 634 Enter3D enter(context_id, true); | 623 Enter3D enter(context_id, true); |
| 635 if (enter.succeeded()) { | 624 if (IsBoundGraphics(&enter)) { |
| 636 ToGles2Impl(&enter)->GetProgramInfoLog(program, bufsize, length, infolog); | 625 glGetProgramInfoLog(program, bufsize, length, infolog); |
| 637 } | 626 } |
| 638 } | 627 } |
| 639 | 628 |
| 640 void GetRenderbufferParameteriv(PP_Resource context_id, | 629 void GetRenderbufferParameteriv(PP_Resource context_id, |
| 641 GLenum target, | 630 GLenum target, |
| 642 GLenum pname, | 631 GLenum pname, |
| 643 GLint* params) { | 632 GLint* params) { |
| 644 Enter3D enter(context_id, true); | 633 Enter3D enter(context_id, true); |
| 645 if (enter.succeeded()) { | 634 if (IsBoundGraphics(&enter)) { |
| 646 ToGles2Impl(&enter)->GetRenderbufferParameteriv(target, pname, params); | 635 glGetRenderbufferParameteriv(target, pname, params); |
| 647 } | 636 } |
| 648 } | 637 } |
| 649 | 638 |
| 650 void GetShaderiv(PP_Resource context_id, | 639 void GetShaderiv(PP_Resource context_id, |
| 651 GLuint shader, | 640 GLuint shader, |
| 652 GLenum pname, | 641 GLenum pname, |
| 653 GLint* params) { | 642 GLint* params) { |
| 654 Enter3D enter(context_id, true); | 643 Enter3D enter(context_id, true); |
| 655 if (enter.succeeded()) { | 644 if (IsBoundGraphics(&enter)) { |
| 656 ToGles2Impl(&enter)->GetShaderiv(shader, pname, params); | 645 glGetShaderiv(shader, pname, params); |
| 657 } | 646 } |
| 658 } | 647 } |
| 659 | 648 |
| 660 void GetShaderInfoLog(PP_Resource context_id, | 649 void GetShaderInfoLog(PP_Resource context_id, |
| 661 GLuint shader, | 650 GLuint shader, |
| 662 GLsizei bufsize, | 651 GLsizei bufsize, |
| 663 GLsizei* length, | 652 GLsizei* length, |
| 664 char* infolog) { | 653 char* infolog) { |
| 665 Enter3D enter(context_id, true); | 654 Enter3D enter(context_id, true); |
| 666 if (enter.succeeded()) { | 655 if (IsBoundGraphics(&enter)) { |
| 667 ToGles2Impl(&enter)->GetShaderInfoLog(shader, bufsize, length, infolog); | 656 glGetShaderInfoLog(shader, bufsize, length, infolog); |
| 668 } | 657 } |
| 669 } | 658 } |
| 670 | 659 |
| 671 void GetShaderPrecisionFormat(PP_Resource context_id, | 660 void GetShaderPrecisionFormat(PP_Resource context_id, |
| 672 GLenum shadertype, | 661 GLenum shadertype, |
| 673 GLenum precisiontype, | 662 GLenum precisiontype, |
| 674 GLint* range, | 663 GLint* range, |
| 675 GLint* precision) { | 664 GLint* precision) { |
| 676 Enter3D enter(context_id, true); | 665 Enter3D enter(context_id, true); |
| 677 if (enter.succeeded()) { | 666 if (IsBoundGraphics(&enter)) { |
| 678 ToGles2Impl(&enter) | 667 glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision); |
| 679 ->GetShaderPrecisionFormat(shadertype, precisiontype, range, precision); | |
| 680 } | 668 } |
| 681 } | 669 } |
| 682 | 670 |
| 683 void GetShaderSource(PP_Resource context_id, | 671 void GetShaderSource(PP_Resource context_id, |
| 684 GLuint shader, | 672 GLuint shader, |
| 685 GLsizei bufsize, | 673 GLsizei bufsize, |
| 686 GLsizei* length, | 674 GLsizei* length, |
| 687 char* source) { | 675 char* source) { |
| 688 Enter3D enter(context_id, true); | 676 Enter3D enter(context_id, true); |
| 689 if (enter.succeeded()) { | 677 if (IsBoundGraphics(&enter)) { |
| 690 ToGles2Impl(&enter)->GetShaderSource(shader, bufsize, length, source); | 678 glGetShaderSource(shader, bufsize, length, source); |
| 691 } | 679 } |
| 692 } | 680 } |
| 693 | 681 |
| 694 const GLubyte* GetString(PP_Resource context_id, GLenum name) { | 682 const GLubyte* GetString(PP_Resource context_id, GLenum name) { |
| 695 Enter3D enter(context_id, true); | 683 Enter3D enter(context_id, true); |
| 696 if (enter.succeeded()) { | 684 if (IsBoundGraphics(&enter)) { |
| 697 return ToGles2Impl(&enter)->GetString(name); | 685 return glGetString(name); |
| 698 } else { | 686 } else { |
| 699 return NULL; | 687 return NULL; |
| 700 } | 688 } |
| 701 } | 689 } |
| 702 | 690 |
| 703 void GetTexParameterfv(PP_Resource context_id, | 691 void GetTexParameterfv(PP_Resource context_id, |
| 704 GLenum target, | 692 GLenum target, |
| 705 GLenum pname, | 693 GLenum pname, |
| 706 GLfloat* params) { | 694 GLfloat* params) { |
| 707 Enter3D enter(context_id, true); | 695 Enter3D enter(context_id, true); |
| 708 if (enter.succeeded()) { | 696 if (IsBoundGraphics(&enter)) { |
| 709 ToGles2Impl(&enter)->GetTexParameterfv(target, pname, params); | 697 glGetTexParameterfv(target, pname, params); |
| 710 } | 698 } |
| 711 } | 699 } |
| 712 | 700 |
| 713 void GetTexParameteriv(PP_Resource context_id, | 701 void GetTexParameteriv(PP_Resource context_id, |
| 714 GLenum target, | 702 GLenum target, |
| 715 GLenum pname, | 703 GLenum pname, |
| 716 GLint* params) { | 704 GLint* params) { |
| 717 Enter3D enter(context_id, true); | 705 Enter3D enter(context_id, true); |
| 718 if (enter.succeeded()) { | 706 if (IsBoundGraphics(&enter)) { |
| 719 ToGles2Impl(&enter)->GetTexParameteriv(target, pname, params); | 707 glGetTexParameteriv(target, pname, params); |
| 720 } | 708 } |
| 721 } | 709 } |
| 722 | 710 |
| 723 void GetUniformfv(PP_Resource context_id, | 711 void GetUniformfv(PP_Resource context_id, |
| 724 GLuint program, | 712 GLuint program, |
| 725 GLint location, | 713 GLint location, |
| 726 GLfloat* params) { | 714 GLfloat* params) { |
| 727 Enter3D enter(context_id, true); | 715 Enter3D enter(context_id, true); |
| 728 if (enter.succeeded()) { | 716 if (IsBoundGraphics(&enter)) { |
| 729 ToGles2Impl(&enter)->GetUniformfv(program, location, params); | 717 glGetUniformfv(program, location, params); |
| 730 } | 718 } |
| 731 } | 719 } |
| 732 | 720 |
| 733 void GetUniformiv(PP_Resource context_id, | 721 void GetUniformiv(PP_Resource context_id, |
| 734 GLuint program, | 722 GLuint program, |
| 735 GLint location, | 723 GLint location, |
| 736 GLint* params) { | 724 GLint* params) { |
| 737 Enter3D enter(context_id, true); | 725 Enter3D enter(context_id, true); |
| 738 if (enter.succeeded()) { | 726 if (IsBoundGraphics(&enter)) { |
| 739 ToGles2Impl(&enter)->GetUniformiv(program, location, params); | 727 glGetUniformiv(program, location, params); |
| 740 } | 728 } |
| 741 } | 729 } |
| 742 | 730 |
| 743 GLint GetUniformLocation(PP_Resource context_id, | 731 GLint GetUniformLocation(PP_Resource context_id, |
| 744 GLuint program, | 732 GLuint program, |
| 745 const char* name) { | 733 const char* name) { |
| 746 Enter3D enter(context_id, true); | 734 Enter3D enter(context_id, true); |
| 747 if (enter.succeeded()) { | 735 if (IsBoundGraphics(&enter)) { |
| 748 return ToGles2Impl(&enter)->GetUniformLocation(program, name); | 736 return glGetUniformLocation(program, name); |
| 749 } else { | 737 } else { |
| 750 return -1; | 738 return -1; |
| 751 } | 739 } |
| 752 } | 740 } |
| 753 | 741 |
| 754 void GetVertexAttribfv(PP_Resource context_id, | 742 void GetVertexAttribfv(PP_Resource context_id, |
| 755 GLuint index, | 743 GLuint index, |
| 756 GLenum pname, | 744 GLenum pname, |
| 757 GLfloat* params) { | 745 GLfloat* params) { |
| 758 Enter3D enter(context_id, true); | 746 Enter3D enter(context_id, true); |
| 759 if (enter.succeeded()) { | 747 if (IsBoundGraphics(&enter)) { |
| 760 ToGles2Impl(&enter)->GetVertexAttribfv(index, pname, params); | 748 glGetVertexAttribfv(index, pname, params); |
| 761 } | 749 } |
| 762 } | 750 } |
| 763 | 751 |
| 764 void GetVertexAttribiv(PP_Resource context_id, | 752 void GetVertexAttribiv(PP_Resource context_id, |
| 765 GLuint index, | 753 GLuint index, |
| 766 GLenum pname, | 754 GLenum pname, |
| 767 GLint* params) { | 755 GLint* params) { |
| 768 Enter3D enter(context_id, true); | 756 Enter3D enter(context_id, true); |
| 769 if (enter.succeeded()) { | 757 if (IsBoundGraphics(&enter)) { |
| 770 ToGles2Impl(&enter)->GetVertexAttribiv(index, pname, params); | 758 glGetVertexAttribiv(index, pname, params); |
| 771 } | 759 } |
| 772 } | 760 } |
| 773 | 761 |
| 774 void GetVertexAttribPointerv(PP_Resource context_id, | 762 void GetVertexAttribPointerv(PP_Resource context_id, |
| 775 GLuint index, | 763 GLuint index, |
| 776 GLenum pname, | 764 GLenum pname, |
| 777 void** pointer) { | 765 void** pointer) { |
| 778 Enter3D enter(context_id, true); | 766 Enter3D enter(context_id, true); |
| 779 if (enter.succeeded()) { | 767 if (IsBoundGraphics(&enter)) { |
| 780 ToGles2Impl(&enter)->GetVertexAttribPointerv(index, pname, pointer); | 768 glGetVertexAttribPointerv(index, pname, pointer); |
| 781 } | 769 } |
| 782 } | 770 } |
| 783 | 771 |
| 784 void Hint(PP_Resource context_id, GLenum target, GLenum mode) { | 772 void Hint(PP_Resource context_id, GLenum target, GLenum mode) { |
| 785 Enter3D enter(context_id, true); | 773 Enter3D enter(context_id, true); |
| 786 if (enter.succeeded()) { | 774 if (IsBoundGraphics(&enter)) { |
| 787 ToGles2Impl(&enter)->Hint(target, mode); | 775 glHint(target, mode); |
| 788 } | 776 } |
| 789 } | 777 } |
| 790 | 778 |
| 791 GLboolean IsBuffer(PP_Resource context_id, GLuint buffer) { | 779 GLboolean IsBuffer(PP_Resource context_id, GLuint buffer) { |
| 792 Enter3D enter(context_id, true); | 780 Enter3D enter(context_id, true); |
| 793 if (enter.succeeded()) { | 781 if (IsBoundGraphics(&enter)) { |
| 794 return ToGles2Impl(&enter)->IsBuffer(buffer); | 782 return glIsBuffer(buffer); |
| 795 } else { | 783 } else { |
| 796 return GL_FALSE; | 784 return GL_FALSE; |
| 797 } | 785 } |
| 798 } | 786 } |
| 799 | 787 |
| 800 GLboolean IsEnabled(PP_Resource context_id, GLenum cap) { | 788 GLboolean IsEnabled(PP_Resource context_id, GLenum cap) { |
| 801 Enter3D enter(context_id, true); | 789 Enter3D enter(context_id, true); |
| 802 if (enter.succeeded()) { | 790 if (IsBoundGraphics(&enter)) { |
| 803 return ToGles2Impl(&enter)->IsEnabled(cap); | 791 return glIsEnabled(cap); |
| 804 } else { | 792 } else { |
| 805 return GL_FALSE; | 793 return GL_FALSE; |
| 806 } | 794 } |
| 807 } | 795 } |
| 808 | 796 |
| 809 GLboolean IsFramebuffer(PP_Resource context_id, GLuint framebuffer) { | 797 GLboolean IsFramebuffer(PP_Resource context_id, GLuint framebuffer) { |
| 810 Enter3D enter(context_id, true); | 798 Enter3D enter(context_id, true); |
| 811 if (enter.succeeded()) { | 799 if (IsBoundGraphics(&enter)) { |
| 812 return ToGles2Impl(&enter)->IsFramebuffer(framebuffer); | 800 return glIsFramebuffer(framebuffer); |
| 813 } else { | 801 } else { |
| 814 return GL_FALSE; | 802 return GL_FALSE; |
| 815 } | 803 } |
| 816 } | 804 } |
| 817 | 805 |
| 818 GLboolean IsProgram(PP_Resource context_id, GLuint program) { | 806 GLboolean IsProgram(PP_Resource context_id, GLuint program) { |
| 819 Enter3D enter(context_id, true); | 807 Enter3D enter(context_id, true); |
| 820 if (enter.succeeded()) { | 808 if (IsBoundGraphics(&enter)) { |
| 821 return ToGles2Impl(&enter)->IsProgram(program); | 809 return glIsProgram(program); |
| 822 } else { | 810 } else { |
| 823 return GL_FALSE; | 811 return GL_FALSE; |
| 824 } | 812 } |
| 825 } | 813 } |
| 826 | 814 |
| 827 GLboolean IsRenderbuffer(PP_Resource context_id, GLuint renderbuffer) { | 815 GLboolean IsRenderbuffer(PP_Resource context_id, GLuint renderbuffer) { |
| 828 Enter3D enter(context_id, true); | 816 Enter3D enter(context_id, true); |
| 829 if (enter.succeeded()) { | 817 if (IsBoundGraphics(&enter)) { |
| 830 return ToGles2Impl(&enter)->IsRenderbuffer(renderbuffer); | 818 return glIsRenderbuffer(renderbuffer); |
| 831 } else { | 819 } else { |
| 832 return GL_FALSE; | 820 return GL_FALSE; |
| 833 } | 821 } |
| 834 } | 822 } |
| 835 | 823 |
| 836 GLboolean IsShader(PP_Resource context_id, GLuint shader) { | 824 GLboolean IsShader(PP_Resource context_id, GLuint shader) { |
| 837 Enter3D enter(context_id, true); | 825 Enter3D enter(context_id, true); |
| 838 if (enter.succeeded()) { | 826 if (IsBoundGraphics(&enter)) { |
| 839 return ToGles2Impl(&enter)->IsShader(shader); | 827 return glIsShader(shader); |
| 840 } else { | 828 } else { |
| 841 return GL_FALSE; | 829 return GL_FALSE; |
| 842 } | 830 } |
| 843 } | 831 } |
| 844 | 832 |
| 845 GLboolean IsTexture(PP_Resource context_id, GLuint texture) { | 833 GLboolean IsTexture(PP_Resource context_id, GLuint texture) { |
| 846 Enter3D enter(context_id, true); | 834 Enter3D enter(context_id, true); |
| 847 if (enter.succeeded()) { | 835 if (IsBoundGraphics(&enter)) { |
| 848 return ToGles2Impl(&enter)->IsTexture(texture); | 836 return glIsTexture(texture); |
| 849 } else { | 837 } else { |
| 850 return GL_FALSE; | 838 return GL_FALSE; |
| 851 } | 839 } |
| 852 } | 840 } |
| 853 | 841 |
| 854 void LineWidth(PP_Resource context_id, GLfloat width) { | 842 void LineWidth(PP_Resource context_id, GLfloat width) { |
| 855 Enter3D enter(context_id, true); | 843 Enter3D enter(context_id, true); |
| 856 if (enter.succeeded()) { | 844 if (IsBoundGraphics(&enter)) { |
| 857 ToGles2Impl(&enter)->LineWidth(width); | 845 glLineWidth(width); |
| 858 } | 846 } |
| 859 } | 847 } |
| 860 | 848 |
| 861 void LinkProgram(PP_Resource context_id, GLuint program) { | 849 void LinkProgram(PP_Resource context_id, GLuint program) { |
| 862 Enter3D enter(context_id, true); | 850 Enter3D enter(context_id, true); |
| 863 if (enter.succeeded()) { | 851 if (IsBoundGraphics(&enter)) { |
| 864 ToGles2Impl(&enter)->LinkProgram(program); | 852 glLinkProgram(program); |
| 865 } | 853 } |
| 866 } | 854 } |
| 867 | 855 |
| 868 void PixelStorei(PP_Resource context_id, GLenum pname, GLint param) { | 856 void PixelStorei(PP_Resource context_id, GLenum pname, GLint param) { |
| 869 Enter3D enter(context_id, true); | 857 Enter3D enter(context_id, true); |
| 870 if (enter.succeeded()) { | 858 if (IsBoundGraphics(&enter)) { |
| 871 ToGles2Impl(&enter)->PixelStorei(pname, param); | 859 glPixelStorei(pname, param); |
| 872 } | 860 } |
| 873 } | 861 } |
| 874 | 862 |
| 875 void PolygonOffset(PP_Resource context_id, GLfloat factor, GLfloat units) { | 863 void PolygonOffset(PP_Resource context_id, GLfloat factor, GLfloat units) { |
| 876 Enter3D enter(context_id, true); | 864 Enter3D enter(context_id, true); |
| 877 if (enter.succeeded()) { | 865 if (IsBoundGraphics(&enter)) { |
| 878 ToGles2Impl(&enter)->PolygonOffset(factor, units); | 866 glPolygonOffset(factor, units); |
| 879 } | 867 } |
| 880 } | 868 } |
| 881 | 869 |
| 882 void ReadPixels(PP_Resource context_id, | 870 void ReadPixels(PP_Resource context_id, |
| 883 GLint x, | 871 GLint x, |
| 884 GLint y, | 872 GLint y, |
| 885 GLsizei width, | 873 GLsizei width, |
| 886 GLsizei height, | 874 GLsizei height, |
| 887 GLenum format, | 875 GLenum format, |
| 888 GLenum type, | 876 GLenum type, |
| 889 void* pixels) { | 877 void* pixels) { |
| 890 Enter3D enter(context_id, true); | 878 Enter3D enter(context_id, true); |
| 891 if (enter.succeeded()) { | 879 if (IsBoundGraphics(&enter)) { |
| 892 ToGles2Impl(&enter)->ReadPixels(x, y, width, height, format, type, pixels); | 880 glReadPixels(x, y, width, height, format, type, pixels); |
| 893 } | 881 } |
| 894 } | 882 } |
| 895 | 883 |
| 896 void ReleaseShaderCompiler(PP_Resource context_id) { | 884 void ReleaseShaderCompiler(PP_Resource context_id) { |
| 897 Enter3D enter(context_id, true); | 885 Enter3D enter(context_id, true); |
| 898 if (enter.succeeded()) { | 886 if (IsBoundGraphics(&enter)) { |
| 899 ToGles2Impl(&enter)->ReleaseShaderCompiler(); | 887 glReleaseShaderCompiler(); |
| 900 } | 888 } |
| 901 } | 889 } |
| 902 | 890 |
| 903 void RenderbufferStorage(PP_Resource context_id, | 891 void RenderbufferStorage(PP_Resource context_id, |
| 904 GLenum target, | 892 GLenum target, |
| 905 GLenum internalformat, | 893 GLenum internalformat, |
| 906 GLsizei width, | 894 GLsizei width, |
| 907 GLsizei height) { | 895 GLsizei height) { |
| 908 Enter3D enter(context_id, true); | 896 Enter3D enter(context_id, true); |
| 909 if (enter.succeeded()) { | 897 if (IsBoundGraphics(&enter)) { |
| 910 ToGles2Impl(&enter) | 898 glRenderbufferStorage(target, internalformat, width, height); |
| 911 ->RenderbufferStorage(target, internalformat, width, height); | |
| 912 } | 899 } |
| 913 } | 900 } |
| 914 | 901 |
| 915 void SampleCoverage(PP_Resource context_id, GLclampf value, GLboolean invert) { | 902 void SampleCoverage(PP_Resource context_id, GLclampf value, GLboolean invert) { |
| 916 Enter3D enter(context_id, true); | 903 Enter3D enter(context_id, true); |
| 917 if (enter.succeeded()) { | 904 if (IsBoundGraphics(&enter)) { |
| 918 ToGles2Impl(&enter)->SampleCoverage(value, invert); | 905 glSampleCoverage(value, invert); |
| 919 } | 906 } |
| 920 } | 907 } |
| 921 | 908 |
| 922 void Scissor(PP_Resource context_id, | 909 void Scissor(PP_Resource context_id, |
| 923 GLint x, | 910 GLint x, |
| 924 GLint y, | 911 GLint y, |
| 925 GLsizei width, | 912 GLsizei width, |
| 926 GLsizei height) { | 913 GLsizei height) { |
| 927 Enter3D enter(context_id, true); | 914 Enter3D enter(context_id, true); |
| 928 if (enter.succeeded()) { | 915 if (IsBoundGraphics(&enter)) { |
| 929 ToGles2Impl(&enter)->Scissor(x, y, width, height); | 916 glScissor(x, y, width, height); |
| 930 } | 917 } |
| 931 } | 918 } |
| 932 | 919 |
| 933 void ShaderBinary(PP_Resource context_id, | 920 void ShaderBinary(PP_Resource context_id, |
| 934 GLsizei n, | 921 GLsizei n, |
| 935 const GLuint* shaders, | 922 const GLuint* shaders, |
| 936 GLenum binaryformat, | 923 GLenum binaryformat, |
| 937 const void* binary, | 924 const void* binary, |
| 938 GLsizei length) { | 925 GLsizei length) { |
| 939 Enter3D enter(context_id, true); | 926 Enter3D enter(context_id, true); |
| 940 if (enter.succeeded()) { | 927 if (IsBoundGraphics(&enter)) { |
| 941 ToGles2Impl(&enter)->ShaderBinary(n, shaders, binaryformat, binary, length); | 928 glShaderBinary(n, shaders, binaryformat, binary, length); |
| 942 } | 929 } |
| 943 } | 930 } |
| 944 | 931 |
| 945 void ShaderSource(PP_Resource context_id, | 932 void ShaderSource(PP_Resource context_id, |
| 946 GLuint shader, | 933 GLuint shader, |
| 947 GLsizei count, | 934 GLsizei count, |
| 948 const char** str, | 935 const char** str, |
| 949 const GLint* length) { | 936 const GLint* length) { |
| 950 Enter3D enter(context_id, true); | 937 Enter3D enter(context_id, true); |
| 951 if (enter.succeeded()) { | 938 if (IsBoundGraphics(&enter)) { |
| 952 ToGles2Impl(&enter)->ShaderSource(shader, count, str, length); | 939 glShaderSource(shader, count, str, length); |
| 953 } | 940 } |
| 954 } | 941 } |
| 955 | 942 |
| 956 void StencilFunc(PP_Resource context_id, GLenum func, GLint ref, GLuint mask) { | 943 void StencilFunc(PP_Resource context_id, GLenum func, GLint ref, GLuint mask) { |
| 957 Enter3D enter(context_id, true); | 944 Enter3D enter(context_id, true); |
| 958 if (enter.succeeded()) { | 945 if (IsBoundGraphics(&enter)) { |
| 959 ToGles2Impl(&enter)->StencilFunc(func, ref, mask); | 946 glStencilFunc(func, ref, mask); |
| 960 } | 947 } |
| 961 } | 948 } |
| 962 | 949 |
| 963 void StencilFuncSeparate(PP_Resource context_id, | 950 void StencilFuncSeparate(PP_Resource context_id, |
| 964 GLenum face, | 951 GLenum face, |
| 965 GLenum func, | 952 GLenum func, |
| 966 GLint ref, | 953 GLint ref, |
| 967 GLuint mask) { | 954 GLuint mask) { |
| 968 Enter3D enter(context_id, true); | 955 Enter3D enter(context_id, true); |
| 969 if (enter.succeeded()) { | 956 if (IsBoundGraphics(&enter)) { |
| 970 ToGles2Impl(&enter)->StencilFuncSeparate(face, func, ref, mask); | 957 glStencilFuncSeparate(face, func, ref, mask); |
| 971 } | 958 } |
| 972 } | 959 } |
| 973 | 960 |
| 974 void StencilMask(PP_Resource context_id, GLuint mask) { | 961 void StencilMask(PP_Resource context_id, GLuint mask) { |
| 975 Enter3D enter(context_id, true); | 962 Enter3D enter(context_id, true); |
| 976 if (enter.succeeded()) { | 963 if (IsBoundGraphics(&enter)) { |
| 977 ToGles2Impl(&enter)->StencilMask(mask); | 964 glStencilMask(mask); |
| 978 } | 965 } |
| 979 } | 966 } |
| 980 | 967 |
| 981 void StencilMaskSeparate(PP_Resource context_id, GLenum face, GLuint mask) { | 968 void StencilMaskSeparate(PP_Resource context_id, GLenum face, GLuint mask) { |
| 982 Enter3D enter(context_id, true); | 969 Enter3D enter(context_id, true); |
| 983 if (enter.succeeded()) { | 970 if (IsBoundGraphics(&enter)) { |
| 984 ToGles2Impl(&enter)->StencilMaskSeparate(face, mask); | 971 glStencilMaskSeparate(face, mask); |
| 985 } | 972 } |
| 986 } | 973 } |
| 987 | 974 |
| 988 void StencilOp(PP_Resource context_id, | 975 void StencilOp(PP_Resource context_id, |
| 989 GLenum fail, | 976 GLenum fail, |
| 990 GLenum zfail, | 977 GLenum zfail, |
| 991 GLenum zpass) { | 978 GLenum zpass) { |
| 992 Enter3D enter(context_id, true); | 979 Enter3D enter(context_id, true); |
| 993 if (enter.succeeded()) { | 980 if (IsBoundGraphics(&enter)) { |
| 994 ToGles2Impl(&enter)->StencilOp(fail, zfail, zpass); | 981 glStencilOp(fail, zfail, zpass); |
| 995 } | 982 } |
| 996 } | 983 } |
| 997 | 984 |
| 998 void StencilOpSeparate(PP_Resource context_id, | 985 void StencilOpSeparate(PP_Resource context_id, |
| 999 GLenum face, | 986 GLenum face, |
| 1000 GLenum fail, | 987 GLenum fail, |
| 1001 GLenum zfail, | 988 GLenum zfail, |
| 1002 GLenum zpass) { | 989 GLenum zpass) { |
| 1003 Enter3D enter(context_id, true); | 990 Enter3D enter(context_id, true); |
| 1004 if (enter.succeeded()) { | 991 if (IsBoundGraphics(&enter)) { |
| 1005 ToGles2Impl(&enter)->StencilOpSeparate(face, fail, zfail, zpass); | 992 glStencilOpSeparate(face, fail, zfail, zpass); |
| 1006 } | 993 } |
| 1007 } | 994 } |
| 1008 | 995 |
| 1009 void TexImage2D(PP_Resource context_id, | 996 void TexImage2D(PP_Resource context_id, |
| 1010 GLenum target, | 997 GLenum target, |
| 1011 GLint level, | 998 GLint level, |
| 1012 GLint internalformat, | 999 GLint internalformat, |
| 1013 GLsizei width, | 1000 GLsizei width, |
| 1014 GLsizei height, | 1001 GLsizei height, |
| 1015 GLint border, | 1002 GLint border, |
| 1016 GLenum format, | 1003 GLenum format, |
| 1017 GLenum type, | 1004 GLenum type, |
| 1018 const void* pixels) { | 1005 const void* pixels) { |
| 1019 Enter3D enter(context_id, true); | 1006 Enter3D enter(context_id, true); |
| 1020 if (enter.succeeded()) { | 1007 if (IsBoundGraphics(&enter)) { |
| 1021 ToGles2Impl(&enter)->TexImage2D(target, | 1008 glTexImage2D(target, |
| 1022 level, | 1009 level, |
| 1023 internalformat, | 1010 internalformat, |
| 1024 width, | 1011 width, |
| 1025 height, | 1012 height, |
| 1026 border, | 1013 border, |
| 1027 format, | 1014 format, |
| 1028 type, | 1015 type, |
| 1029 pixels); | 1016 pixels); |
| 1030 } | 1017 } |
| 1031 } | 1018 } |
| 1032 | 1019 |
| 1033 void TexParameterf(PP_Resource context_id, | 1020 void TexParameterf(PP_Resource context_id, |
| 1034 GLenum target, | 1021 GLenum target, |
| 1035 GLenum pname, | 1022 GLenum pname, |
| 1036 GLfloat param) { | 1023 GLfloat param) { |
| 1037 Enter3D enter(context_id, true); | 1024 Enter3D enter(context_id, true); |
| 1038 if (enter.succeeded()) { | 1025 if (IsBoundGraphics(&enter)) { |
| 1039 ToGles2Impl(&enter)->TexParameterf(target, pname, param); | 1026 glTexParameterf(target, pname, param); |
| 1040 } | 1027 } |
| 1041 } | 1028 } |
| 1042 | 1029 |
| 1043 void TexParameterfv(PP_Resource context_id, | 1030 void TexParameterfv(PP_Resource context_id, |
| 1044 GLenum target, | 1031 GLenum target, |
| 1045 GLenum pname, | 1032 GLenum pname, |
| 1046 const GLfloat* params) { | 1033 const GLfloat* params) { |
| 1047 Enter3D enter(context_id, true); | 1034 Enter3D enter(context_id, true); |
| 1048 if (enter.succeeded()) { | 1035 if (IsBoundGraphics(&enter)) { |
| 1049 ToGles2Impl(&enter)->TexParameterfv(target, pname, params); | 1036 glTexParameterfv(target, pname, params); |
| 1050 } | 1037 } |
| 1051 } | 1038 } |
| 1052 | 1039 |
| 1053 void TexParameteri(PP_Resource context_id, | 1040 void TexParameteri(PP_Resource context_id, |
| 1054 GLenum target, | 1041 GLenum target, |
| 1055 GLenum pname, | 1042 GLenum pname, |
| 1056 GLint param) { | 1043 GLint param) { |
| 1057 Enter3D enter(context_id, true); | 1044 Enter3D enter(context_id, true); |
| 1058 if (enter.succeeded()) { | 1045 if (IsBoundGraphics(&enter)) { |
| 1059 ToGles2Impl(&enter)->TexParameteri(target, pname, param); | 1046 glTexParameteri(target, pname, param); |
| 1060 } | 1047 } |
| 1061 } | 1048 } |
| 1062 | 1049 |
| 1063 void TexParameteriv(PP_Resource context_id, | 1050 void TexParameteriv(PP_Resource context_id, |
| 1064 GLenum target, | 1051 GLenum target, |
| 1065 GLenum pname, | 1052 GLenum pname, |
| 1066 const GLint* params) { | 1053 const GLint* params) { |
| 1067 Enter3D enter(context_id, true); | 1054 Enter3D enter(context_id, true); |
| 1068 if (enter.succeeded()) { | 1055 if (IsBoundGraphics(&enter)) { |
| 1069 ToGles2Impl(&enter)->TexParameteriv(target, pname, params); | 1056 glTexParameteriv(target, pname, params); |
| 1070 } | 1057 } |
| 1071 } | 1058 } |
| 1072 | 1059 |
| 1073 void TexSubImage2D(PP_Resource context_id, | 1060 void TexSubImage2D(PP_Resource context_id, |
| 1074 GLenum target, | 1061 GLenum target, |
| 1075 GLint level, | 1062 GLint level, |
| 1076 GLint xoffset, | 1063 GLint xoffset, |
| 1077 GLint yoffset, | 1064 GLint yoffset, |
| 1078 GLsizei width, | 1065 GLsizei width, |
| 1079 GLsizei height, | 1066 GLsizei height, |
| 1080 GLenum format, | 1067 GLenum format, |
| 1081 GLenum type, | 1068 GLenum type, |
| 1082 const void* pixels) { | 1069 const void* pixels) { |
| 1083 Enter3D enter(context_id, true); | 1070 Enter3D enter(context_id, true); |
| 1084 if (enter.succeeded()) { | 1071 if (IsBoundGraphics(&enter)) { |
| 1085 ToGles2Impl(&enter)->TexSubImage2D( | 1072 glTexSubImage2D( |
| 1086 target, level, xoffset, yoffset, width, height, format, type, pixels); | 1073 target, level, xoffset, yoffset, width, height, format, type, pixels); |
| 1087 } | 1074 } |
| 1088 } | 1075 } |
| 1089 | 1076 |
| 1090 void Uniform1f(PP_Resource context_id, GLint location, GLfloat x) { | 1077 void Uniform1f(PP_Resource context_id, GLint location, GLfloat x) { |
| 1091 Enter3D enter(context_id, true); | 1078 Enter3D enter(context_id, true); |
| 1092 if (enter.succeeded()) { | 1079 if (IsBoundGraphics(&enter)) { |
| 1093 ToGles2Impl(&enter)->Uniform1f(location, x); | 1080 glUniform1f(location, x); |
| 1094 } | 1081 } |
| 1095 } | 1082 } |
| 1096 | 1083 |
| 1097 void Uniform1fv(PP_Resource context_id, | 1084 void Uniform1fv(PP_Resource context_id, |
| 1098 GLint location, | 1085 GLint location, |
| 1099 GLsizei count, | 1086 GLsizei count, |
| 1100 const GLfloat* v) { | 1087 const GLfloat* v) { |
| 1101 Enter3D enter(context_id, true); | 1088 Enter3D enter(context_id, true); |
| 1102 if (enter.succeeded()) { | 1089 if (IsBoundGraphics(&enter)) { |
| 1103 ToGles2Impl(&enter)->Uniform1fv(location, count, v); | 1090 glUniform1fv(location, count, v); |
| 1104 } | 1091 } |
| 1105 } | 1092 } |
| 1106 | 1093 |
| 1107 void Uniform1i(PP_Resource context_id, GLint location, GLint x) { | 1094 void Uniform1i(PP_Resource context_id, GLint location, GLint x) { |
| 1108 Enter3D enter(context_id, true); | 1095 Enter3D enter(context_id, true); |
| 1109 if (enter.succeeded()) { | 1096 if (IsBoundGraphics(&enter)) { |
| 1110 ToGles2Impl(&enter)->Uniform1i(location, x); | 1097 glUniform1i(location, x); |
| 1111 } | 1098 } |
| 1112 } | 1099 } |
| 1113 | 1100 |
| 1114 void Uniform1iv(PP_Resource context_id, | 1101 void Uniform1iv(PP_Resource context_id, |
| 1115 GLint location, | 1102 GLint location, |
| 1116 GLsizei count, | 1103 GLsizei count, |
| 1117 const GLint* v) { | 1104 const GLint* v) { |
| 1118 Enter3D enter(context_id, true); | 1105 Enter3D enter(context_id, true); |
| 1119 if (enter.succeeded()) { | 1106 if (IsBoundGraphics(&enter)) { |
| 1120 ToGles2Impl(&enter)->Uniform1iv(location, count, v); | 1107 glUniform1iv(location, count, v); |
| 1121 } | 1108 } |
| 1122 } | 1109 } |
| 1123 | 1110 |
| 1124 void Uniform2f(PP_Resource context_id, GLint location, GLfloat x, GLfloat y) { | 1111 void Uniform2f(PP_Resource context_id, GLint location, GLfloat x, GLfloat y) { |
| 1125 Enter3D enter(context_id, true); | 1112 Enter3D enter(context_id, true); |
| 1126 if (enter.succeeded()) { | 1113 if (IsBoundGraphics(&enter)) { |
| 1127 ToGles2Impl(&enter)->Uniform2f(location, x, y); | 1114 glUniform2f(location, x, y); |
| 1128 } | 1115 } |
| 1129 } | 1116 } |
| 1130 | 1117 |
| 1131 void Uniform2fv(PP_Resource context_id, | 1118 void Uniform2fv(PP_Resource context_id, |
| 1132 GLint location, | 1119 GLint location, |
| 1133 GLsizei count, | 1120 GLsizei count, |
| 1134 const GLfloat* v) { | 1121 const GLfloat* v) { |
| 1135 Enter3D enter(context_id, true); | 1122 Enter3D enter(context_id, true); |
| 1136 if (enter.succeeded()) { | 1123 if (IsBoundGraphics(&enter)) { |
| 1137 ToGles2Impl(&enter)->Uniform2fv(location, count, v); | 1124 glUniform2fv(location, count, v); |
| 1138 } | 1125 } |
| 1139 } | 1126 } |
| 1140 | 1127 |
| 1141 void Uniform2i(PP_Resource context_id, GLint location, GLint x, GLint y) { | 1128 void Uniform2i(PP_Resource context_id, GLint location, GLint x, GLint y) { |
| 1142 Enter3D enter(context_id, true); | 1129 Enter3D enter(context_id, true); |
| 1143 if (enter.succeeded()) { | 1130 if (IsBoundGraphics(&enter)) { |
| 1144 ToGles2Impl(&enter)->Uniform2i(location, x, y); | 1131 glUniform2i(location, x, y); |
| 1145 } | 1132 } |
| 1146 } | 1133 } |
| 1147 | 1134 |
| 1148 void Uniform2iv(PP_Resource context_id, | 1135 void Uniform2iv(PP_Resource context_id, |
| 1149 GLint location, | 1136 GLint location, |
| 1150 GLsizei count, | 1137 GLsizei count, |
| 1151 const GLint* v) { | 1138 const GLint* v) { |
| 1152 Enter3D enter(context_id, true); | 1139 Enter3D enter(context_id, true); |
| 1153 if (enter.succeeded()) { | 1140 if (IsBoundGraphics(&enter)) { |
| 1154 ToGles2Impl(&enter)->Uniform2iv(location, count, v); | 1141 glUniform2iv(location, count, v); |
| 1155 } | 1142 } |
| 1156 } | 1143 } |
| 1157 | 1144 |
| 1158 void Uniform3f(PP_Resource context_id, | 1145 void Uniform3f(PP_Resource context_id, |
| 1159 GLint location, | 1146 GLint location, |
| 1160 GLfloat x, | 1147 GLfloat x, |
| 1161 GLfloat y, | 1148 GLfloat y, |
| 1162 GLfloat z) { | 1149 GLfloat z) { |
| 1163 Enter3D enter(context_id, true); | 1150 Enter3D enter(context_id, true); |
| 1164 if (enter.succeeded()) { | 1151 if (IsBoundGraphics(&enter)) { |
| 1165 ToGles2Impl(&enter)->Uniform3f(location, x, y, z); | 1152 glUniform3f(location, x, y, z); |
| 1166 } | 1153 } |
| 1167 } | 1154 } |
| 1168 | 1155 |
| 1169 void Uniform3fv(PP_Resource context_id, | 1156 void Uniform3fv(PP_Resource context_id, |
| 1170 GLint location, | 1157 GLint location, |
| 1171 GLsizei count, | 1158 GLsizei count, |
| 1172 const GLfloat* v) { | 1159 const GLfloat* v) { |
| 1173 Enter3D enter(context_id, true); | 1160 Enter3D enter(context_id, true); |
| 1174 if (enter.succeeded()) { | 1161 if (IsBoundGraphics(&enter)) { |
| 1175 ToGles2Impl(&enter)->Uniform3fv(location, count, v); | 1162 glUniform3fv(location, count, v); |
| 1176 } | 1163 } |
| 1177 } | 1164 } |
| 1178 | 1165 |
| 1179 void Uniform3i(PP_Resource context_id, | 1166 void Uniform3i(PP_Resource context_id, |
| 1180 GLint location, | 1167 GLint location, |
| 1181 GLint x, | 1168 GLint x, |
| 1182 GLint y, | 1169 GLint y, |
| 1183 GLint z) { | 1170 GLint z) { |
| 1184 Enter3D enter(context_id, true); | 1171 Enter3D enter(context_id, true); |
| 1185 if (enter.succeeded()) { | 1172 if (IsBoundGraphics(&enter)) { |
| 1186 ToGles2Impl(&enter)->Uniform3i(location, x, y, z); | 1173 glUniform3i(location, x, y, z); |
| 1187 } | 1174 } |
| 1188 } | 1175 } |
| 1189 | 1176 |
| 1190 void Uniform3iv(PP_Resource context_id, | 1177 void Uniform3iv(PP_Resource context_id, |
| 1191 GLint location, | 1178 GLint location, |
| 1192 GLsizei count, | 1179 GLsizei count, |
| 1193 const GLint* v) { | 1180 const GLint* v) { |
| 1194 Enter3D enter(context_id, true); | 1181 Enter3D enter(context_id, true); |
| 1195 if (enter.succeeded()) { | 1182 if (IsBoundGraphics(&enter)) { |
| 1196 ToGles2Impl(&enter)->Uniform3iv(location, count, v); | 1183 glUniform3iv(location, count, v); |
| 1197 } | 1184 } |
| 1198 } | 1185 } |
| 1199 | 1186 |
| 1200 void Uniform4f(PP_Resource context_id, | 1187 void Uniform4f(PP_Resource context_id, |
| 1201 GLint location, | 1188 GLint location, |
| 1202 GLfloat x, | 1189 GLfloat x, |
| 1203 GLfloat y, | 1190 GLfloat y, |
| 1204 GLfloat z, | 1191 GLfloat z, |
| 1205 GLfloat w) { | 1192 GLfloat w) { |
| 1206 Enter3D enter(context_id, true); | 1193 Enter3D enter(context_id, true); |
| 1207 if (enter.succeeded()) { | 1194 if (IsBoundGraphics(&enter)) { |
| 1208 ToGles2Impl(&enter)->Uniform4f(location, x, y, z, w); | 1195 glUniform4f(location, x, y, z, w); |
| 1209 } | 1196 } |
| 1210 } | 1197 } |
| 1211 | 1198 |
| 1212 void Uniform4fv(PP_Resource context_id, | 1199 void Uniform4fv(PP_Resource context_id, |
| 1213 GLint location, | 1200 GLint location, |
| 1214 GLsizei count, | 1201 GLsizei count, |
| 1215 const GLfloat* v) { | 1202 const GLfloat* v) { |
| 1216 Enter3D enter(context_id, true); | 1203 Enter3D enter(context_id, true); |
| 1217 if (enter.succeeded()) { | 1204 if (IsBoundGraphics(&enter)) { |
| 1218 ToGles2Impl(&enter)->Uniform4fv(location, count, v); | 1205 glUniform4fv(location, count, v); |
| 1219 } | 1206 } |
| 1220 } | 1207 } |
| 1221 | 1208 |
| 1222 void Uniform4i(PP_Resource context_id, | 1209 void Uniform4i(PP_Resource context_id, |
| 1223 GLint location, | 1210 GLint location, |
| 1224 GLint x, | 1211 GLint x, |
| 1225 GLint y, | 1212 GLint y, |
| 1226 GLint z, | 1213 GLint z, |
| 1227 GLint w) { | 1214 GLint w) { |
| 1228 Enter3D enter(context_id, true); | 1215 Enter3D enter(context_id, true); |
| 1229 if (enter.succeeded()) { | 1216 if (IsBoundGraphics(&enter)) { |
| 1230 ToGles2Impl(&enter)->Uniform4i(location, x, y, z, w); | 1217 glUniform4i(location, x, y, z, w); |
| 1231 } | 1218 } |
| 1232 } | 1219 } |
| 1233 | 1220 |
| 1234 void Uniform4iv(PP_Resource context_id, | 1221 void Uniform4iv(PP_Resource context_id, |
| 1235 GLint location, | 1222 GLint location, |
| 1236 GLsizei count, | 1223 GLsizei count, |
| 1237 const GLint* v) { | 1224 const GLint* v) { |
| 1238 Enter3D enter(context_id, true); | 1225 Enter3D enter(context_id, true); |
| 1239 if (enter.succeeded()) { | 1226 if (IsBoundGraphics(&enter)) { |
| 1240 ToGles2Impl(&enter)->Uniform4iv(location, count, v); | 1227 glUniform4iv(location, count, v); |
| 1241 } | 1228 } |
| 1242 } | 1229 } |
| 1243 | 1230 |
| 1244 void UniformMatrix2fv(PP_Resource context_id, | 1231 void UniformMatrix2fv(PP_Resource context_id, |
| 1245 GLint location, | 1232 GLint location, |
| 1246 GLsizei count, | 1233 GLsizei count, |
| 1247 GLboolean transpose, | 1234 GLboolean transpose, |
| 1248 const GLfloat* value) { | 1235 const GLfloat* value) { |
| 1249 Enter3D enter(context_id, true); | 1236 Enter3D enter(context_id, true); |
| 1250 if (enter.succeeded()) { | 1237 if (IsBoundGraphics(&enter)) { |
| 1251 ToGles2Impl(&enter)->UniformMatrix2fv(location, count, transpose, value); | 1238 glUniformMatrix2fv(location, count, transpose, value); |
| 1252 } | 1239 } |
| 1253 } | 1240 } |
| 1254 | 1241 |
| 1255 void UniformMatrix3fv(PP_Resource context_id, | 1242 void UniformMatrix3fv(PP_Resource context_id, |
| 1256 GLint location, | 1243 GLint location, |
| 1257 GLsizei count, | 1244 GLsizei count, |
| 1258 GLboolean transpose, | 1245 GLboolean transpose, |
| 1259 const GLfloat* value) { | 1246 const GLfloat* value) { |
| 1260 Enter3D enter(context_id, true); | 1247 Enter3D enter(context_id, true); |
| 1261 if (enter.succeeded()) { | 1248 if (IsBoundGraphics(&enter)) { |
| 1262 ToGles2Impl(&enter)->UniformMatrix3fv(location, count, transpose, value); | 1249 glUniformMatrix3fv(location, count, transpose, value); |
| 1263 } | 1250 } |
| 1264 } | 1251 } |
| 1265 | 1252 |
| 1266 void UniformMatrix4fv(PP_Resource context_id, | 1253 void UniformMatrix4fv(PP_Resource context_id, |
| 1267 GLint location, | 1254 GLint location, |
| 1268 GLsizei count, | 1255 GLsizei count, |
| 1269 GLboolean transpose, | 1256 GLboolean transpose, |
| 1270 const GLfloat* value) { | 1257 const GLfloat* value) { |
| 1271 Enter3D enter(context_id, true); | 1258 Enter3D enter(context_id, true); |
| 1272 if (enter.succeeded()) { | 1259 if (IsBoundGraphics(&enter)) { |
| 1273 ToGles2Impl(&enter)->UniformMatrix4fv(location, count, transpose, value); | 1260 glUniformMatrix4fv(location, count, transpose, value); |
| 1274 } | 1261 } |
| 1275 } | 1262 } |
| 1276 | 1263 |
| 1277 void UseProgram(PP_Resource context_id, GLuint program) { | 1264 void UseProgram(PP_Resource context_id, GLuint program) { |
| 1278 Enter3D enter(context_id, true); | 1265 Enter3D enter(context_id, true); |
| 1279 if (enter.succeeded()) { | 1266 if (IsBoundGraphics(&enter)) { |
| 1280 ToGles2Impl(&enter)->UseProgram(program); | 1267 glUseProgram(program); |
| 1281 } | 1268 } |
| 1282 } | 1269 } |
| 1283 | 1270 |
| 1284 void ValidateProgram(PP_Resource context_id, GLuint program) { | 1271 void ValidateProgram(PP_Resource context_id, GLuint program) { |
| 1285 Enter3D enter(context_id, true); | 1272 Enter3D enter(context_id, true); |
| 1286 if (enter.succeeded()) { | 1273 if (IsBoundGraphics(&enter)) { |
| 1287 ToGles2Impl(&enter)->ValidateProgram(program); | 1274 glValidateProgram(program); |
| 1288 } | 1275 } |
| 1289 } | 1276 } |
| 1290 | 1277 |
| 1291 void VertexAttrib1f(PP_Resource context_id, GLuint indx, GLfloat x) { | 1278 void VertexAttrib1f(PP_Resource context_id, GLuint indx, GLfloat x) { |
| 1292 Enter3D enter(context_id, true); | 1279 Enter3D enter(context_id, true); |
| 1293 if (enter.succeeded()) { | 1280 if (IsBoundGraphics(&enter)) { |
| 1294 ToGles2Impl(&enter)->VertexAttrib1f(indx, x); | 1281 glVertexAttrib1f(indx, x); |
| 1295 } | 1282 } |
| 1296 } | 1283 } |
| 1297 | 1284 |
| 1298 void VertexAttrib1fv(PP_Resource context_id, | 1285 void VertexAttrib1fv(PP_Resource context_id, |
| 1299 GLuint indx, | 1286 GLuint indx, |
| 1300 const GLfloat* values) { | 1287 const GLfloat* values) { |
| 1301 Enter3D enter(context_id, true); | 1288 Enter3D enter(context_id, true); |
| 1302 if (enter.succeeded()) { | 1289 if (IsBoundGraphics(&enter)) { |
| 1303 ToGles2Impl(&enter)->VertexAttrib1fv(indx, values); | 1290 glVertexAttrib1fv(indx, values); |
| 1304 } | 1291 } |
| 1305 } | 1292 } |
| 1306 | 1293 |
| 1307 void VertexAttrib2f(PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y) { | 1294 void VertexAttrib2f(PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y) { |
| 1308 Enter3D enter(context_id, true); | 1295 Enter3D enter(context_id, true); |
| 1309 if (enter.succeeded()) { | 1296 if (IsBoundGraphics(&enter)) { |
| 1310 ToGles2Impl(&enter)->VertexAttrib2f(indx, x, y); | 1297 glVertexAttrib2f(indx, x, y); |
| 1311 } | 1298 } |
| 1312 } | 1299 } |
| 1313 | 1300 |
| 1314 void VertexAttrib2fv(PP_Resource context_id, | 1301 void VertexAttrib2fv(PP_Resource context_id, |
| 1315 GLuint indx, | 1302 GLuint indx, |
| 1316 const GLfloat* values) { | 1303 const GLfloat* values) { |
| 1317 Enter3D enter(context_id, true); | 1304 Enter3D enter(context_id, true); |
| 1318 if (enter.succeeded()) { | 1305 if (IsBoundGraphics(&enter)) { |
| 1319 ToGles2Impl(&enter)->VertexAttrib2fv(indx, values); | 1306 glVertexAttrib2fv(indx, values); |
| 1320 } | 1307 } |
| 1321 } | 1308 } |
| 1322 | 1309 |
| 1323 void VertexAttrib3f(PP_Resource context_id, | 1310 void VertexAttrib3f(PP_Resource context_id, |
| 1324 GLuint indx, | 1311 GLuint indx, |
| 1325 GLfloat x, | 1312 GLfloat x, |
| 1326 GLfloat y, | 1313 GLfloat y, |
| 1327 GLfloat z) { | 1314 GLfloat z) { |
| 1328 Enter3D enter(context_id, true); | 1315 Enter3D enter(context_id, true); |
| 1329 if (enter.succeeded()) { | 1316 if (IsBoundGraphics(&enter)) { |
| 1330 ToGles2Impl(&enter)->VertexAttrib3f(indx, x, y, z); | 1317 glVertexAttrib3f(indx, x, y, z); |
| 1331 } | 1318 } |
| 1332 } | 1319 } |
| 1333 | 1320 |
| 1334 void VertexAttrib3fv(PP_Resource context_id, | 1321 void VertexAttrib3fv(PP_Resource context_id, |
| 1335 GLuint indx, | 1322 GLuint indx, |
| 1336 const GLfloat* values) { | 1323 const GLfloat* values) { |
| 1337 Enter3D enter(context_id, true); | 1324 Enter3D enter(context_id, true); |
| 1338 if (enter.succeeded()) { | 1325 if (IsBoundGraphics(&enter)) { |
| 1339 ToGles2Impl(&enter)->VertexAttrib3fv(indx, values); | 1326 glVertexAttrib3fv(indx, values); |
| 1340 } | 1327 } |
| 1341 } | 1328 } |
| 1342 | 1329 |
| 1343 void VertexAttrib4f(PP_Resource context_id, | 1330 void VertexAttrib4f(PP_Resource context_id, |
| 1344 GLuint indx, | 1331 GLuint indx, |
| 1345 GLfloat x, | 1332 GLfloat x, |
| 1346 GLfloat y, | 1333 GLfloat y, |
| 1347 GLfloat z, | 1334 GLfloat z, |
| 1348 GLfloat w) { | 1335 GLfloat w) { |
| 1349 Enter3D enter(context_id, true); | 1336 Enter3D enter(context_id, true); |
| 1350 if (enter.succeeded()) { | 1337 if (IsBoundGraphics(&enter)) { |
| 1351 ToGles2Impl(&enter)->VertexAttrib4f(indx, x, y, z, w); | 1338 glVertexAttrib4f(indx, x, y, z, w); |
| 1352 } | 1339 } |
| 1353 } | 1340 } |
| 1354 | 1341 |
| 1355 void VertexAttrib4fv(PP_Resource context_id, | 1342 void VertexAttrib4fv(PP_Resource context_id, |
| 1356 GLuint indx, | 1343 GLuint indx, |
| 1357 const GLfloat* values) { | 1344 const GLfloat* values) { |
| 1358 Enter3D enter(context_id, true); | 1345 Enter3D enter(context_id, true); |
| 1359 if (enter.succeeded()) { | 1346 if (IsBoundGraphics(&enter)) { |
| 1360 ToGles2Impl(&enter)->VertexAttrib4fv(indx, values); | 1347 glVertexAttrib4fv(indx, values); |
| 1361 } | 1348 } |
| 1362 } | 1349 } |
| 1363 | 1350 |
| 1364 void VertexAttribPointer(PP_Resource context_id, | 1351 void VertexAttribPointer(PP_Resource context_id, |
| 1365 GLuint indx, | 1352 GLuint indx, |
| 1366 GLint size, | 1353 GLint size, |
| 1367 GLenum type, | 1354 GLenum type, |
| 1368 GLboolean normalized, | 1355 GLboolean normalized, |
| 1369 GLsizei stride, | 1356 GLsizei stride, |
| 1370 const void* ptr) { | 1357 const void* ptr) { |
| 1371 Enter3D enter(context_id, true); | 1358 Enter3D enter(context_id, true); |
| 1372 if (enter.succeeded()) { | 1359 if (IsBoundGraphics(&enter)) { |
| 1373 ToGles2Impl(&enter) | 1360 glVertexAttribPointer(indx, size, type, normalized, stride, ptr); |
| 1374 ->VertexAttribPointer(indx, size, type, normalized, stride, ptr); | |
| 1375 } | 1361 } |
| 1376 } | 1362 } |
| 1377 | 1363 |
| 1378 void Viewport(PP_Resource context_id, | 1364 void Viewport(PP_Resource context_id, |
| 1379 GLint x, | 1365 GLint x, |
| 1380 GLint y, | 1366 GLint y, |
| 1381 GLsizei width, | 1367 GLsizei width, |
| 1382 GLsizei height) { | 1368 GLsizei height) { |
| 1383 Enter3D enter(context_id, true); | 1369 Enter3D enter(context_id, true); |
| 1384 if (enter.succeeded()) { | 1370 if (IsBoundGraphics(&enter)) { |
| 1385 ToGles2Impl(&enter)->Viewport(x, y, width, height); | 1371 glViewport(x, y, width, height); |
| 1386 } | |
| 1387 } | |
| 1388 | |
| 1389 void BlitFramebufferEXT(PP_Resource context_id, | |
| 1390 GLint srcX0, | |
| 1391 GLint srcY0, | |
| 1392 GLint srcX1, | |
| 1393 GLint srcY1, | |
| 1394 GLint dstX0, | |
| 1395 GLint dstY0, | |
| 1396 GLint dstX1, | |
| 1397 GLint dstY1, | |
| 1398 GLbitfield mask, | |
| 1399 GLenum filter) { | |
| 1400 Enter3D enter(context_id, true); | |
| 1401 if (enter.succeeded()) { | |
| 1402 ToGles2Impl(&enter)->BlitFramebufferCHROMIUM( | |
| 1403 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); | |
| 1404 } | |
| 1405 } | |
| 1406 | |
| 1407 void RenderbufferStorageMultisampleEXT(PP_Resource context_id, | |
| 1408 GLenum target, | |
| 1409 GLsizei samples, | |
| 1410 GLenum internalformat, | |
| 1411 GLsizei width, | |
| 1412 GLsizei height) { | |
| 1413 Enter3D enter(context_id, true); | |
| 1414 if (enter.succeeded()) { | |
| 1415 ToGles2Impl(&enter)->RenderbufferStorageMultisampleCHROMIUM( | |
| 1416 target, samples, internalformat, width, height); | |
| 1417 } | |
| 1418 } | |
| 1419 | |
| 1420 void GenQueriesEXT(PP_Resource context_id, GLsizei n, GLuint* queries) { | |
| 1421 Enter3D enter(context_id, true); | |
| 1422 if (enter.succeeded()) { | |
| 1423 ToGles2Impl(&enter)->GenQueriesEXT(n, queries); | |
| 1424 } | |
| 1425 } | |
| 1426 | |
| 1427 void DeleteQueriesEXT(PP_Resource context_id, | |
| 1428 GLsizei n, | |
| 1429 const GLuint* queries) { | |
| 1430 Enter3D enter(context_id, true); | |
| 1431 if (enter.succeeded()) { | |
| 1432 ToGles2Impl(&enter)->DeleteQueriesEXT(n, queries); | |
| 1433 } | |
| 1434 } | |
| 1435 | |
| 1436 GLboolean IsQueryEXT(PP_Resource context_id, GLuint id) { | |
| 1437 Enter3D enter(context_id, true); | |
| 1438 if (enter.succeeded()) { | |
| 1439 return ToGles2Impl(&enter)->IsQueryEXT(id); | |
| 1440 } else { | |
| 1441 return GL_FALSE; | |
| 1442 } | |
| 1443 } | |
| 1444 | |
| 1445 void BeginQueryEXT(PP_Resource context_id, GLenum target, GLuint id) { | |
| 1446 Enter3D enter(context_id, true); | |
| 1447 if (enter.succeeded()) { | |
| 1448 ToGles2Impl(&enter)->BeginQueryEXT(target, id); | |
| 1449 } | |
| 1450 } | |
| 1451 | |
| 1452 void EndQueryEXT(PP_Resource context_id, GLenum target) { | |
| 1453 Enter3D enter(context_id, true); | |
| 1454 if (enter.succeeded()) { | |
| 1455 ToGles2Impl(&enter)->EndQueryEXT(target); | |
| 1456 } | |
| 1457 } | |
| 1458 | |
| 1459 void GetQueryivEXT(PP_Resource context_id, | |
| 1460 GLenum target, | |
| 1461 GLenum pname, | |
| 1462 GLint* params) { | |
| 1463 Enter3D enter(context_id, true); | |
| 1464 if (enter.succeeded()) { | |
| 1465 ToGles2Impl(&enter)->GetQueryivEXT(target, pname, params); | |
| 1466 } | |
| 1467 } | |
| 1468 | |
| 1469 void GetQueryObjectuivEXT(PP_Resource context_id, | |
| 1470 GLuint id, | |
| 1471 GLenum pname, | |
| 1472 GLuint* params) { | |
| 1473 Enter3D enter(context_id, true); | |
| 1474 if (enter.succeeded()) { | |
| 1475 ToGles2Impl(&enter)->GetQueryObjectuivEXT(id, pname, params); | |
| 1476 } | |
| 1477 } | |
| 1478 | |
| 1479 GLboolean EnableFeatureCHROMIUM(PP_Resource context_id, const char* feature) { | |
| 1480 Enter3D enter(context_id, true); | |
| 1481 if (enter.succeeded()) { | |
| 1482 return ToGles2Impl(&enter)->EnableFeatureCHROMIUM(feature); | |
| 1483 } else { | |
| 1484 return GL_FALSE; | |
| 1485 } | |
| 1486 } | |
| 1487 | |
| 1488 void* MapBufferSubDataCHROMIUM(PP_Resource context_id, | |
| 1489 GLuint target, | |
| 1490 GLintptr offset, | |
| 1491 GLsizeiptr size, | |
| 1492 GLenum access) { | |
| 1493 Enter3D enter(context_id, true); | |
| 1494 if (enter.succeeded()) { | |
| 1495 return ToGles2Impl(&enter) | |
| 1496 ->MapBufferSubDataCHROMIUM(target, offset, size, access); | |
| 1497 } else { | |
| 1498 return NULL; | |
| 1499 } | |
| 1500 } | |
| 1501 | |
| 1502 void UnmapBufferSubDataCHROMIUM(PP_Resource context_id, const void* mem) { | |
| 1503 Enter3D enter(context_id, true); | |
| 1504 if (enter.succeeded()) { | |
| 1505 ToGles2Impl(&enter)->UnmapBufferSubDataCHROMIUM(mem); | |
| 1506 } | |
| 1507 } | |
| 1508 | |
| 1509 void* MapTexSubImage2DCHROMIUM(PP_Resource context_id, | |
| 1510 GLenum target, | |
| 1511 GLint level, | |
| 1512 GLint xoffset, | |
| 1513 GLint yoffset, | |
| 1514 GLsizei width, | |
| 1515 GLsizei height, | |
| 1516 GLenum format, | |
| 1517 GLenum type, | |
| 1518 GLenum access) { | |
| 1519 Enter3D enter(context_id, true); | |
| 1520 if (enter.succeeded()) { | |
| 1521 return ToGles2Impl(&enter)->MapTexSubImage2DCHROMIUM( | |
| 1522 target, level, xoffset, yoffset, width, height, format, type, access); | |
| 1523 } else { | |
| 1524 return NULL; | |
| 1525 } | |
| 1526 } | |
| 1527 | |
| 1528 void UnmapTexSubImage2DCHROMIUM(PP_Resource context_id, const void* mem) { | |
| 1529 Enter3D enter(context_id, true); | |
| 1530 if (enter.succeeded()) { | |
| 1531 ToGles2Impl(&enter)->UnmapTexSubImage2DCHROMIUM(mem); | |
| 1532 } | |
| 1533 } | |
| 1534 | |
| 1535 void DrawArraysInstancedANGLE(PP_Resource context_id, | |
| 1536 GLenum mode, | |
| 1537 GLint first, | |
| 1538 GLsizei count, | |
| 1539 GLsizei primcount) { | |
| 1540 Enter3D enter(context_id, true); | |
| 1541 if (enter.succeeded()) { | |
| 1542 ToGles2Impl(&enter) | |
| 1543 ->DrawArraysInstancedANGLE(mode, first, count, primcount); | |
| 1544 } | |
| 1545 } | |
| 1546 | |
| 1547 void DrawElementsInstancedANGLE(PP_Resource context_id, | |
| 1548 GLenum mode, | |
| 1549 GLsizei count, | |
| 1550 GLenum type, | |
| 1551 const void* indices, | |
| 1552 GLsizei primcount) { | |
| 1553 Enter3D enter(context_id, true); | |
| 1554 if (enter.succeeded()) { | |
| 1555 ToGles2Impl(&enter) | |
| 1556 ->DrawElementsInstancedANGLE(mode, count, type, indices, primcount); | |
| 1557 } | |
| 1558 } | |
| 1559 | |
| 1560 void VertexAttribDivisorANGLE(PP_Resource context_id, | |
| 1561 GLuint index, | |
| 1562 GLuint divisor) { | |
| 1563 Enter3D enter(context_id, true); | |
| 1564 if (enter.succeeded()) { | |
| 1565 ToGles2Impl(&enter)->VertexAttribDivisorANGLE(index, divisor); | |
| 1566 } | |
| 1567 } | |
| 1568 | |
| 1569 void DrawBuffersEXT(PP_Resource context_id, GLsizei count, const GLenum* bufs) { | |
| 1570 Enter3D enter(context_id, true); | |
| 1571 if (enter.succeeded()) { | |
| 1572 ToGles2Impl(&enter)->DrawBuffersEXT(count, bufs); | |
| 1573 } | 1372 } |
| 1574 } | 1373 } |
| 1575 | 1374 |
| 1576 } // namespace | 1375 } // namespace |
| 1577 const PPB_OpenGLES2* PPB_OpenGLES2_Shared::GetInterface() { | 1376 |
| 1377 const PPB_OpenGLES2* GetPPB_OpenGLES2_Thunk() { |
| 1578 static const struct PPB_OpenGLES2 ppb_opengles2 = { | 1378 static const struct PPB_OpenGLES2 ppb_opengles2 = { |
| 1579 &ActiveTexture, &AttachShader, | 1379 &ActiveTexture, &AttachShader, |
| 1580 &BindAttribLocation, &BindBuffer, | 1380 &BindAttribLocation, &BindBuffer, |
| 1581 &BindFramebuffer, &BindRenderbuffer, | 1381 &BindFramebuffer, &BindRenderbuffer, |
| 1582 &BindTexture, &BlendColor, | 1382 &BindTexture, &BlendColor, |
| 1583 &BlendEquation, &BlendEquationSeparate, | 1383 &BlendEquation, &BlendEquationSeparate, |
| 1584 &BlendFunc, &BlendFuncSeparate, | 1384 &BlendFunc, &BlendFuncSeparate, |
| 1585 &BufferData, &BufferSubData, | 1385 &BufferData, &BufferSubData, |
| 1586 &CheckFramebufferStatus, &Clear, | 1386 &CheckFramebufferStatus, &Clear, |
| 1587 &ClearColor, &ClearDepthf, | 1387 &ClearColor, &ClearDepthf, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 &Uniform4iv, &UniformMatrix2fv, | 1442 &Uniform4iv, &UniformMatrix2fv, |
| 1643 &UniformMatrix3fv, &UniformMatrix4fv, | 1443 &UniformMatrix3fv, &UniformMatrix4fv, |
| 1644 &UseProgram, &ValidateProgram, | 1444 &UseProgram, &ValidateProgram, |
| 1645 &VertexAttrib1f, &VertexAttrib1fv, | 1445 &VertexAttrib1f, &VertexAttrib1fv, |
| 1646 &VertexAttrib2f, &VertexAttrib2fv, | 1446 &VertexAttrib2f, &VertexAttrib2fv, |
| 1647 &VertexAttrib3f, &VertexAttrib3fv, | 1447 &VertexAttrib3f, &VertexAttrib3fv, |
| 1648 &VertexAttrib4f, &VertexAttrib4fv, | 1448 &VertexAttrib4f, &VertexAttrib4fv, |
| 1649 &VertexAttribPointer, &Viewport}; | 1449 &VertexAttribPointer, &Viewport}; |
| 1650 return &ppb_opengles2; | 1450 return &ppb_opengles2; |
| 1651 } | 1451 } |
| 1652 const PPB_OpenGLES2InstancedArrays* | 1452 |
| 1653 PPB_OpenGLES2_Shared::GetInstancedArraysInterface() { | 1453 } // namespace examples |
| 1654 static const struct PPB_OpenGLES2InstancedArrays ppb_opengles2 = { | 1454 } // namespace mojo |
| 1655 &DrawArraysInstancedANGLE, &DrawElementsInstancedANGLE, | |
| 1656 &VertexAttribDivisorANGLE}; | |
| 1657 return &ppb_opengles2; | |
| 1658 } | |
| 1659 const PPB_OpenGLES2FramebufferBlit* | |
| 1660 PPB_OpenGLES2_Shared::GetFramebufferBlitInterface() { | |
| 1661 static const struct PPB_OpenGLES2FramebufferBlit ppb_opengles2 = { | |
| 1662 &BlitFramebufferEXT}; | |
| 1663 return &ppb_opengles2; | |
| 1664 } | |
| 1665 const PPB_OpenGLES2FramebufferMultisample* | |
| 1666 PPB_OpenGLES2_Shared::GetFramebufferMultisampleInterface() { | |
| 1667 static const struct PPB_OpenGLES2FramebufferMultisample ppb_opengles2 = { | |
| 1668 &RenderbufferStorageMultisampleEXT}; | |
| 1669 return &ppb_opengles2; | |
| 1670 } | |
| 1671 const PPB_OpenGLES2ChromiumEnableFeature* | |
| 1672 PPB_OpenGLES2_Shared::GetChromiumEnableFeatureInterface() { | |
| 1673 static const struct PPB_OpenGLES2ChromiumEnableFeature ppb_opengles2 = { | |
| 1674 &EnableFeatureCHROMIUM}; | |
| 1675 return &ppb_opengles2; | |
| 1676 } | |
| 1677 const PPB_OpenGLES2ChromiumMapSub* | |
| 1678 PPB_OpenGLES2_Shared::GetChromiumMapSubInterface() { | |
| 1679 static const struct PPB_OpenGLES2ChromiumMapSub ppb_opengles2 = { | |
| 1680 &MapBufferSubDataCHROMIUM, &UnmapBufferSubDataCHROMIUM, | |
| 1681 &MapTexSubImage2DCHROMIUM, &UnmapTexSubImage2DCHROMIUM}; | |
| 1682 return &ppb_opengles2; | |
| 1683 } | |
| 1684 const PPB_OpenGLES2Query* PPB_OpenGLES2_Shared::GetQueryInterface() { | |
| 1685 static const struct PPB_OpenGLES2Query ppb_opengles2 = { | |
| 1686 &GenQueriesEXT, &DeleteQueriesEXT, &IsQueryEXT, &BeginQueryEXT, | |
| 1687 &EndQueryEXT, &GetQueryivEXT, &GetQueryObjectuivEXT}; | |
| 1688 return &ppb_opengles2; | |
| 1689 } | |
| 1690 const PPB_OpenGLES2DrawBuffers_Dev* | |
| 1691 PPB_OpenGLES2_Shared::GetDrawBuffersInterface() { | |
| 1692 static const struct PPB_OpenGLES2DrawBuffers_Dev ppb_opengles2 = { | |
| 1693 &DrawBuffersEXT}; | |
| 1694 return &ppb_opengles2; | |
| 1695 } | |
| 1696 } // namespace ppapi | |
| OLD | NEW |