OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "modules/webgl/WebGL2RenderingContextBase.h" | 5 #include "modules/webgl/WebGL2RenderingContextBase.h" |
6 | 6 |
7 #include "bindings/modules/v8/WebGLAny.h" | 7 #include "bindings/modules/v8/WebGLAny.h" |
8 #include "core/frame/ImageBitmap.h" | 8 #include "core/frame/ImageBitmap.h" |
9 #include "core/html/HTMLCanvasElement.h" | 9 #include "core/html/HTMLCanvasElement.h" |
10 #include "core/html/HTMLImageElement.h" | 10 #include "core/html/HTMLImageElement.h" |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 } | 627 } |
628 return true; | 628 return true; |
629 } | 629 } |
630 | 630 |
631 IntRect WebGL2RenderingContextBase::GetTextureSourceSubRectangle( | 631 IntRect WebGL2RenderingContextBase::GetTextureSourceSubRectangle( |
632 GLsizei width, | 632 GLsizei width, |
633 GLsizei height) { | 633 GLsizei height) { |
634 return IntRect(unpack_skip_pixels_, unpack_skip_rows_, width, height); | 634 return IntRect(unpack_skip_pixels_, unpack_skip_rows_, width, height); |
635 } | 635 } |
636 | 636 |
637 bool WebGL2RenderingContextBase::CanUseTexImageByGPU( | |
638 TexImageFunctionID function_id, | |
639 GLint internalformat, | |
640 GLenum type) { | |
641 switch (internalformat) { | |
642 case GL_RGB565: | |
643 case GL_RGBA4: | |
644 case GL_RGB5_A1: | |
645 // FIXME: ES3 limitation that CopyTexImage with sized internalformat, | |
646 // component sizes have to match the source color format. | |
647 return false; | |
648 default: | |
649 break; | |
650 } | |
651 return WebGLRenderingContextBase::CanUseTexImageByGPU(function_id, | |
652 internalformat, type); | |
653 } | |
654 | |
655 void WebGL2RenderingContextBase::invalidateFramebuffer( | 637 void WebGL2RenderingContextBase::invalidateFramebuffer( |
656 GLenum target, | 638 GLenum target, |
657 const Vector<GLenum>& attachments) { | 639 const Vector<GLenum>& attachments) { |
658 if (isContextLost()) | 640 if (isContextLost()) |
659 return; | 641 return; |
660 | 642 |
661 Vector<GLenum> translated_attachments = attachments; | 643 Vector<GLenum> translated_attachments = attachments; |
662 if (!CheckAndTranslateAttachments("invalidateFramebuffer", target, | 644 if (!CheckAndTranslateAttachments("invalidateFramebuffer", target, |
663 translated_attachments)) | 645 translated_attachments)) |
664 return; | 646 return; |
(...skipping 5028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5693 | 5675 |
5694 void WebGL2RenderingContextBase:: | 5676 void WebGL2RenderingContextBase:: |
5695 DrawingBufferClientRestorePixelUnpackBufferBinding() { | 5677 DrawingBufferClientRestorePixelUnpackBufferBinding() { |
5696 if (!ContextGL()) | 5678 if (!ContextGL()) |
5697 return; | 5679 return; |
5698 ContextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, | 5680 ContextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, |
5699 ObjectOrZero(bound_pixel_unpack_buffer_.Get())); | 5681 ObjectOrZero(bound_pixel_unpack_buffer_.Get())); |
5700 } | 5682 } |
5701 | 5683 |
5702 } // namespace blink | 5684 } // namespace blink |
OLD | NEW |