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 4172d0e8627b3f9c451a1c6094a2efe76442eebb..6a6377ed4f407666959bd0a14f4f30a9f9c859df 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 TexImageFunctionID { |
+ 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(TexImageFunctionID, 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*, TexImageFunctionID, 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(TexImageFunctionID, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, GLsizei, GLint, GLint, GLint, DOMArrayBufferView*); |
+ void texImageHelperImageData(TexImageFunctionID, GLenum, GLint, GLint, GLint, GLenum, GLenum, GLsizei, GLint, GLint, GLint, ImageData*); |
+ void texImageHelperHTMLImageElement(TexImageFunctionID, GLenum, GLint, GLint, GLenum, GLenum, GLint, GLint, GLint, HTMLImageElement*, ExceptionState&); |
+ void texImageHelperHTMLCanvasElement(TexImageFunctionID, GLenum, GLint, GLint, GLenum, GLenum, GLint, GLint, GLint, HTMLCanvasElement*, ExceptionState&); |
+ void texImageHelperHTMLVideoElement(TexImageFunctionID, GLenum, GLint, GLint, GLenum, GLenum, GLint, GLint, GLint, HTMLVideoElement*, ExceptionState&); |
+ void texImageHelperImageBitmap(TexImageFunctionID, GLenum, GLint, GLint, GLenum, GLenum, GLint, GLint, GLint, ImageBitmap*, ExceptionState&); |
+ static const char* getTexImageFunctionName(TexImageFunctionID); |
+ |
private: |
WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); |
static PassOwnPtr<WebGraphicsContext3DProvider> createContextProviderInternal(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned); |