Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h

Issue 2495953002: Support uploads of sub-rectangles of canvases to 2D and 3D textures. (Closed)
Patch Set: Fixed regression in accelerated video-to-texture uploads. Marked Mac Intel failures. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 GLint zoffset, 1016 GLint zoffset,
1017 GLenum format, 1017 GLenum format,
1018 GLenum type, 1018 GLenum type,
1019 Image*, 1019 Image*,
1020 WebGLImageConversion::ImageHtmlDomSource, 1020 WebGLImageConversion::ImageHtmlDomSource,
1021 bool flipY, 1021 bool flipY,
1022 bool premultiplyAlpha, 1022 bool premultiplyAlpha,
1023 const IntRect&, 1023 const IntRect&,
1024 GLsizei depth, 1024 GLsizei depth,
1025 GLint unpackImageHeight); 1025 GLint unpackImageHeight);
1026
1027 template <typename T>
1028 IntRect getTextureSourceSize(T* textureSource) {
1029 return IntRect(0, 0, textureSource->width(), textureSource->height());
1030 }
1031
1026 template <typename T> 1032 template <typename T>
1027 bool validateTexImageSubRectangle(const char* functionName, 1033 bool validateTexImageSubRectangle(const char* functionName,
1028 TexImageFunctionID functionID, 1034 TexImageFunctionID functionID,
1029 T* image, 1035 T* image,
1030 const IntRect& subRect, 1036 const IntRect& subRect,
1031 GLsizei depth, 1037 GLsizei depth,
1032 GLint unpackImageHeight, 1038 GLint unpackImageHeight,
1033 bool* selectingSubRectangle) { 1039 bool* selectingSubRectangle) {
1034 DCHECK(functionName); 1040 DCHECK(functionName);
1035 DCHECK(selectingSubRectangle); 1041 DCHECK(selectingSubRectangle);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 return false; 1082 return false;
1077 } 1083 }
1078 } else { 1084 } else {
1079 DCHECK_EQ(depth, 1); 1085 DCHECK_EQ(depth, 1);
1080 DCHECK_EQ(unpackImageHeight, 0); 1086 DCHECK_EQ(unpackImageHeight, 0);
1081 } 1087 }
1082 return true; 1088 return true;
1083 } 1089 }
1084 1090
1085 // Copy from the source directly to the texture via the gpu, without a 1091 // Copy from the source directly to the texture via the gpu, without a
1086 // read-back to system memory. Souce could be canvas or imageBitmap. 1092 // read-back to system memory. Source could be canvas or imageBitmap.
1087 void texImageByGPU(TexImageByGPUType, 1093 void texImageByGPU(TexImageByGPUType,
1088 WebGLTexture*, 1094 WebGLTexture*,
1089 GLenum target, 1095 GLenum target,
1090 GLint level, 1096 GLint level,
1091 GLint internalformat, 1097 GLint internalformat,
1092 GLenum type, 1098 GLenum type,
1093 GLint xoffset, 1099 GLint xoffset,
1094 GLint yoffset, 1100 GLint yoffset,
1095 GLint zoffset, 1101 GLint zoffset,
1096 CanvasImageSource*); 1102 CanvasImageSource*,
1103 const IntRect& sourceSubRectangle);
1097 virtual bool canUseTexImageByGPU(TexImageFunctionID, 1104 virtual bool canUseTexImageByGPU(TexImageFunctionID,
1098 GLint internalformat, 1105 GLint internalformat,
1099 GLenum type); 1106 GLenum type);
1100 1107
1101 virtual WebGLImageConversion::PixelStoreParams getPackPixelStoreParams(); 1108 virtual WebGLImageConversion::PixelStoreParams getPackPixelStoreParams();
1102 virtual WebGLImageConversion::PixelStoreParams getUnpackPixelStoreParams( 1109 virtual WebGLImageConversion::PixelStoreParams getUnpackPixelStoreParams(
1103 TexImageDimension); 1110 TexImageDimension);
1104 1111
1105 // Helper function for copyTex{Sub}Image, check whether the internalformat 1112 // Helper function for copyTex{Sub}Image, check whether the internalformat
1106 // and the color buffer format of the current bound framebuffer combination 1113 // and the color buffer format of the current bound framebuffer combination
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 void texImageHelperHTMLCanvasElement(TexImageFunctionID, 1566 void texImageHelperHTMLCanvasElement(TexImageFunctionID,
1560 GLenum, 1567 GLenum,
1561 GLint, 1568 GLint,
1562 GLint, 1569 GLint,
1563 GLenum, 1570 GLenum,
1564 GLenum, 1571 GLenum,
1565 GLint, 1572 GLint,
1566 GLint, 1573 GLint,
1567 GLint, 1574 GLint,
1568 HTMLCanvasElement*, 1575 HTMLCanvasElement*,
1576 const IntRect&,
1577 GLsizei,
1578 GLint,
1569 ExceptionState&); 1579 ExceptionState&);
1570 void texImageHelperHTMLVideoElement(TexImageFunctionID, 1580 void texImageHelperHTMLVideoElement(TexImageFunctionID,
1571 GLenum, 1581 GLenum,
1572 GLint, 1582 GLint,
1573 GLint, 1583 GLint,
1574 GLenum, 1584 GLenum,
1575 GLenum, 1585 GLenum,
1576 GLint, 1586 GLint,
1577 GLint, 1587 GLint,
1578 GLint, 1588 GLint,
(...skipping 29 matching lines...) Expand all
1608 WebGLRenderingContextBase(HTMLCanvasElement*, 1618 WebGLRenderingContextBase(HTMLCanvasElement*,
1609 OffscreenCanvas*, 1619 OffscreenCanvas*,
1610 std::unique_ptr<WebGraphicsContext3DProvider>, 1620 std::unique_ptr<WebGraphicsContext3DProvider>,
1611 const CanvasContextCreationAttributes&, 1621 const CanvasContextCreationAttributes&,
1612 unsigned); 1622 unsigned);
1613 static std::unique_ptr<WebGraphicsContext3DProvider> 1623 static std::unique_ptr<WebGraphicsContext3DProvider>
1614 createContextProviderInternal(HTMLCanvasElement*, 1624 createContextProviderInternal(HTMLCanvasElement*,
1615 ScriptState*, 1625 ScriptState*,
1616 const CanvasContextCreationAttributes&, 1626 const CanvasContextCreationAttributes&,
1617 unsigned); 1627 unsigned);
1618 void texImageCanvasByGPU(HTMLCanvasElement*, GLuint, GLenum, GLenum, GLint); 1628 void texImageCanvasByGPU(HTMLCanvasElement*,
1629 GLuint,
1630 GLenum,
1631 GLenum,
1632 GLint,
1633 GLint,
1634 GLint,
1635 const IntRect& sourceSubRectangle);
1619 void texImageBitmapByGPU(ImageBitmap*, GLuint, GLenum, GLenum, GLint, bool); 1636 void texImageBitmapByGPU(ImageBitmap*, GLuint, GLenum, GLenum, GLint, bool);
1620 1637
1621 const unsigned m_version; 1638 const unsigned m_version;
1622 1639
1623 bool isPaintable() const final { return drawingBuffer(); } 1640 bool isPaintable() const final { return drawingBuffer(); }
1624 }; 1641 };
1625 1642
1626 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, 1643 DEFINE_TYPE_CASTS(WebGLRenderingContextBase,
1627 CanvasRenderingContext, 1644 CanvasRenderingContext,
1628 context, 1645 context,
1629 context->is3d(), 1646 context->is3d(),
1630 context.is3d()); 1647 context.is3d());
1631 1648
1632 } // namespace blink 1649 } // namespace blink
1633 1650
1634 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( 1651 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(
1635 blink::WebGLRenderingContextBase::TextureUnitState); 1652 blink::WebGLRenderingContextBase::TextureUnitState);
1636 1653
1637 #endif // WebGLRenderingContextBase_h 1654 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698