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

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

Issue 2277603005: Implement tex{Sub}Image{2|3}D with ArrayBufferView sub source. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 // Helper function to check input width and height for functions {copy, comp ressed}Tex{Sub}Image. 887 // Helper function to check input width and height for functions {copy, comp ressed}Tex{Sub}Image.
888 // Generates GL error and returns false if width or height is invalid. 888 // Generates GL error and returns false if width or height is invalid.
889 bool validateTexFuncDimensions(const char* functionName, TexImageFunctionTyp e, GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth); 889 bool validateTexFuncDimensions(const char* functionName, TexImageFunctionTyp e, GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth);
890 890
891 // Helper function to check input parameters for functions {copy}Tex{Sub}Ima ge. 891 // Helper function to check input parameters for functions {copy}Tex{Sub}Ima ge.
892 // Generates GL error and returns false if parameters are invalid. 892 // Generates GL error and returns false if parameters are invalid.
893 bool validateTexFuncParameters(const char* functionName, TexImageFunctionTyp e, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei hei ght, GLsizei depth, GLint border, GLenum format, GLenum type); 893 bool validateTexFuncParameters(const char* functionName, TexImageFunctionTyp e, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei hei ght, GLsizei depth, GLint border, GLenum format, GLenum type);
894 894
895 enum NullDisposition { 895 enum NullDisposition {
896 NullAllowed, 896 NullAllowed,
897 NullNotAllowed 897 NullNotAllowed,
898 NullNotReachable
898 }; 899 };
899 900
900 // Helper function to validate that the given ArrayBufferView 901 // Helper function to validate that the given ArrayBufferView
901 // is of the correct type and contains enough data for the texImage call. 902 // is of the correct type and contains enough data for the texImage call.
902 // Generates GL error and returns false if parameters are invalid. 903 // Generates GL error and returns false if parameters are invalid.
903 bool validateTexFuncData(const char* functionName, TexImageDimension, GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, DOMArrayBufferView* pixels, NullDisposition); 904 bool validateTexFuncData(const char* functionName, TexImageDimension, GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, DOMArrayBufferView* pixels, NullDisposition, GLuint srcOffset);
904 905
905 // Helper function to validate a given texture format is settable as in 906 // Helper function to validate a given texture format is settable as in
906 // you can supply data to texImage2D, or call texImage2D, copyTexImage2D and 907 // you can supply data to texImage2D, or call texImage2D, copyTexImage2D and
907 // copyTexSubImage2D. 908 // copyTexSubImage2D.
908 // Generates GL error and returns false if the format is not settable. 909 // Generates GL error and returns false if the format is not settable.
909 bool validateSettableTexFormat(const char* functionName, GLenum format); 910 bool validateSettableTexFormat(const char* functionName, GLenum format);
910 911
911 // Helper function to validate format for CopyTexImage. 912 // Helper function to validate format for CopyTexImage.
912 bool validateCopyTexFormat(const char* functionName, GLenum format); 913 bool validateCopyTexFormat(const char* functionName, GLenum format);
913 914
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 static void willDestroyContext(WebGLRenderingContextBase*); 1096 static void willDestroyContext(WebGLRenderingContextBase*);
1096 static void forciblyLoseOldestContext(const String& reason); 1097 static void forciblyLoseOldestContext(const String& reason);
1097 // Return the least recently used context's position in the active context v ector. 1098 // Return the least recently used context's position in the active context v ector.
1098 // If the vector is empty, return the maximum allowed active context number. 1099 // If the vector is empty, return the maximum allowed active context number.
1099 static WebGLRenderingContextBase* oldestContext(); 1100 static WebGLRenderingContextBase* oldestContext();
1100 static WebGLRenderingContextBase* oldestEvictedContext(); 1101 static WebGLRenderingContextBase* oldestEvictedContext();
1101 1102
1102 ImageBitmap* transferToImageBitmapBase(); 1103 ImageBitmap* transferToImageBitmapBase();
1103 1104
1104 // Helper functions for tex(Sub)Image2D && texSubImage3D 1105 // Helper functions for tex(Sub)Image2D && texSubImage3D
1105 void texImageHelperDOMArrayBufferView(TexImageFunctionID, GLenum, GLint, GLi nt, GLsizei, GLsizei, GLint, GLenum, GLenum, GLsizei, GLint, GLint, GLint, DOMAr rayBufferView*); 1106 void texImageHelperDOMArrayBufferView(TexImageFunctionID, GLenum, GLint, GLi nt, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, GLint, GLint, GLint, DOMAr rayBufferView*, NullDisposition, GLuint srcOffset);
1106 void texImageHelperImageData(TexImageFunctionID, GLenum, GLint, GLint, GLint , GLenum, GLenum, GLsizei, GLint, GLint, GLint, ImageData*); 1107 void texImageHelperImageData(TexImageFunctionID, GLenum, GLint, GLint, GLint , GLenum, GLenum, GLsizei, GLint, GLint, GLint, ImageData*);
1107 void texImageHelperHTMLImageElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLImageElement*, ExceptionState&); 1108 void texImageHelperHTMLImageElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLImageElement*, ExceptionState&);
1108 void texImageHelperHTMLCanvasElement(TexImageFunctionID, GLenum, GLint, GLin t, GLenum, GLenum, GLint, GLint, GLint, HTMLCanvasElement*, ExceptionState&); 1109 void texImageHelperHTMLCanvasElement(TexImageFunctionID, GLenum, GLint, GLin t, GLenum, GLenum, GLint, GLint, GLint, HTMLCanvasElement*, ExceptionState&);
1109 void texImageHelperHTMLVideoElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLVideoElement*, ExceptionState&); 1110 void texImageHelperHTMLVideoElement(TexImageFunctionID, GLenum, GLint, GLint , GLenum, GLenum, GLint, GLint, GLint, HTMLVideoElement*, ExceptionState&);
1110 void texImageHelperImageBitmap(TexImageFunctionID, GLenum, GLint, GLint, GLe num, GLenum, GLint, GLint, GLint, ImageBitmap*, ExceptionState&); 1111 void texImageHelperImageBitmap(TexImageFunctionID, GLenum, GLint, GLint, GLe num, GLenum, GLint, GLint, GLint, ImageBitmap*, ExceptionState&);
1111 static const char* getTexImageFunctionName(TexImageFunctionID); 1112 static const char* getTexImageFunctionName(TexImageFunctionID);
1112 1113
1113 private: 1114 private:
1114 WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, std::unique_ ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&, unsigned); 1115 WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, std::unique_ ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&, unsigned);
1115 static std::unique_ptr<WebGraphicsContext3DProvider> createContextProviderIn ternal(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned); 1116 static std::unique_ptr<WebGraphicsContext3DProvider> createContextProviderIn ternal(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned);
1116 void texImageCanvasByGPU(HTMLCanvasElement*, GLuint, GLenum, GLenum, GLint); 1117 void texImageCanvasByGPU(HTMLCanvasElement*, GLuint, GLenum, GLenum, GLint);
1117 void texImageBitmapByGPU(ImageBitmap*, GLuint, GLenum, GLenum, GLint, bool); 1118 void texImageBitmapByGPU(ImageBitmap*, GLuint, GLenum, GLenum, GLint, bool);
1118 1119
1119 const unsigned m_version; 1120 const unsigned m_version;
1120 1121
1121 bool isPaintable() const final { return drawingBuffer(); } 1122 bool isPaintable() const final { return drawingBuffer(); }
1122 }; 1123 };
1123 1124
1124 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 1125 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
1125 1126
1126 } // namespace blink 1127 } // namespace blink
1127 1128
1128 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); 1129 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState);
1129 1130
1130 #endif // WebGLRenderingContextBase_h 1131 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698