OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 CompressedTexImage | 980 CompressedTexImage |
981 }; | 981 }; |
982 | 982 |
983 // This must stay in sync with WebMediaPlayer::TexImageFunctionID. | 983 // This must stay in sync with WebMediaPlayer::TexImageFunctionID. |
984 enum TexImageFunctionID { | 984 enum TexImageFunctionID { |
985 TexImage2D, | 985 TexImage2D, |
986 TexSubImage2D, | 986 TexSubImage2D, |
987 TexImage3D, | 987 TexImage3D, |
988 TexSubImage3D | 988 TexSubImage3D |
989 }; | 989 }; |
990 enum TexImageByGPUType { | 990 |
991 TexImage2DByGPU, | 991 static SnapshotReason functionIDToSnapshotReason(TexImageFunctionID); |
992 TexSubImage2DByGPU, | 992 |
993 TexSubImage3DByGPU | |
994 }; | |
995 enum TexImageDimension { Tex2D, Tex3D }; | 993 enum TexImageDimension { Tex2D, Tex3D }; |
996 void texImage2DBase(GLenum target, | 994 void texImage2DBase(GLenum target, |
997 GLint level, | 995 GLint level, |
998 GLint internalformat, | 996 GLint internalformat, |
999 GLsizei width, | 997 GLsizei width, |
1000 GLsizei height, | 998 GLsizei height, |
1001 GLint border, | 999 GLint border, |
1002 GLenum format, | 1000 GLenum format, |
1003 GLenum type, | 1001 GLenum type, |
1004 const void* pixels); | 1002 const void* pixels); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 } | 1093 } |
1096 } else { | 1094 } else { |
1097 DCHECK_EQ(depth, 1); | 1095 DCHECK_EQ(depth, 1); |
1098 DCHECK_EQ(unpackImageHeight, 0); | 1096 DCHECK_EQ(unpackImageHeight, 0); |
1099 } | 1097 } |
1100 return true; | 1098 return true; |
1101 } | 1099 } |
1102 | 1100 |
1103 // Copy from the source directly to the texture via the gpu, without a | 1101 // Copy from the source directly to the texture via the gpu, without a |
1104 // read-back to system memory. Source could be canvas or imageBitmap. | 1102 // read-back to system memory. Source could be canvas or imageBitmap. |
1105 void texImageByGPU(TexImageByGPUType, | 1103 void texImageByGPU(TexImageFunctionID, |
1106 WebGLTexture*, | 1104 WebGLTexture*, |
1107 GLenum target, | 1105 GLenum target, |
1108 GLint level, | 1106 GLint level, |
1109 GLint internalformat, | 1107 GLint internalformat, |
1110 GLenum type, | 1108 GLenum type, |
1111 GLint xoffset, | 1109 GLint xoffset, |
1112 GLint yoffset, | 1110 GLint yoffset, |
1113 GLint zoffset, | 1111 GLint zoffset, |
1114 CanvasImageSource*, | 1112 CanvasImageSource*, |
1115 const IntRect& sourceSubRectangle); | 1113 const IntRect& sourceSubRectangle); |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 WebGLRenderingContextBase(HTMLCanvasElement*, | 1637 WebGLRenderingContextBase(HTMLCanvasElement*, |
1640 OffscreenCanvas*, | 1638 OffscreenCanvas*, |
1641 std::unique_ptr<WebGraphicsContext3DProvider>, | 1639 std::unique_ptr<WebGraphicsContext3DProvider>, |
1642 const CanvasContextCreationAttributes&, | 1640 const CanvasContextCreationAttributes&, |
1643 unsigned); | 1641 unsigned); |
1644 static std::unique_ptr<WebGraphicsContext3DProvider> | 1642 static std::unique_ptr<WebGraphicsContext3DProvider> |
1645 createContextProviderInternal(HTMLCanvasElement*, | 1643 createContextProviderInternal(HTMLCanvasElement*, |
1646 ScriptState*, | 1644 ScriptState*, |
1647 const CanvasContextCreationAttributes&, | 1645 const CanvasContextCreationAttributes&, |
1648 unsigned); | 1646 unsigned); |
1649 void texImageCanvasByGPU(HTMLCanvasElement*, | 1647 void texImageCanvasByGPU(TexImageFunctionID, |
| 1648 HTMLCanvasElement*, |
1650 GLuint, | 1649 GLuint, |
1651 GLenum, | 1650 GLenum, |
1652 GLenum, | 1651 GLenum, |
1653 GLint, | 1652 GLint, |
1654 GLint, | 1653 GLint, |
1655 GLint, | 1654 GLint, |
1656 const IntRect& sourceSubRectangle); | 1655 const IntRect& sourceSubRectangle); |
1657 void texImageBitmapByGPU(ImageBitmap*, GLuint, GLenum, GLenum, GLint, bool); | 1656 void texImageBitmapByGPU(ImageBitmap*, GLuint, GLenum, GLenum, GLint, bool); |
1658 | 1657 |
1659 const unsigned m_version; | 1658 const unsigned m_version; |
1660 | 1659 |
1661 bool isPaintable() const final { return drawingBuffer(); } | 1660 bool isPaintable() const final { return drawingBuffer(); } |
1662 }; | 1661 }; |
1663 | 1662 |
1664 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, | 1663 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, |
1665 CanvasRenderingContext, | 1664 CanvasRenderingContext, |
1666 context, | 1665 context, |
1667 context->is3d(), | 1666 context->is3d(), |
1668 context.is3d()); | 1667 context.is3d()); |
1669 | 1668 |
1670 } // namespace blink | 1669 } // namespace blink |
1671 | 1670 |
1672 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( | 1671 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( |
1673 blink::WebGLRenderingContextBase::TextureUnitState); | 1672 blink::WebGLRenderingContextBase::TextureUnitState); |
1674 | 1673 |
1675 #endif // WebGLRenderingContextBase_h | 1674 #endif // WebGLRenderingContextBase_h |
OLD | NEW |