Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: ppapi/shared_impl/ppb_opengles2_shared.cc

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

Powered by Google App Engine
This is Rietveld 408576698