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

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: address kbr@'s comments Created 4 years, 5 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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 TexSubImage3DByGPU 786 TexSubImage3DByGPU
787 }; 787 };
788 enum TexImageDimension { 788 enum TexImageDimension {
789 Tex2D, 789 Tex2D,
790 Tex3D 790 Tex3D
791 }; 791 };
792 void texImage2DBase(GLenum target, GLint level, GLint internalformat, GLsize i width, GLsizei height, GLint border, GLenum format, GLenum type, const void* p ixels); 792 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 texImageImpl(TexImageFunctionID, GLenum target, GLint level, GLint inte rnalformat, GLint xoffset, GLint yoffset, GLint zoffset, 793 void texImageImpl(TexImageFunctionID, GLenum target, GLint level, GLint inte rnalformat, GLint xoffset, GLint yoffset, GLint zoffset,
794 GLenum format, GLenum type, Image*, WebGLImageConversion::ImageHtmlDomSo urce, bool flipY, bool premultiplyAlpha); 794 GLenum format, GLenum type, Image*, WebGLImageConversion::ImageHtmlDomSo urce, bool flipY, bool premultiplyAlpha);
795 795
796 // Copy from the canvas element directly to the texture via the GPU, without a read-back to system memory. 796 // Copy from the source directly to the texture via the gpu, without a read- back to system memory.
797 void texImageCanvasByGPU(TexImageByGPUType, WebGLTexture*, GLenum target, GL int level, 797 // Souce could be canvas or imageBitmap.
798 GLint internalformat, GLenum type, GLint xoffset, GLint yoffset, GLint z offset, HTMLCanvasElement*); 798 void texImageByGPU(TexImageByGPUType, WebGLTexture*, GLenum target, GLint le vel, GLint internalformat,
799 virtual bool canUseTexImageCanvasByGPU(GLint internalformat, GLenum type); 799 GLenum type, GLint xoffset, GLint yoffset, GLint zoffset, CanvasImageSou rce*);
800 virtual bool canUseTexImageByGPU(TexImageFunctionID, GLint internalformat, G Lenum type);
800 801
801 virtual WebGLImageConversion::PixelStoreParams getPackPixelStoreParams(); 802 virtual WebGLImageConversion::PixelStoreParams getPackPixelStoreParams();
802 virtual WebGLImageConversion::PixelStoreParams getUnpackPixelStoreParams(Tex ImageDimension); 803 virtual WebGLImageConversion::PixelStoreParams getUnpackPixelStoreParams(Tex ImageDimension);
803 804
804 // Helper function for copyTex{Sub}Image, check whether the internalformat 805 // Helper function for copyTex{Sub}Image, check whether the internalformat
805 // and the color buffer format of the current bound framebuffer combination 806 // and the color buffer format of the current bound framebuffer combination
806 // is valid. 807 // is valid.
807 bool isTexInternalFormatColorBufferCombinationValid(GLenum texInternalFormat , GLenum colorBufferFormat); 808 bool isTexInternalFormatColorBufferCombinationValid(GLenum texInternalFormat , GLenum colorBufferFormat);
808 809
809 // Helper function to verify limits on the length of uniform and attribute l ocations. 810 // Helper function to verify limits on the length of uniform and attribute l ocations.
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 void texImageHelperImageData(TexImageFunctionID, GLenum, GLint, GLint, GLint , GLenum, GLenum, GLsizei, GLint, GLint, GLint, ImageData*); 1099 void texImageHelperImageData(TexImageFunctionID, GLenum, GLint, GLint, GLint , GLenum, GLenum, GLsizei, GLint, GLint, GLint, ImageData*);
1099 void texImageHelperHTMLImageElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLImageElement*, ExceptionState&); 1100 void texImageHelperHTMLImageElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLImageElement*, ExceptionState&);
1100 void texImageHelperHTMLCanvasElement(TexImageFunctionID, GLenum, GLint, GLin t, GLenum, GLenum, GLint, GLint, GLint, HTMLCanvasElement*, ExceptionState&); 1101 void texImageHelperHTMLCanvasElement(TexImageFunctionID, GLenum, GLint, GLin t, GLenum, GLenum, GLint, GLint, GLint, HTMLCanvasElement*, ExceptionState&);
1101 void texImageHelperHTMLVideoElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLVideoElement*, ExceptionState&); 1102 void texImageHelperHTMLVideoElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLVideoElement*, ExceptionState&);
1102 void texImageHelperImageBitmap(TexImageFunctionID, GLenum, GLint, GLint, GLe num, GLenum, GLint, GLint, GLint, ImageBitmap*, ExceptionState&); 1103 void texImageHelperImageBitmap(TexImageFunctionID, GLenum, GLint, GLint, GLe num, GLenum, GLint, GLint, GLint, ImageBitmap*, ExceptionState&);
1103 static const char* getTexImageFunctionName(TexImageFunctionID); 1104 static const char* getTexImageFunctionName(TexImageFunctionID);
1104 1105
1105 private: 1106 private:
1106 WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, std::unique_ ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); 1107 WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, std::unique_ ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&);
1107 static std::unique_ptr<WebGraphicsContext3DProvider> createContextProviderIn ternal(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned); 1108 static std::unique_ptr<WebGraphicsContext3DProvider> createContextProviderIn ternal(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned);
1109 void texImageCanvasByGPU(HTMLCanvasElement*, GLuint, GLenum, GLenum, GLint);
1110 void texImageBitmapByGPU(ImageBitmap*, GLuint, GLenum, GLenum, GLint, bool);
1108 }; 1111 };
1109 1112
1110 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 1113 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
1111 1114
1112 } // namespace blink 1115 } // namespace blink
1113 1116
1114 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); 1117 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState);
1115 1118
1116 #endif // WebGLRenderingContextBase_h 1119 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698