| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 5 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #ifndef GL_GLEXT_PROTOTYPES | 8 #ifndef GL_GLEXT_PROTOTYPES |
| 9 #define GL_GLEXT_PROTOTYPES 1 | 9 #define GL_GLEXT_PROTOTYPES 1 |
| 10 #endif | 10 #endif |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 static base::LazyInstance<GLES2Initializer> g_gles2_initializer = | 67 static base::LazyInstance<GLES2Initializer> g_gles2_initializer = |
| 68 LAZY_INSTANCE_INITIALIZER; | 68 LAZY_INSTANCE_INITIALIZER; |
| 69 | 69 |
| 70 } // namespace anonymous | 70 } // namespace anonymous |
| 71 | 71 |
| 72 // static | 72 // static |
| 73 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 73 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
| 74 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( | 74 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( |
| 75 const WebKit::WebGraphicsContext3D::Attributes& attributes, | 75 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 76 gfx::AcceleratedWidget window) { | 76 gfx::AcceleratedWidget window) { |
| 77 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context; | 77 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context; |
| 78 if (gfx::GLSurface::InitializeOneOff()) { | 78 if (gfx::GLSurface::InitializeOneOff()) { |
| 79 context.reset(new WebGraphicsContext3DInProcessCommandBufferImpl( | 79 context.reset(new WebGraphicsContext3DInProcessCommandBufferImpl( |
| 80 scoped_ptr< ::gpu::GLInProcessContext>(), attributes, false, window)); | 80 scoped_ptr< ::gpu::GLInProcessContext>(), attributes, false, window)); |
| 81 } | 81 } |
| 82 return context.Pass(); | 82 return context.Pass(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 // static | 85 // static |
| 86 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 86 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
| 87 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( | 87 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( |
| 88 const WebKit::WebGraphicsContext3D::Attributes& attributes) { | 88 const blink::WebGraphicsContext3D::Attributes& attributes) { |
| 89 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( | 89 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( |
| 90 scoped_ptr< ::gpu::GLInProcessContext>(), | 90 scoped_ptr< ::gpu::GLInProcessContext>(), |
| 91 attributes, | 91 attributes, |
| 92 true, | 92 true, |
| 93 gfx::kNullAcceleratedWidget)) | 93 gfx::kNullAcceleratedWidget)) |
| 94 .Pass(); | 94 .Pass(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 97 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
| 98 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 98 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
| 99 scoped_ptr< ::gpu::GLInProcessContext> context, | 99 scoped_ptr< ::gpu::GLInProcessContext> context, |
| 100 const WebKit::WebGraphicsContext3D::Attributes& attributes) { | 100 const blink::WebGraphicsContext3D::Attributes& attributes) { |
| 101 return make_scoped_ptr( | 101 return make_scoped_ptr( |
| 102 new WebGraphicsContext3DInProcessCommandBufferImpl( | 102 new WebGraphicsContext3DInProcessCommandBufferImpl( |
| 103 context.Pass(), | 103 context.Pass(), |
| 104 attributes, | 104 attributes, |
| 105 true /* is_offscreen. Not used. */, | 105 true /* is_offscreen. Not used. */, |
| 106 gfx::kNullAcceleratedWidget /* window. Not used. */)) | 106 gfx::kNullAcceleratedWidget /* window. Not used. */)) |
| 107 .Pass(); | 107 .Pass(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 WebGraphicsContext3DInProcessCommandBufferImpl:: | 110 WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 111 WebGraphicsContext3DInProcessCommandBufferImpl( | 111 WebGraphicsContext3DInProcessCommandBufferImpl( |
| 112 scoped_ptr< ::gpu::GLInProcessContext> context, | 112 scoped_ptr< ::gpu::GLInProcessContext> context, |
| 113 const WebKit::WebGraphicsContext3D::Attributes& attributes, | 113 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 114 bool is_offscreen, | 114 bool is_offscreen, |
| 115 gfx::AcceleratedWidget window) | 115 gfx::AcceleratedWidget window) |
| 116 : is_offscreen_(is_offscreen), | 116 : is_offscreen_(is_offscreen), |
| 117 window_(window), | 117 window_(window), |
| 118 initialized_(false), | 118 initialized_(false), |
| 119 initialize_failed_(false), | 119 initialize_failed_(false), |
| 120 context_(context.Pass()), | 120 context_(context.Pass()), |
| 121 gl_(NULL), | 121 gl_(NULL), |
| 122 context_lost_callback_(NULL), | 122 context_lost_callback_(NULL), |
| 123 context_lost_reason_(GL_NO_ERROR), | 123 context_lost_reason_(GL_NO_ERROR), |
| 124 attributes_(attributes), | 124 attributes_(attributes), |
| 125 flush_id_(0) { | 125 flush_id_(0) { |
| 126 } | 126 } |
| 127 | 127 |
| 128 WebGraphicsContext3DInProcessCommandBufferImpl:: | 128 WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 129 ~WebGraphicsContext3DInProcessCommandBufferImpl() { | 129 ~WebGraphicsContext3DInProcessCommandBufferImpl() { |
| 130 } | 130 } |
| 131 | 131 |
| 132 // static | 132 // static |
| 133 void WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( | 133 void WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( |
| 134 const WebKit::WebGraphicsContext3D::Attributes& attributes, | 134 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 135 ::gpu::GLInProcessContextAttribs* output_attribs) { | 135 ::gpu::GLInProcessContextAttribs* output_attribs) { |
| 136 output_attribs->alpha_size = attributes.alpha ? 8 : 0; | 136 output_attribs->alpha_size = attributes.alpha ? 8 : 0; |
| 137 output_attribs->depth_size = attributes.depth ? 24 : 0; | 137 output_attribs->depth_size = attributes.depth ? 24 : 0; |
| 138 output_attribs->stencil_size = attributes.stencil ? 8 : 0; | 138 output_attribs->stencil_size = attributes.stencil ? 8 : 0; |
| 139 output_attribs->samples = attributes.antialias ? 4 : 0; | 139 output_attribs->samples = attributes.antialias ? 4 : 0; |
| 140 output_attribs->sample_buffers = attributes.antialias ? 1 : 0; | 140 output_attribs->sample_buffers = attributes.antialias ? 1 : 0; |
| 141 } | 141 } |
| 142 | 142 |
| 143 bool WebGraphicsContext3DInProcessCommandBufferImpl::MaybeInitializeGL() { | 143 bool WebGraphicsContext3DInProcessCommandBufferImpl::MaybeInitializeGL() { |
| 144 if (initialized_) | 144 if (initialized_) |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 NOTIMPLEMENTED(); | 411 NOTIMPLEMENTED(); |
| 412 } | 412 } |
| 413 | 413 |
| 414 void WebGraphicsContext3DInProcessCommandBufferImpl:: | 414 void WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 415 rateLimitOffscreenContextCHROMIUM() { | 415 rateLimitOffscreenContextCHROMIUM() { |
| 416 // TODO(gmam): See if we can comment this in. | 416 // TODO(gmam): See if we can comment this in. |
| 417 // ClearContext(); | 417 // ClearContext(); |
| 418 gl_->RateLimitOffscreenContextCHROMIUM(); | 418 gl_->RateLimitOffscreenContextCHROMIUM(); |
| 419 } | 419 } |
| 420 | 420 |
| 421 WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl:: | 421 blink::WebString WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 422 getRequestableExtensionsCHROMIUM() { | 422 getRequestableExtensionsCHROMIUM() { |
| 423 // TODO(gmam): See if we can comment this in. | 423 // TODO(gmam): See if we can comment this in. |
| 424 // ClearContext(); | 424 // ClearContext(); |
| 425 return WebKit::WebString::fromUTF8( | 425 return blink::WebString::fromUTF8( |
| 426 gl_->GetRequestableExtensionsCHROMIUM()); | 426 gl_->GetRequestableExtensionsCHROMIUM()); |
| 427 } | 427 } |
| 428 | 428 |
| 429 void WebGraphicsContext3DInProcessCommandBufferImpl::requestExtensionCHROMIUM( | 429 void WebGraphicsContext3DInProcessCommandBufferImpl::requestExtensionCHROMIUM( |
| 430 const char* extension) { | 430 const char* extension) { |
| 431 // TODO(gmam): See if we can comment this in. | 431 // TODO(gmam): See if we can comment this in. |
| 432 // ClearContext(); | 432 // ClearContext(); |
| 433 gl_->RequestExtensionCHROMIUM(extension); | 433 gl_->RequestExtensionCHROMIUM(extension); |
| 434 } | 434 } |
| 435 | 435 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 return false; | 596 return false; |
| 597 } | 597 } |
| 598 GLsizei length = 0; | 598 GLsizei length = 0; |
| 599 GLint size = -1; | 599 GLint size = -1; |
| 600 GLenum type = 0; | 600 GLenum type = 0; |
| 601 gl_->GetActiveAttrib( | 601 gl_->GetActiveAttrib( |
| 602 program, index, max_name_length, &length, &size, &type, name.get()); | 602 program, index, max_name_length, &length, &size, &type, name.get()); |
| 603 if (size < 0) { | 603 if (size < 0) { |
| 604 return false; | 604 return false; |
| 605 } | 605 } |
| 606 info.name = WebKit::WebString::fromUTF8(name.get(), length); | 606 info.name = blink::WebString::fromUTF8(name.get(), length); |
| 607 info.type = type; | 607 info.type = type; |
| 608 info.size = size; | 608 info.size = size; |
| 609 return true; | 609 return true; |
| 610 } | 610 } |
| 611 | 611 |
| 612 bool WebGraphicsContext3DInProcessCommandBufferImpl::getActiveUniform( | 612 bool WebGraphicsContext3DInProcessCommandBufferImpl::getActiveUniform( |
| 613 WebGLId program, WGC3Duint index, ActiveInfo& info) { | 613 WebGLId program, WGC3Duint index, ActiveInfo& info) { |
| 614 ClearContext(); | 614 ClearContext(); |
| 615 GLint max_name_length = -1; | 615 GLint max_name_length = -1; |
| 616 gl_->GetProgramiv( | 616 gl_->GetProgramiv( |
| 617 program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max_name_length); | 617 program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max_name_length); |
| 618 if (max_name_length < 0) | 618 if (max_name_length < 0) |
| 619 return false; | 619 return false; |
| 620 scoped_ptr<GLchar[]> name(new GLchar[max_name_length]); | 620 scoped_ptr<GLchar[]> name(new GLchar[max_name_length]); |
| 621 if (!name) { | 621 if (!name) { |
| 622 synthesizeGLError(GL_OUT_OF_MEMORY); | 622 synthesizeGLError(GL_OUT_OF_MEMORY); |
| 623 return false; | 623 return false; |
| 624 } | 624 } |
| 625 GLsizei length = 0; | 625 GLsizei length = 0; |
| 626 GLint size = -1; | 626 GLint size = -1; |
| 627 GLenum type = 0; | 627 GLenum type = 0; |
| 628 gl_->GetActiveUniform( | 628 gl_->GetActiveUniform( |
| 629 program, index, max_name_length, &length, &size, &type, name.get()); | 629 program, index, max_name_length, &length, &size, &type, name.get()); |
| 630 if (size < 0) { | 630 if (size < 0) { |
| 631 return false; | 631 return false; |
| 632 } | 632 } |
| 633 info.name = WebKit::WebString::fromUTF8(name.get(), length); | 633 info.name = blink::WebString::fromUTF8(name.get(), length); |
| 634 info.type = type; | 634 info.type = type; |
| 635 info.size = size; | 635 info.size = size; |
| 636 return true; | 636 return true; |
| 637 } | 637 } |
| 638 | 638 |
| 639 DELEGATE_TO_GL_4(getAttachedShaders, GetAttachedShaders, | 639 DELEGATE_TO_GL_4(getAttachedShaders, GetAttachedShaders, |
| 640 WebGLId, WGC3Dsizei, WGC3Dsizei*, WebGLId*) | 640 WebGLId, WGC3Dsizei, WGC3Dsizei*, WebGLId*) |
| 641 | 641 |
| 642 DELEGATE_TO_GL_2R(getAttribLocation, GetAttribLocation, | 642 DELEGATE_TO_GL_2R(getAttribLocation, GetAttribLocation, |
| 643 WebGLId, const WGC3Dchar*, WGC3Dint) | 643 WebGLId, const WGC3Dchar*, WGC3Dint) |
| 644 | 644 |
| 645 DELEGATE_TO_GL_2(getBooleanv, GetBooleanv, WGC3Denum, WGC3Dboolean*) | 645 DELEGATE_TO_GL_2(getBooleanv, GetBooleanv, WGC3Denum, WGC3Dboolean*) |
| 646 | 646 |
| 647 DELEGATE_TO_GL_3(getBufferParameteriv, GetBufferParameteriv, | 647 DELEGATE_TO_GL_3(getBufferParameteriv, GetBufferParameteriv, |
| 648 WGC3Denum, WGC3Denum, WGC3Dint*) | 648 WGC3Denum, WGC3Denum, WGC3Dint*) |
| 649 | 649 |
| 650 WebKit::WebGraphicsContext3D::Attributes | 650 blink::WebGraphicsContext3D::Attributes |
| 651 WebGraphicsContext3DInProcessCommandBufferImpl::getContextAttributes() { | 651 WebGraphicsContext3DInProcessCommandBufferImpl::getContextAttributes() { |
| 652 return attributes_; | 652 return attributes_; |
| 653 } | 653 } |
| 654 | 654 |
| 655 WGC3Denum WebGraphicsContext3DInProcessCommandBufferImpl::getError() { | 655 WGC3Denum WebGraphicsContext3DInProcessCommandBufferImpl::getError() { |
| 656 ClearContext(); | 656 ClearContext(); |
| 657 if (!synthetic_errors_.empty()) { | 657 if (!synthetic_errors_.empty()) { |
| 658 std::vector<WGC3Denum>::iterator iter = synthetic_errors_.begin(); | 658 std::vector<WGC3Denum>::iterator iter = synthetic_errors_.begin(); |
| 659 WGC3Denum err = *iter; | 659 WGC3Denum err = *iter; |
| 660 synthetic_errors_.erase(iter); | 660 synthetic_errors_.erase(iter); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 671 DELEGATE_TO_GL_2(getFloatv, GetFloatv, WGC3Denum, WGC3Dfloat*) | 671 DELEGATE_TO_GL_2(getFloatv, GetFloatv, WGC3Denum, WGC3Dfloat*) |
| 672 | 672 |
| 673 DELEGATE_TO_GL_4(getFramebufferAttachmentParameteriv, | 673 DELEGATE_TO_GL_4(getFramebufferAttachmentParameteriv, |
| 674 GetFramebufferAttachmentParameteriv, | 674 GetFramebufferAttachmentParameteriv, |
| 675 WGC3Denum, WGC3Denum, WGC3Denum, WGC3Dint*) | 675 WGC3Denum, WGC3Denum, WGC3Denum, WGC3Dint*) |
| 676 | 676 |
| 677 DELEGATE_TO_GL_2(getIntegerv, GetIntegerv, WGC3Denum, WGC3Dint*) | 677 DELEGATE_TO_GL_2(getIntegerv, GetIntegerv, WGC3Denum, WGC3Dint*) |
| 678 | 678 |
| 679 DELEGATE_TO_GL_3(getProgramiv, GetProgramiv, WebGLId, WGC3Denum, WGC3Dint*) | 679 DELEGATE_TO_GL_3(getProgramiv, GetProgramiv, WebGLId, WGC3Denum, WGC3Dint*) |
| 680 | 680 |
| 681 WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl:: | 681 blink::WebString WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 682 getProgramInfoLog(WebGLId program) { | 682 getProgramInfoLog(WebGLId program) { |
| 683 ClearContext(); | 683 ClearContext(); |
| 684 GLint logLength = 0; | 684 GLint logLength = 0; |
| 685 gl_->GetProgramiv(program, GL_INFO_LOG_LENGTH, &logLength); | 685 gl_->GetProgramiv(program, GL_INFO_LOG_LENGTH, &logLength); |
| 686 if (!logLength) | 686 if (!logLength) |
| 687 return WebKit::WebString(); | 687 return blink::WebString(); |
| 688 scoped_ptr<GLchar[]> log(new GLchar[logLength]); | 688 scoped_ptr<GLchar[]> log(new GLchar[logLength]); |
| 689 if (!log) | 689 if (!log) |
| 690 return WebKit::WebString(); | 690 return blink::WebString(); |
| 691 GLsizei returnedLogLength = 0; | 691 GLsizei returnedLogLength = 0; |
| 692 gl_->GetProgramInfoLog( | 692 gl_->GetProgramInfoLog( |
| 693 program, logLength, &returnedLogLength, log.get()); | 693 program, logLength, &returnedLogLength, log.get()); |
| 694 DCHECK_EQ(logLength, returnedLogLength + 1); | 694 DCHECK_EQ(logLength, returnedLogLength + 1); |
| 695 WebKit::WebString res = | 695 blink::WebString res = |
| 696 WebKit::WebString::fromUTF8(log.get(), returnedLogLength); | 696 blink::WebString::fromUTF8(log.get(), returnedLogLength); |
| 697 return res; | 697 return res; |
| 698 } | 698 } |
| 699 | 699 |
| 700 DELEGATE_TO_GL_3(getRenderbufferParameteriv, GetRenderbufferParameteriv, | 700 DELEGATE_TO_GL_3(getRenderbufferParameteriv, GetRenderbufferParameteriv, |
| 701 WGC3Denum, WGC3Denum, WGC3Dint*) | 701 WGC3Denum, WGC3Denum, WGC3Dint*) |
| 702 | 702 |
| 703 DELEGATE_TO_GL_3(getShaderiv, GetShaderiv, WebGLId, WGC3Denum, WGC3Dint*) | 703 DELEGATE_TO_GL_3(getShaderiv, GetShaderiv, WebGLId, WGC3Denum, WGC3Dint*) |
| 704 | 704 |
| 705 WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl:: | 705 blink::WebString WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 706 getShaderInfoLog(WebGLId shader) { | 706 getShaderInfoLog(WebGLId shader) { |
| 707 ClearContext(); | 707 ClearContext(); |
| 708 GLint logLength = 0; | 708 GLint logLength = 0; |
| 709 gl_->GetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength); | 709 gl_->GetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength); |
| 710 if (!logLength) | 710 if (!logLength) |
| 711 return WebKit::WebString(); | 711 return blink::WebString(); |
| 712 scoped_ptr<GLchar[]> log(new GLchar[logLength]); | 712 scoped_ptr<GLchar[]> log(new GLchar[logLength]); |
| 713 if (!log) | 713 if (!log) |
| 714 return WebKit::WebString(); | 714 return blink::WebString(); |
| 715 GLsizei returnedLogLength = 0; | 715 GLsizei returnedLogLength = 0; |
| 716 gl_->GetShaderInfoLog( | 716 gl_->GetShaderInfoLog( |
| 717 shader, logLength, &returnedLogLength, log.get()); | 717 shader, logLength, &returnedLogLength, log.get()); |
| 718 DCHECK_EQ(logLength, returnedLogLength + 1); | 718 DCHECK_EQ(logLength, returnedLogLength + 1); |
| 719 WebKit::WebString res = | 719 blink::WebString res = |
| 720 WebKit::WebString::fromUTF8(log.get(), returnedLogLength); | 720 blink::WebString::fromUTF8(log.get(), returnedLogLength); |
| 721 return res; | 721 return res; |
| 722 } | 722 } |
| 723 | 723 |
| 724 DELEGATE_TO_GL_4(getShaderPrecisionFormat, GetShaderPrecisionFormat, | 724 DELEGATE_TO_GL_4(getShaderPrecisionFormat, GetShaderPrecisionFormat, |
| 725 WGC3Denum, WGC3Denum, WGC3Dint*, WGC3Dint*) | 725 WGC3Denum, WGC3Denum, WGC3Dint*, WGC3Dint*) |
| 726 | 726 |
| 727 WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl:: | 727 blink::WebString WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 728 getShaderSource(WebGLId shader) { | 728 getShaderSource(WebGLId shader) { |
| 729 ClearContext(); | 729 ClearContext(); |
| 730 GLint logLength = 0; | 730 GLint logLength = 0; |
| 731 gl_->GetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &logLength); | 731 gl_->GetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &logLength); |
| 732 if (!logLength) | 732 if (!logLength) |
| 733 return WebKit::WebString(); | 733 return blink::WebString(); |
| 734 scoped_ptr<GLchar[]> log(new GLchar[logLength]); | 734 scoped_ptr<GLchar[]> log(new GLchar[logLength]); |
| 735 if (!log) | 735 if (!log) |
| 736 return WebKit::WebString(); | 736 return blink::WebString(); |
| 737 GLsizei returnedLogLength = 0; | 737 GLsizei returnedLogLength = 0; |
| 738 gl_->GetShaderSource( | 738 gl_->GetShaderSource( |
| 739 shader, logLength, &returnedLogLength, log.get()); | 739 shader, logLength, &returnedLogLength, log.get()); |
| 740 if (!returnedLogLength) | 740 if (!returnedLogLength) |
| 741 return WebKit::WebString(); | 741 return blink::WebString(); |
| 742 DCHECK_EQ(logLength, returnedLogLength + 1); | 742 DCHECK_EQ(logLength, returnedLogLength + 1); |
| 743 WebKit::WebString res = | 743 blink::WebString res = |
| 744 WebKit::WebString::fromUTF8(log.get(), returnedLogLength); | 744 blink::WebString::fromUTF8(log.get(), returnedLogLength); |
| 745 return res; | 745 return res; |
| 746 } | 746 } |
| 747 | 747 |
| 748 WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl:: | 748 blink::WebString WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 749 getTranslatedShaderSourceANGLE(WebGLId shader) { | 749 getTranslatedShaderSourceANGLE(WebGLId shader) { |
| 750 ClearContext(); | 750 ClearContext(); |
| 751 GLint logLength = 0; | 751 GLint logLength = 0; |
| 752 gl_->GetShaderiv( | 752 gl_->GetShaderiv( |
| 753 shader, GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, &logLength); | 753 shader, GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, &logLength); |
| 754 if (!logLength) | 754 if (!logLength) |
| 755 return WebKit::WebString(); | 755 return blink::WebString(); |
| 756 scoped_ptr<GLchar[]> log(new GLchar[logLength]); | 756 scoped_ptr<GLchar[]> log(new GLchar[logLength]); |
| 757 if (!log) | 757 if (!log) |
| 758 return WebKit::WebString(); | 758 return blink::WebString(); |
| 759 GLsizei returnedLogLength = 0; | 759 GLsizei returnedLogLength = 0; |
| 760 gl_->GetTranslatedShaderSourceANGLE( | 760 gl_->GetTranslatedShaderSourceANGLE( |
| 761 shader, logLength, &returnedLogLength, log.get()); | 761 shader, logLength, &returnedLogLength, log.get()); |
| 762 if (!returnedLogLength) | 762 if (!returnedLogLength) |
| 763 return WebKit::WebString(); | 763 return blink::WebString(); |
| 764 DCHECK_EQ(logLength, returnedLogLength + 1); | 764 DCHECK_EQ(logLength, returnedLogLength + 1); |
| 765 WebKit::WebString res = | 765 blink::WebString res = |
| 766 WebKit::WebString::fromUTF8(log.get(), returnedLogLength); | 766 blink::WebString::fromUTF8(log.get(), returnedLogLength); |
| 767 return res; | 767 return res; |
| 768 } | 768 } |
| 769 | 769 |
| 770 WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl::getString( | 770 blink::WebString WebGraphicsContext3DInProcessCommandBufferImpl::getString( |
| 771 WGC3Denum name) { | 771 WGC3Denum name) { |
| 772 ClearContext(); | 772 ClearContext(); |
| 773 return WebKit::WebString::fromUTF8( | 773 return blink::WebString::fromUTF8( |
| 774 reinterpret_cast<const char*>(gl_->GetString(name))); | 774 reinterpret_cast<const char*>(gl_->GetString(name))); |
| 775 } | 775 } |
| 776 | 776 |
| 777 DELEGATE_TO_GL_3(getTexParameterfv, GetTexParameterfv, | 777 DELEGATE_TO_GL_3(getTexParameterfv, GetTexParameterfv, |
| 778 WGC3Denum, WGC3Denum, WGC3Dfloat*) | 778 WGC3Denum, WGC3Denum, WGC3Dfloat*) |
| 779 | 779 |
| 780 DELEGATE_TO_GL_3(getTexParameteriv, GetTexParameteriv, | 780 DELEGATE_TO_GL_3(getTexParameteriv, GetTexParameteriv, |
| 781 WGC3Denum, WGC3Denum, WGC3Dint*) | 781 WGC3Denum, WGC3Denum, WGC3Dint*) |
| 782 | 782 |
| 783 DELEGATE_TO_GL_3(getUniformfv, GetUniformfv, WebGLId, WGC3Dint, WGC3Dfloat*) | 783 DELEGATE_TO_GL_3(getUniformfv, GetUniformfv, WebGLId, WGC3Dint, WGC3Dfloat*) |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 | 1199 |
| 1200 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM, | 1200 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM, |
| 1201 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, | 1201 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, |
| 1202 WGC3Denum, WGC3Denum, const void*) | 1202 WGC3Denum, WGC3Denum, const void*) |
| 1203 | 1203 |
| 1204 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, | 1204 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, |
| 1205 WGC3Denum) | 1205 WGC3Denum) |
| 1206 | 1206 |
| 1207 } // namespace gpu | 1207 } // namespace gpu |
| 1208 } // namespace webkit | 1208 } // namespace webkit |
| OLD | NEW |