Chromium Code Reviews| Index: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp |
| diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp |
| index 43cecb80cf7d1dea7439344d236cedbc0d454db0..0de5488462291f5864fd1871561c42d985e8374c 100644 |
| --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp |
| +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp |
| @@ -4353,9 +4353,11 @@ void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum in |
| WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); |
| ASSERT(texture); |
| - // texImage2DCanvasByGPU relies on copyTextureCHROMIUM which doesn't support float type. |
| - bool isFloatType = type == GL_FLOAT || type == GL_HALF_FLOAT || type == GL_HALF_FLOAT_OES; |
| - if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerated() || isFloatType) { |
| + // texImage2DCanvasByGPU relies on copyTextureCHROMIUM which doesn't support float/integer type and sRGB internal format. |
| + bool isFloatType = type == GL_FLOAT || type == GL_HALF_FLOAT || type == GL_HALF_FLOAT_OES || type == GL_UNSIGNED_INT_10F_11F_11F_REV; |
| + bool isIntegerFormat = format == GL_RED_INTEGER || format == GL_RG_INTEGER || format == GL_RGB_INTEGER || format == GL_RGBA_INTEGER; |
| + bool isSRGBFormat = internalformat == GL_SRGB8 || internalformat == GL_SRGB8_ALPHA8 || internalformat == GL_SRGB || internalformat == GL_SRGB_ALPHA_EXT; |
| + if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerated() || 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.
|
| // 2D canvas has only FrontBuffer. |
| texImage2DImpl(target, level, internalformat, format, type, canvas->copiedImage(FrontBuffer, PreferAcceleration).get(), |
| WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha); |
| @@ -4611,8 +4613,11 @@ void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint |
| WebGLTexture* texture = validateTextureBinding("texSubImage2D", target, true); |
| ASSERT(texture); |
| - bool isFloatType = type == GL_FLOAT || type == GL_HALF_FLOAT || type == GL_HALF_FLOAT_OES; |
| - if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerated() || isFloatType) { |
| + GLenum internalformat = texture->getInternalFormat(target, level); |
| + bool isFloatType = type == GL_FLOAT || type == GL_HALF_FLOAT || type == GL_HALF_FLOAT_OES || type == GL_UNSIGNED_INT_10F_11F_11F_REV; |
| + bool isIntegerFormat = format == GL_RED_INTEGER || format == GL_RG_INTEGER || format == GL_RGB_INTEGER || format == GL_RGBA_INTEGER; |
| + bool isSRGBFormat = internalformat == GL_SRGB8 || internalformat == GL_SRGB8_ALPHA8 || internalformat == GL_SRGB || internalformat == GL_SRGB_ALPHA_EXT; |
| + if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerated() || isFloatType || isIntegerFormat || isSRGBFormat) { |
|
bajones
2015/10/15 17:17:58
Same here.
qiankun
2015/10/16 17:19:35
Done.
|
| // 2D canvas has only FrontBuffer. |
| texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas->copiedImage(FrontBuffer, PreferAcceleration).get(), |
| WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha); |