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