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
3 // found in the LICENSE file.
5 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
8 #ifndef GL_GLEXT_PROTOTYPES
9 #define GL_GLEXT_PROTOTYPES 1
11 #include <GLES2/gl2ext.h>
12 #include <GLES2/gl2extchromium.h>
16 #include "base/atomicops.h"
17 #include "base/bind.h"
18 #include "base/bind_helpers.h"
19 #include "base/callback.h"
20 #include "base/lazy_instance.h"
21 #include "base/logging.h"
22 #include "gpu/command_buffer/client/gl_in_process_context.h"
23 #include "gpu/command_buffer/client/gles2_implementation.h"
24 #include "gpu/command_buffer/client/gles2_lib.h"
25 #include "ui/gfx/size.h"
26 #include "ui/gl/gl_surface.h"
27 #include "webkit/common/gpu/gl_bindings_skia_cmd_buffer.h"
29 using gpu::gles2::GLES2Implementation;
30 using gpu::GLInProcessContext;
37 const int32 kCommandBufferSize = 1024 * 1024;
38 // TODO(kbr): make the transfer buffer size configurable via context
39 // creation attributes.
40 const size_t kStartTransferBufferSize = 4 * 1024 * 1024;
41 const size_t kMinTransferBufferSize = 1 * 256 * 1024;
42 const size_t kMaxTransferBufferSize = 16 * 1024 * 1024;
44 uint32_t GenFlushID() {
45 static base::subtle::Atomic32 flush_id = 0;
47 base::subtle::Atomic32 my_id = base::subtle::Barrier_AtomicIncrement(
49 return static_cast<uint32_t>(my_id);
52 // Singleton used to initialize and terminate the gles2 library.
53 class GLES2Initializer {
56 ::gles2::Initialize();
64 DISALLOW_COPY_AND_ASSIGN(GLES2Initializer);
67 static base::LazyInstance<GLES2Initializer> g_gles2_initializer =
68 LAZY_INSTANCE_INITIALIZER;
70 } // namespace anonymous
73 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
74 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
75 const WebKit::WebGraphicsContext3D::Attributes& attributes,
76 gfx::AcceleratedWidget window) {
77 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context;
78 if (gfx::GLSurface::InitializeOneOff()) {
79 context.reset(new WebGraphicsContext3DInProcessCommandBufferImpl(
80 scoped_ptr< ::gpu::GLInProcessContext>(), attributes, false, window));
82 return context.Pass();
86 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
87 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
88 const WebKit::WebGraphicsContext3D::Attributes& attributes) {
89 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl(
90 scoped_ptr< ::gpu::GLInProcessContext>(),
93 gfx::kNullAcceleratedWidget))
97 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
98 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext(
99 scoped_ptr< ::gpu::GLInProcessContext> context,
100 const WebKit::WebGraphicsContext3D::Attributes& attributes) {
101 return make_scoped_ptr(
102 new WebGraphicsContext3DInProcessCommandBufferImpl(
105 true /* is_offscreen. Not used. */,
106 gfx::kNullAcceleratedWidget /* window. Not used. */))
110 WebGraphicsContext3DInProcessCommandBufferImpl::
111 WebGraphicsContext3DInProcessCommandBufferImpl(
112 scoped_ptr< ::gpu::GLInProcessContext> context,
113 const WebKit::WebGraphicsContext3D::Attributes& attributes,
115 gfx::AcceleratedWidget window)
116 : is_offscreen_(is_offscreen),
119 initialize_failed_(false),
120 context_(context.Pass()),
122 context_lost_callback_(NULL),
123 context_lost_reason_(GL_NO_ERROR),
124 attributes_(attributes),
128 WebGraphicsContext3DInProcessCommandBufferImpl::
129 ~WebGraphicsContext3DInProcessCommandBufferImpl() {
133 void WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes(
134 const WebKit::WebGraphicsContext3D::Attributes& attributes,
135 ::gpu::GLInProcessContextAttribs* output_attribs) {
136 output_attribs->alpha_size = attributes.alpha ? 8 : 0;
137 output_attribs->depth_size = attributes.depth ? 24 : 0;
138 output_attribs->stencil_size = attributes.stencil ? 8 : 0;
139 output_attribs->samples = attributes.antialias ? 4 : 0;
140 output_attribs->sample_buffers = attributes.antialias ? 1 : 0;
143 bool WebGraphicsContext3DInProcessCommandBufferImpl::MaybeInitializeGL() {
147 if (initialize_failed_)
150 // Ensure the gles2 library is initialized first in a thread safe way.
151 g_gles2_initializer.Get();
154 // TODO(kbr): More work will be needed in this implementation to
155 // properly support GPU switching. Like in the out-of-process
156 // command buffer implementation, all previously created contexts
157 // will need to be lost either when the first context requesting the
158 // discrete GPU is created, or the last one is destroyed.
159 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu;
161 ::gpu::GLInProcessContextAttribs attrib_struct;
162 ConvertAttributes(attributes_, &attrib_struct),
164 context_.reset(GLInProcessContext::CreateContext(
168 attributes_.shareResources,
174 base::Closure context_lost_callback = base::Bind(
175 &WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost,
176 base::Unretained(this));
177 context_->SetContextLostCallback(context_lost_callback);
179 initialize_failed_ = true;
183 gl_ = context_->GetImplementation();
185 if (gl_ && attributes_.noExtensions)
186 gl_->EnableFeatureCHROMIUM("webgl_enable_glsl_webgl_validation");
188 // Set attributes_ from created offscreen context.
190 GLint alpha_bits = 0;
191 getIntegerv(GL_ALPHA_BITS, &alpha_bits);
192 attributes_.alpha = alpha_bits > 0;
193 GLint depth_bits = 0;
194 getIntegerv(GL_DEPTH_BITS, &depth_bits);
195 attributes_.depth = depth_bits > 0;
196 GLint stencil_bits = 0;
197 getIntegerv(GL_STENCIL_BITS, &stencil_bits);
198 attributes_.stencil = stencil_bits > 0;
199 GLint sample_buffers = 0;
200 getIntegerv(GL_SAMPLE_BUFFERS, &sample_buffers);
201 attributes_.antialias = sample_buffers > 0;
208 bool WebGraphicsContext3DInProcessCommandBufferImpl::makeContextCurrent() {
209 if (!MaybeInitializeGL())
211 ::gles2::SetGLContext(gl_);
212 return context_ && !isContextLost();
215 uint32_t WebGraphicsContext3DInProcessCommandBufferImpl::lastFlushID() {
219 void WebGraphicsContext3DInProcessCommandBufferImpl::ClearContext() {
220 // NOTE: Comment in the line below to check for code that is not calling
221 // eglMakeCurrent where appropriate. The issue is code using
222 // WebGraphicsContext3D does not need to call makeContextCurrent. Code using
223 // direct OpenGL bindings needs to call the appropriate form of
224 // eglMakeCurrent. If it doesn't it will be issuing commands on the wrong
225 // context. Uncommenting the line below clears the current context so that
226 // any code not calling eglMakeCurrent in the appropriate place should crash.
227 // This is not a perfect test but generally code that used the direct OpenGL
228 // bindings should not be mixed with code that uses WebGraphicsContext3D.
230 // GLInProcessContext::MakeCurrent(NULL);
233 // Helper macros to reduce the amount of code.
235 #define DELEGATE_TO_GL(name, glname) \
236 void WebGraphicsContext3DInProcessCommandBufferImpl::name() { \
241 #define DELEGATE_TO_GL_R(name, glname, rt) \
242 rt WebGraphicsContext3DInProcessCommandBufferImpl::name() { \
244 return gl_->glname(); \
247 #define DELEGATE_TO_GL_1(name, glname, t1) \
248 void WebGraphicsContext3DInProcessCommandBufferImpl::name(t1 a1) { \
253 #define DELEGATE_TO_GL_1R(name, glname, t1, rt) \
254 rt WebGraphicsContext3DInProcessCommandBufferImpl::name(t1 a1) { \
256 return gl_->glname(a1); \
259 #define DELEGATE_TO_GL_1RB(name, glname, t1, rt) \
260 rt WebGraphicsContext3DInProcessCommandBufferImpl::name(t1 a1) { \
262 return gl_->glname(a1) ? true : false; \
265 #define DELEGATE_TO_GL_2(name, glname, t1, t2) \
266 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \
269 gl_->glname(a1, a2); \
272 #define DELEGATE_TO_GL_2R(name, glname, t1, t2, rt) \
273 rt WebGraphicsContext3DInProcessCommandBufferImpl::name(t1 a1, t2 a2) { \
275 return gl_->glname(a1, a2); \
278 #define DELEGATE_TO_GL_3(name, glname, t1, t2, t3) \
279 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \
280 t1 a1, t2 a2, t3 a3) { \
282 gl_->glname(a1, a2, a3); \
285 #define DELEGATE_TO_GL_3R(name, glname, t1, t2, t3, rt) \
286 rt WebGraphicsContext3DInProcessCommandBufferImpl::name( \
287 t1 a1, t2 a2, t3 a3) { \
289 return gl_->glname(a1, a2, a3); \
292 #define DELEGATE_TO_GL_4(name, glname, t1, t2, t3, t4) \
293 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \
294 t1 a1, t2 a2, t3 a3, t4 a4) { \
296 gl_->glname(a1, a2, a3, a4); \
299 #define DELEGATE_TO_GL_5(name, glname, t1, t2, t3, t4, t5) \
300 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \
301 t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) { \
303 gl_->glname(a1, a2, a3, a4, a5); \
306 #define DELEGATE_TO_GL_6(name, glname, t1, t2, t3, t4, t5, t6) \
307 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \
308 t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) { \
310 gl_->glname(a1, a2, a3, a4, a5, a6); \
313 #define DELEGATE_TO_GL_7(name, glname, t1, t2, t3, t4, t5, t6, t7) \
314 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \
315 t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7) { \
317 gl_->glname(a1, a2, a3, a4, a5, a6, a7); \
320 #define DELEGATE_TO_GL_8(name, glname, t1, t2, t3, t4, t5, t6, t7, t8) \
321 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \
322 t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8) { \
324 gl_->glname(a1, a2, a3, a4, a5, a6, a7, a8); \
327 #define DELEGATE_TO_GL_9(name, glname, t1, t2, t3, t4, t5, t6, t7, t8, t9) \
328 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \
329 t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8, t9 a9) { \
331 gl_->glname(a1, a2, a3, a4, a5, a6, a7, a8, a9); \
334 void WebGraphicsContext3DInProcessCommandBufferImpl::prepareTexture() {
335 if (!isContextLost()) {
337 gl_->ShallowFlushCHROMIUM();
341 void WebGraphicsContext3DInProcessCommandBufferImpl::postSubBufferCHROMIUM(
342 int x, int y, int width, int height) {
343 gl_->PostSubBufferCHROMIUM(x, y, width, height);
346 DELEGATE_TO_GL_3(reshapeWithScaleFactor, ResizeCHROMIUM, int, int, float)
348 void WebGraphicsContext3DInProcessCommandBufferImpl::synthesizeGLError(
350 if (std::find(synthetic_errors_.begin(), synthetic_errors_.end(), error) ==
351 synthetic_errors_.end()) {
352 synthetic_errors_.push_back(error);
356 void* WebGraphicsContext3DInProcessCommandBufferImpl::mapBufferSubDataCHROMIUM(
362 return gl_->MapBufferSubDataCHROMIUM(target, offset, size, access);
365 void WebGraphicsContext3DInProcessCommandBufferImpl::unmapBufferSubDataCHROMIUM(
368 return gl_->UnmapBufferSubDataCHROMIUM(mem);
371 void* WebGraphicsContext3DInProcessCommandBufferImpl::mapTexSubImage2DCHROMIUM(
382 return gl_->MapTexSubImage2DCHROMIUM(
383 target, level, xoffset, yoffset, width, height, format, type, access);
386 void WebGraphicsContext3DInProcessCommandBufferImpl::unmapTexSubImage2DCHROMIUM(
389 gl_->UnmapTexSubImage2DCHROMIUM(mem);
392 void WebGraphicsContext3DInProcessCommandBufferImpl::setVisibilityCHROMIUM(
396 void WebGraphicsContext3DInProcessCommandBufferImpl::discardFramebufferEXT(
397 WGC3Denum target, WGC3Dsizei numAttachments, const WGC3Denum* attachments) {
398 gl_->DiscardFramebufferEXT(target, numAttachments, attachments);
401 void WebGraphicsContext3DInProcessCommandBufferImpl::
402 discardBackbufferCHROMIUM() {
405 void WebGraphicsContext3DInProcessCommandBufferImpl::
406 ensureBackbufferCHROMIUM() {
409 void WebGraphicsContext3DInProcessCommandBufferImpl::
410 copyTextureToParentTextureCHROMIUM(WebGLId texture, WebGLId parentTexture) {
414 void WebGraphicsContext3DInProcessCommandBufferImpl::
415 rateLimitOffscreenContextCHROMIUM() {
416 // TODO(gmam): See if we can comment this in.
418 gl_->RateLimitOffscreenContextCHROMIUM();
421 WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl::
422 getRequestableExtensionsCHROMIUM() {
423 // TODO(gmam): See if we can comment this in.
425 return WebKit::WebString::fromUTF8(
426 gl_->GetRequestableExtensionsCHROMIUM());
429 void WebGraphicsContext3DInProcessCommandBufferImpl::requestExtensionCHROMIUM(
430 const char* extension) {
431 // TODO(gmam): See if we can comment this in.
433 gl_->RequestExtensionCHROMIUM(extension);
436 void WebGraphicsContext3DInProcessCommandBufferImpl::blitFramebufferCHROMIUM(
437 WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1,
438 WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1,
439 WGC3Dbitfield mask, WGC3Denum filter) {
441 gl_->BlitFramebufferEXT(
442 srcX0, srcY0, srcX1, srcY1,
443 dstX0, dstY0, dstX1, dstY1,
447 void WebGraphicsContext3DInProcessCommandBufferImpl::
448 renderbufferStorageMultisampleCHROMIUM(
449 WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat,
450 WGC3Dsizei width, WGC3Dsizei height) {
452 gl_->RenderbufferStorageMultisampleEXT(
453 target, samples, internalformat, width, height);
456 DELEGATE_TO_GL_1(activeTexture, ActiveTexture, WGC3Denum)
458 DELEGATE_TO_GL_2(attachShader, AttachShader, WebGLId, WebGLId)
460 DELEGATE_TO_GL_3(bindAttribLocation, BindAttribLocation, WebGLId,
461 WGC3Duint, const WGC3Dchar*)
463 DELEGATE_TO_GL_2(bindBuffer, BindBuffer, WGC3Denum, WebGLId)
465 void WebGraphicsContext3DInProcessCommandBufferImpl::bindFramebuffer(
467 WebGLId framebuffer) {
469 gl_->BindFramebuffer(target, framebuffer);
472 DELEGATE_TO_GL_2(bindRenderbuffer, BindRenderbuffer, WGC3Denum, WebGLId)
474 DELEGATE_TO_GL_2(bindTexture, BindTexture, WGC3Denum, WebGLId)
476 DELEGATE_TO_GL_4(blendColor, BlendColor,
477 WGC3Dclampf, WGC3Dclampf, WGC3Dclampf, WGC3Dclampf)
479 DELEGATE_TO_GL_1(blendEquation, BlendEquation, WGC3Denum)
481 DELEGATE_TO_GL_2(blendEquationSeparate, BlendEquationSeparate,
482 WGC3Denum, WGC3Denum)
484 DELEGATE_TO_GL_2(blendFunc, BlendFunc, WGC3Denum, WGC3Denum)
486 DELEGATE_TO_GL_4(blendFuncSeparate, BlendFuncSeparate,
487 WGC3Denum, WGC3Denum, WGC3Denum, WGC3Denum)
489 DELEGATE_TO_GL_4(bufferData, BufferData,
490 WGC3Denum, WGC3Dsizeiptr, const void*, WGC3Denum)
492 DELEGATE_TO_GL_4(bufferSubData, BufferSubData,
493 WGC3Denum, WGC3Dintptr, WGC3Dsizeiptr, const void*)
495 DELEGATE_TO_GL_1R(checkFramebufferStatus, CheckFramebufferStatus,
496 WGC3Denum, WGC3Denum)
498 DELEGATE_TO_GL_1(clear, Clear, WGC3Dbitfield)
500 DELEGATE_TO_GL_4(clearColor, ClearColor,
501 WGC3Dclampf, WGC3Dclampf, WGC3Dclampf, WGC3Dclampf)
503 DELEGATE_TO_GL_1(clearDepth, ClearDepthf, WGC3Dclampf)
505 DELEGATE_TO_GL_1(clearStencil, ClearStencil, WGC3Dint)
507 DELEGATE_TO_GL_4(colorMask, ColorMask,
508 WGC3Dboolean, WGC3Dboolean, WGC3Dboolean, WGC3Dboolean)
510 DELEGATE_TO_GL_1(compileShader, CompileShader, WebGLId)
512 DELEGATE_TO_GL_8(compressedTexImage2D, CompressedTexImage2D,
513 WGC3Denum, WGC3Dint, WGC3Denum, WGC3Dint, WGC3Dint,
514 WGC3Dsizei, WGC3Dsizei, const void*)
516 DELEGATE_TO_GL_9(compressedTexSubImage2D, CompressedTexSubImage2D,
517 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint,
518 WGC3Denum, WGC3Dsizei, const void*)
520 DELEGATE_TO_GL_8(copyTexImage2D, CopyTexImage2D,
521 WGC3Denum, WGC3Dint, WGC3Denum, WGC3Dint, WGC3Dint,
522 WGC3Dsizei, WGC3Dsizei, WGC3Dint)
524 DELEGATE_TO_GL_8(copyTexSubImage2D, CopyTexSubImage2D,
525 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint,
526 WGC3Dsizei, WGC3Dsizei)
528 DELEGATE_TO_GL_1(cullFace, CullFace, WGC3Denum)
530 DELEGATE_TO_GL_1(depthFunc, DepthFunc, WGC3Denum)
532 DELEGATE_TO_GL_1(depthMask, DepthMask, WGC3Dboolean)
534 DELEGATE_TO_GL_2(depthRange, DepthRangef, WGC3Dclampf, WGC3Dclampf)
536 DELEGATE_TO_GL_2(detachShader, DetachShader, WebGLId, WebGLId)
538 DELEGATE_TO_GL_1(disable, Disable, WGC3Denum)
540 DELEGATE_TO_GL_1(disableVertexAttribArray, DisableVertexAttribArray,
543 DELEGATE_TO_GL_3(drawArrays, DrawArrays, WGC3Denum, WGC3Dint, WGC3Dsizei)
545 void WebGraphicsContext3DInProcessCommandBufferImpl::drawElements(
549 WGC3Dintptr offset) {
553 reinterpret_cast<void*>(static_cast<intptr_t>(offset)));
556 DELEGATE_TO_GL_1(enable, Enable, WGC3Denum)
558 DELEGATE_TO_GL_1(enableVertexAttribArray, EnableVertexAttribArray,
561 void WebGraphicsContext3DInProcessCommandBufferImpl::finish() {
562 flush_id_ = GenFlushID();
566 void WebGraphicsContext3DInProcessCommandBufferImpl::flush() {
567 flush_id_ = GenFlushID();
571 DELEGATE_TO_GL_4(framebufferRenderbuffer, FramebufferRenderbuffer,
572 WGC3Denum, WGC3Denum, WGC3Denum, WebGLId)
574 DELEGATE_TO_GL_5(framebufferTexture2D, FramebufferTexture2D,
575 WGC3Denum, WGC3Denum, WGC3Denum, WebGLId, WGC3Dint)
577 DELEGATE_TO_GL_1(frontFace, FrontFace, WGC3Denum)
579 DELEGATE_TO_GL_1(generateMipmap, GenerateMipmap, WGC3Denum)
581 bool WebGraphicsContext3DInProcessCommandBufferImpl::getActiveAttrib(
582 WebGLId program, WGC3Duint index, ActiveInfo& info) {
585 synthesizeGLError(GL_INVALID_VALUE);
588 GLint max_name_length = -1;
590 program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max_name_length);
591 if (max_name_length < 0)
593 scoped_ptr<GLchar[]> name(new GLchar[max_name_length]);
595 synthesizeGLError(GL_OUT_OF_MEMORY);
601 gl_->GetActiveAttrib(
602 program, index, max_name_length, &length, &size, &type, name.get());
606 info.name = WebKit::WebString::fromUTF8(name.get(), length);
612 bool WebGraphicsContext3DInProcessCommandBufferImpl::getActiveUniform(
613 WebGLId program, WGC3Duint index, ActiveInfo& info) {
615 GLint max_name_length = -1;
617 program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max_name_length);
618 if (max_name_length < 0)
620 scoped_ptr<GLchar[]> name(new GLchar[max_name_length]);
622 synthesizeGLError(GL_OUT_OF_MEMORY);
628 gl_->GetActiveUniform(
629 program, index, max_name_length, &length, &size, &type, name.get());
633 info.name = WebKit::WebString::fromUTF8(name.get(), length);
639 DELEGATE_TO_GL_4(getAttachedShaders, GetAttachedShaders,
640 WebGLId, WGC3Dsizei, WGC3Dsizei*, WebGLId*)
642 DELEGATE_TO_GL_2R(getAttribLocation, GetAttribLocation,
643 WebGLId, const WGC3Dchar*, WGC3Dint)
645 DELEGATE_TO_GL_2(getBooleanv, GetBooleanv, WGC3Denum, WGC3Dboolean*)
647 DELEGATE_TO_GL_3(getBufferParameteriv, GetBufferParameteriv,
648 WGC3Denum, WGC3Denum, WGC3Dint*)
650 WebKit::WebGraphicsContext3D::Attributes
651 WebGraphicsContext3DInProcessCommandBufferImpl::getContextAttributes() {
655 WGC3Denum WebGraphicsContext3DInProcessCommandBufferImpl::getError() {
657 if (!synthetic_errors_.empty()) {
658 std::vector<WGC3Denum>::iterator iter = synthetic_errors_.begin();
659 WGC3Denum err = *iter;
660 synthetic_errors_.erase(iter);
664 return gl_->GetError();
667 bool WebGraphicsContext3DInProcessCommandBufferImpl::isContextLost() {
668 return context_lost_reason_ != GL_NO_ERROR;
671 DELEGATE_TO_GL_2(getFloatv, GetFloatv, WGC3Denum, WGC3Dfloat*)
673 DELEGATE_TO_GL_4(getFramebufferAttachmentParameteriv,
674 GetFramebufferAttachmentParameteriv,
675 WGC3Denum, WGC3Denum, WGC3Denum, WGC3Dint*)
677 DELEGATE_TO_GL_2(getIntegerv, GetIntegerv, WGC3Denum, WGC3Dint*)
679 DELEGATE_TO_GL_3(getProgramiv, GetProgramiv, WebGLId, WGC3Denum, WGC3Dint*)
681 WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl::
682 getProgramInfoLog(WebGLId program) {
685 gl_->GetProgramiv(program, GL_INFO_LOG_LENGTH, &logLength);
687 return WebKit::WebString();
688 scoped_ptr<GLchar[]> log(new GLchar[logLength]);
690 return WebKit::WebString();
691 GLsizei returnedLogLength = 0;
692 gl_->GetProgramInfoLog(
693 program, logLength, &returnedLogLength, log.get());
694 DCHECK_EQ(logLength, returnedLogLength + 1);
695 WebKit::WebString res =
696 WebKit::WebString::fromUTF8(log.get(), returnedLogLength);
700 DELEGATE_TO_GL_3(getRenderbufferParameteriv, GetRenderbufferParameteriv,
701 WGC3Denum, WGC3Denum, WGC3Dint*)
703 DELEGATE_TO_GL_3(getShaderiv, GetShaderiv, WebGLId, WGC3Denum, WGC3Dint*)
705 WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl::
706 getShaderInfoLog(WebGLId shader) {
709 gl_->GetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength);
711 return WebKit::WebString();
712 scoped_ptr<GLchar[]> log(new GLchar[logLength]);
714 return WebKit::WebString();
715 GLsizei returnedLogLength = 0;
716 gl_->GetShaderInfoLog(
717 shader, logLength, &returnedLogLength, log.get());
718 DCHECK_EQ(logLength, returnedLogLength + 1);
719 WebKit::WebString res =
720 WebKit::WebString::fromUTF8(log.get(), returnedLogLength);
724 DELEGATE_TO_GL_4(getShaderPrecisionFormat, GetShaderPrecisionFormat,
725 WGC3Denum, WGC3Denum, WGC3Dint*, WGC3Dint*)
727 WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl::
728 getShaderSource(WebGLId shader) {
731 gl_->GetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &logLength);
733 return WebKit::WebString();
734 scoped_ptr<GLchar[]> log(new GLchar[logLength]);
736 return WebKit::WebString();
737 GLsizei returnedLogLength = 0;
738 gl_->GetShaderSource(
739 shader, logLength, &returnedLogLength, log.get());
740 if (!returnedLogLength)
741 return WebKit::WebString();
742 DCHECK_EQ(logLength, returnedLogLength + 1);
743 WebKit::WebString res =
744 WebKit::WebString::fromUTF8(log.get(), returnedLogLength);
748 WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl::
749 getTranslatedShaderSourceANGLE(WebGLId shader) {
753 shader, GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, &logLength);
755 return WebKit::WebString();
756 scoped_ptr<GLchar[]> log(new GLchar[logLength]);
758 return WebKit::WebString();
759 GLsizei returnedLogLength = 0;
760 gl_->GetTranslatedShaderSourceANGLE(
761 shader, logLength, &returnedLogLength, log.get());
762 if (!returnedLogLength)
763 return WebKit::WebString();
764 DCHECK_EQ(logLength, returnedLogLength + 1);
765 WebKit::WebString res =
766 WebKit::WebString::fromUTF8(log.get(), returnedLogLength);
770 WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl::getString(
773 return WebKit::WebString::fromUTF8(
774 reinterpret_cast<const char*>(gl_->GetString(name)));
777 DELEGATE_TO_GL_3(getTexParameterfv, GetTexParameterfv,
778 WGC3Denum, WGC3Denum, WGC3Dfloat*)
780 DELEGATE_TO_GL_3(getTexParameteriv, GetTexParameteriv,
781 WGC3Denum, WGC3Denum, WGC3Dint*)
783 DELEGATE_TO_GL_3(getUniformfv, GetUniformfv, WebGLId, WGC3Dint, WGC3Dfloat*)
785 DELEGATE_TO_GL_3(getUniformiv, GetUniformiv, WebGLId, WGC3Dint, WGC3Dint*)
787 DELEGATE_TO_GL_2R(getUniformLocation, GetUniformLocation,
788 WebGLId, const WGC3Dchar*, WGC3Dint)
790 DELEGATE_TO_GL_3(getVertexAttribfv, GetVertexAttribfv,
791 WGC3Duint, WGC3Denum, WGC3Dfloat*)
793 DELEGATE_TO_GL_3(getVertexAttribiv, GetVertexAttribiv,
794 WGC3Duint, WGC3Denum, WGC3Dint*)
796 WGC3Dsizeiptr WebGraphicsContext3DInProcessCommandBufferImpl::
797 getVertexAttribOffset(WGC3Duint index, WGC3Denum pname) {
799 GLvoid* value = NULL;
800 // NOTE: If pname is ever a value that returns more then 1 element
801 // this will corrupt memory.
802 gl_->GetVertexAttribPointerv(index, pname, &value);
803 return static_cast<WGC3Dsizeiptr>(reinterpret_cast<intptr_t>(value));
806 DELEGATE_TO_GL_2(hint, Hint, WGC3Denum, WGC3Denum)
808 DELEGATE_TO_GL_1RB(isBuffer, IsBuffer, WebGLId, WGC3Dboolean)
810 DELEGATE_TO_GL_1RB(isEnabled, IsEnabled, WGC3Denum, WGC3Dboolean)
812 DELEGATE_TO_GL_1RB(isFramebuffer, IsFramebuffer, WebGLId, WGC3Dboolean)
814 DELEGATE_TO_GL_1RB(isProgram, IsProgram, WebGLId, WGC3Dboolean)
816 DELEGATE_TO_GL_1RB(isRenderbuffer, IsRenderbuffer, WebGLId, WGC3Dboolean)
818 DELEGATE_TO_GL_1RB(isShader, IsShader, WebGLId, WGC3Dboolean)
820 DELEGATE_TO_GL_1RB(isTexture, IsTexture, WebGLId, WGC3Dboolean)
822 DELEGATE_TO_GL_1(lineWidth, LineWidth, WGC3Dfloat)
824 DELEGATE_TO_GL_1(linkProgram, LinkProgram, WebGLId)
826 DELEGATE_TO_GL_2(pixelStorei, PixelStorei, WGC3Denum, WGC3Dint)
828 DELEGATE_TO_GL_2(polygonOffset, PolygonOffset, WGC3Dfloat, WGC3Dfloat)
830 DELEGATE_TO_GL_7(readPixels, ReadPixels,
831 WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, WGC3Denum,
834 void WebGraphicsContext3DInProcessCommandBufferImpl::releaseShaderCompiler() {
838 DELEGATE_TO_GL_4(renderbufferStorage, RenderbufferStorage,
839 WGC3Denum, WGC3Denum, WGC3Dsizei, WGC3Dsizei)
841 DELEGATE_TO_GL_2(sampleCoverage, SampleCoverage, WGC3Dfloat, WGC3Dboolean)
843 DELEGATE_TO_GL_4(scissor, Scissor, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei)
845 void WebGraphicsContext3DInProcessCommandBufferImpl::shaderSource(
846 WebGLId shader, const WGC3Dchar* string) {
848 GLint length = strlen(string);
849 gl_->ShaderSource(shader, 1, &string, &length);
852 DELEGATE_TO_GL_3(stencilFunc, StencilFunc, WGC3Denum, WGC3Dint, WGC3Duint)
854 DELEGATE_TO_GL_4(stencilFuncSeparate, StencilFuncSeparate,
855 WGC3Denum, WGC3Denum, WGC3Dint, WGC3Duint)
857 DELEGATE_TO_GL_1(stencilMask, StencilMask, WGC3Duint)
859 DELEGATE_TO_GL_2(stencilMaskSeparate, StencilMaskSeparate,
860 WGC3Denum, WGC3Duint)
862 DELEGATE_TO_GL_3(stencilOp, StencilOp,
863 WGC3Denum, WGC3Denum, WGC3Denum)
865 DELEGATE_TO_GL_4(stencilOpSeparate, StencilOpSeparate,
866 WGC3Denum, WGC3Denum, WGC3Denum, WGC3Denum)
868 DELEGATE_TO_GL_9(texImage2D, TexImage2D,
869 WGC3Denum, WGC3Dint, WGC3Denum, WGC3Dsizei, WGC3Dsizei,
870 WGC3Dint, WGC3Denum, WGC3Denum, const void*)
872 DELEGATE_TO_GL_3(texParameterf, TexParameterf,
873 WGC3Denum, WGC3Denum, WGC3Dfloat);
875 static const unsigned int kTextureWrapR = 0x8072;
877 void WebGraphicsContext3DInProcessCommandBufferImpl::texParameteri(
878 WGC3Denum target, WGC3Denum pname, WGC3Dint param) {
880 // TODO(kbr): figure out whether the setting of TEXTURE_WRAP_R in
881 // GraphicsContext3D.cpp is strictly necessary to avoid seams at the
882 // edge of cube maps, and, if it is, push it into the GLES2 service
884 if (pname == kTextureWrapR) {
887 gl_->TexParameteri(target, pname, param);
890 DELEGATE_TO_GL_9(texSubImage2D, TexSubImage2D,
891 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei,
892 WGC3Dsizei, WGC3Denum, WGC3Denum, const void*)
894 DELEGATE_TO_GL_2(uniform1f, Uniform1f, WGC3Dint, WGC3Dfloat)
896 DELEGATE_TO_GL_3(uniform1fv, Uniform1fv, WGC3Dint, WGC3Dsizei,
899 DELEGATE_TO_GL_2(uniform1i, Uniform1i, WGC3Dint, WGC3Dint)
901 DELEGATE_TO_GL_3(uniform1iv, Uniform1iv, WGC3Dint, WGC3Dsizei, const WGC3Dint*)
903 DELEGATE_TO_GL_3(uniform2f, Uniform2f, WGC3Dint, WGC3Dfloat, WGC3Dfloat)
905 DELEGATE_TO_GL_3(uniform2fv, Uniform2fv, WGC3Dint, WGC3Dsizei,
908 DELEGATE_TO_GL_3(uniform2i, Uniform2i, WGC3Dint, WGC3Dint, WGC3Dint)
910 DELEGATE_TO_GL_3(uniform2iv, Uniform2iv, WGC3Dint, WGC3Dsizei, const WGC3Dint*)
912 DELEGATE_TO_GL_4(uniform3f, Uniform3f, WGC3Dint,
913 WGC3Dfloat, WGC3Dfloat, WGC3Dfloat)
915 DELEGATE_TO_GL_3(uniform3fv, Uniform3fv, WGC3Dint, WGC3Dsizei,
918 DELEGATE_TO_GL_4(uniform3i, Uniform3i, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint)
920 DELEGATE_TO_GL_3(uniform3iv, Uniform3iv, WGC3Dint, WGC3Dsizei, const WGC3Dint*)
922 DELEGATE_TO_GL_5(uniform4f, Uniform4f, WGC3Dint,
923 WGC3Dfloat, WGC3Dfloat, WGC3Dfloat, WGC3Dfloat)
925 DELEGATE_TO_GL_3(uniform4fv, Uniform4fv, WGC3Dint, WGC3Dsizei,
928 DELEGATE_TO_GL_5(uniform4i, Uniform4i, WGC3Dint,
929 WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint)
931 DELEGATE_TO_GL_3(uniform4iv, Uniform4iv, WGC3Dint, WGC3Dsizei, const WGC3Dint*)
933 DELEGATE_TO_GL_4(uniformMatrix2fv, UniformMatrix2fv,
934 WGC3Dint, WGC3Dsizei, WGC3Dboolean, const WGC3Dfloat*)
936 DELEGATE_TO_GL_4(uniformMatrix3fv, UniformMatrix3fv,
937 WGC3Dint, WGC3Dsizei, WGC3Dboolean, const WGC3Dfloat*)
939 DELEGATE_TO_GL_4(uniformMatrix4fv, UniformMatrix4fv,
940 WGC3Dint, WGC3Dsizei, WGC3Dboolean, const WGC3Dfloat*)
942 DELEGATE_TO_GL_1(useProgram, UseProgram, WebGLId)
944 DELEGATE_TO_GL_1(validateProgram, ValidateProgram, WebGLId)
946 DELEGATE_TO_GL_2(vertexAttrib1f, VertexAttrib1f, WGC3Duint, WGC3Dfloat)
948 DELEGATE_TO_GL_2(vertexAttrib1fv, VertexAttrib1fv, WGC3Duint,
951 DELEGATE_TO_GL_3(vertexAttrib2f, VertexAttrib2f, WGC3Duint,
952 WGC3Dfloat, WGC3Dfloat)
954 DELEGATE_TO_GL_2(vertexAttrib2fv, VertexAttrib2fv, WGC3Duint,
957 DELEGATE_TO_GL_4(vertexAttrib3f, VertexAttrib3f, WGC3Duint,
958 WGC3Dfloat, WGC3Dfloat, WGC3Dfloat)
960 DELEGATE_TO_GL_2(vertexAttrib3fv, VertexAttrib3fv, WGC3Duint,
963 DELEGATE_TO_GL_5(vertexAttrib4f, VertexAttrib4f, WGC3Duint,
964 WGC3Dfloat, WGC3Dfloat, WGC3Dfloat, WGC3Dfloat)
966 DELEGATE_TO_GL_2(vertexAttrib4fv, VertexAttrib4fv, WGC3Duint,
969 void WebGraphicsContext3DInProcessCommandBufferImpl::vertexAttribPointer(
970 WGC3Duint index, WGC3Dint size, WGC3Denum type, WGC3Dboolean normalized,
971 WGC3Dsizei stride, WGC3Dintptr offset) {
973 gl_->VertexAttribPointer(
974 index, size, type, normalized, stride,
975 reinterpret_cast<void*>(static_cast<intptr_t>(offset)));
978 DELEGATE_TO_GL_4(viewport, Viewport,
979 WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei)
981 DELEGATE_TO_GL_2(genBuffers, GenBuffers, WGC3Dsizei, WebGLId*);
983 DELEGATE_TO_GL_2(genFramebuffers, GenFramebuffers, WGC3Dsizei, WebGLId*);
985 DELEGATE_TO_GL_2(genRenderbuffers, GenRenderbuffers, WGC3Dsizei, WebGLId*);
987 DELEGATE_TO_GL_2(genTextures, GenTextures, WGC3Dsizei, WebGLId*);
989 DELEGATE_TO_GL_2(deleteBuffers, DeleteBuffers, WGC3Dsizei, WebGLId*);
991 DELEGATE_TO_GL_2(deleteFramebuffers, DeleteFramebuffers, WGC3Dsizei, WebGLId*);
993 DELEGATE_TO_GL_2(deleteRenderbuffers, DeleteRenderbuffers, WGC3Dsizei,
996 DELEGATE_TO_GL_2(deleteTextures, DeleteTextures, WGC3Dsizei, WebGLId*);
998 WebGLId WebGraphicsContext3DInProcessCommandBufferImpl::createBuffer() {
1001 gl_->GenBuffers(1, &o);
1005 WebGLId WebGraphicsContext3DInProcessCommandBufferImpl::createFramebuffer() {
1008 gl_->GenFramebuffers(1, &o);
1012 WebGLId WebGraphicsContext3DInProcessCommandBufferImpl::createRenderbuffer() {
1015 gl_->GenRenderbuffers(1, &o);
1019 WebGLId WebGraphicsContext3DInProcessCommandBufferImpl::createTexture() {
1022 gl_->GenTextures(1, &o);
1026 void WebGraphicsContext3DInProcessCommandBufferImpl::deleteBuffer(
1029 gl_->DeleteBuffers(1, &buffer);
1032 void WebGraphicsContext3DInProcessCommandBufferImpl::deleteFramebuffer(
1033 WebGLId framebuffer) {
1035 gl_->DeleteFramebuffers(1, &framebuffer);
1038 void WebGraphicsContext3DInProcessCommandBufferImpl::deleteRenderbuffer(
1039 WebGLId renderbuffer) {
1041 gl_->DeleteRenderbuffers(1, &renderbuffer);
1044 void WebGraphicsContext3DInProcessCommandBufferImpl::deleteTexture(
1047 gl_->DeleteTextures(1, &texture);
1050 DELEGATE_TO_GL_R(createProgram, CreateProgram, WebGLId);
1052 DELEGATE_TO_GL_1R(createShader, CreateShader, WGC3Denum, WebGLId);
1054 DELEGATE_TO_GL_1(deleteProgram, DeleteProgram, WebGLId);
1056 DELEGATE_TO_GL_1(deleteShader, DeleteShader, WebGLId);
1058 void WebGraphicsContext3DInProcessCommandBufferImpl::OnSwapBuffersComplete() {
1061 void WebGraphicsContext3DInProcessCommandBufferImpl::setContextLostCallback(
1062 WebGraphicsContext3D::WebGraphicsContextLostCallback* cb) {
1063 context_lost_callback_ = cb;
1066 WGC3Denum WebGraphicsContext3DInProcessCommandBufferImpl::
1067 getGraphicsResetStatusARB() {
1068 return context_lost_reason_;
1071 DELEGATE_TO_GL_5(texImageIOSurface2DCHROMIUM, TexImageIOSurface2DCHROMIUM,
1072 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Duint, WGC3Duint)
1074 DELEGATE_TO_GL_5(texStorage2DEXT, TexStorage2DEXT,
1075 WGC3Denum, WGC3Dint, WGC3Duint, WGC3Dint, WGC3Dint)
1077 WebGLId WebGraphicsContext3DInProcessCommandBufferImpl::createQueryEXT() {
1079 gl_->GenQueriesEXT(1, &o);
1083 void WebGraphicsContext3DInProcessCommandBufferImpl::
1084 deleteQueryEXT(WebGLId query) {
1085 gl_->DeleteQueriesEXT(1, &query);
1088 DELEGATE_TO_GL_1R(isQueryEXT, IsQueryEXT, WebGLId, WGC3Dboolean)
1089 DELEGATE_TO_GL_2(beginQueryEXT, BeginQueryEXT, WGC3Denum, WebGLId)
1090 DELEGATE_TO_GL_1(endQueryEXT, EndQueryEXT, WGC3Denum)
1091 DELEGATE_TO_GL_3(getQueryivEXT, GetQueryivEXT, WGC3Denum, WGC3Denum, WGC3Dint*)
1092 DELEGATE_TO_GL_3(getQueryObjectuivEXT, GetQueryObjectuivEXT,
1093 WebGLId, WGC3Denum, WGC3Duint*)
1095 DELEGATE_TO_GL_6(copyTextureCHROMIUM, CopyTextureCHROMIUM, WGC3Denum, WGC3Duint,
1096 WGC3Duint, WGC3Dint, WGC3Denum, WGC3Denum)
1098 void WebGraphicsContext3DInProcessCommandBufferImpl::insertEventMarkerEXT(
1099 const WGC3Dchar* marker) {
1100 gl_->InsertEventMarkerEXT(0, marker);
1103 void WebGraphicsContext3DInProcessCommandBufferImpl::pushGroupMarkerEXT(
1104 const WGC3Dchar* marker) {
1105 gl_->PushGroupMarkerEXT(0, marker);
1108 DELEGATE_TO_GL(popGroupMarkerEXT, PopGroupMarkerEXT);
1110 DELEGATE_TO_GL_2(bindTexImage2DCHROMIUM, BindTexImage2DCHROMIUM,
1111 WGC3Denum, WGC3Dint)
1112 DELEGATE_TO_GL_2(releaseTexImage2DCHROMIUM, ReleaseTexImage2DCHROMIUM,
1113 WGC3Denum, WGC3Dint)
1115 DELEGATE_TO_GL_1R(createStreamTextureCHROMIUM, CreateStreamTextureCHROMIUM,
1117 DELEGATE_TO_GL_1(destroyStreamTextureCHROMIUM, DestroyStreamTextureCHROMIUM,
1120 void* WebGraphicsContext3DInProcessCommandBufferImpl::mapBufferCHROMIUM(
1121 WGC3Denum target, WGC3Denum access) {
1123 return gl_->MapBufferCHROMIUM(target, access);
1126 WGC3Dboolean WebGraphicsContext3DInProcessCommandBufferImpl::
1127 unmapBufferCHROMIUM(WGC3Denum target) {
1129 return gl_->UnmapBufferCHROMIUM(target);
1132 GrGLInterface* WebGraphicsContext3DInProcessCommandBufferImpl::
1133 createGrGLInterface() {
1134 return CreateCommandBufferSkiaGLBinding();
1137 ::gpu::ContextSupport*
1138 WebGraphicsContext3DInProcessCommandBufferImpl::GetContextSupport() {
1142 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() {
1143 // TODO(kbr): improve the precision here.
1144 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB;
1145 if (context_lost_callback_) {
1146 context_lost_callback_->onContextLost();
1150 DELEGATE_TO_GL_3R(createImageCHROMIUM, CreateImageCHROMIUM,
1151 WGC3Dsizei, WGC3Dsizei, WGC3Denum, WGC3Duint);
1153 DELEGATE_TO_GL_1(destroyImageCHROMIUM, DestroyImageCHROMIUM, WGC3Duint);
1155 DELEGATE_TO_GL_3(getImageParameterivCHROMIUM, GetImageParameterivCHROMIUM,
1156 WGC3Duint, WGC3Denum, GLint*);
1158 DELEGATE_TO_GL_2R(mapImageCHROMIUM, MapImageCHROMIUM,
1159 WGC3Duint, WGC3Denum, void*);
1161 DELEGATE_TO_GL_1(unmapImageCHROMIUM, UnmapImageCHROMIUM, WGC3Duint);
1163 DELEGATE_TO_GL_3(bindUniformLocationCHROMIUM, BindUniformLocationCHROMIUM,
1164 WebGLId, WGC3Dint, const WGC3Dchar*)
1166 void WebGraphicsContext3DInProcessCommandBufferImpl::shallowFlushCHROMIUM() {
1167 flush_id_ = GenFlushID();
1168 gl_->ShallowFlushCHROMIUM();
1171 void WebGraphicsContext3DInProcessCommandBufferImpl::shallowFinishCHROMIUM() {
1172 flush_id_ = GenFlushID();
1173 gl_->ShallowFinishCHROMIUM();
1176 DELEGATE_TO_GL_1(genMailboxCHROMIUM, GenMailboxCHROMIUM, WGC3Dbyte*)
1177 DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM,
1178 WGC3Denum, const WGC3Dbyte*)
1179 DELEGATE_TO_GL_2(consumeTextureCHROMIUM, ConsumeTextureCHROMIUM,
1180 WGC3Denum, const WGC3Dbyte*)
1182 DELEGATE_TO_GL_2(drawBuffersEXT, DrawBuffersEXT,
1183 WGC3Dsizei, const WGC3Denum*)
1185 unsigned WebGraphicsContext3DInProcessCommandBufferImpl::insertSyncPoint() {
1186 shallowFlushCHROMIUM();
1190 void WebGraphicsContext3DInProcessCommandBufferImpl::loseContextCHROMIUM(
1191 WGC3Denum current, WGC3Denum other) {
1192 gl_->LoseContextCHROMIUM(current, other);
1193 gl_->ShallowFlushCHROMIUM();
1196 DELEGATE_TO_GL_9(asyncTexImage2DCHROMIUM, AsyncTexImage2DCHROMIUM,
1197 WGC3Denum, WGC3Dint, WGC3Denum, WGC3Dsizei, WGC3Dsizei, WGC3Dint,
1198 WGC3Denum, WGC3Denum, const void*)
1200 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM,
1201 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei,
1202 WGC3Denum, WGC3Denum, const void*)
1204 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM,
1208 } // namespace webkit