Index: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h |
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h |
index f6738b88b58248e6ae101cf6b1e65dac499bdb38..3101a78428d9ef8127fdbba5c27aab0ae6747bc7 100644 |
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h |
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h |
@@ -769,17 +769,18 @@ protected: |
// Convert texture internal format. |
GLenum convertTexInternalFormat(GLenum internalformat, GLenum type); |
- void texImage2DBase(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels); |
- void texImage2DImpl(GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, Image*, WebGLImageConversion::ImageHtmlDomSource, bool flipY, bool premultiplyAlpha); |
- void texSubImage2DBase(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels); |
- void texSubImage2DImpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, Image*, WebGLImageConversion::ImageHtmlDomSource, bool flipY, bool premultiplyAlpha); |
- |
enum TexImageFunctionType { |
TexImage, |
TexSubImage, |
CopyTexImage, |
CompressedTexImage |
}; |
+ enum TexImageFunctionName { |
+ TexImage2D, |
+ TexSubImage2D, |
+ TexImage3D, |
+ TexSubImage3D |
+ }; |
enum TexImageByGPUType { |
TexImage2DByGPU, |
TexSubImage2DByGPU, |
@@ -789,6 +790,10 @@ protected: |
Tex2D, |
Tex3D |
}; |
+ void texImage2DBase(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels); |
+ void texImageImpl(TexImageFunctionName, GLenum target, GLint level, GLint internalformat, GLint xoffset, GLint yoffset, GLint zoffset, |
+ GLenum format, GLenum type, Image*, WebGLImageConversion::ImageHtmlDomSource, bool flipY, bool premultiplyAlpha); |
+ |
// Copy from the canvas element directly to the texture via the GPU, without a read-back to system memory. |
void texImageCanvasByGPU(TexImageByGPUType, WebGLTexture*, GLenum target, GLint level, |
GLint internalformat, GLenum type, GLint xoffset, GLint yoffset, GLint zoffset, HTMLCanvasElement*); |
@@ -819,6 +824,9 @@ protected: |
// null. Otherwise, return the texture bound to the target. |
WebGLTexture* validateTextureBinding(const char* functionName, GLenum target); |
+ // Wrapper function for validateTexture2D(3D)Binding, used in texImageHelper functions. |
+ virtual WebGLTexture* validateTexImageBinding(const char*, TexImageFunctionName, GLenum); |
+ |
// Helper function to check texture 2D target and texture bound to the target. |
// Generate GL errors and return 0 if target is invalid or texture bound is |
// null. Otherwise, return the texture bound to the target. |
@@ -1088,6 +1096,16 @@ protected: |
CrossThreadWeakPersistentThisPointer<WebGLRenderingContextBase> createWeakThisPointer() { return CrossThreadWeakPersistentThisPointer<WebGLRenderingContextBase>(this); } |
ImageBitmap* transferToImageBitmapBase(); |
+ |
+ // Helper functions for tex(Sub)Image2D && texSubImage3D |
+ void texImageHelperDOMArrayBufferView(TexImageFunctionName, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, GLsizei, GLint, GLint, GLint, DOMArrayBufferView*); |
+ void texImageHelperImageData(TexImageFunctionName, GLenum, GLint, GLint, GLint, GLenum, GLenum, GLsizei, GLint, GLint, GLint, ImageData*); |
+ void texImageHelperHTMLImageElement(TexImageFunctionName, GLenum, GLint, GLint, GLenum, GLenum, GLint, GLint, GLint, HTMLImageElement*, ExceptionState&); |
+ void texImageHelperHTMLCanvasElement(TexImageFunctionName, GLenum, GLint, GLint, GLenum, GLenum, GLint, GLint, GLint, HTMLCanvasElement*, ExceptionState&); |
+ void texImageHelperHTMLVideoElement(TexImageFunctionName, GLenum, GLint, GLint, GLenum, GLenum, GLint, GLint, GLint, HTMLVideoElement*, ExceptionState&); |
+ void texImageHelperImageBitmap(TexImageFunctionName, GLenum, GLint, GLint, GLenum, GLenum, GLint, GLint, GLint, ImageBitmap*, ExceptionState&); |
+ static const char* getTexImageFunctionName(TexImageFunctionName); |
+ |
private: |
WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); |
static PassOwnPtr<WebGraphicsContext3DProvider> createContextProviderInternal(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned); |