Changeset 147042 in webkit
- Timestamp:
- Mar 27, 2013 6:35:02 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r147041 r147042 1 2013-03-27 Jun Jiang <jun.a.jiang@intel.com> 2 3 Refactor validation checks for texture uploads 4 https://bugs.webkit.org/show_bug.cgi?id=111012 5 6 Reviewed by Kenneth Russell. 7 8 Move the validation checks to the entry level of tex{Sub}Image2D, return early for invalid parameters and avoid duplicated checks. 9 Moreover, turn all the validation checks at the bottom level - tex{Sub}Image2DBase into assertions. 10 11 Already covered by current tests. 12 13 * html/canvas/WebGLRenderingContext.cpp: 14 (WebCore::WebGLRenderingContext::copyTexSubImage2D): 15 (WebCore::WebGLRenderingContext::texImage2DBase): 16 (WebCore::WebGLRenderingContext::texImage2DImpl): 17 (WebCore::WebGLRenderingContext::validateTexFunc): A helper function for tex{Sub}Image2D to check input parameters. 18 (WebCore::WebGLRenderingContext::texImage2D): 19 (WebCore::WebGLRenderingContext::texSubImage2DBase): 20 (WebCore::WebGLRenderingContext::texSubImage2DImpl): 21 (WebCore::WebGLRenderingContext::texSubImage2D): 22 (WebCore::WebGLRenderingContext::validateHTMLImageElement): 23 (WebCore::WebGLRenderingContext::validateHTMLCanvasElement): 24 (WebCore::WebGLRenderingContext::validateHTMLVideoElement): 25 * html/canvas/WebGLRenderingContext.h: 26 1 27 2013-03-27 Arnaud Renevier <a.renevier@sisa.samsung.com> 2 28 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
r146820 r147042 1464 1464 if (!validateSize("copyTexSubImage2D", xoffset, yoffset) || !validateSize("copyTexSubImage2D", width, height)) 1465 1465 return; 1466 // Before checking if it is in the range, check if overflow happens first. 1467 if (xoffset + width < 0 || yoffset + height < 0) { 1468 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "copyTexSubImage2D", "bad dimensions"); 1469 return; 1470 } 1466 1471 if (xoffset + width > tex->getWidth(target, level) || yoffset + height > tex->getHeight(target, level)) { 1467 1472 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "copyTexSubImage2D", "rectangle out of range"); … … 3682 3687 // FIXME: For now we ignore any errors returned 3683 3688 ec = 0; 3684 if (!validateTexFuncParameters("texImage2D", NotTexSubImage2D, target, level, internalformat, width, height, border, format, type))3685 return;3686 3689 WebGLTexture* tex = validateTextureBinding("texImage2D", target, true); 3687 if (!tex) 3688 return; 3689 if (!isGLES2NPOTStrict()) { 3690 if (level && WebGLTexture::isNPOT(width, height)) { 3691 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texImage2D", "level > 0 not power of 2"); 3692 return; 3693 } 3694 } 3690 ASSERT(validateTexFuncParameters("texImage2D", NotTexSubImage2D, target, level, internalformat, width, height, border, format, type)); 3691 ASSERT(tex); 3692 ASSERT(!level || !WebGLTexture::isNPOT(width, height)); 3695 3693 if (!pixels) { 3696 3694 // Note: Chromium's OpenGL implementation clears textures and isResourceSafe() is therefore true. … … 3707 3705 } 3708 3706 } else { 3709 if (!validateSettableTexFormat("texImage2D", internalformat)) 3710 return; 3707 ASSERT(validateSettableTexFormat("texImage2D", internalformat)); 3711 3708 m_context->texImage2D(target, level, internalformat, width, height, 3712 3709 border, format, type, pixels); … … 3719 3716 { 3720 3717 ec = 0; 3721 if (!validateSettableTexFormat("texImage2D", internalformat))3722 return;3723 3718 Vector<uint8_t> data; 3724 3719 GraphicsContext3D::ImageExtractor imageExtractor(image, domSource, premultiplyAlpha, m_unpackColorspaceConversion == GraphicsContext3D::NONE); … … 3748 3743 } 3749 3744 3745 bool WebGLRenderingContext::validateTexFunc(const char* functionName, TexFuncValidationFunctionType functionType, TexFuncValidationSourceType sourceType, GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, GC3Dint xoffset, GC3Dint yoffset) 3746 { 3747 // FIXME: Uploading {ImageData, HTMLImageElement, HTMLCanvasElement, HTMLVideoElement} to half floating point texture is not supported yet. 3748 // See https://bugs.webkit.org/show_bug.cgi?id=110936. 3749 if (sourceType != SourceArrayBufferView && type == GraphicsContext3D::HALF_FLOAT_OES) { 3750 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "Operation not supported yet"); 3751 return false; 3752 } 3753 3754 if (!validateTexFuncParameters(functionName, functionType, target, level, internalformat, width, height, border, format, type)) 3755 return false; 3756 3757 WebGLTexture* texture = validateTextureBinding(functionName, target, true); 3758 if (!texture) 3759 return false; 3760 3761 if (functionType == NotTexSubImage2D) { 3762 if (level && WebGLTexture::isNPOT(width, height)) { 3763 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "level > 0 not power of 2"); 3764 return false; 3765 } 3766 // For SourceArrayBufferView, function validateTexFuncData() would handle whether to validate the SettableTexFormat 3767 // by checking if the ArrayBufferView is null or not. 3768 if (sourceType != SourceArrayBufferView) { 3769 if (!validateSettableTexFormat(functionName, format)) 3770 return false; 3771 } 3772 } else { 3773 if (!validateSettableTexFormat(functionName, format)) 3774 return false; 3775 if (!validateSize(functionName, xoffset, yoffset)) 3776 return false; 3777 // Before checking if it is in the range, check if overflow happens first. 3778 if (xoffset + width < 0 || yoffset + height < 0) { 3779 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "bad dimensions"); 3780 return false; 3781 } 3782 if (xoffset + width > texture->getWidth(target, level) || yoffset + height > texture->getHeight(target, level)) { 3783 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "dimensions out of range"); 3784 return false; 3785 } 3786 if (texture->getInternalFormat(target, level) != format || texture->getType(target, level) != type) { 3787 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "type and format do not match texture"); 3788 return false; 3789 } 3790 } 3791 3792 return true; 3793 } 3794 3750 3795 void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, 3751 3796 GC3Dsizei width, GC3Dsizei height, GC3Dint border, 3752 3797 GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionCode& ec) 3753 3798 { 3754 if (isContextLost() || !validateTexFuncData("texImage2D", level, width, height, format, type, pixels, NullAllowed)) 3799 if (isContextLost() || !validateTexFuncData("texImage2D", level, width, height, format, type, pixels, NullAllowed) 3800 || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceArrayBufferView, target, level, internalformat, width, height, border, format, type, 0, 0)) 3755 3801 return; 3756 3802 void* data = pixels ? pixels->baseAddress() : 0; … … 3779 3825 { 3780 3826 ec = 0; 3781 if (isContextLost() )3827 if (isContextLost() || !pixels || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceImageData, target, level, internalformat, pixels->width(), pixels->height(), 0, format, type, 0, 0)) 3782 3828 return; 3783 3829 Vector<uint8_t> data; 3784 if (!pixels)3785 return;3786 if (!validateTexFuncFormatAndType("texImage2D", format, type, level))3787 return;3788 if (!validateSettableTexFormat("texImage2D", format))3789 return;3790 // FIXME: Uploading ImageData to half floating point texture is not supported yet3791 // https://bugs.webkit.org/show_bug.cgi?id=1109363792 if (type == GraphicsContext3D::HALF_FLOAT_OES) {3793 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texImage2D", "Operation not supported yet");3794 return;3795 }3796 3797 3830 bool needConversion = true; 3798 3831 // The data from ImageData is always of format RGBA8. … … 3817 3850 { 3818 3851 ec = 0; 3819 if (isContextLost()) 3820 return; 3821 if (!validateHTMLImageElement("texImage2D", image)) 3822 return; 3823 if (wouldTaintOrigin(image)) { 3824 ec = SECURITY_ERR; 3825 return; 3826 } 3827 // FIXME: Uploading ImageElement to half floating point texture is not supported yet 3828 // https://bugs.webkit.org/show_bug.cgi?id=110936 3829 if (type == GraphicsContext3D::HALF_FLOAT_OES) { 3830 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texImage2D", "Operation not supported yet"); 3831 return; 3832 } 3833 3834 texImage2DImpl(target, level, internalformat, format, type, image->cachedImage()->imageForRenderer(image->renderer()), GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, ec); 3852 if (isContextLost() || !validateHTMLImageElement("texImage2D", image, ec)) 3853 return; 3854 Image* imageForRender = image->cachedImage()->imageForRenderer(image->renderer()); 3855 if (!imageForRender || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLImageElement, target, level, internalformat, imageForRender->width(), imageForRender->height(), 0, format, type, 0, 0)) 3856 return; 3857 3858 texImage2DImpl(target, level, internalformat, format, type, imageForRender, GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, ec); 3835 3859 } 3836 3860 … … 3839 3863 { 3840 3864 ec = 0; 3841 if (isContextLost()) 3842 return; 3843 if (!canvas || !canvas->buffer()) { 3844 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texImage2D", "no canvas"); 3845 return; 3846 } 3847 if (wouldTaintOrigin(canvas)) { 3848 ec = SECURITY_ERR; 3849 return; 3850 } 3851 if (!validateTexFuncFormatAndType("texImage2D", format, type, level)) 3852 return; 3853 if (!validateSettableTexFormat("texImage2D", format)) 3854 return; 3855 // FIXME: Uploading HTMLCanvasElement to half floating point texture is not supported yet 3856 // https://bugs.webkit.org/show_bug.cgi?id=110936 3857 if (type == GraphicsContext3D::HALF_FLOAT_OES) { 3858 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texImage2D", "Operation not supported yet"); 3859 return; 3860 } 3865 if (isContextLost() || !validateHTMLCanvasElement("texImage2D", canvas, ec) || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLCanvasElement, target, level, internalformat, canvas->width(), canvas->height(), 0, format, type, 0, 0)) 3866 return; 3861 3867 3862 3868 WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); … … 3902 3908 { 3903 3909 ec = 0; 3904 if (isContextLost()) 3905 return; 3906 if (!video || !video->videoWidth() || !video->videoHeight()) { 3907 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texImage2D", "no video"); 3908 return; 3909 } 3910 if (wouldTaintOrigin(video)) { 3911 ec = SECURITY_ERR; 3912 return; 3913 } 3914 if (!validateTexFuncFormatAndType("texImage2D", format, type, level)) 3915 return; 3916 if (!validateSettableTexFormat("texImage2D", format)) 3910 if (isContextLost() || !validateHTMLVideoElement("texImage2D", video, ec) 3911 || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLVideoElement, target, level, internalformat, video->videoWidth(), video->videoHeight(), 0, format, type, 0, 0)) 3917 3912 return; 3918 3913 … … 3938 3933 if (!image) 3939 3934 return; 3940 // FIXME: Uploading HTMLVideoElement to half floating point texture is not supported yet3941 // https://bugs.webkit.org/show_bug.cgi?id=1109363942 if (type == GraphicsContext3D::HALF_FLOAT_OES) {3943 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texImage2D", "Operation not supported yet");3944 return;3945 }3946 3947 3935 texImage2DImpl(target, level, internalformat, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, ec); 3948 3936 } … … 4002 3990 // FIXME: For now we ignore any errors returned 4003 3991 ec = 0; 4004 if (isContextLost()) 4005 return; 4006 if (!validateTexFuncParameters("texSubImage2D", TexSubImage2D, target, level, format, width, height, 0, format, type)) 4007 return; 4008 if (!validateSize("texSubImage2D", xoffset, yoffset)) 4009 return; 4010 if (!validateSettableTexFormat("texSubImage2D", format)) 4011 return; 3992 ASSERT(!isContextLost()); 3993 ASSERT(validateTexFuncParameters("texSubImage2D", TexSubImage2D, target, level, format, width, height, 0, format, type)); 3994 ASSERT(validateSize("texSubImage2D", xoffset, yoffset)); 3995 ASSERT(validateSettableTexFormat("texSubImage2D", format)); 4012 3996 WebGLTexture* tex = validateTextureBinding("texSubImage2D", target, true); 4013 if (!tex) 4014 return;4015 if (xoffset + width > tex->getWidth(target, level) || yoffset + height > tex->getHeight(target, level)) {4016 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texSubImage2D", "dimensions out of range");4017 return;4018 }4019 if (tex->getInternalFormat(target, level) != format || tex->getType(target, level) != type) {4020 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texSubImage2D", "type and format do not match texture");4021 return;4022 }3997 if (!tex) { 3998 ASSERT_NOT_REACHED(); 3999 return; 4000 } 4001 ASSERT((xoffset + width) >= 0); 4002 ASSERT((yoffset + height) >= 0); 4003 ASSERT(tex->getWidth(target, level) >= (xoffset + width)); 4004 ASSERT(tex->getHeight(target, level) >= (yoffset + height)); 4005 ASSERT(tex->getInternalFormat(target, level) == format); 4006 ASSERT(tex->getType(target, level) == type); 4023 4007 m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); 4024 4008 cleanupAfterGraphicsCall(false); … … 4028 4012 { 4029 4013 ec = 0; 4030 if (isContextLost())4031 return;4032 if (!validateTexFuncFormatAndType("texSubImage2D", format, type, level))4033 return;4034 if (!validateSettableTexFormat("texSubImage2D", format))4035 return;4036 4014 Vector<uint8_t> data; 4037 4015 GraphicsContext3D::ImageExtractor imageExtractor(image, domSource, premultiplyAlpha, m_unpackColorspaceConversion == GraphicsContext3D::NONE); … … 4065 4043 GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionCode& ec) 4066 4044 { 4067 if (isContextLost() || !validateTexFuncData("texSubImage2D", level, width, height, format, type, pixels, NullNotAllowed)) 4045 if (isContextLost() || !validateTexFuncData("texSubImage2D", level, width, height, format, type, pixels, NullNotAllowed) 4046 || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceArrayBufferView, target, level, format, width, height, 0, format, type, xoffset, yoffset)) 4068 4047 return; 4069 4048 void* data = pixels->baseAddress(); … … 4091 4070 { 4092 4071 ec = 0; 4093 if (isContextLost()) 4094 return; 4095 if (!pixels) 4096 return; 4097 if (!validateTexFuncFormatAndType("texSubImage2D", format, type, level)) 4098 return; 4099 if (!validateSettableTexFormat("texSubImage2D", format)) 4100 return; 4101 // FIXME: Uploading ImageData to half floating point texture is not supported yet 4102 // https://bugs.webkit.org/show_bug.cgi?id=110936 4103 if (type == GraphicsContext3D::HALF_FLOAT_OES) { 4104 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texSubImage2D", "Operation not supported yet"); 4105 return; 4106 } 4072 if (isContextLost() || !pixels || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceImageData, target, level, format, pixels->width(), pixels->height(), 0, format, type, xoffset, yoffset)) 4073 return; 4107 4074 4108 4075 Vector<uint8_t> data; … … 4129 4096 { 4130 4097 ec = 0; 4131 if (isContextLost()) 4132 return; 4133 if (!validateHTMLImageElement("texSubImage2D", image)) 4134 return; 4135 if (wouldTaintOrigin(image)) { 4136 ec = SECURITY_ERR; 4137 return; 4138 } 4139 // FIXME: Uploading HTMLImageElement to half floating point texture is not supported yet 4140 // https://bugs.webkit.org/show_bug.cgi?id=110936 4141 if (type == GraphicsContext3D::HALF_FLOAT_OES) { 4142 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texSubImage2D", "Operation not supported yet"); 4143 return; 4144 } 4145 4146 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image->cachedImage()->imageForRenderer(image->renderer()), GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, ec); 4098 if (isContextLost() || !validateHTMLImageElement("texSubImage2D", image, ec)) 4099 return; 4100 Image* imageForRender = image->cachedImage()->imageForRenderer(image->renderer()); 4101 if (!imageForRender || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLImageElement, target, level, format, imageForRender->width(), imageForRender->height(), 0, format, type, xoffset, yoffset)) 4102 return; 4103 4104 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRender, GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, ec); 4147 4105 } 4148 4106 … … 4151 4109 { 4152 4110 ec = 0; 4153 if (isContextLost()) 4154 return; 4155 if (!canvas || !canvas->buffer()) { 4156 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texSubImage2D", "no canvas"); 4157 return; 4158 } 4159 if (wouldTaintOrigin(canvas)) { 4160 ec = SECURITY_ERR; 4161 return; 4162 } 4163 if (!validateTexFuncFormatAndType("texSubImage2D", format, type, level)) 4164 return; 4165 if (!validateSettableTexFormat("texSubImage2D", format)) 4166 return; 4167 // FIXME: Uploading HTMLCanvasElement to half floating point texture is not supported yet 4168 // https://bugs.webkit.org/show_bug.cgi?id=110936 4169 if (type == GraphicsContext3D::HALF_FLOAT_OES) { 4170 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texSubImage2D", "Operation not supported yet"); 4171 return; 4172 } 4111 if (isContextLost() || !validateHTMLCanvasElement("texSubImage2D", canvas, ec) 4112 || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLCanvasElement, target, level, format, canvas->width(), canvas->height(), 0, format, type, xoffset, yoffset)) 4113 return; 4173 4114 4174 4115 RefPtr<ImageData> imageData = canvas->getImageData(); … … 4184 4125 { 4185 4126 ec = 0; 4186 if (isContextLost()) 4187 return; 4188 if (!video || !video->videoWidth() || !video->videoHeight()) { 4189 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texSubImage2D", "no video"); 4190 return; 4191 } 4192 4193 if (wouldTaintOrigin(video)) { 4194 ec = SECURITY_ERR; 4195 return; 4196 } 4197 if (!validateTexFuncFormatAndType("texSubImage2D", format, type, level)) 4198 return; 4199 if (!validateSettableTexFormat("texSubImage2D", format)) 4127 if (isContextLost() || !validateHTMLVideoElement("texSubImage2D", video, ec) 4128 || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLVideoElement, target, level, format, video->videoWidth(), video->videoHeight(), 0, format, type, xoffset, yoffset)) 4200 4129 return; 4201 4130 … … 4203 4132 if (!image) 4204 4133 return; 4205 // FIXME: Uploading HTMLVideoElement to half floating point texture is not supported yet4206 // https://bugs.webkit.org/show_bug.cgi?id=1109364207 if (type == GraphicsContext3D::HALF_FLOAT_OES) {4208 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texSubImage2D", "Operation not supported yet");4209 return;4210 }4211 4212 4134 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, ec); 4213 4135 } … … 5686 5608 } 5687 5609 5688 bool WebGLRenderingContext::validateHTMLImageElement(const char* functionName, HTMLImageElement* image )5610 bool WebGLRenderingContext::validateHTMLImageElement(const char* functionName, HTMLImageElement* image, ExceptionCode& ec) 5689 5611 { 5690 5612 if (!image || !image->cachedImage()) { … … 5697 5619 return false; 5698 5620 } 5621 if (wouldTaintOrigin(image)) { 5622 ec = SECURITY_ERR; 5623 return false; 5624 } 5699 5625 return true; 5700 5626 } 5627 5628 bool WebGLRenderingContext::validateHTMLCanvasElement(const char* functionName, HTMLCanvasElement* canvas, ExceptionCode& ec) 5629 { 5630 if (!canvas || !canvas->buffer()) { 5631 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no canvas"); 5632 return false; 5633 } 5634 if (wouldTaintOrigin(canvas)) { 5635 ec = SECURITY_ERR; 5636 return false; 5637 } 5638 return true; 5639 } 5640 5641 #if ENABLE(VIDEO) 5642 bool WebGLRenderingContext::validateHTMLVideoElement(const char* functionName, HTMLVideoElement* video, ExceptionCode& ec) 5643 { 5644 if (!video || !video->videoWidth() || !video->videoHeight()) { 5645 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no video"); 5646 return false; 5647 } 5648 if (wouldTaintOrigin(video)) { 5649 ec = SECURITY_ERR; 5650 return false; 5651 } 5652 return true; 5653 } 5654 #endif 5701 5655 5702 5656 void WebGLRenderingContext::vertexAttribfImpl(const char* functionName, GC3Duint index, GC3Dsizei expectedSize, GC3Dfloat v0, GC3Dfloat v1, GC3Dfloat v2, GC3Dfloat v3) -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h
r146820 r147042 608 608 }; 609 609 610 enum TexFuncValidationSourceType { 611 SourceArrayBufferView, 612 SourceImageData, 613 SourceHTMLImageElement, 614 SourceHTMLCanvasElement, 615 SourceHTMLVideoElement, 616 }; 617 618 // Helper function for tex{Sub}Image2D to check if the input format/type/level/target/width/height/border/xoffset/yoffset are valid. 619 // Otherwise, it would return quickly without doing other work. 620 bool validateTexFunc(const char* functionName, TexFuncValidationFunctionType, TexFuncValidationSourceType, GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, 621 GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, GC3Dint xoffset, GC3Dint yoffset); 622 610 623 // Helper function to check input parameters for functions {copy}Tex{Sub}Image. 611 624 // Generates GL error and returns false if parameters are invalid. … … 699 712 WebGLBuffer* validateBufferDataParameters(const char* functionName, GC3Denum target, GC3Denum usage); 700 713 701 // Helper function for tex{Sub}Image2D to make sure image is ready. 702 bool validateHTMLImageElement(const char* functionName, HTMLImageElement*); 714 // Helper function for tex{Sub}Image2D to make sure image is ready and wouldn't taint Origin. 715 bool validateHTMLImageElement(const char* functionName, HTMLImageElement*, ExceptionCode&); 716 717 // Helper function for tex{Sub}Image2D to make sure canvas is ready and wouldn't taint Origin. 718 bool validateHTMLCanvasElement(const char* functionName, HTMLCanvasElement*, ExceptionCode&); 719 720 #if ENABLE(VIDEO) 721 // Helper function for tex{Sub}Image2D to make sure video is ready wouldn't taint Origin. 722 bool validateHTMLVideoElement(const char* functionName, HTMLVideoElement*, ExceptionCode&); 723 #endif 703 724 704 725 // Helper functions for vertexAttribNf{v}.
Note: See TracChangeset
for help on using the changeset viewer.