Index: content/renderer/webgraphicscontext3d_command_buffer_impl.cc |
diff --git a/content/renderer/webgraphicscontext3d_command_buffer_impl.cc b/content/renderer/webgraphicscontext3d_command_buffer_impl.cc |
index ff8d96f8daabccac65097df1a68436e5d4e7a63b..88dcadcfb68922c303ca3085e47b2158fcf383b8 100644 |
--- a/content/renderer/webgraphicscontext3d_command_buffer_impl.cc |
+++ b/content/renderer/webgraphicscontext3d_command_buffer_impl.cc |
@@ -23,13 +23,26 @@ |
#include "content/renderer/gpu_channel_host.h" |
#include "content/renderer/render_thread.h" |
#include "content/renderer/render_view.h" |
+#include "gpu/command_buffer/client/gles2_implementation.h" |
#include "gpu/command_buffer/common/constants.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
#include "webkit/glue/gl_bindings_skia_cmd_buffer.h" |
+#if defined(USE_REAL_GL_API) |
+#define CALL_GL_IMPL(name) gl##name |
+inline void WebGraphicsContext3DCommandBufferImpl::localMakeContextCurrent() { |
+ makeContextCurrent(); |
+} |
+#else |
+#define CALL_GL_IMPL(name) (gles2_implementation_->name) |
+inline void WebGraphicsContext3DCommandBufferImpl::localMakeContextCurrent() { |
+} |
+#endif |
+ |
WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl() |
: context_(NULL), |
+ gles2_implementation_(NULL), |
web_view_(NULL), |
#if defined(OS_MACOSX) |
plugin_handle_(NULL), |
@@ -144,6 +157,7 @@ bool WebGraphicsContext3DCommandBufferImpl::initialize( |
if (!context_) |
return false; |
+ gles2_implementation_ = context_->GetImplementation(); |
context_->SetContextLostCallback( |
NewCallback(this, |
&WebGraphicsContext3DCommandBufferImpl::OnContextLost)); |
@@ -204,13 +218,13 @@ void WebGraphicsContext3DCommandBufferImpl::prepareTexture() { |
void WebGraphicsContext3DCommandBufferImpl::reshape(int width, int height) { |
cached_width_ = width; |
cached_height_ = height; |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
Ken Russell (switch to Gerrit)
2011/05/21 01:09:21
I thought the reason for this change was to make t
greggman
2011/05/21 01:22:49
You're right. I changed it to the simpler way.
|
if (web_view_) { |
#if defined(OS_MACOSX) |
context_->ResizeOnscreen(gfx::Size(width, height)); |
#else |
- glResizeCHROMIUM(width, height); |
+ CALL_GL_IMPL(ResizeCHROMIUM)(width, height); |
#endif |
} else { |
context_->ResizeOffscreen(gfx::Size(width, height)); |
@@ -225,13 +239,13 @@ void WebGraphicsContext3DCommandBufferImpl::reshape(int width, int height) { |
WebGLId WebGraphicsContext3DCommandBufferImpl::createCompositorTexture( |
WGC3Dsizei width, WGC3Dsizei height) { |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
return context_->CreateParentTexture(gfx::Size(width, height)); |
} |
void WebGraphicsContext3DCommandBufferImpl::deleteCompositorTexture( |
WebGLId parent_texture) { |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
context_->DeleteParentTexture(parent_texture); |
} |
@@ -266,7 +280,7 @@ bool WebGraphicsContext3DCommandBufferImpl::readBackFramebuffer( |
return false; |
} |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
// Earlier versions of this code used the GPU to flip the |
// framebuffer vertically before reading it back for compositing |
@@ -277,10 +291,10 @@ bool WebGraphicsContext3DCommandBufferImpl::readBackFramebuffer( |
bool mustRestoreFBO = (bound_fbo_ != 0); |
if (mustRestoreFBO) { |
- glBindFramebuffer(GL_FRAMEBUFFER, 0); |
+ CALL_GL_IMPL(BindFramebuffer)(GL_FRAMEBUFFER, 0); |
} |
- glReadPixels(0, 0, cached_width_, cached_height_, |
- GL_RGBA, GL_UNSIGNED_BYTE, pixels); |
+ CALL_GL_IMPL(ReadPixels)(0, 0, cached_width_, cached_height_, |
+ GL_RGBA, GL_UNSIGNED_BYTE, pixels); |
// Swizzle red and blue channels |
// TODO(kbr): expose GL_BGRA as extension |
@@ -289,7 +303,7 @@ bool WebGraphicsContext3DCommandBufferImpl::readBackFramebuffer( |
} |
if (mustRestoreFBO) { |
- glBindFramebuffer(GL_FRAMEBUFFER, bound_fbo_); |
+ CALL_GL_IMPL(BindFramebuffer)(GL_FRAMEBUFFER, bound_fbo_); |
} |
#ifdef FLIP_FRAMEBUFFER_VERTICALLY |
@@ -314,14 +328,14 @@ void* WebGraphicsContext3DCommandBufferImpl::mapBufferSubDataCHROMIUM( |
WGC3Dintptr offset, |
WGC3Dsizeiptr size, |
WGC3Denum access) { |
- makeContextCurrent(); |
- return glMapBufferSubDataCHROMIUM(target, offset, size, access); |
+ localMakeContextCurrent(); |
+ return CALL_GL_IMPL(MapBufferSubDataCHROMIUM)(target, offset, size, access); |
} |
void WebGraphicsContext3DCommandBufferImpl::unmapBufferSubDataCHROMIUM( |
const void* mem) { |
- makeContextCurrent(); |
- return glUnmapBufferSubDataCHROMIUM(mem); |
+ localMakeContextCurrent(); |
+ return CALL_GL_IMPL(UnmapBufferSubDataCHROMIUM)(mem); |
} |
void* WebGraphicsContext3DCommandBufferImpl::mapTexSubImage2DCHROMIUM( |
@@ -334,14 +348,14 @@ void* WebGraphicsContext3DCommandBufferImpl::mapTexSubImage2DCHROMIUM( |
WGC3Denum format, |
WGC3Denum type, |
WGC3Denum access) { |
- return glMapTexSubImage2DCHROMIUM( |
+ return CALL_GL_IMPL(MapTexSubImage2DCHROMIUM)( |
target, level, xoffset, yoffset, width, height, format, type, access); |
} |
void WebGraphicsContext3DCommandBufferImpl::unmapTexSubImage2DCHROMIUM( |
const void* mem) { |
- makeContextCurrent(); |
- glUnmapTexSubImage2DCHROMIUM(mem); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(UnmapTexSubImage2DCHROMIUM)(mem); |
} |
void WebGraphicsContext3DCommandBufferImpl::copyTextureToParentTextureCHROMIUM( |
@@ -372,140 +386,143 @@ void WebGraphicsContext3DCommandBufferImpl::getChildToParentLatchCHROMIUM( |
void WebGraphicsContext3DCommandBufferImpl::waitLatchCHROMIUM( |
WGC3Duint latch_id) |
{ |
- makeContextCurrent(); |
- glWaitLatchCHROMIUM(latch_id); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(WaitLatchCHROMIUM)(latch_id); |
} |
void WebGraphicsContext3DCommandBufferImpl::setLatchCHROMIUM( |
WGC3Duint latch_id) |
{ |
- makeContextCurrent(); |
- glSetLatchCHROMIUM(latch_id); |
- glFlush(); // required to ensure set command is sent to GPU process |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(SetLatchCHROMIUM)(latch_id); |
+ // required to ensure set command is sent to GPU process |
+ CALL_GL_IMPL(Flush)(); |
} |
void WebGraphicsContext3DCommandBufferImpl:: |
rateLimitOffscreenContextCHROMIUM() { |
- makeContextCurrent(); |
- glRateLimitOffscreenContextCHROMIUM(); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(RateLimitOffscreenContextCHROMIUM)(); |
} |
WebKit::WebString WebGraphicsContext3DCommandBufferImpl:: |
getRequestableExtensionsCHROMIUM() { |
- makeContextCurrent(); |
- return WebKit::WebString::fromUTF8(glGetRequestableExtensionsCHROMIUM()); |
+ localMakeContextCurrent(); |
+ return WebKit::WebString::fromUTF8( |
+ CALL_GL_IMPL(GetRequestableExtensionsCHROMIUM)()); |
} |
void WebGraphicsContext3DCommandBufferImpl::requestExtensionCHROMIUM( |
const char* extension) { |
- makeContextCurrent(); |
- glRequestExtensionCHROMIUM(extension); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(RequestExtensionCHROMIUM)(extension); |
} |
void WebGraphicsContext3DCommandBufferImpl::blitFramebufferCHROMIUM( |
WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, |
WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, |
WGC3Dbitfield mask, WGC3Denum filter) { |
- makeContextCurrent(); |
- glBlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, |
- dstX0, dstY0, dstX1, dstY1, |
- mask, filter); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(BlitFramebufferEXT)( |
+ srcX0, srcY0, srcX1, srcY1, |
+ dstX0, dstY0, dstX1, dstY1, |
+ mask, filter); |
} |
void WebGraphicsContext3DCommandBufferImpl:: |
renderbufferStorageMultisampleCHROMIUM( |
WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, |
WGC3Dsizei width, WGC3Dsizei height) { |
- makeContextCurrent(); |
- glRenderbufferStorageMultisampleEXT(target, samples, internalformat, |
- width, height); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(RenderbufferStorageMultisampleEXT)( |
+ target, samples, internalformat, width, height); |
} |
// Helper macros to reduce the amount of code. |
#define DELEGATE_TO_GL(name, glname) \ |
void WebGraphicsContext3DCommandBufferImpl::name() { \ |
- makeContextCurrent(); \ |
- gl##glname(); \ |
+ localMakeContextCurrent(); \ |
+ CALL_GL_IMPL(glname)(); \ |
} |
#define DELEGATE_TO_GL_1(name, glname, t1) \ |
void WebGraphicsContext3DCommandBufferImpl::name(t1 a1) { \ |
- makeContextCurrent(); \ |
- gl##glname(a1); \ |
+ localMakeContextCurrent(); \ |
+ CALL_GL_IMPL(glname)(a1); \ |
} |
#define DELEGATE_TO_GL_1R(name, glname, t1, rt) \ |
rt WebGraphicsContext3DCommandBufferImpl::name(t1 a1) { \ |
- makeContextCurrent(); \ |
- return gl##glname(a1); \ |
+ localMakeContextCurrent(); \ |
+ return CALL_GL_IMPL(glname)(a1); \ |
} |
#define DELEGATE_TO_GL_1RB(name, glname, t1, rt) \ |
rt WebGraphicsContext3DCommandBufferImpl::name(t1 a1) { \ |
- makeContextCurrent(); \ |
- return gl##glname(a1) ? true : false; \ |
+ localMakeContextCurrent(); \ |
+ return CALL_GL_IMPL(glname)(a1) ? true : false; \ |
} |
#define DELEGATE_TO_GL_2(name, glname, t1, t2) \ |
void WebGraphicsContext3DCommandBufferImpl::name(t1 a1, t2 a2) { \ |
- makeContextCurrent(); \ |
- gl##glname(a1, a2); \ |
+ localMakeContextCurrent(); \ |
+ CALL_GL_IMPL(glname)(a1, a2); \ |
} |
#define DELEGATE_TO_GL_2R(name, glname, t1, t2, rt) \ |
rt WebGraphicsContext3DCommandBufferImpl::name(t1 a1, t2 a2) { \ |
- makeContextCurrent(); \ |
- return gl##glname(a1, a2); \ |
+ localMakeContextCurrent(); \ |
+ return CALL_GL_IMPL(glname)(a1, a2); \ |
} |
#define DELEGATE_TO_GL_3(name, glname, t1, t2, t3) \ |
void WebGraphicsContext3DCommandBufferImpl::name(t1 a1, t2 a2, t3 a3) { \ |
- makeContextCurrent(); \ |
- gl##glname(a1, a2, a3); \ |
+ localMakeContextCurrent(); \ |
+ CALL_GL_IMPL(glname)(a1, a2, a3); \ |
} |
#define DELEGATE_TO_GL_4(name, glname, t1, t2, t3, t4) \ |
void WebGraphicsContext3DCommandBufferImpl::name(t1 a1, t2 a2, t3 a3, t4 a4) { \ |
- makeContextCurrent(); \ |
- gl##glname(a1, a2, a3, a4); \ |
+ localMakeContextCurrent(); \ |
+ CALL_GL_IMPL(glname)(a1, a2, a3, a4); \ |
} |
#define DELEGATE_TO_GL_5(name, glname, t1, t2, t3, t4, t5) \ |
void WebGraphicsContext3DCommandBufferImpl::name(t1 a1, t2 a2, t3 a3, \ |
t4 a4, t5 a5) { \ |
- makeContextCurrent(); \ |
- gl##glname(a1, a2, a3, a4, a5); \ |
+ localMakeContextCurrent(); \ |
+ CALL_GL_IMPL(glname)(a1, a2, a3, a4, a5); \ |
} |
#define DELEGATE_TO_GL_6(name, glname, t1, t2, t3, t4, t5, t6) \ |
void WebGraphicsContext3DCommandBufferImpl::name(t1 a1, t2 a2, t3 a3, \ |
t4 a4, t5 a5, t6 a6) { \ |
- makeContextCurrent(); \ |
- gl##glname(a1, a2, a3, a4, a5, a6); \ |
+ localMakeContextCurrent(); \ |
+ CALL_GL_IMPL(glname)(a1, a2, a3, a4, a5, a6); \ |
} |
#define DELEGATE_TO_GL_7(name, glname, t1, t2, t3, t4, t5, t6, t7) \ |
void WebGraphicsContext3DCommandBufferImpl::name(t1 a1, t2 a2, t3 a3, \ |
t4 a4, t5 a5, t6 a6, t7 a7) { \ |
- makeContextCurrent(); \ |
- gl##glname(a1, a2, a3, a4, a5, a6, a7); \ |
+ localMakeContextCurrent(); \ |
+ CALL_GL_IMPL(glname)(a1, a2, a3, a4, a5, a6, a7); \ |
} |
#define DELEGATE_TO_GL_8(name, glname, t1, t2, t3, t4, t5, t6, t7, t8) \ |
void WebGraphicsContext3DCommandBufferImpl::name(t1 a1, t2 a2, t3 a3, \ |
t4 a4, t5 a5, t6 a6, \ |
t7 a7, t8 a8) { \ |
- makeContextCurrent(); \ |
- gl##glname(a1, a2, a3, a4, a5, a6, a7, a8); \ |
+ localMakeContextCurrent(); \ |
+ CALL_GL_IMPL(glname)(a1, a2, a3, a4, a5, a6, a7, a8); \ |
} |
#define DELEGATE_TO_GL_9(name, glname, t1, t2, t3, t4, t5, t6, t7, t8, t9) \ |
void WebGraphicsContext3DCommandBufferImpl::name(t1 a1, t2 a2, t3 a3, \ |
t4 a4, t5 a5, t6 a6, \ |
t7 a7, t8 a8, t9 a9) { \ |
- makeContextCurrent(); \ |
- gl##glname(a1, a2, a3, a4, a5, a6, a7, a8, a9); \ |
+ localMakeContextCurrent(); \ |
+ CALL_GL_IMPL(glname)(a1, a2, a3, a4, a5, a6, a7, a8, a9); \ |
} |
DELEGATE_TO_GL_1(activeTexture, ActiveTexture, WGC3Denum) |
@@ -520,8 +537,8 @@ DELEGATE_TO_GL_2(bindBuffer, BindBuffer, WGC3Denum, WebGLId) |
void WebGraphicsContext3DCommandBufferImpl::bindFramebuffer( |
WGC3Denum target, |
WebGLId framebuffer) { |
- makeContextCurrent(); |
- glBindFramebuffer(target, framebuffer); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(BindFramebuffer)(target, framebuffer); |
bound_fbo_ = framebuffer; |
} |
@@ -594,9 +611,10 @@ void WebGraphicsContext3DCommandBufferImpl::drawElements(WGC3Denum mode, |
WGC3Dsizei count, |
WGC3Denum type, |
WGC3Dintptr offset) { |
- makeContextCurrent(); |
- glDrawElements(mode, count, type, |
- reinterpret_cast<void*>(static_cast<intptr_t>(offset))); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(DrawElements)( |
+ mode, count, type, |
+ reinterpret_cast<void*>(static_cast<intptr_t>(offset))); |
} |
DELEGATE_TO_GL_1(enable, Enable, WGC3Denum) |
@@ -620,13 +638,14 @@ DELEGATE_TO_GL_1(generateMipmap, GenerateMipmap, WGC3Denum) |
bool WebGraphicsContext3DCommandBufferImpl::getActiveAttrib( |
WebGLId program, WGC3Duint index, ActiveInfo& info) { |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
if (!program) { |
synthesizeGLError(GL_INVALID_VALUE); |
return false; |
} |
GLint max_name_length = -1; |
- glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max_name_length); |
+ CALL_GL_IMPL(GetProgramiv)( |
+ program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max_name_length); |
if (max_name_length < 0) |
return false; |
scoped_array<GLchar> name(new GLchar[max_name_length]); |
@@ -637,8 +656,8 @@ bool WebGraphicsContext3DCommandBufferImpl::getActiveAttrib( |
GLsizei length = 0; |
GLint size = -1; |
GLenum type = 0; |
- glGetActiveAttrib(program, index, max_name_length, |
- &length, &size, &type, name.get()); |
+ CALL_GL_IMPL(GetActiveAttrib)( |
+ program, index, max_name_length, &length, &size, &type, name.get()); |
if (size < 0) { |
return false; |
} |
@@ -650,9 +669,10 @@ bool WebGraphicsContext3DCommandBufferImpl::getActiveAttrib( |
bool WebGraphicsContext3DCommandBufferImpl::getActiveUniform( |
WebGLId program, WGC3Duint index, ActiveInfo& info) { |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
GLint max_name_length = -1; |
- glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max_name_length); |
+ CALL_GL_IMPL(GetProgramiv)( |
+ program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max_name_length); |
if (max_name_length < 0) |
return false; |
scoped_array<GLchar> name(new GLchar[max_name_length]); |
@@ -663,8 +683,8 @@ bool WebGraphicsContext3DCommandBufferImpl::getActiveUniform( |
GLsizei length = 0; |
GLint size = -1; |
GLenum type = 0; |
- glGetActiveUniform(program, index, max_name_length, |
- &length, &size, &type, name.get()); |
+ CALL_GL_IMPL(GetActiveUniform)( |
+ program, index, max_name_length, &length, &size, &type, name.get()); |
if (size < 0) { |
return false; |
} |
@@ -698,8 +718,8 @@ WGC3Denum WebGraphicsContext3DCommandBufferImpl::getError() { |
return err; |
} |
- makeContextCurrent(); |
- return glGetError(); |
+ localMakeContextCurrent(); |
+ return CALL_GL_IMPL(GetError)(); |
} |
bool WebGraphicsContext3DCommandBufferImpl::isContextLost() { |
@@ -718,16 +738,17 @@ DELEGATE_TO_GL_3(getProgramiv, GetProgramiv, WebGLId, WGC3Denum, WGC3Dint*) |
WebKit::WebString WebGraphicsContext3DCommandBufferImpl::getProgramInfoLog( |
WebGLId program) { |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
GLint logLength = 0; |
- glGetProgramiv(program, GL_INFO_LOG_LENGTH, &logLength); |
+ CALL_GL_IMPL(GetProgramiv)(program, GL_INFO_LOG_LENGTH, &logLength); |
if (!logLength) |
return WebKit::WebString(); |
scoped_array<GLchar> log(new GLchar[logLength]); |
if (!log.get()) |
return WebKit::WebString(); |
GLsizei returnedLogLength = 0; |
- glGetProgramInfoLog(program, logLength, &returnedLogLength, log.get()); |
+ CALL_GL_IMPL(GetProgramInfoLog)( |
+ program, logLength, &returnedLogLength, log.get()); |
DCHECK_EQ(logLength, returnedLogLength + 1); |
WebKit::WebString res = |
WebKit::WebString::fromUTF8(log.get(), returnedLogLength); |
@@ -741,16 +762,17 @@ DELEGATE_TO_GL_3(getShaderiv, GetShaderiv, WebGLId, WGC3Denum, WGC3Dint*) |
WebKit::WebString WebGraphicsContext3DCommandBufferImpl::getShaderInfoLog( |
WebGLId shader) { |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
GLint logLength = 0; |
- glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength); |
+ CALL_GL_IMPL(GetShaderiv)(shader, GL_INFO_LOG_LENGTH, &logLength); |
if (!logLength) |
return WebKit::WebString(); |
scoped_array<GLchar> log(new GLchar[logLength]); |
if (!log.get()) |
return WebKit::WebString(); |
GLsizei returnedLogLength = 0; |
- glGetShaderInfoLog(shader, logLength, &returnedLogLength, log.get()); |
+ CALL_GL_IMPL(GetShaderInfoLog)( |
+ shader, logLength, &returnedLogLength, log.get()); |
DCHECK_EQ(logLength, returnedLogLength + 1); |
WebKit::WebString res = |
WebKit::WebString::fromUTF8(log.get(), returnedLogLength); |
@@ -759,16 +781,17 @@ WebKit::WebString WebGraphicsContext3DCommandBufferImpl::getShaderInfoLog( |
WebKit::WebString WebGraphicsContext3DCommandBufferImpl::getShaderSource( |
WebGLId shader) { |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
GLint logLength = 0; |
- glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &logLength); |
+ CALL_GL_IMPL(GetShaderiv)(shader, GL_SHADER_SOURCE_LENGTH, &logLength); |
if (!logLength) |
return WebKit::WebString(); |
scoped_array<GLchar> log(new GLchar[logLength]); |
if (!log.get()) |
return WebKit::WebString(); |
GLsizei returnedLogLength = 0; |
- glGetShaderSource(shader, logLength, &returnedLogLength, log.get()); |
+ CALL_GL_IMPL(GetShaderSource)( |
+ shader, logLength, &returnedLogLength, log.get()); |
DCHECK_EQ(logLength, returnedLogLength + 1); |
WebKit::WebString res = |
WebKit::WebString::fromUTF8(log.get(), returnedLogLength); |
@@ -777,9 +800,9 @@ WebKit::WebString WebGraphicsContext3DCommandBufferImpl::getShaderSource( |
WebKit::WebString WebGraphicsContext3DCommandBufferImpl::getString( |
WGC3Denum name) { |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
return WebKit::WebString::fromUTF8( |
- reinterpret_cast<const char*>(glGetString(name))); |
+ reinterpret_cast<const char*>(CALL_GL_IMPL(GetString)(name))); |
} |
DELEGATE_TO_GL_3(getTexParameterfv, GetTexParameterfv, |
@@ -803,11 +826,11 @@ DELEGATE_TO_GL_3(getVertexAttribiv, GetVertexAttribiv, |
WGC3Dsizeiptr WebGraphicsContext3DCommandBufferImpl::getVertexAttribOffset( |
WGC3Duint index, WGC3Denum pname) { |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
GLvoid* value = NULL; |
// NOTE: If pname is ever a value that returns more then 1 element |
// this will corrupt memory. |
- glGetVertexAttribPointerv(index, pname, &value); |
+ CALL_GL_IMPL(GetVertexAttribPointerv)(index, pname, &value); |
return static_cast<WGC3Dsizeiptr>(reinterpret_cast<intptr_t>(value)); |
} |
@@ -851,9 +874,9 @@ DELEGATE_TO_GL_4(scissor, Scissor, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei) |
void WebGraphicsContext3DCommandBufferImpl::shaderSource( |
WebGLId shader, const WGC3Dchar* string) { |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
GLint length = strlen(string); |
- glShaderSource(shader, 1, &string, &length); |
+ CALL_GL_IMPL(ShaderSource)(shader, 1, &string, &length); |
} |
DELEGATE_TO_GL_3(stencilFunc, StencilFunc, WGC3Denum, WGC3Dint, WGC3Duint) |
@@ -890,8 +913,8 @@ void WebGraphicsContext3DCommandBufferImpl::texParameteri( |
if (pname == kTextureWrapR) { |
return; |
} |
- makeContextCurrent(); |
- glTexParameteri(target, pname, param); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(TexParameteri)(target, pname, param); |
} |
DELEGATE_TO_GL_9(texSubImage2D, TexSubImage2D, |
@@ -976,89 +999,89 @@ DELEGATE_TO_GL_2(vertexAttrib4fv, VertexAttrib4fv, WGC3Duint, |
void WebGraphicsContext3DCommandBufferImpl::vertexAttribPointer( |
WGC3Duint index, WGC3Dint size, WGC3Denum type, WGC3Dboolean normalized, |
WGC3Dsizei stride, WGC3Dintptr offset) { |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
- glVertexAttribPointer(index, size, type, normalized, stride, |
- reinterpret_cast<void*>( |
- static_cast<intptr_t>(offset))); |
+ CALL_GL_IMPL(VertexAttribPointer)( |
+ index, size, type, normalized, stride, |
+ reinterpret_cast<void*>(static_cast<intptr_t>(offset))); |
} |
DELEGATE_TO_GL_4(viewport, Viewport, |
WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei) |
WebGLId WebGraphicsContext3DCommandBufferImpl::createBuffer() { |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
GLuint o; |
- glGenBuffers(1, &o); |
+ CALL_GL_IMPL(GenBuffers)(1, &o); |
return o; |
} |
WebGLId WebGraphicsContext3DCommandBufferImpl::createFramebuffer() { |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
GLuint o = 0; |
- glGenFramebuffers(1, &o); |
+ CALL_GL_IMPL(GenFramebuffers)(1, &o); |
return o; |
} |
WebGLId WebGraphicsContext3DCommandBufferImpl::createProgram() { |
- makeContextCurrent(); |
- return glCreateProgram(); |
+ localMakeContextCurrent(); |
+ return CALL_GL_IMPL(CreateProgram)(); |
} |
WebGLId WebGraphicsContext3DCommandBufferImpl::createRenderbuffer() { |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
GLuint o; |
- glGenRenderbuffers(1, &o); |
+ CALL_GL_IMPL(GenRenderbuffers)(1, &o); |
return o; |
} |
DELEGATE_TO_GL_1R(createShader, CreateShader, WGC3Denum, WebGLId); |
WebGLId WebGraphicsContext3DCommandBufferImpl::createTexture() { |
- makeContextCurrent(); |
+ localMakeContextCurrent(); |
GLuint o; |
- glGenTextures(1, &o); |
+ CALL_GL_IMPL(GenTextures)(1, &o); |
return o; |
} |
void WebGraphicsContext3DCommandBufferImpl::deleteBuffer(WebGLId buffer) { |
- makeContextCurrent(); |
- glDeleteBuffers(1, &buffer); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(DeleteBuffers)(1, &buffer); |
} |
void WebGraphicsContext3DCommandBufferImpl::deleteFramebuffer( |
WebGLId framebuffer) { |
- makeContextCurrent(); |
- glDeleteFramebuffers(1, &framebuffer); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(DeleteFramebuffers)(1, &framebuffer); |
} |
void WebGraphicsContext3DCommandBufferImpl::deleteProgram(WebGLId program) { |
- makeContextCurrent(); |
- glDeleteProgram(program); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(DeleteProgram)(program); |
} |
void WebGraphicsContext3DCommandBufferImpl::deleteRenderbuffer( |
WebGLId renderbuffer) { |
- makeContextCurrent(); |
- glDeleteRenderbuffers(1, &renderbuffer); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(DeleteRenderbuffers)(1, &renderbuffer); |
} |
void WebGraphicsContext3DCommandBufferImpl::deleteShader(WebGLId shader) { |
- makeContextCurrent(); |
- glDeleteShader(shader); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(DeleteShader)(shader); |
} |
void WebGraphicsContext3DCommandBufferImpl::deleteTexture(WebGLId texture) { |
- makeContextCurrent(); |
- glDeleteTextures(1, &texture); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(DeleteTextures)(1, &texture); |
} |
void WebGraphicsContext3DCommandBufferImpl::copyTextureToCompositor( |
WebGLId texture, WebGLId parentTexture) { |
TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::copyTextureToCompositor"); |
- makeContextCurrent(); |
- glCopyTextureToParentTextureCHROMIUM(texture, parentTexture); |
- glFlush(); |
+ localMakeContextCurrent(); |
+ CALL_GL_IMPL(CopyTextureToParentTextureCHROMIUM)(texture, parentTexture); |
+ CALL_GL_IMPL(Flush)(); |
} |
void WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete() { |