| OLD | NEW |
| 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 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 WebGLTexture* validateTextureBinding(const char* functionName, GLenum target
); | 852 WebGLTexture* validateTextureBinding(const char* functionName, GLenum target
); |
| 853 | 853 |
| 854 // Wrapper function for validateTexture2D(3D)Binding, used in texImageHelper
functions. | 854 // Wrapper function for validateTexture2D(3D)Binding, used in texImageHelper
functions. |
| 855 virtual WebGLTexture* validateTexImageBinding(const char*, TexImageFunctionI
D, GLenum); | 855 virtual WebGLTexture* validateTexImageBinding(const char*, TexImageFunctionI
D, GLenum); |
| 856 | 856 |
| 857 // Helper function to check texture 2D target and texture bound to the targe
t. | 857 // 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 | 858 // Generate GL errors and return 0 if target is invalid or texture bound is |
| 859 // null. Otherwise, return the texture bound to the target. | 859 // null. Otherwise, return the texture bound to the target. |
| 860 WebGLTexture* validateTexture2DBinding(const char* functionName, GLenum targ
et); | 860 WebGLTexture* validateTexture2DBinding(const char* functionName, GLenum targ
et); |
| 861 | 861 |
| 862 enum TexFuncValidationSourceType { |
| 863 SourceArrayBufferView, |
| 864 SourceImageData, |
| 865 SourceHTMLImageElement, |
| 866 SourceHTMLCanvasElement, |
| 867 SourceHTMLVideoElement, |
| 868 SourceImageBitmap, |
| 869 SourceUnpackBuffer, |
| 870 }; |
| 871 |
| 862 // Helper function to check input internalformat/format/type for functions {
copy}Tex{Sub}Image. | 872 // Helper function to check input internalformat/format/type for functions {
copy}Tex{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, TexFuncValidationSourceType, 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. |
| 873 // Generates INVALID_OPERATION if ArrayBuffer view type is incompatible with
type. | 883 // Generates INVALID_OPERATION if ArrayBuffer view type is incompatible with
type. |
| 874 virtual bool validateReadPixelsFormatAndType(GLenum format, GLenum type, DOM
ArrayBufferView*); | 884 virtual bool validateReadPixelsFormatAndType(GLenum format, GLenum type, DOM
ArrayBufferView*); |
| 875 | 885 |
| 876 // Helper function to check parameters of readPixels. Returns true if all pa
rameters | 886 // Helper function to check parameters of readPixels. Returns true if all pa
rameters |
| 877 // are valid. Otherwise, generates appropriate error and returns false. | 887 // are valid. Otherwise, generates appropriate error and returns false. |
| 878 bool validateReadPixelsFuncParameters(GLsizei width, GLsizei height, GLenum
format, GLenum type, DOMArrayBufferView*, long long bufferSize); | 888 bool validateReadPixelsFuncParameters(GLsizei width, GLsizei height, GLenum
format, GLenum type, DOMArrayBufferView*, long long bufferSize); |
| 879 | 889 |
| 880 virtual GLint getMaxTextureLevelForTarget(GLenum target); | 890 virtual GLint getMaxTextureLevelForTarget(GLenum target); |
| 881 | 891 |
| 882 // Helper function to check input level for functions {copy}Tex{Sub}Image. | 892 // Helper function to check input level for functions {copy}Tex{Sub}Image. |
| 883 // Generates GL error and returns false if level is invalid. | 893 // Generates GL error and returns false if level is invalid. |
| 884 bool validateTexFuncLevel(const char* functionName, GLenum target, GLint lev
el); | 894 bool validateTexFuncLevel(const char* functionName, GLenum target, GLint lev
el); |
| 885 | 895 |
| 886 // Helper function to check if a 64-bit value is non-negative and can fit in
to a 32-bit integer. | 896 // Helper function to check if a 64-bit value is non-negative and can fit in
to a 32-bit integer. |
| 887 // Generates GL error and returns false if not. | 897 // Generates GL error and returns false if not. |
| 888 bool validateValueFitNonNegInt32(const char* functionName, const char* param
Name, long long value); | 898 bool validateValueFitNonNegInt32(const char* functionName, const char* param
Name, long long value); |
| 889 | 899 |
| 890 enum TexFuncValidationSourceType { | |
| 891 SourceArrayBufferView, | |
| 892 SourceImageData, | |
| 893 SourceHTMLImageElement, | |
| 894 SourceHTMLCanvasElement, | |
| 895 SourceHTMLVideoElement, | |
| 896 SourceImageBitmap, | |
| 897 SourceUnpackBuffer, | |
| 898 }; | |
| 899 | |
| 900 // Helper function for tex{Sub}Image{2|3}D to check if the input format/type
/level/target/width/height/depth/border/xoffset/yoffset/zoffset are valid. | 900 // Helper function for tex{Sub}Image{2|3}D to check if the input format/type
/level/target/width/height/depth/border/xoffset/yoffset/zoffset are valid. |
| 901 // Otherwise, it would return quickly without doing other work. | 901 // 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, | 902 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); | 903 GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type,
GLint xoffset, GLint yoffset, GLint zoffset); |
| 904 | 904 |
| 905 // Helper function to check input width and height for functions {copy, comp
ressed}Tex{Sub}Image. | 905 // 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. | 906 // 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); | 907 bool validateTexFuncDimensions(const char* functionName, TexImageFunctionTyp
e, GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth); |
| 908 | 908 |
| 909 // Helper function to check input parameters for functions {copy}Tex{Sub}Ima
ge. | 909 // Helper function to check input parameters for functions {copy}Tex{Sub}Ima
ge. |
| 910 // Generates GL error and returns false if parameters are invalid. | 910 // 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); | 911 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 | 912 |
| 913 enum NullDisposition { | 913 enum NullDisposition { |
| 914 NullAllowed, | 914 NullAllowed, |
| 915 NullNotAllowed, | 915 NullNotAllowed, |
| 916 NullNotReachable | 916 NullNotReachable |
| 917 }; | 917 }; |
| 918 | 918 |
| 919 // Helper function to validate that the given ArrayBufferView | 919 // Helper function to validate that the given ArrayBufferView |
| 920 // is of the correct type and contains enough data for the texImage call. | 920 // is of the correct type and contains enough data for the texImage call. |
| 921 // Generates GL error and returns false if parameters are invalid. | 921 // Generates GL error and returns false if parameters are invalid. |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 bool isPaintable() const final { return drawingBuffer(); } | 1108 bool isPaintable() const final { return drawingBuffer(); } |
| 1109 }; | 1109 }; |
| 1110 | 1110 |
| 1111 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); | 1111 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); |
| 1112 | 1112 |
| 1113 } // namespace blink | 1113 } // namespace blink |
| 1114 | 1114 |
| 1115 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); | 1115 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); |
| 1116 | 1116 |
| 1117 #endif // WebGLRenderingContextBase_h | 1117 #endif // WebGLRenderingContextBase_h |
| OLD | NEW |