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

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

Issue 2370703003: Validate internalformat/format/type for uploading DOM elements to texture (Closed)
Patch Set: fix extension Created 4 years, 2 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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 DrawingBuffer* m_drawingBuffer; 742 DrawingBuffer* m_drawingBuffer;
743 Member<WebGLFramebuffer> m_readFramebufferBinding; 743 Member<WebGLFramebuffer> m_readFramebufferBinding;
744 }; 744 };
745 745
746 // Errors raised by synthesizeGLError() while the context is lost. 746 // Errors raised by synthesizeGLError() while the context is lost.
747 Vector<GLenum> m_lostContextErrors; 747 Vector<GLenum> m_lostContextErrors;
748 // Other errors raised by synthesizeGLError(). 748 // Other errors raised by synthesizeGLError().
749 Vector<GLenum> m_syntheticErrors; 749 Vector<GLenum> m_syntheticErrors;
750 750
751 bool m_isWebGL2FormatsTypesAdded; 751 bool m_isWebGL2FormatsTypesAdded;
752 bool m_isWebGL2TexImageSourceFormatsTypesAdded;
752 bool m_isWebGL2InternalFormatsCopyTexImageAdded; 753 bool m_isWebGL2InternalFormatsCopyTexImageAdded;
753 bool m_isOESTextureFloatFormatsTypesAdded; 754 bool m_isOESTextureFloatFormatsTypesAdded;
754 bool m_isOESTextureHalfFloatFormatsTypesAdded; 755 bool m_isOESTextureHalfFloatFormatsTypesAdded;
755 bool m_isWebGLDepthTextureFormatsTypesAdded; 756 bool m_isWebGLDepthTextureFormatsTypesAdded;
756 bool m_isEXTsRGBFormatsTypesAdded; 757 bool m_isEXTsRGBFormatsTypesAdded;
757 758
758 std::set<GLenum> m_supportedInternalFormats; 759 std::set<GLenum> m_supportedInternalFormats;
760 std::set<GLenum> m_supportedTexImageSourceInternalFormats;
759 std::set<GLenum> m_supportedInternalFormatsCopyTexImage; 761 std::set<GLenum> m_supportedInternalFormatsCopyTexImage;
760 std::set<GLenum> m_supportedFormats; 762 std::set<GLenum> m_supportedFormats;
763 std::set<GLenum> m_supportedTexImageSourceFormats;
761 std::set<GLenum> m_supportedTypes; 764 std::set<GLenum> m_supportedTypes;
765 std::set<GLenum> m_supportedTexImageSourceTypes;
762 766
763 // Helpers for getParameter and others 767 // Helpers for getParameter and others
764 ScriptValue getBooleanParameter(ScriptState*, GLenum); 768 ScriptValue getBooleanParameter(ScriptState*, GLenum);
765 ScriptValue getBooleanArrayParameter(ScriptState*, GLenum); 769 ScriptValue getBooleanArrayParameter(ScriptState*, GLenum);
766 ScriptValue getFloatParameter(ScriptState*, GLenum); 770 ScriptValue getFloatParameter(ScriptState*, GLenum);
767 ScriptValue getIntParameter(ScriptState*, GLenum); 771 ScriptValue getIntParameter(ScriptState*, GLenum);
768 ScriptValue getInt64Parameter(ScriptState*, GLenum); 772 ScriptValue getInt64Parameter(ScriptState*, GLenum);
769 ScriptValue getUnsignedIntParameter(ScriptState*, GLenum); 773 ScriptValue getUnsignedIntParameter(ScriptState*, GLenum);
770 ScriptValue getWebGLFloatArrayParameter(ScriptState*, GLenum); 774 ScriptValue getWebGLFloatArrayParameter(ScriptState*, GLenum);
771 ScriptValue getWebGLIntArrayParameter(ScriptState*, GLenum); 775 ScriptValue getWebGLIntArrayParameter(ScriptState*, GLenum);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 WebGLTexture* validateTextureBinding(const char* functionName, GLenum target ); 856 WebGLTexture* validateTextureBinding(const char* functionName, GLenum target );
853 857
854 // Wrapper function for validateTexture2D(3D)Binding, used in texImageHelper functions. 858 // Wrapper function for validateTexture2D(3D)Binding, used in texImageHelper functions.
855 virtual WebGLTexture* validateTexImageBinding(const char*, TexImageFunctionI D, GLenum); 859 virtual WebGLTexture* validateTexImageBinding(const char*, TexImageFunctionI D, GLenum);
856 860
857 // Helper function to check texture 2D target and texture bound to the targe t. 861 // Helper function to check texture 2D target and texture bound to the targe t.
858 // Generate GL errors and return 0 if target is invalid or texture bound is 862 // Generate GL errors and return 0 if target is invalid or texture bound is
859 // null. Otherwise, return the texture bound to the target. 863 // null. Otherwise, return the texture bound to the target.
860 WebGLTexture* validateTexture2DBinding(const char* functionName, GLenum targ et); 864 WebGLTexture* validateTexture2DBinding(const char* functionName, GLenum targ et);
861 865
862 // Helper function to check input internalformat/format/type for functions { copy}Tex{Sub}Image. 866 void addExtensionSupportedFormatsTypes();
867
868 // Helper function to check input internalformat/format/type for functions T ex{Sub}Image taking TexImageSource source data.
869 // Generates GL error and returns false if parameters are invalid.
870 bool validateTexImageSourceFormatAndType(const char* functionName, TexImageF unctionType, GLenum internalformat, GLenum format, GLenum type);
871
872 // Helper function to check input internalformat/format/type for functions T ex{Sub}Image.
863 // Generates GL error and returns false if parameters are invalid. 873 // Generates GL error and returns false if parameters are invalid.
864 bool validateTexFuncFormatAndType(const char* functionName, TexImageFunction Type, GLenum internalformat, GLenum format, GLenum type, GLint level); 874 bool validateTexFuncFormatAndType(const char* functionName, TexImageFunction Type, GLenum internalformat, GLenum format, GLenum type, GLint level);
865 875
866 // Helper function to check readbuffer validity for copyTex{Sub}Image. 876 // Helper function to check readbuffer validity for copyTex{Sub}Image.
867 // If yes, obtains the bound read framebuffer, returns true. 877 // If yes, obtains the bound read framebuffer, returns true.
868 // If not, generates a GL error, returns false. 878 // If not, generates a GL error, returns false.
869 bool validateReadBufferAndGetInfo(const char* functionName, WebGLFramebuffer *& readFramebufferBinding); 879 bool validateReadBufferAndGetInfo(const char* functionName, WebGLFramebuffer *& readFramebufferBinding);
870 880
871 // Helper function to check format/type and ArrayBuffer view type for readPi xels. 881 // Helper function to check format/type and ArrayBuffer view type for readPi xels.
872 // Generates INVALID_ENUM and returns false if parameters are invalid. 882 // Generates INVALID_ENUM and returns false if parameters are invalid.
(...skipping 28 matching lines...) Expand all
901 // Otherwise, it would return quickly without doing other work. 911 // Otherwise, it would return quickly without doing other work.
902 bool validateTexFunc(const char* functionName, TexImageFunctionType, TexFunc ValidationSourceType, GLenum target, GLint level, GLenum internalformat, GLsizei width, 912 bool validateTexFunc(const char* functionName, TexImageFunctionType, TexFunc ValidationSourceType, GLenum target, GLint level, GLenum internalformat, GLsizei width,
903 GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLint xoffset, GLint yoffset, GLint zoffset); 913 GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLint xoffset, GLint yoffset, GLint zoffset);
904 914
905 // Helper function to check input width and height for functions {copy, comp ressed}Tex{Sub}Image. 915 // Helper function to check input width and height for functions {copy, comp ressed}Tex{Sub}Image.
906 // Generates GL error and returns false if width or height is invalid. 916 // Generates GL error and returns false if width or height is invalid.
907 bool validateTexFuncDimensions(const char* functionName, TexImageFunctionTyp e, GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth); 917 bool validateTexFuncDimensions(const char* functionName, TexImageFunctionTyp e, GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth);
908 918
909 // Helper function to check input parameters for functions {copy}Tex{Sub}Ima ge. 919 // Helper function to check input parameters for functions {copy}Tex{Sub}Ima ge.
910 // Generates GL error and returns false if parameters are invalid. 920 // Generates GL error and returns false if parameters are invalid.
911 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); 921 bool validateTexFuncParameters(const char* functionName, TexImageFunctionTyp e, TexFuncValidationSourceType, GLenum target, GLint level, GLenum internalforma t, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GL enum type);
912 922
913 enum NullDisposition { 923 enum NullDisposition {
914 NullAllowed, 924 NullAllowed,
915 NullNotAllowed, 925 NullNotAllowed,
916 NullNotReachable 926 NullNotReachable
917 }; 927 };
918 928
919 // Helper function to validate that the given ArrayBufferView 929 // Helper function to validate that the given ArrayBufferView
920 // is of the correct type and contains enough data for the texImage call. 930 // is of the correct type and contains enough data for the texImage call.
921 // Generates GL error and returns false if parameters are invalid. 931 // Generates GL error and returns false if parameters are invalid.
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 bool isPaintable() const final { return drawingBuffer(); } 1118 bool isPaintable() const final { return drawingBuffer(); }
1109 }; 1119 };
1110 1120
1111 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 1121 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
1112 1122
1113 } // namespace blink 1123 } // namespace blink
1114 1124
1115 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); 1125 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState);
1116 1126
1117 #endif // WebGLRenderingContextBase_h 1127 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698