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

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

Issue 2026803002: Avoid GPU readback in tex(Sub)Image2D(ImageBitmap) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: staticbitmapimage does not keep provider anymore Created 4 years, 6 months 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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 TexSubImage3DByGPU 787 TexSubImage3DByGPU
788 }; 788 };
789 enum TexImageDimension { 789 enum TexImageDimension {
790 Tex2D, 790 Tex2D,
791 Tex3D 791 Tex3D
792 }; 792 };
793 void texImage2DBase(GLenum target, GLint level, GLint internalformat, GLsize i width, GLsizei height, GLint border, GLenum format, GLenum type, const void* p ixels); 793 void texImage2DBase(GLenum target, GLint level, GLint internalformat, GLsize i width, GLsizei height, GLint border, GLenum format, GLenum type, const void* p ixels);
794 void texImageImpl(TexImageFunctionID, GLenum target, GLint level, GLint inte rnalformat, GLint xoffset, GLint yoffset, GLint zoffset, 794 void texImageImpl(TexImageFunctionID, GLenum target, GLint level, GLint inte rnalformat, GLint xoffset, GLint yoffset, GLint zoffset,
795 GLenum format, GLenum type, Image*, WebGLImageConversion::ImageHtmlDomSo urce, bool flipY, bool premultiplyAlpha); 795 GLenum format, GLenum type, Image*, WebGLImageConversion::ImageHtmlDomSo urce, bool flipY, bool premultiplyAlpha);
796 796
797 // Copy from the canvas element directly to the texture via the GPU, without a read-back to system memory. 797 // Copy from the source directly to the texture via the gpu, without a read- back to system memory.
798 void texImageCanvasByGPU(TexImageByGPUType, WebGLTexture*, GLenum target, GL int level, 798 // Souce could be canvas or imageBitmap.
799 GLint internalformat, GLenum type, GLint xoffset, GLint yoffset, GLint z offset, HTMLCanvasElement*); 799 void texImageByGPU(TexImageByGPUType, WebGLTexture*, GLenum target, GLint le vel, GLint internalformat,
800 virtual bool canUseTexImageCanvasByGPU(GLint internalformat, GLenum type); 800 GLenum type, GLint xoffset, GLint yoffset, GLint zoffset, HTMLCanvasElem ent*, ImageBitmap*);
801 virtual bool canUseTexImageByGPU(GLint internalformat, GLenum type);
801 802
802 virtual WebGLImageConversion::PixelStoreParams getPackPixelStoreParams(); 803 virtual WebGLImageConversion::PixelStoreParams getPackPixelStoreParams();
803 virtual WebGLImageConversion::PixelStoreParams getUnpackPixelStoreParams(Tex ImageDimension); 804 virtual WebGLImageConversion::PixelStoreParams getUnpackPixelStoreParams(Tex ImageDimension);
804 805
805 // Helper function for copyTex{Sub}Image, check whether the internalformat 806 // Helper function for copyTex{Sub}Image, check whether the internalformat
806 // and the color buffer format of the current bound framebuffer combination 807 // and the color buffer format of the current bound framebuffer combination
807 // is valid. 808 // is valid.
808 bool isTexInternalFormatColorBufferCombinationValid(GLenum texInternalFormat , GLenum colorBufferFormat); 809 bool isTexInternalFormatColorBufferCombinationValid(GLenum texInternalFormat , GLenum colorBufferFormat);
809 810
810 // Helper function to verify limits on the length of uniform and attribute l ocations. 811 // Helper function to verify limits on the length of uniform and attribute l ocations.
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 void texImageHelperImageData(TexImageFunctionID, GLenum, GLint, GLint, GLint , GLenum, GLenum, GLsizei, GLint, GLint, GLint, ImageData*); 1103 void texImageHelperImageData(TexImageFunctionID, GLenum, GLint, GLint, GLint , GLenum, GLenum, GLsizei, GLint, GLint, GLint, ImageData*);
1103 void texImageHelperHTMLImageElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLImageElement*, ExceptionState&); 1104 void texImageHelperHTMLImageElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLImageElement*, ExceptionState&);
1104 void texImageHelperHTMLCanvasElement(TexImageFunctionID, GLenum, GLint, GLin t, GLenum, GLenum, GLint, GLint, GLint, HTMLCanvasElement*, ExceptionState&); 1105 void texImageHelperHTMLCanvasElement(TexImageFunctionID, GLenum, GLint, GLin t, GLenum, GLenum, GLint, GLint, GLint, HTMLCanvasElement*, ExceptionState&);
1105 void texImageHelperHTMLVideoElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLVideoElement*, ExceptionState&); 1106 void texImageHelperHTMLVideoElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLVideoElement*, ExceptionState&);
1106 void texImageHelperImageBitmap(TexImageFunctionID, GLenum, GLint, GLint, GLe num, GLenum, GLint, GLint, GLint, ImageBitmap*, ExceptionState&); 1107 void texImageHelperImageBitmap(TexImageFunctionID, GLenum, GLint, GLint, GLe num, GLenum, GLint, GLint, GLint, ImageBitmap*, ExceptionState&);
1107 static const char* getTexImageFunctionName(TexImageFunctionID); 1108 static const char* getTexImageFunctionName(TexImageFunctionID);
1108 1109
1109 private: 1110 private:
1110 WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, PassOwnPtr<W ebGraphicsContext3DProvider>, const WebGLContextAttributes&); 1111 WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, PassOwnPtr<W ebGraphicsContext3DProvider>, const WebGLContextAttributes&);
1111 static PassOwnPtr<WebGraphicsContext3DProvider> createContextProviderInterna l(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned); 1112 static PassOwnPtr<WebGraphicsContext3DProvider> createContextProviderInterna l(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned);
1113 void texImageCanvasByGPU(HTMLCanvasElement*, GLuint, GLenum, GLenum, GLint);
1114 void texImageBitmapByGPU(ImageBitmap*, GLuint, GLenum, GLenum, GLint);
1112 }; 1115 };
1113 1116
1114 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 1117 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
1115 1118
1116 } // namespace blink 1119 } // namespace blink
1117 1120
1118 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); 1121 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState);
1119 1122
1120 #endif // WebGLRenderingContextBase_h 1123 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698