Chromium Code Reviews| 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 3436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3447 } | 3447 } |
| 3448 } | 3448 } |
| 3449 | 3449 |
| 3450 if (m_unpackAlignment != 1) | 3450 if (m_unpackAlignment != 1) |
| 3451 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); | 3451 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 3452 texImage2DBase(target, level, internalformat, imageExtractor.imageWidth(), i mageExtractor.imageHeight(), 0, format, type, needConversion ? data.data() : ima gePixelData, exceptionState); | 3452 texImage2DBase(target, level, internalformat, imageExtractor.imageWidth(), i mageExtractor.imageHeight(), 0, format, type, needConversion ? data.data() : ima gePixelData, exceptionState); |
| 3453 if (m_unpackAlignment != 1) | 3453 if (m_unpackAlignment != 1) |
| 3454 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 3454 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 3455 } | 3455 } |
| 3456 | 3456 |
| 3457 bool WebGLRenderingContextBase::validateTexFunc(const char* functionName, TexFun cValidationFunctionType functionType, TexFuncValidationSourceType sourceType, GL enum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLint xoffset, GLint yoffset) | 3457 bool WebGLRenderingContextBase::validateTexFunc(const char* functionName, TexIma geFunctionType functionType, TexFuncValidationSourceType sourceType, GLenum targ et, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint bor der, GLenum format, GLenum type, GLint xoffset, GLint yoffset) |
| 3458 { | 3458 { |
| 3459 if (!validateTexFuncParameters(functionName, functionType, target, level, in ternalformat, width, height, border, format, type)) | 3459 if (!validateTexFuncParameters(functionName, functionType, target, level, in ternalformat, width, height, border, format, type)) |
| 3460 return false; | 3460 return false; |
| 3461 | 3461 |
| 3462 WebGLTexture* texture = validateTextureBinding(functionName, target, true); | 3462 WebGLTexture* texture = validateTextureBinding(functionName, target, true); |
| 3463 if (!texture) | 3463 if (!texture) |
| 3464 return false; | 3464 return false; |
| 3465 | 3465 |
| 3466 if (functionType == NotTexSubImage2D) { | 3466 if (functionType == NotTexSubImage2D) { |
| 3467 if (level && WebGLTexture::isNPOT(width, height)) { | 3467 if (level && WebGLTexture::isNPOT(width, height)) { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3583 RefPtr<Image> imageForRender = image->cachedImage()->imageForRenderer(image- >renderer()); | 3583 RefPtr<Image> imageForRender = image->cachedImage()->imageForRenderer(image- >renderer()); |
| 3584 if (imageForRender->isSVGImage()) | 3584 if (imageForRender->isSVGImage()) |
| 3585 imageForRender = drawImageIntoBuffer(imageForRender.get(), image->width( ), image->height(), "texImage2D"); | 3585 imageForRender = drawImageIntoBuffer(imageForRender.get(), image->width( ), image->height(), "texImage2D"); |
| 3586 | 3586 |
| 3587 if (!imageForRender || !validateTexFunc("texImage2D", NotTexSubImage2D, Sour ceHTMLImageElement, target, level, internalformat, imageForRender->width(), imag eForRender->height(), 0, format, type, 0, 0)) | 3587 if (!imageForRender || !validateTexFunc("texImage2D", NotTexSubImage2D, Sour ceHTMLImageElement, target, level, internalformat, imageForRender->width(), imag eForRender->height(), 0, format, type, 0, 0)) |
| 3588 return; | 3588 return; |
| 3589 | 3589 |
| 3590 texImage2DImpl(target, level, internalformat, format, type, imageForRender.g et(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlph a, exceptionState); | 3590 texImage2DImpl(target, level, internalformat, format, type, imageForRender.g et(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlph a, exceptionState); |
| 3591 } | 3591 } |
| 3592 | 3592 |
| 3593 void WebGLRenderingContextBase::texImage2DCanvasByGPU(TexImageFunctionType funct ionType, WebGLTexture* texture, GLenum target, | |
| 3594 GLint level, GLenum internalformat, GLenum type, GLint xoffset, GLint yoffse t, HTMLCanvasElement* canvas) | |
| 3595 { | |
| 3596 ScopedTexture2DRestorer restorer(this); | |
| 3597 | |
| 3598 Platform3DObject targetTexture = texture->object(); | |
| 3599 GLenum targetType = type; | |
| 3600 GLenum targetInternalformat = internalformat; | |
| 3601 GLint targetLevel = level; | |
| 3602 bool possibleDirectCopy = false; | |
| 3603 if (functionType == NotTexSubImage2D) { | |
| 3604 possibleDirectCopy = GL_TEXTURE_2D == target && Extensions3DUtil::canUse CopyTextureCHROMIUM(internalformat, type, level); | |
| 3605 } else if (functionType == TexSubImage2D) { | |
| 3606 possibleDirectCopy = false; | |
| 3607 } | |
| 3608 // if direct copy is not possible, create a temporary texture and then copy from canvas to temporary texture to target texture. | |
| 3609 if (!possibleDirectCopy) { | |
| 3610 targetLevel = 0; | |
| 3611 targetInternalformat = GL_RGBA; | |
| 3612 targetType = GL_UNSIGNED_BYTE; | |
| 3613 targetTexture = webContext()->createTexture(); | |
| 3614 webContext()->bindTexture(GL_TEXTURE_2D, targetTexture); | |
| 3615 webContext()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEA REST); | |
| 3616 webContext()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEA REST); | |
| 3617 webContext()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_T O_EDGE); | |
| 3618 webContext()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_T O_EDGE); | |
| 3619 webContext()->texImage2D(GL_TEXTURE_2D, 0, targetInternalformat, canvas- >width(), | |
| 3620 canvas->height(), 0, GL_RGBA, targetType, 0); | |
| 3621 } | |
| 3622 | |
| 3623 if (!canvas->is3D()) { | |
| 3624 ImageBuffer* buffer = canvas->buffer(); | |
| 3625 if (!buffer->copyToPlatformTexture(webContext(), targetTexture, targetIn ternalformat, targetType, | |
| 3626 targetLevel, m_unpackPremultiplyAlpha, m_unpackFlipY)) { | |
|
dshwang
2014/12/12 17:30:02
Accelerated canvas must succeed it. This fails if
| |
| 3627 ASSERT_NOT_REACHED(); | |
| 3628 } | |
| 3629 } else { | |
| 3630 WebGLRenderingContextBase* gl = toWebGLRenderingContextBase(canvas->rend eringContext()); | |
| 3631 ScopedTexture2DRestorer restorer(gl); | |
| 3632 if (!gl->drawingBuffer()->copyToPlatformTexture(webContext(), targetText ure, targetInternalformat, targetType, | |
|
dshwang
2014/12/12 17:30:02
It cannot fail because DrawingBuffer::copyToPlatfo
| |
| 3633 targetLevel, m_unpackPremultiplyAlpha, !m_unpackFlipY, BackBuffer)) { | |
| 3634 ASSERT_NOT_REACHED(); | |
| 3635 } | |
| 3636 } | |
| 3637 | |
| 3638 if (!possibleDirectCopy) { | |
| 3639 WebGLId tmpFBO = webContext()->createFramebuffer(); | |
| 3640 webContext()->bindFramebuffer(GL_FRAMEBUFFER, tmpFBO); | |
| 3641 webContext()->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, targetTexture, 0); | |
| 3642 webContext()->bindTexture(texture->getTarget(), texture->object()); | |
| 3643 if (functionType == NotTexSubImage2D) { | |
| 3644 webContext()->copyTexImage2D(target, level, internalformat, 0, 0, ca nvas->width(), canvas->height(), 0); | |
| 3645 } else if (functionType == TexSubImage2D) { | |
| 3646 webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, 0, 0, canvas->width(), canvas->height()); | |
| 3647 } | |
| 3648 webContext()->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); | |
| 3649 restoreCurrentFramebuffer(); | |
| 3650 webContext()->deleteFramebuffer(tmpFBO); | |
| 3651 webContext()->deleteTexture(targetTexture); | |
| 3652 } | |
| 3653 } | |
| 3654 | |
| 3593 void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum in ternalformat, | 3655 void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum in ternalformat, |
| 3594 GLenum format, GLenum type, HTMLCanvasElement* canvas, ExceptionState& excep tionState) | 3656 GLenum format, GLenum type, HTMLCanvasElement* canvas, ExceptionState& excep tionState) |
| 3595 { | 3657 { |
| 3596 if (isContextLost() || !validateHTMLCanvasElement("texImage2D", canvas, exce ptionState) || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLCanvas Element, target, level, internalformat, canvas->width(), canvas->height(), 0, fo rmat, type, 0, 0)) | 3658 if (isContextLost() || !validateHTMLCanvasElement("texImage2D", canvas, exce ptionState) || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLCanvas Element, target, level, internalformat, canvas->width(), canvas->height(), 0, fo rmat, type, 0, 0)) |
| 3597 return; | 3659 return; |
| 3598 | 3660 |
| 3599 WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); | 3661 WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); |
| 3662 ASSERT(texture); | |
|
dshwang
2014/12/12 17:30:02
validateHTMLCanvasElement() already check texture
| |
| 3600 | 3663 |
| 3601 // If possible, copy from the canvas element directly to the texture | 3664 if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerate d()) { |
| 3602 // via the GPU, without a read-back to system memory. | 3665 ASSERT(!canvas->renderingContext() || canvas->renderingContext()->is2d() ); |
|
dshwang
2014/12/12 17:30:02
It's rephrase of above if condition.
| |
| 3603 if (canvas->renderingContext() && GL_TEXTURE_2D == target && texture) { | 3666 // 2D canvas has only FrontBuffer. |
| 3604 ScopedTexture2DRestorer restorer(this); | 3667 texImage2DImpl(target, level, internalformat, format, type, canvas->copi edImage(FrontBuffer).get(), |
| 3605 | 3668 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremulti plyAlpha, exceptionState); |
| 3606 if (!canvas->is3D()) { | 3669 return; |
| 3607 ImageBuffer* buffer = canvas->buffer(); | |
| 3608 if (buffer && buffer->copyToPlatformTexture(webContext(), texture->o bject(), internalformat, type, | |
| 3609 level, m_unpackPremultiplyAlpha, m_unpackFlipY)) { | |
| 3610 texture->setLevelInfo(target, level, internalformat, canvas->wid th(), canvas->height(), type); | |
| 3611 return; | |
| 3612 } | |
| 3613 } else { | |
| 3614 WebGLRenderingContextBase* gl = toWebGLRenderingContextBase(canvas-> renderingContext()); | |
| 3615 ScopedTexture2DRestorer restorer(gl); | |
| 3616 if (gl->drawingBuffer()->copyToPlatformTexture(webContext(), texture ->object(), internalformat, type, | |
| 3617 level, m_unpackPremultiplyAlpha, !m_unpackFlipY, BackBuffer)) { | |
| 3618 texture->setLevelInfo(target, level, internalformat, canvas->wid th(), canvas->height(), type); | |
| 3619 return; | |
| 3620 } | |
| 3621 } | |
| 3622 } | 3670 } |
| 3623 | 3671 |
| 3624 texImage2DImpl(target, level, internalformat, format, type, canvas->copiedIm age(BackBuffer).get(), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unp ackPremultiplyAlpha, exceptionState); | 3672 texImage2DCanvasByGPU(NotTexSubImage2D, texture, target, level, internalform at, type, 0, 0, canvas); |
| 3673 texture->setLevelInfo(target, level, internalformat, canvas->width(), canvas ->height(), type); | |
| 3625 } | 3674 } |
| 3626 | 3675 |
| 3627 PassRefPtr<Image> WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement* video, BackingStoreCopy backingStoreCopy) | 3676 PassRefPtr<Image> WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement* video, BackingStoreCopy backingStoreCopy) |
| 3628 { | 3677 { |
| 3629 IntSize size(video->videoWidth(), video->videoHeight()); | 3678 IntSize size(video->videoWidth(), video->videoHeight()); |
| 3630 ImageBuffer* buf = m_generatedImageCache.imageBuffer(size); | 3679 ImageBuffer* buf = m_generatedImageCache.imageBuffer(size); |
| 3631 if (!buf) { | 3680 if (!buf) { |
| 3632 synthesizeGLError(GL_OUT_OF_MEMORY, "texImage2D", "out of memory"); | 3681 synthesizeGLError(GL_OUT_OF_MEMORY, "texImage2D", "out of memory"); |
| 3633 return nullptr; | 3682 return nullptr; |
| 3634 } | 3683 } |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3848 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRen der.get(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultipl yAlpha, exceptionState); | 3897 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRen der.get(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultipl yAlpha, exceptionState); |
| 3849 } | 3898 } |
| 3850 | 3899 |
| 3851 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, | 3900 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, |
| 3852 GLenum format, GLenum type, HTMLCanvasElement* canvas, ExceptionState& excep tionState) | 3901 GLenum format, GLenum type, HTMLCanvasElement* canvas, ExceptionState& excep tionState) |
| 3853 { | 3902 { |
| 3854 if (isContextLost() || !validateHTMLCanvasElement("texSubImage2D", canvas, e xceptionState) | 3903 if (isContextLost() || !validateHTMLCanvasElement("texSubImage2D", canvas, e xceptionState) |
| 3855 || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLCanvasElem ent, target, level, format, canvas->width(), canvas->height(), 0, format, type, xoffset, yoffset)) | 3904 || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLCanvasElem ent, target, level, format, canvas->width(), canvas->height(), 0, format, type, xoffset, yoffset)) |
| 3856 return; | 3905 return; |
| 3857 | 3906 |
| 3858 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas->cop iedImage(BackBuffer).get(), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, exceptionState); | 3907 WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); |
| 3908 ASSERT(texture); | |
| 3909 | |
| 3910 if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerate d()) { | |
| 3911 ASSERT(!canvas->renderingContext() || canvas->renderingContext()->is2d() ); | |
| 3912 // 2D canvas has only FrontBuffer. | |
| 3913 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas- >copiedImage(FrontBuffer).get(), | |
| 3914 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremulti plyAlpha, exceptionState); | |
| 3915 return; | |
| 3916 } | |
| 3917 | |
| 3918 texImage2DCanvasByGPU(TexSubImage2D, texture, target, level, GL_RGBA, type, xoffset, yoffset, canvas); | |
| 3859 } | 3919 } |
| 3860 | 3920 |
| 3861 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, | 3921 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, |
| 3862 GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& excepti onState) | 3922 GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& excepti onState) |
| 3863 { | 3923 { |
| 3864 if (isContextLost() || !validateHTMLVideoElement("texSubImage2D", video, exc eptionState) | 3924 if (isContextLost() || !validateHTMLVideoElement("texSubImage2D", video, exc eptionState) |
| 3865 || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLVideoEleme nt, target, level, format, video->videoWidth(), video->videoHeight(), 0, format, type, xoffset, yoffset)) | 3925 || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLVideoEleme nt, target, level, format, video->videoWidth(), video->videoHeight(), 0, format, type, xoffset, yoffset)) |
| 3866 return; | 3926 return; |
| 3867 | 3927 |
| 3868 RefPtr<Image> image = videoFrameToImage(video, ImageBuffer::fastCopyImageMod e()); | 3928 RefPtr<Image> image = videoFrameToImage(video, ImageBuffer::fastCopyImageMod e()); |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4809 synthesizeGLError(GL_INVALID_VALUE, functionName, "level out of rang e"); | 4869 synthesizeGLError(GL_INVALID_VALUE, functionName, "level out of rang e"); |
| 4810 return false; | 4870 return false; |
| 4811 } | 4871 } |
| 4812 break; | 4872 break; |
| 4813 } | 4873 } |
| 4814 // This function only checks if level is legal, so we return true and don't | 4874 // This function only checks if level is legal, so we return true and don't |
| 4815 // generate INVALID_ENUM if target is illegal. | 4875 // generate INVALID_ENUM if target is illegal. |
| 4816 return true; | 4876 return true; |
| 4817 } | 4877 } |
| 4818 | 4878 |
| 4819 bool WebGLRenderingContextBase::validateTexFuncDimensions(const char* functionNa me, TexFuncValidationFunctionType functionType, | 4879 bool WebGLRenderingContextBase::validateTexFuncDimensions(const char* functionNa me, TexImageFunctionType functionType, |
| 4820 GLenum target, GLint level, GLsizei width, GLsizei height) | 4880 GLenum target, GLint level, GLsizei width, GLsizei height) |
| 4821 { | 4881 { |
| 4822 if (width < 0 || height < 0) { | 4882 if (width < 0 || height < 0) { |
| 4823 synthesizeGLError(GL_INVALID_VALUE, functionName, "width or height < 0") ; | 4883 synthesizeGLError(GL_INVALID_VALUE, functionName, "width or height < 0") ; |
| 4824 return false; | 4884 return false; |
| 4825 } | 4885 } |
| 4826 | 4886 |
| 4827 switch (target) { | 4887 switch (target) { |
| 4828 case GL_TEXTURE_2D: | 4888 case GL_TEXTURE_2D: |
| 4829 if (width > (m_maxTextureSize >> level) || height > (m_maxTextureSize >> level)) { | 4889 if (width > (m_maxTextureSize >> level) || height > (m_maxTextureSize >> level)) { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 4848 return false; | 4908 return false; |
| 4849 } | 4909 } |
| 4850 break; | 4910 break; |
| 4851 default: | 4911 default: |
| 4852 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target"); | 4912 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target"); |
| 4853 return false; | 4913 return false; |
| 4854 } | 4914 } |
| 4855 return true; | 4915 return true; |
| 4856 } | 4916 } |
| 4857 | 4917 |
| 4858 bool WebGLRenderingContextBase::validateTexFuncParameters(const char* functionNa me, TexFuncValidationFunctionType functionType, GLenum target, | 4918 bool WebGLRenderingContextBase::validateTexFuncParameters(const char* functionNa me, TexImageFunctionType functionType, GLenum target, |
| 4859 GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint bor der, GLenum format, GLenum type) | 4919 GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint bor der, GLenum format, GLenum type) |
| 4860 { | 4920 { |
| 4861 // We absolutely have to validate the format and type combination. | 4921 // We absolutely have to validate the format and type combination. |
| 4862 // The texImage2D entry points taking HTMLImage, etc. will produce | 4922 // The texImage2D entry points taking HTMLImage, etc. will produce |
| 4863 // temporary data based on this combination, so it must be legal. | 4923 // temporary data based on this combination, so it must be legal. |
| 4864 if (!validateTexFuncFormatAndType(functionName, format, type, level) || !val idateTexFuncLevel(functionName, target, level)) | 4924 if (!validateTexFuncFormatAndType(functionName, format, type, level) || !val idateTexFuncLevel(functionName, target, level)) |
| 4865 return false; | 4925 return false; |
| 4866 | 4926 |
| 4867 if (!validateTexFuncDimensions(functionName, functionType, target, level, wi dth, height)) | 4927 if (!validateTexFuncDimensions(functionName, functionType, target, level, wi dth, height)) |
| 4868 return false; | 4928 return false; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5021 } | 5081 } |
| 5022 | 5082 |
| 5023 if (pixels->byteLength() != bytesRequired) { | 5083 if (pixels->byteLength() != bytesRequired) { |
| 5024 synthesizeGLError(GL_INVALID_VALUE, functionName, "length of ArrayBuffer View is not correct for dimensions"); | 5084 synthesizeGLError(GL_INVALID_VALUE, functionName, "length of ArrayBuffer View is not correct for dimensions"); |
| 5025 return false; | 5085 return false; |
| 5026 } | 5086 } |
| 5027 | 5087 |
| 5028 return true; | 5088 return true; |
| 5029 } | 5089 } |
| 5030 | 5090 |
| 5031 bool WebGLRenderingContextBase::validateCompressedTexDimensions(const char* func tionName, TexFuncValidationFunctionType functionType, GLenum target, GLint level , GLsizei width, GLsizei height, GLenum format) | 5091 bool WebGLRenderingContextBase::validateCompressedTexDimensions(const char* func tionName, TexImageFunctionType functionType, GLenum target, GLint level, GLsizei width, GLsizei height, GLenum format) |
| 5032 { | 5092 { |
| 5033 if (!validateTexFuncDimensions(functionName, functionType, target, level, wi dth, height)) | 5093 if (!validateTexFuncDimensions(functionName, functionType, target, level, wi dth, height)) |
| 5034 return false; | 5094 return false; |
| 5035 | 5095 |
| 5036 bool widthValid = false; | 5096 bool widthValid = false; |
| 5037 bool heightValid = false; | 5097 bool heightValid = false; |
| 5038 | 5098 |
| 5039 switch (format) { | 5099 switch (format) { |
| 5040 case GC3D_COMPRESSED_ATC_RGB_AMD: | 5100 case GC3D_COMPRESSED_ATC_RGB_AMD: |
| 5041 case GC3D_COMPRESSED_ATC_RGBA_EXPLICIT_ALPHA_AMD: | 5101 case GC3D_COMPRESSED_ATC_RGBA_EXPLICIT_ALPHA_AMD: |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5863 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; | 5923 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; |
| 5864 } | 5924 } |
| 5865 #else | 5925 #else |
| 5866 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 5926 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
| 5867 { | 5927 { |
| 5868 return m_drawingBuffer.get(); | 5928 return m_drawingBuffer.get(); |
| 5869 } | 5929 } |
| 5870 #endif | 5930 #endif |
| 5871 | 5931 |
| 5872 } // namespace blink | 5932 } // namespace blink |
| OLD | NEW |