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 4335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4346 | 4346 |
4347 void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum in ternalformat, | 4347 void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum in ternalformat, |
4348 GLenum format, GLenum type, HTMLCanvasElement* canvas, ExceptionState& excep tionState) | 4348 GLenum format, GLenum type, HTMLCanvasElement* canvas, ExceptionState& excep tionState) |
4349 { | 4349 { |
4350 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)) | 4350 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)) |
4351 return; | 4351 return; |
4352 | 4352 |
4353 WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); | 4353 WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); |
4354 ASSERT(texture); | 4354 ASSERT(texture); |
4355 | 4355 |
4356 // texImage2DCanvasByGPU relies on copyTextureCHROMIUM which doesn't support float type. | 4356 // texImage2DCanvasByGPU relies on copyTextureCHROMIUM which doesn't support float/integer type and sRGB internal format. |
4357 bool isFloatType = type == GL_FLOAT || type == GL_HALF_FLOAT || type == GL_H ALF_FLOAT_OES; | 4357 bool isFloatType = type == GL_FLOAT || type == GL_HALF_FLOAT || type == GL_H ALF_FLOAT_OES || type == GL_UNSIGNED_INT_10F_11F_11F_REV; |
4358 if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerate d() || isFloatType) { | 4358 bool isIntegerFormat = format == GL_RED_INTEGER || format == GL_RG_INTEGER | | format == GL_RGB_INTEGER || format == GL_RGBA_INTEGER; |
4359 bool isSRGBFormat = internalformat == GL_SRGB8 || internalformat == GL_SRGB8 _ALPHA8 || internalformat == GL_SRGB || internalformat == GL_SRGB_ALPHA_EXT; | |
4360 if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerate d() || isFloatType || isIntegerFormat || isSRGBFormat) { | |
bajones
2015/10/15 17:17:58
The newly added format checks make this difficult
qiankun
2015/10/16 17:19:35
Done.
| |
4359 // 2D canvas has only FrontBuffer. | 4361 // 2D canvas has only FrontBuffer. |
4360 texImage2DImpl(target, level, internalformat, format, type, canvas->copi edImage(FrontBuffer, PreferAcceleration).get(), | 4362 texImage2DImpl(target, level, internalformat, format, type, canvas->copi edImage(FrontBuffer, PreferAcceleration).get(), |
4361 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremulti plyAlpha); | 4363 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremulti plyAlpha); |
4362 return; | 4364 return; |
4363 } | 4365 } |
4364 | 4366 |
4365 texImage2DCanvasByGPU(NotTexSubImage2D, texture, target, level, internalform at, type, 0, 0, canvas); | 4367 texImage2DCanvasByGPU(NotTexSubImage2D, texture, target, level, internalform at, type, 0, 0, canvas); |
4366 texture->setLevelInfo(target, level, internalformat, canvas->width(), canvas ->height(), 1, type); | 4368 texture->setLevelInfo(target, level, internalformat, canvas->width(), canvas ->height(), 1, type); |
4367 } | 4369 } |
4368 | 4370 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4604 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, | 4606 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, |
4605 GLenum format, GLenum type, HTMLCanvasElement* canvas, ExceptionState& excep tionState) | 4607 GLenum format, GLenum type, HTMLCanvasElement* canvas, ExceptionState& excep tionState) |
4606 { | 4608 { |
4607 if (isContextLost() || !validateHTMLCanvasElement("texSubImage2D", canvas, e xceptionState) | 4609 if (isContextLost() || !validateHTMLCanvasElement("texSubImage2D", canvas, e xceptionState) |
4608 || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLCanvasElem ent, target, level, 0, canvas->width(), canvas->height(), 0, format, type, xoffs et, yoffset)) | 4610 || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLCanvasElem ent, target, level, 0, canvas->width(), canvas->height(), 0, format, type, xoffs et, yoffset)) |
4609 return; | 4611 return; |
4610 | 4612 |
4611 WebGLTexture* texture = validateTextureBinding("texSubImage2D", target, true ); | 4613 WebGLTexture* texture = validateTextureBinding("texSubImage2D", target, true ); |
4612 ASSERT(texture); | 4614 ASSERT(texture); |
4613 | 4615 |
4614 bool isFloatType = type == GL_FLOAT || type == GL_HALF_FLOAT || type == GL_H ALF_FLOAT_OES; | 4616 GLenum internalformat = texture->getInternalFormat(target, level); |
4615 if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerate d() || isFloatType) { | 4617 bool isFloatType = type == GL_FLOAT || type == GL_HALF_FLOAT || type == GL_H ALF_FLOAT_OES || type == GL_UNSIGNED_INT_10F_11F_11F_REV; |
4618 bool isIntegerFormat = format == GL_RED_INTEGER || format == GL_RG_INTEGER | | format == GL_RGB_INTEGER || format == GL_RGBA_INTEGER; | |
4619 bool isSRGBFormat = internalformat == GL_SRGB8 || internalformat == GL_SRGB8 _ALPHA8 || internalformat == GL_SRGB || internalformat == GL_SRGB_ALPHA_EXT; | |
4620 if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerate d() || isFloatType || isIntegerFormat || isSRGBFormat) { | |
bajones
2015/10/15 17:17:58
Same here.
qiankun
2015/10/16 17:19:35
Done.
| |
4616 // 2D canvas has only FrontBuffer. | 4621 // 2D canvas has only FrontBuffer. |
4617 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas- >copiedImage(FrontBuffer, PreferAcceleration).get(), | 4622 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas- >copiedImage(FrontBuffer, PreferAcceleration).get(), |
4618 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremulti plyAlpha); | 4623 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremulti plyAlpha); |
4619 return; | 4624 return; |
4620 } | 4625 } |
4621 | 4626 |
4622 texImage2DCanvasByGPU(TexSubImage2D, texture, target, level, GL_RGBA, type, xoffset, yoffset, canvas); | 4627 texImage2DCanvasByGPU(TexSubImage2D, texture, target, level, GL_RGBA, type, xoffset, yoffset, canvas); |
4623 } | 4628 } |
4624 | 4629 |
4625 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, | 4630 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, |
(...skipping 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6832 | 6837 |
6833 return totalBytesPerPixel; | 6838 return totalBytesPerPixel; |
6834 } | 6839 } |
6835 | 6840 |
6836 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 6841 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
6837 { | 6842 { |
6838 return m_drawingBuffer.get(); | 6843 return m_drawingBuffer.get(); |
6839 } | 6844 } |
6840 | 6845 |
6841 } // namespace blink | 6846 } // namespace blink |
OLD | NEW |