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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 } | 625 } |
626 return true; | 626 return true; |
627 } | 627 } |
628 | 628 |
629 IntRect WebGL2RenderingContextBase::getTextureSourceSubRectangle( | 629 IntRect WebGL2RenderingContextBase::getTextureSourceSubRectangle( |
630 GLsizei width, | 630 GLsizei width, |
631 GLsizei height) { | 631 GLsizei height) { |
632 return IntRect(m_unpackSkipPixels, m_unpackSkipRows, width, height); | 632 return IntRect(m_unpackSkipPixels, m_unpackSkipRows, width, height); |
633 } | 633 } |
634 | 634 |
635 bool WebGL2RenderingContextBase::canUseTexImageByGPU( | |
636 TexImageFunctionID functionID, | |
637 GLint internalformat, | |
638 GLenum type) { | |
639 switch (internalformat) { | |
640 case GL_RGB565: | |
641 case GL_RGBA4: | |
642 case GL_RGB5_A1: | |
643 // FIXME: ES3 limitation that CopyTexImage with sized internalformat, | |
644 // component sizes have to match the source color format. | |
645 return false; | |
646 default: | |
647 break; | |
648 } | |
649 return WebGLRenderingContextBase::canUseTexImageByGPU(functionID, | |
650 internalformat, type); | |
651 } | |
652 | |
653 void WebGL2RenderingContextBase::invalidateFramebuffer( | 635 void WebGL2RenderingContextBase::invalidateFramebuffer( |
654 GLenum target, | 636 GLenum target, |
655 const Vector<GLenum>& attachments) { | 637 const Vector<GLenum>& attachments) { |
656 if (isContextLost()) | 638 if (isContextLost()) |
657 return; | 639 return; |
658 | 640 |
659 Vector<GLenum> translatedAttachments = attachments; | 641 Vector<GLenum> translatedAttachments = attachments; |
660 if (!checkAndTranslateAttachments("invalidateFramebuffer", target, | 642 if (!checkAndTranslateAttachments("invalidateFramebuffer", target, |
661 translatedAttachments)) | 643 translatedAttachments)) |
662 return; | 644 return; |
(...skipping 5004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5667 | 5649 |
5668 void WebGL2RenderingContextBase:: | 5650 void WebGL2RenderingContextBase:: |
5669 DrawingBufferClientRestorePixelUnpackBufferBinding() { | 5651 DrawingBufferClientRestorePixelUnpackBufferBinding() { |
5670 if (!contextGL()) | 5652 if (!contextGL()) |
5671 return; | 5653 return; |
5672 contextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, | 5654 contextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, |
5673 objectOrZero(m_boundPixelUnpackBuffer.get())); | 5655 objectOrZero(m_boundPixelUnpackBuffer.get())); |
5674 } | 5656 } |
5675 | 5657 |
5676 } // namespace blink | 5658 } // namespace blink |
OLD | NEW |