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

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 comments 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 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 }; 782 };
783 enum TexImageByGPUType { 783 enum TexImageByGPUType {
784 TexImage2DByGPU, 784 TexImage2DByGPU,
785 TexSubImage2DByGPU, 785 TexSubImage2DByGPU,
786 TexSubImage3DByGPU 786 TexSubImage3DByGPU
787 }; 787 };
788 enum TexImageDimension { 788 enum TexImageDimension {
789 Tex2D, 789 Tex2D,
790 Tex3D 790 Tex3D
791 }; 791 };
792 // Copy from the canvas element directly to the texture via the GPU, without a read-back to system memory. 792 // Copy from the source directly to the texture via the gpu, without a read- back to system memory.
793 void texImageCanvasByGPU(TexImageByGPUType, WebGLTexture*, GLenum target, GL int level, 793 // Souce could be canvas or imageBitmap.
794 GLint internalformat, GLenum type, GLint xoffset, GLint yoffset, GLint z offset, HTMLCanvasElement*); 794 void texImageByGPU(TexImageByGPUType, WebGLTexture*, GLenum target, GLint le vel, GLint internalformat,
795 bool canUseTexImageCanvasByGPU(GLint internalformat, GLenum type); 795 GLenum type, GLint xoffset, GLint yoffset, GLint zoffset, HTMLCanvasElem ent*, ImageBitmap*);
796 bool canUseTexImageByGPU(GLint internalformat, GLenum type);
796 797
797 virtual WebGLImageConversion::PixelStoreParams getPackPixelStoreParams(); 798 virtual WebGLImageConversion::PixelStoreParams getPackPixelStoreParams();
798 virtual WebGLImageConversion::PixelStoreParams getUnpackPixelStoreParams(Tex ImageDimension); 799 virtual WebGLImageConversion::PixelStoreParams getUnpackPixelStoreParams(Tex ImageDimension);
799 800
800 // Helper function for copyTex{Sub}Image, check whether the internalformat 801 // Helper function for copyTex{Sub}Image, check whether the internalformat
801 // and the color buffer format of the current bound framebuffer combination 802 // and the color buffer format of the current bound framebuffer combination
802 // is valid. 803 // is valid.
803 bool isTexInternalFormatColorBufferCombinationValid(GLenum texInternalFormat , GLenum colorBufferFormat); 804 bool isTexInternalFormatColorBufferCombinationValid(GLenum texInternalFormat , GLenum colorBufferFormat);
804 805
805 // Helper function to verify limits on the length of uniform and attribute l ocations. 806 // Helper function to verify limits on the length of uniform and attribute l ocations.
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 // If the vector is empty, return the maximum allowed active context number. 1085 // If the vector is empty, return the maximum allowed active context number.
1085 static WebGLRenderingContextBase* oldestContext(); 1086 static WebGLRenderingContextBase* oldestContext();
1086 static WebGLRenderingContextBase* oldestEvictedContext(); 1087 static WebGLRenderingContextBase* oldestEvictedContext();
1087 1088
1088 CrossThreadWeakPersistentThisPointer<WebGLRenderingContextBase> createWeakTh isPointer() { return CrossThreadWeakPersistentThisPointer<WebGLRenderingContextB ase>(this); } 1089 CrossThreadWeakPersistentThisPointer<WebGLRenderingContextBase> createWeakTh isPointer() { return CrossThreadWeakPersistentThisPointer<WebGLRenderingContextB ase>(this); }
1089 1090
1090 ImageBitmap* transferToImageBitmapBase(); 1091 ImageBitmap* transferToImageBitmapBase();
1091 private: 1092 private:
1092 WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, PassOwnPtr<W ebGraphicsContext3DProvider>, const WebGLContextAttributes&); 1093 WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, PassOwnPtr<W ebGraphicsContext3DProvider>, const WebGLContextAttributes&);
1093 static PassOwnPtr<WebGraphicsContext3DProvider> createContextProviderInterna l(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned); 1094 static PassOwnPtr<WebGraphicsContext3DProvider> createContextProviderInterna l(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned);
1095 void texImageCanvasByGPU(HTMLCanvasElement*, GLuint, GLenum, GLenum, GLint);
1096 void texImageBitmapByGPU(ImageBitmap*, GLuint, GLenum, GLenum, GLint);
1094 }; 1097 };
1095 1098
1096 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 1099 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
1097 1100
1098 } // namespace blink 1101 } // namespace blink
1099 1102
1100 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); 1103 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState);
1101 1104
1102 #endif // WebGLRenderingContextBase_h 1105 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698