Index: mojo/examples/pepper_container_app/ppb_opengles2_thunk.cc |
diff --git a/ppapi/shared_impl/ppb_opengles2_shared.cc b/mojo/examples/pepper_container_app/ppb_opengles2_thunk.cc |
similarity index 58% |
copy from ppapi/shared_impl/ppb_opengles2_shared.cc |
copy to mojo/examples/pepper_container_app/ppb_opengles2_thunk.cc |
index d212ad53dc2dfae6bd04602919d0265e9bcfcba6..56fc8913bdba41b03f8082b780fbc222585bfea0 100644 |
--- a/ppapi/shared_impl/ppb_opengles2_shared.cc |
+++ b/mojo/examples/pepper_container_app/ppb_opengles2_thunk.cc |
@@ -1,43 +1,37 @@ |
-// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-// This file is auto-generated from |
-// gpu/command_buffer/build_gles2_cmd_buffer.py |
-// It's formatted by clang-format using chromium coding style: |
-// clang-format -i -style=chromium filename |
-// DO NOT EDIT! |
- |
-#include "ppapi/shared_impl/ppb_opengles2_shared.h" |
- |
#include "base/logging.h" |
-#include "gpu/command_buffer/client/gles2_implementation.h" |
-#include "ppapi/shared_impl/ppb_graphics_3d_shared.h" |
+#include "mojo/examples/pepper_container_app/graphics_3d_resource.h" |
+#include "mojo/examples/pepper_container_app/thunk.h" |
+#include "mojo/public/gles2/gles2.h" |
#include "ppapi/thunk/enter.h" |
+#include "ppapi/thunk/ppb_graphics_3d_api.h" |
-namespace ppapi { |
+namespace mojo { |
+namespace examples { |
namespace { |
-typedef thunk::EnterResource<thunk::PPB_Graphics3D_API> Enter3D; |
+typedef ppapi::thunk::EnterResource<ppapi::thunk::PPB_Graphics3D_API> Enter3D; |
-gpu::gles2::GLES2Implementation* ToGles2Impl(Enter3D* enter) { |
- DCHECK(enter); |
- DCHECK(enter->succeeded()); |
- return static_cast<PPB_Graphics3D_Shared*>(enter->object())->gles2_impl(); |
+bool IsBoundGraphics(Enter3D* enter) { |
+ return enter->succeeded() && |
+ static_cast<Graphics3DResource*>(enter->object())->IsBoundGraphics(); |
} |
void ActiveTexture(PP_Resource context_id, GLenum texture) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->ActiveTexture(texture); |
+ if (IsBoundGraphics(&enter)) { |
+ glActiveTexture(texture); |
} |
} |
void AttachShader(PP_Resource context_id, GLuint program, GLuint shader) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->AttachShader(program, shader); |
+ if (IsBoundGraphics(&enter)) { |
+ glAttachShader(program, shader); |
} |
} |
@@ -46,15 +40,15 @@ void BindAttribLocation(PP_Resource context_id, |
GLuint index, |
const char* name) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->BindAttribLocation(program, index, name); |
+ if (IsBoundGraphics(&enter)) { |
+ glBindAttribLocation(program, index, name); |
} |
} |
void BindBuffer(PP_Resource context_id, GLenum target, GLuint buffer) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->BindBuffer(target, buffer); |
+ if (IsBoundGraphics(&enter)) { |
+ glBindBuffer(target, buffer); |
} |
} |
@@ -62,8 +56,8 @@ void BindFramebuffer(PP_Resource context_id, |
GLenum target, |
GLuint framebuffer) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->BindFramebuffer(target, framebuffer); |
+ if (IsBoundGraphics(&enter)) { |
+ glBindFramebuffer(target, framebuffer); |
} |
} |
@@ -71,15 +65,15 @@ void BindRenderbuffer(PP_Resource context_id, |
GLenum target, |
GLuint renderbuffer) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->BindRenderbuffer(target, renderbuffer); |
+ if (IsBoundGraphics(&enter)) { |
+ glBindRenderbuffer(target, renderbuffer); |
} |
} |
void BindTexture(PP_Resource context_id, GLenum target, GLuint texture) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->BindTexture(target, texture); |
+ if (IsBoundGraphics(&enter)) { |
+ glBindTexture(target, texture); |
} |
} |
@@ -89,15 +83,15 @@ void BlendColor(PP_Resource context_id, |
GLclampf blue, |
GLclampf alpha) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->BlendColor(red, green, blue, alpha); |
+ if (IsBoundGraphics(&enter)) { |
+ glBlendColor(red, green, blue, alpha); |
} |
} |
void BlendEquation(PP_Resource context_id, GLenum mode) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->BlendEquation(mode); |
+ if (IsBoundGraphics(&enter)) { |
+ glBlendEquation(mode); |
} |
} |
@@ -105,15 +99,15 @@ void BlendEquationSeparate(PP_Resource context_id, |
GLenum modeRGB, |
GLenum modeAlpha) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->BlendEquationSeparate(modeRGB, modeAlpha); |
+ if (IsBoundGraphics(&enter)) { |
+ glBlendEquationSeparate(modeRGB, modeAlpha); |
} |
} |
void BlendFunc(PP_Resource context_id, GLenum sfactor, GLenum dfactor) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->BlendFunc(sfactor, dfactor); |
+ if (IsBoundGraphics(&enter)) { |
+ glBlendFunc(sfactor, dfactor); |
} |
} |
@@ -123,8 +117,8 @@ void BlendFuncSeparate(PP_Resource context_id, |
GLenum srcAlpha, |
GLenum dstAlpha) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); |
+ if (IsBoundGraphics(&enter)) { |
+ glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); |
} |
} |
@@ -134,8 +128,8 @@ void BufferData(PP_Resource context_id, |
const void* data, |
GLenum usage) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->BufferData(target, size, data, usage); |
+ if (IsBoundGraphics(&enter)) { |
+ glBufferData(target, size, data, usage); |
} |
} |
@@ -145,15 +139,15 @@ void BufferSubData(PP_Resource context_id, |
GLsizeiptr size, |
const void* data) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->BufferSubData(target, offset, size, data); |
+ if (IsBoundGraphics(&enter)) { |
+ glBufferSubData(target, offset, size, data); |
} |
} |
GLenum CheckFramebufferStatus(PP_Resource context_id, GLenum target) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->CheckFramebufferStatus(target); |
+ if (IsBoundGraphics(&enter)) { |
+ return glCheckFramebufferStatus(target); |
} else { |
return 0; |
} |
@@ -161,8 +155,8 @@ GLenum CheckFramebufferStatus(PP_Resource context_id, GLenum target) { |
void Clear(PP_Resource context_id, GLbitfield mask) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Clear(mask); |
+ if (IsBoundGraphics(&enter)) { |
+ glClear(mask); |
} |
} |
@@ -172,22 +166,22 @@ void ClearColor(PP_Resource context_id, |
GLclampf blue, |
GLclampf alpha) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->ClearColor(red, green, blue, alpha); |
+ if (IsBoundGraphics(&enter)) { |
+ glClearColor(red, green, blue, alpha); |
} |
} |
void ClearDepthf(PP_Resource context_id, GLclampf depth) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->ClearDepthf(depth); |
+ if (IsBoundGraphics(&enter)) { |
+ glClearDepthf(depth); |
} |
} |
void ClearStencil(PP_Resource context_id, GLint s) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->ClearStencil(s); |
+ if (IsBoundGraphics(&enter)) { |
+ glClearStencil(s); |
} |
} |
@@ -197,15 +191,15 @@ void ColorMask(PP_Resource context_id, |
GLboolean blue, |
GLboolean alpha) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->ColorMask(red, green, blue, alpha); |
+ if (IsBoundGraphics(&enter)) { |
+ glColorMask(red, green, blue, alpha); |
} |
} |
void CompileShader(PP_Resource context_id, GLuint shader) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->CompileShader(shader); |
+ if (IsBoundGraphics(&enter)) { |
+ glCompileShader(shader); |
} |
} |
@@ -219,8 +213,8 @@ void CompressedTexImage2D(PP_Resource context_id, |
GLsizei imageSize, |
const void* data) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->CompressedTexImage2D( |
+ if (IsBoundGraphics(&enter)) { |
+ glCompressedTexImage2D( |
target, level, internalformat, width, height, border, imageSize, data); |
} |
} |
@@ -236,16 +230,16 @@ void CompressedTexSubImage2D(PP_Resource context_id, |
GLsizei imageSize, |
const void* data) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->CompressedTexSubImage2D(target, |
- level, |
- xoffset, |
- yoffset, |
- width, |
- height, |
- format, |
- imageSize, |
- data); |
+ if (IsBoundGraphics(&enter)) { |
+ glCompressedTexSubImage2D(target, |
+ level, |
+ xoffset, |
+ yoffset, |
+ width, |
+ height, |
+ format, |
+ imageSize, |
+ data); |
} |
} |
@@ -259,8 +253,8 @@ void CopyTexImage2D(PP_Resource context_id, |
GLsizei height, |
GLint border) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->CopyTexImage2D( |
+ if (IsBoundGraphics(&enter)) { |
+ glCopyTexImage2D( |
target, level, internalformat, x, y, width, height, border); |
} |
} |
@@ -275,16 +269,15 @@ void CopyTexSubImage2D(PP_Resource context_id, |
GLsizei width, |
GLsizei height) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->CopyTexSubImage2D( |
- target, level, xoffset, yoffset, x, y, width, height); |
+ if (IsBoundGraphics(&enter)) { |
+ glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); |
} |
} |
GLuint CreateProgram(PP_Resource context_id) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->CreateProgram(); |
+ if (IsBoundGraphics(&enter)) { |
+ return glCreateProgram(); |
} else { |
return 0; |
} |
@@ -292,8 +285,8 @@ GLuint CreateProgram(PP_Resource context_id) { |
GLuint CreateShader(PP_Resource context_id, GLenum type) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->CreateShader(type); |
+ if (IsBoundGraphics(&enter)) { |
+ return glCreateShader(type); |
} else { |
return 0; |
} |
@@ -301,15 +294,15 @@ GLuint CreateShader(PP_Resource context_id, GLenum type) { |
void CullFace(PP_Resource context_id, GLenum mode) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->CullFace(mode); |
+ if (IsBoundGraphics(&enter)) { |
+ glCullFace(mode); |
} |
} |
void DeleteBuffers(PP_Resource context_id, GLsizei n, const GLuint* buffers) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->DeleteBuffers(n, buffers); |
+ if (IsBoundGraphics(&enter)) { |
+ glDeleteBuffers(n, buffers); |
} |
} |
@@ -317,15 +310,15 @@ void DeleteFramebuffers(PP_Resource context_id, |
GLsizei n, |
const GLuint* framebuffers) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->DeleteFramebuffers(n, framebuffers); |
+ if (IsBoundGraphics(&enter)) { |
+ glDeleteFramebuffers(n, framebuffers); |
} |
} |
void DeleteProgram(PP_Resource context_id, GLuint program) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->DeleteProgram(program); |
+ if (IsBoundGraphics(&enter)) { |
+ glDeleteProgram(program); |
} |
} |
@@ -333,64 +326,64 @@ void DeleteRenderbuffers(PP_Resource context_id, |
GLsizei n, |
const GLuint* renderbuffers) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->DeleteRenderbuffers(n, renderbuffers); |
+ if (IsBoundGraphics(&enter)) { |
+ glDeleteRenderbuffers(n, renderbuffers); |
} |
} |
void DeleteShader(PP_Resource context_id, GLuint shader) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->DeleteShader(shader); |
+ if (IsBoundGraphics(&enter)) { |
+ glDeleteShader(shader); |
} |
} |
void DeleteTextures(PP_Resource context_id, GLsizei n, const GLuint* textures) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->DeleteTextures(n, textures); |
+ if (IsBoundGraphics(&enter)) { |
+ glDeleteTextures(n, textures); |
} |
} |
void DepthFunc(PP_Resource context_id, GLenum func) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->DepthFunc(func); |
+ if (IsBoundGraphics(&enter)) { |
+ glDepthFunc(func); |
} |
} |
void DepthMask(PP_Resource context_id, GLboolean flag) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->DepthMask(flag); |
+ if (IsBoundGraphics(&enter)) { |
+ glDepthMask(flag); |
} |
} |
void DepthRangef(PP_Resource context_id, GLclampf zNear, GLclampf zFar) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->DepthRangef(zNear, zFar); |
+ if (IsBoundGraphics(&enter)) { |
+ glDepthRangef(zNear, zFar); |
} |
} |
void DetachShader(PP_Resource context_id, GLuint program, GLuint shader) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->DetachShader(program, shader); |
+ if (IsBoundGraphics(&enter)) { |
+ glDetachShader(program, shader); |
} |
} |
void Disable(PP_Resource context_id, GLenum cap) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Disable(cap); |
+ if (IsBoundGraphics(&enter)) { |
+ glDisable(cap); |
} |
} |
void DisableVertexAttribArray(PP_Resource context_id, GLuint index) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->DisableVertexAttribArray(index); |
+ if (IsBoundGraphics(&enter)) { |
+ glDisableVertexAttribArray(index); |
} |
} |
@@ -399,8 +392,8 @@ void DrawArrays(PP_Resource context_id, |
GLint first, |
GLsizei count) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->DrawArrays(mode, first, count); |
+ if (IsBoundGraphics(&enter)) { |
+ glDrawArrays(mode, first, count); |
} |
} |
@@ -410,36 +403,36 @@ void DrawElements(PP_Resource context_id, |
GLenum type, |
const void* indices) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->DrawElements(mode, count, type, indices); |
+ if (IsBoundGraphics(&enter)) { |
+ glDrawElements(mode, count, type, indices); |
} |
} |
void Enable(PP_Resource context_id, GLenum cap) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Enable(cap); |
+ if (IsBoundGraphics(&enter)) { |
+ glEnable(cap); |
} |
} |
void EnableVertexAttribArray(PP_Resource context_id, GLuint index) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->EnableVertexAttribArray(index); |
+ if (IsBoundGraphics(&enter)) { |
+ glEnableVertexAttribArray(index); |
} |
} |
void Finish(PP_Resource context_id) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Finish(); |
+ if (IsBoundGraphics(&enter)) { |
+ glFinish(); |
} |
} |
void Flush(PP_Resource context_id) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Flush(); |
+ if (IsBoundGraphics(&enter)) { |
+ glFlush(); |
} |
} |
@@ -449,8 +442,8 @@ void FramebufferRenderbuffer(PP_Resource context_id, |
GLenum renderbuffertarget, |
GLuint renderbuffer) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->FramebufferRenderbuffer( |
+ if (IsBoundGraphics(&enter)) { |
+ glFramebufferRenderbuffer( |
target, attachment, renderbuffertarget, renderbuffer); |
} |
} |
@@ -462,37 +455,36 @@ void FramebufferTexture2D(PP_Resource context_id, |
GLuint texture, |
GLint level) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter) |
- ->FramebufferTexture2D(target, attachment, textarget, texture, level); |
+ if (IsBoundGraphics(&enter)) { |
+ glFramebufferTexture2D(target, attachment, textarget, texture, level); |
} |
} |
void FrontFace(PP_Resource context_id, GLenum mode) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->FrontFace(mode); |
+ if (IsBoundGraphics(&enter)) { |
+ glFrontFace(mode); |
} |
} |
void GenBuffers(PP_Resource context_id, GLsizei n, GLuint* buffers) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GenBuffers(n, buffers); |
+ if (IsBoundGraphics(&enter)) { |
+ glGenBuffers(n, buffers); |
} |
} |
void GenerateMipmap(PP_Resource context_id, GLenum target) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GenerateMipmap(target); |
+ if (IsBoundGraphics(&enter)) { |
+ glGenerateMipmap(target); |
} |
} |
void GenFramebuffers(PP_Resource context_id, GLsizei n, GLuint* framebuffers) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GenFramebuffers(n, framebuffers); |
+ if (IsBoundGraphics(&enter)) { |
+ glGenFramebuffers(n, framebuffers); |
} |
} |
@@ -500,15 +492,15 @@ void GenRenderbuffers(PP_Resource context_id, |
GLsizei n, |
GLuint* renderbuffers) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GenRenderbuffers(n, renderbuffers); |
+ if (IsBoundGraphics(&enter)) { |
+ glGenRenderbuffers(n, renderbuffers); |
} |
} |
void GenTextures(PP_Resource context_id, GLsizei n, GLuint* textures) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GenTextures(n, textures); |
+ if (IsBoundGraphics(&enter)) { |
+ glGenTextures(n, textures); |
} |
} |
@@ -521,9 +513,8 @@ void GetActiveAttrib(PP_Resource context_id, |
GLenum* type, |
char* name) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter) |
- ->GetActiveAttrib(program, index, bufsize, length, size, type, name); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetActiveAttrib(program, index, bufsize, length, size, type, name); |
} |
} |
@@ -536,9 +527,8 @@ void GetActiveUniform(PP_Resource context_id, |
GLenum* type, |
char* name) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter) |
- ->GetActiveUniform(program, index, bufsize, length, size, type, name); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetActiveUniform(program, index, bufsize, length, size, type, name); |
} |
} |
@@ -548,8 +538,8 @@ void GetAttachedShaders(PP_Resource context_id, |
GLsizei* count, |
GLuint* shaders) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetAttachedShaders(program, maxcount, count, shaders); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetAttachedShaders(program, maxcount, count, shaders); |
} |
} |
@@ -557,8 +547,8 @@ GLint GetAttribLocation(PP_Resource context_id, |
GLuint program, |
const char* name) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->GetAttribLocation(program, name); |
+ if (IsBoundGraphics(&enter)) { |
+ return glGetAttribLocation(program, name); |
} else { |
return -1; |
} |
@@ -566,8 +556,8 @@ GLint GetAttribLocation(PP_Resource context_id, |
void GetBooleanv(PP_Resource context_id, GLenum pname, GLboolean* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetBooleanv(pname, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetBooleanv(pname, params); |
} |
} |
@@ -576,15 +566,15 @@ void GetBufferParameteriv(PP_Resource context_id, |
GLenum pname, |
GLint* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetBufferParameteriv(target, pname, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetBufferParameteriv(target, pname, params); |
} |
} |
GLenum GetError(PP_Resource context_id) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->GetError(); |
+ if (IsBoundGraphics(&enter)) { |
+ return glGetError(); |
} else { |
return 0; |
} |
@@ -592,8 +582,8 @@ GLenum GetError(PP_Resource context_id) { |
void GetFloatv(PP_Resource context_id, GLenum pname, GLfloat* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetFloatv(pname, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetFloatv(pname, params); |
} |
} |
@@ -603,16 +593,15 @@ void GetFramebufferAttachmentParameteriv(PP_Resource context_id, |
GLenum pname, |
GLint* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetFramebufferAttachmentParameteriv( |
- target, attachment, pname, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetFramebufferAttachmentParameteriv(target, attachment, pname, params); |
} |
} |
void GetIntegerv(PP_Resource context_id, GLenum pname, GLint* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetIntegerv(pname, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetIntegerv(pname, params); |
} |
} |
@@ -621,8 +610,8 @@ void GetProgramiv(PP_Resource context_id, |
GLenum pname, |
GLint* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetProgramiv(program, pname, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetProgramiv(program, pname, params); |
} |
} |
@@ -632,8 +621,8 @@ void GetProgramInfoLog(PP_Resource context_id, |
GLsizei* length, |
char* infolog) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetProgramInfoLog(program, bufsize, length, infolog); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetProgramInfoLog(program, bufsize, length, infolog); |
} |
} |
@@ -642,8 +631,8 @@ void GetRenderbufferParameteriv(PP_Resource context_id, |
GLenum pname, |
GLint* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetRenderbufferParameteriv(target, pname, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetRenderbufferParameteriv(target, pname, params); |
} |
} |
@@ -652,8 +641,8 @@ void GetShaderiv(PP_Resource context_id, |
GLenum pname, |
GLint* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetShaderiv(shader, pname, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetShaderiv(shader, pname, params); |
} |
} |
@@ -663,8 +652,8 @@ void GetShaderInfoLog(PP_Resource context_id, |
GLsizei* length, |
char* infolog) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetShaderInfoLog(shader, bufsize, length, infolog); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetShaderInfoLog(shader, bufsize, length, infolog); |
} |
} |
@@ -674,9 +663,8 @@ void GetShaderPrecisionFormat(PP_Resource context_id, |
GLint* range, |
GLint* precision) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter) |
- ->GetShaderPrecisionFormat(shadertype, precisiontype, range, precision); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision); |
} |
} |
@@ -686,15 +674,15 @@ void GetShaderSource(PP_Resource context_id, |
GLsizei* length, |
char* source) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetShaderSource(shader, bufsize, length, source); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetShaderSource(shader, bufsize, length, source); |
} |
} |
const GLubyte* GetString(PP_Resource context_id, GLenum name) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->GetString(name); |
+ if (IsBoundGraphics(&enter)) { |
+ return glGetString(name); |
} else { |
return NULL; |
} |
@@ -705,8 +693,8 @@ void GetTexParameterfv(PP_Resource context_id, |
GLenum pname, |
GLfloat* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetTexParameterfv(target, pname, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetTexParameterfv(target, pname, params); |
} |
} |
@@ -715,8 +703,8 @@ void GetTexParameteriv(PP_Resource context_id, |
GLenum pname, |
GLint* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetTexParameteriv(target, pname, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetTexParameteriv(target, pname, params); |
} |
} |
@@ -725,8 +713,8 @@ void GetUniformfv(PP_Resource context_id, |
GLint location, |
GLfloat* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetUniformfv(program, location, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetUniformfv(program, location, params); |
} |
} |
@@ -735,8 +723,8 @@ void GetUniformiv(PP_Resource context_id, |
GLint location, |
GLint* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetUniformiv(program, location, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetUniformiv(program, location, params); |
} |
} |
@@ -744,8 +732,8 @@ GLint GetUniformLocation(PP_Resource context_id, |
GLuint program, |
const char* name) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->GetUniformLocation(program, name); |
+ if (IsBoundGraphics(&enter)) { |
+ return glGetUniformLocation(program, name); |
} else { |
return -1; |
} |
@@ -756,8 +744,8 @@ void GetVertexAttribfv(PP_Resource context_id, |
GLenum pname, |
GLfloat* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetVertexAttribfv(index, pname, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetVertexAttribfv(index, pname, params); |
} |
} |
@@ -766,8 +754,8 @@ void GetVertexAttribiv(PP_Resource context_id, |
GLenum pname, |
GLint* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetVertexAttribiv(index, pname, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetVertexAttribiv(index, pname, params); |
} |
} |
@@ -776,22 +764,22 @@ void GetVertexAttribPointerv(PP_Resource context_id, |
GLenum pname, |
void** pointer) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetVertexAttribPointerv(index, pname, pointer); |
+ if (IsBoundGraphics(&enter)) { |
+ glGetVertexAttribPointerv(index, pname, pointer); |
} |
} |
void Hint(PP_Resource context_id, GLenum target, GLenum mode) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Hint(target, mode); |
+ if (IsBoundGraphics(&enter)) { |
+ glHint(target, mode); |
} |
} |
GLboolean IsBuffer(PP_Resource context_id, GLuint buffer) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->IsBuffer(buffer); |
+ if (IsBoundGraphics(&enter)) { |
+ return glIsBuffer(buffer); |
} else { |
return GL_FALSE; |
} |
@@ -799,8 +787,8 @@ GLboolean IsBuffer(PP_Resource context_id, GLuint buffer) { |
GLboolean IsEnabled(PP_Resource context_id, GLenum cap) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->IsEnabled(cap); |
+ if (IsBoundGraphics(&enter)) { |
+ return glIsEnabled(cap); |
} else { |
return GL_FALSE; |
} |
@@ -808,8 +796,8 @@ GLboolean IsEnabled(PP_Resource context_id, GLenum cap) { |
GLboolean IsFramebuffer(PP_Resource context_id, GLuint framebuffer) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->IsFramebuffer(framebuffer); |
+ if (IsBoundGraphics(&enter)) { |
+ return glIsFramebuffer(framebuffer); |
} else { |
return GL_FALSE; |
} |
@@ -817,8 +805,8 @@ GLboolean IsFramebuffer(PP_Resource context_id, GLuint framebuffer) { |
GLboolean IsProgram(PP_Resource context_id, GLuint program) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->IsProgram(program); |
+ if (IsBoundGraphics(&enter)) { |
+ return glIsProgram(program); |
} else { |
return GL_FALSE; |
} |
@@ -826,8 +814,8 @@ GLboolean IsProgram(PP_Resource context_id, GLuint program) { |
GLboolean IsRenderbuffer(PP_Resource context_id, GLuint renderbuffer) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->IsRenderbuffer(renderbuffer); |
+ if (IsBoundGraphics(&enter)) { |
+ return glIsRenderbuffer(renderbuffer); |
} else { |
return GL_FALSE; |
} |
@@ -835,8 +823,8 @@ GLboolean IsRenderbuffer(PP_Resource context_id, GLuint renderbuffer) { |
GLboolean IsShader(PP_Resource context_id, GLuint shader) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->IsShader(shader); |
+ if (IsBoundGraphics(&enter)) { |
+ return glIsShader(shader); |
} else { |
return GL_FALSE; |
} |
@@ -844,8 +832,8 @@ GLboolean IsShader(PP_Resource context_id, GLuint shader) { |
GLboolean IsTexture(PP_Resource context_id, GLuint texture) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->IsTexture(texture); |
+ if (IsBoundGraphics(&enter)) { |
+ return glIsTexture(texture); |
} else { |
return GL_FALSE; |
} |
@@ -853,29 +841,29 @@ GLboolean IsTexture(PP_Resource context_id, GLuint texture) { |
void LineWidth(PP_Resource context_id, GLfloat width) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->LineWidth(width); |
+ if (IsBoundGraphics(&enter)) { |
+ glLineWidth(width); |
} |
} |
void LinkProgram(PP_Resource context_id, GLuint program) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->LinkProgram(program); |
+ if (IsBoundGraphics(&enter)) { |
+ glLinkProgram(program); |
} |
} |
void PixelStorei(PP_Resource context_id, GLenum pname, GLint param) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->PixelStorei(pname, param); |
+ if (IsBoundGraphics(&enter)) { |
+ glPixelStorei(pname, param); |
} |
} |
void PolygonOffset(PP_Resource context_id, GLfloat factor, GLfloat units) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->PolygonOffset(factor, units); |
+ if (IsBoundGraphics(&enter)) { |
+ glPolygonOffset(factor, units); |
} |
} |
@@ -888,15 +876,15 @@ void ReadPixels(PP_Resource context_id, |
GLenum type, |
void* pixels) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->ReadPixels(x, y, width, height, format, type, pixels); |
+ if (IsBoundGraphics(&enter)) { |
+ glReadPixels(x, y, width, height, format, type, pixels); |
} |
} |
void ReleaseShaderCompiler(PP_Resource context_id) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->ReleaseShaderCompiler(); |
+ if (IsBoundGraphics(&enter)) { |
+ glReleaseShaderCompiler(); |
} |
} |
@@ -906,16 +894,15 @@ void RenderbufferStorage(PP_Resource context_id, |
GLsizei width, |
GLsizei height) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter) |
- ->RenderbufferStorage(target, internalformat, width, height); |
+ if (IsBoundGraphics(&enter)) { |
+ glRenderbufferStorage(target, internalformat, width, height); |
} |
} |
void SampleCoverage(PP_Resource context_id, GLclampf value, GLboolean invert) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->SampleCoverage(value, invert); |
+ if (IsBoundGraphics(&enter)) { |
+ glSampleCoverage(value, invert); |
} |
} |
@@ -925,8 +912,8 @@ void Scissor(PP_Resource context_id, |
GLsizei width, |
GLsizei height) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Scissor(x, y, width, height); |
+ if (IsBoundGraphics(&enter)) { |
+ glScissor(x, y, width, height); |
} |
} |
@@ -937,8 +924,8 @@ void ShaderBinary(PP_Resource context_id, |
const void* binary, |
GLsizei length) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->ShaderBinary(n, shaders, binaryformat, binary, length); |
+ if (IsBoundGraphics(&enter)) { |
+ glShaderBinary(n, shaders, binaryformat, binary, length); |
} |
} |
@@ -948,15 +935,15 @@ void ShaderSource(PP_Resource context_id, |
const char** str, |
const GLint* length) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->ShaderSource(shader, count, str, length); |
+ if (IsBoundGraphics(&enter)) { |
+ glShaderSource(shader, count, str, length); |
} |
} |
void StencilFunc(PP_Resource context_id, GLenum func, GLint ref, GLuint mask) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->StencilFunc(func, ref, mask); |
+ if (IsBoundGraphics(&enter)) { |
+ glStencilFunc(func, ref, mask); |
} |
} |
@@ -966,22 +953,22 @@ void StencilFuncSeparate(PP_Resource context_id, |
GLint ref, |
GLuint mask) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->StencilFuncSeparate(face, func, ref, mask); |
+ if (IsBoundGraphics(&enter)) { |
+ glStencilFuncSeparate(face, func, ref, mask); |
} |
} |
void StencilMask(PP_Resource context_id, GLuint mask) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->StencilMask(mask); |
+ if (IsBoundGraphics(&enter)) { |
+ glStencilMask(mask); |
} |
} |
void StencilMaskSeparate(PP_Resource context_id, GLenum face, GLuint mask) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->StencilMaskSeparate(face, mask); |
+ if (IsBoundGraphics(&enter)) { |
+ glStencilMaskSeparate(face, mask); |
} |
} |
@@ -990,8 +977,8 @@ void StencilOp(PP_Resource context_id, |
GLenum zfail, |
GLenum zpass) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->StencilOp(fail, zfail, zpass); |
+ if (IsBoundGraphics(&enter)) { |
+ glStencilOp(fail, zfail, zpass); |
} |
} |
@@ -1001,8 +988,8 @@ void StencilOpSeparate(PP_Resource context_id, |
GLenum zfail, |
GLenum zpass) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->StencilOpSeparate(face, fail, zfail, zpass); |
+ if (IsBoundGraphics(&enter)) { |
+ glStencilOpSeparate(face, fail, zfail, zpass); |
} |
} |
@@ -1017,16 +1004,16 @@ void TexImage2D(PP_Resource context_id, |
GLenum type, |
const void* pixels) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->TexImage2D(target, |
- level, |
- internalformat, |
- width, |
- height, |
- border, |
- format, |
- type, |
- pixels); |
+ if (IsBoundGraphics(&enter)) { |
+ glTexImage2D(target, |
+ level, |
+ internalformat, |
+ width, |
+ height, |
+ border, |
+ format, |
+ type, |
+ pixels); |
} |
} |
@@ -1035,8 +1022,8 @@ void TexParameterf(PP_Resource context_id, |
GLenum pname, |
GLfloat param) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->TexParameterf(target, pname, param); |
+ if (IsBoundGraphics(&enter)) { |
+ glTexParameterf(target, pname, param); |
} |
} |
@@ -1045,8 +1032,8 @@ void TexParameterfv(PP_Resource context_id, |
GLenum pname, |
const GLfloat* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->TexParameterfv(target, pname, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glTexParameterfv(target, pname, params); |
} |
} |
@@ -1055,8 +1042,8 @@ void TexParameteri(PP_Resource context_id, |
GLenum pname, |
GLint param) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->TexParameteri(target, pname, param); |
+ if (IsBoundGraphics(&enter)) { |
+ glTexParameteri(target, pname, param); |
} |
} |
@@ -1065,8 +1052,8 @@ void TexParameteriv(PP_Resource context_id, |
GLenum pname, |
const GLint* params) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->TexParameteriv(target, pname, params); |
+ if (IsBoundGraphics(&enter)) { |
+ glTexParameteriv(target, pname, params); |
} |
} |
@@ -1081,16 +1068,16 @@ void TexSubImage2D(PP_Resource context_id, |
GLenum type, |
const void* pixels) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->TexSubImage2D( |
+ if (IsBoundGraphics(&enter)) { |
+ glTexSubImage2D( |
target, level, xoffset, yoffset, width, height, format, type, pixels); |
} |
} |
void Uniform1f(PP_Resource context_id, GLint location, GLfloat x) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform1f(location, x); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform1f(location, x); |
} |
} |
@@ -1099,15 +1086,15 @@ void Uniform1fv(PP_Resource context_id, |
GLsizei count, |
const GLfloat* v) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform1fv(location, count, v); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform1fv(location, count, v); |
} |
} |
void Uniform1i(PP_Resource context_id, GLint location, GLint x) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform1i(location, x); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform1i(location, x); |
} |
} |
@@ -1116,15 +1103,15 @@ void Uniform1iv(PP_Resource context_id, |
GLsizei count, |
const GLint* v) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform1iv(location, count, v); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform1iv(location, count, v); |
} |
} |
void Uniform2f(PP_Resource context_id, GLint location, GLfloat x, GLfloat y) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform2f(location, x, y); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform2f(location, x, y); |
} |
} |
@@ -1133,15 +1120,15 @@ void Uniform2fv(PP_Resource context_id, |
GLsizei count, |
const GLfloat* v) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform2fv(location, count, v); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform2fv(location, count, v); |
} |
} |
void Uniform2i(PP_Resource context_id, GLint location, GLint x, GLint y) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform2i(location, x, y); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform2i(location, x, y); |
} |
} |
@@ -1150,8 +1137,8 @@ void Uniform2iv(PP_Resource context_id, |
GLsizei count, |
const GLint* v) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform2iv(location, count, v); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform2iv(location, count, v); |
} |
} |
@@ -1161,8 +1148,8 @@ void Uniform3f(PP_Resource context_id, |
GLfloat y, |
GLfloat z) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform3f(location, x, y, z); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform3f(location, x, y, z); |
} |
} |
@@ -1171,8 +1158,8 @@ void Uniform3fv(PP_Resource context_id, |
GLsizei count, |
const GLfloat* v) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform3fv(location, count, v); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform3fv(location, count, v); |
} |
} |
@@ -1182,8 +1169,8 @@ void Uniform3i(PP_Resource context_id, |
GLint y, |
GLint z) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform3i(location, x, y, z); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform3i(location, x, y, z); |
} |
} |
@@ -1192,8 +1179,8 @@ void Uniform3iv(PP_Resource context_id, |
GLsizei count, |
const GLint* v) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform3iv(location, count, v); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform3iv(location, count, v); |
} |
} |
@@ -1204,8 +1191,8 @@ void Uniform4f(PP_Resource context_id, |
GLfloat z, |
GLfloat w) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform4f(location, x, y, z, w); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform4f(location, x, y, z, w); |
} |
} |
@@ -1214,8 +1201,8 @@ void Uniform4fv(PP_Resource context_id, |
GLsizei count, |
const GLfloat* v) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform4fv(location, count, v); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform4fv(location, count, v); |
} |
} |
@@ -1226,8 +1213,8 @@ void Uniform4i(PP_Resource context_id, |
GLint z, |
GLint w) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform4i(location, x, y, z, w); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform4i(location, x, y, z, w); |
} |
} |
@@ -1236,8 +1223,8 @@ void Uniform4iv(PP_Resource context_id, |
GLsizei count, |
const GLint* v) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Uniform4iv(location, count, v); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniform4iv(location, count, v); |
} |
} |
@@ -1247,8 +1234,8 @@ void UniformMatrix2fv(PP_Resource context_id, |
GLboolean transpose, |
const GLfloat* value) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->UniformMatrix2fv(location, count, transpose, value); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniformMatrix2fv(location, count, transpose, value); |
} |
} |
@@ -1258,8 +1245,8 @@ void UniformMatrix3fv(PP_Resource context_id, |
GLboolean transpose, |
const GLfloat* value) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->UniformMatrix3fv(location, count, transpose, value); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniformMatrix3fv(location, count, transpose, value); |
} |
} |
@@ -1269,29 +1256,29 @@ void UniformMatrix4fv(PP_Resource context_id, |
GLboolean transpose, |
const GLfloat* value) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->UniformMatrix4fv(location, count, transpose, value); |
+ if (IsBoundGraphics(&enter)) { |
+ glUniformMatrix4fv(location, count, transpose, value); |
} |
} |
void UseProgram(PP_Resource context_id, GLuint program) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->UseProgram(program); |
+ if (IsBoundGraphics(&enter)) { |
+ glUseProgram(program); |
} |
} |
void ValidateProgram(PP_Resource context_id, GLuint program) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->ValidateProgram(program); |
+ if (IsBoundGraphics(&enter)) { |
+ glValidateProgram(program); |
} |
} |
void VertexAttrib1f(PP_Resource context_id, GLuint indx, GLfloat x) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->VertexAttrib1f(indx, x); |
+ if (IsBoundGraphics(&enter)) { |
+ glVertexAttrib1f(indx, x); |
} |
} |
@@ -1299,15 +1286,15 @@ void VertexAttrib1fv(PP_Resource context_id, |
GLuint indx, |
const GLfloat* values) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->VertexAttrib1fv(indx, values); |
+ if (IsBoundGraphics(&enter)) { |
+ glVertexAttrib1fv(indx, values); |
} |
} |
void VertexAttrib2f(PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->VertexAttrib2f(indx, x, y); |
+ if (IsBoundGraphics(&enter)) { |
+ glVertexAttrib2f(indx, x, y); |
} |
} |
@@ -1315,8 +1302,8 @@ void VertexAttrib2fv(PP_Resource context_id, |
GLuint indx, |
const GLfloat* values) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->VertexAttrib2fv(indx, values); |
+ if (IsBoundGraphics(&enter)) { |
+ glVertexAttrib2fv(indx, values); |
} |
} |
@@ -1326,8 +1313,8 @@ void VertexAttrib3f(PP_Resource context_id, |
GLfloat y, |
GLfloat z) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->VertexAttrib3f(indx, x, y, z); |
+ if (IsBoundGraphics(&enter)) { |
+ glVertexAttrib3f(indx, x, y, z); |
} |
} |
@@ -1335,8 +1322,8 @@ void VertexAttrib3fv(PP_Resource context_id, |
GLuint indx, |
const GLfloat* values) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->VertexAttrib3fv(indx, values); |
+ if (IsBoundGraphics(&enter)) { |
+ glVertexAttrib3fv(indx, values); |
} |
} |
@@ -1347,8 +1334,8 @@ void VertexAttrib4f(PP_Resource context_id, |
GLfloat z, |
GLfloat w) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->VertexAttrib4f(indx, x, y, z, w); |
+ if (IsBoundGraphics(&enter)) { |
+ glVertexAttrib4f(indx, x, y, z, w); |
} |
} |
@@ -1356,8 +1343,8 @@ void VertexAttrib4fv(PP_Resource context_id, |
GLuint indx, |
const GLfloat* values) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->VertexAttrib4fv(indx, values); |
+ if (IsBoundGraphics(&enter)) { |
+ glVertexAttrib4fv(indx, values); |
} |
} |
@@ -1369,9 +1356,8 @@ void VertexAttribPointer(PP_Resource context_id, |
GLsizei stride, |
const void* ptr) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter) |
- ->VertexAttribPointer(indx, size, type, normalized, stride, ptr); |
+ if (IsBoundGraphics(&enter)) { |
+ glVertexAttribPointer(indx, size, type, normalized, stride, ptr); |
} |
} |
@@ -1381,200 +1367,14 @@ void Viewport(PP_Resource context_id, |
GLsizei width, |
GLsizei height) { |
Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->Viewport(x, y, width, height); |
- } |
-} |
- |
-void BlitFramebufferEXT(PP_Resource context_id, |
- GLint srcX0, |
- GLint srcY0, |
- GLint srcX1, |
- GLint srcY1, |
- GLint dstX0, |
- GLint dstY0, |
- GLint dstX1, |
- GLint dstY1, |
- GLbitfield mask, |
- GLenum filter) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->BlitFramebufferCHROMIUM( |
- srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
- } |
-} |
- |
-void RenderbufferStorageMultisampleEXT(PP_Resource context_id, |
- GLenum target, |
- GLsizei samples, |
- GLenum internalformat, |
- GLsizei width, |
- GLsizei height) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->RenderbufferStorageMultisampleCHROMIUM( |
- target, samples, internalformat, width, height); |
- } |
-} |
- |
-void GenQueriesEXT(PP_Resource context_id, GLsizei n, GLuint* queries) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GenQueriesEXT(n, queries); |
- } |
-} |
- |
-void DeleteQueriesEXT(PP_Resource context_id, |
- GLsizei n, |
- const GLuint* queries) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->DeleteQueriesEXT(n, queries); |
- } |
-} |
- |
-GLboolean IsQueryEXT(PP_Resource context_id, GLuint id) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->IsQueryEXT(id); |
- } else { |
- return GL_FALSE; |
- } |
-} |
- |
-void BeginQueryEXT(PP_Resource context_id, GLenum target, GLuint id) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->BeginQueryEXT(target, id); |
- } |
-} |
- |
-void EndQueryEXT(PP_Resource context_id, GLenum target) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->EndQueryEXT(target); |
- } |
-} |
- |
-void GetQueryivEXT(PP_Resource context_id, |
- GLenum target, |
- GLenum pname, |
- GLint* params) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetQueryivEXT(target, pname, params); |
- } |
-} |
- |
-void GetQueryObjectuivEXT(PP_Resource context_id, |
- GLuint id, |
- GLenum pname, |
- GLuint* params) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->GetQueryObjectuivEXT(id, pname, params); |
- } |
-} |
- |
-GLboolean EnableFeatureCHROMIUM(PP_Resource context_id, const char* feature) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->EnableFeatureCHROMIUM(feature); |
- } else { |
- return GL_FALSE; |
- } |
-} |
- |
-void* MapBufferSubDataCHROMIUM(PP_Resource context_id, |
- GLuint target, |
- GLintptr offset, |
- GLsizeiptr size, |
- GLenum access) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter) |
- ->MapBufferSubDataCHROMIUM(target, offset, size, access); |
- } else { |
- return NULL; |
- } |
-} |
- |
-void UnmapBufferSubDataCHROMIUM(PP_Resource context_id, const void* mem) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->UnmapBufferSubDataCHROMIUM(mem); |
- } |
-} |
- |
-void* MapTexSubImage2DCHROMIUM(PP_Resource context_id, |
- GLenum target, |
- GLint level, |
- GLint xoffset, |
- GLint yoffset, |
- GLsizei width, |
- GLsizei height, |
- GLenum format, |
- GLenum type, |
- GLenum access) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- return ToGles2Impl(&enter)->MapTexSubImage2DCHROMIUM( |
- target, level, xoffset, yoffset, width, height, format, type, access); |
- } else { |
- return NULL; |
- } |
-} |
- |
-void UnmapTexSubImage2DCHROMIUM(PP_Resource context_id, const void* mem) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->UnmapTexSubImage2DCHROMIUM(mem); |
- } |
-} |
- |
-void DrawArraysInstancedANGLE(PP_Resource context_id, |
- GLenum mode, |
- GLint first, |
- GLsizei count, |
- GLsizei primcount) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter) |
- ->DrawArraysInstancedANGLE(mode, first, count, primcount); |
- } |
-} |
- |
-void DrawElementsInstancedANGLE(PP_Resource context_id, |
- GLenum mode, |
- GLsizei count, |
- GLenum type, |
- const void* indices, |
- GLsizei primcount) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter) |
- ->DrawElementsInstancedANGLE(mode, count, type, indices, primcount); |
- } |
-} |
- |
-void VertexAttribDivisorANGLE(PP_Resource context_id, |
- GLuint index, |
- GLuint divisor) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->VertexAttribDivisorANGLE(index, divisor); |
- } |
-} |
- |
-void DrawBuffersEXT(PP_Resource context_id, GLsizei count, const GLenum* bufs) { |
- Enter3D enter(context_id, true); |
- if (enter.succeeded()) { |
- ToGles2Impl(&enter)->DrawBuffersEXT(count, bufs); |
+ if (IsBoundGraphics(&enter)) { |
+ glViewport(x, y, width, height); |
} |
} |
} // namespace |
-const PPB_OpenGLES2* PPB_OpenGLES2_Shared::GetInterface() { |
+ |
+const PPB_OpenGLES2* GetPPB_OpenGLES2_Thunk() { |
static const struct PPB_OpenGLES2 ppb_opengles2 = { |
&ActiveTexture, &AttachShader, |
&BindAttribLocation, &BindBuffer, |
@@ -1649,48 +1449,6 @@ const PPB_OpenGLES2* PPB_OpenGLES2_Shared::GetInterface() { |
&VertexAttribPointer, &Viewport}; |
return &ppb_opengles2; |
} |
-const PPB_OpenGLES2InstancedArrays* |
-PPB_OpenGLES2_Shared::GetInstancedArraysInterface() { |
- static const struct PPB_OpenGLES2InstancedArrays ppb_opengles2 = { |
- &DrawArraysInstancedANGLE, &DrawElementsInstancedANGLE, |
- &VertexAttribDivisorANGLE}; |
- return &ppb_opengles2; |
-} |
-const PPB_OpenGLES2FramebufferBlit* |
-PPB_OpenGLES2_Shared::GetFramebufferBlitInterface() { |
- static const struct PPB_OpenGLES2FramebufferBlit ppb_opengles2 = { |
- &BlitFramebufferEXT}; |
- return &ppb_opengles2; |
-} |
-const PPB_OpenGLES2FramebufferMultisample* |
-PPB_OpenGLES2_Shared::GetFramebufferMultisampleInterface() { |
- static const struct PPB_OpenGLES2FramebufferMultisample ppb_opengles2 = { |
- &RenderbufferStorageMultisampleEXT}; |
- return &ppb_opengles2; |
-} |
-const PPB_OpenGLES2ChromiumEnableFeature* |
-PPB_OpenGLES2_Shared::GetChromiumEnableFeatureInterface() { |
- static const struct PPB_OpenGLES2ChromiumEnableFeature ppb_opengles2 = { |
- &EnableFeatureCHROMIUM}; |
- return &ppb_opengles2; |
-} |
-const PPB_OpenGLES2ChromiumMapSub* |
-PPB_OpenGLES2_Shared::GetChromiumMapSubInterface() { |
- static const struct PPB_OpenGLES2ChromiumMapSub ppb_opengles2 = { |
- &MapBufferSubDataCHROMIUM, &UnmapBufferSubDataCHROMIUM, |
- &MapTexSubImage2DCHROMIUM, &UnmapTexSubImage2DCHROMIUM}; |
- return &ppb_opengles2; |
-} |
-const PPB_OpenGLES2Query* PPB_OpenGLES2_Shared::GetQueryInterface() { |
- static const struct PPB_OpenGLES2Query ppb_opengles2 = { |
- &GenQueriesEXT, &DeleteQueriesEXT, &IsQueryEXT, &BeginQueryEXT, |
- &EndQueryEXT, &GetQueryivEXT, &GetQueryObjectuivEXT}; |
- return &ppb_opengles2; |
-} |
-const PPB_OpenGLES2DrawBuffers_Dev* |
-PPB_OpenGLES2_Shared::GetDrawBuffersInterface() { |
- static const struct PPB_OpenGLES2DrawBuffers_Dev ppb_opengles2 = { |
- &DrawBuffersEXT}; |
- return &ppb_opengles2; |
-} |
-} // namespace ppapi |
+ |
+} // namespace examples |
+} // namespace mojo |