Index: Source/core/html/canvas/WebGLRenderingContext.cpp |
diff --git a/Source/core/html/canvas/WebGLRenderingContext.cpp b/Source/core/html/canvas/WebGLRenderingContext.cpp |
index 56668d64afea6676d30de39aca0c725e38bc20be..e418968e6f3dac4bf7a82b3db7c9374395d675ac 100644 |
--- a/Source/core/html/canvas/WebGLRenderingContext.cpp |
+++ b/Source/core/html/canvas/WebGLRenderingContext.cpp |
@@ -3313,6 +3313,18 @@ void WebGLRenderingContext::stencilOpSeparate(GLenum face, GLenum fail, GLenum z |
m_context->stencilOpSeparate(face, fail, zfail, zpass); |
} |
+GLenum WebGLRenderingContext::convertTexInternalFormat(GLenum internalformat, GLenum type) |
+{ |
+ // Convert to sized internal formats that are renderable with GL_CHROMIUM_color_buffer_float_rgb(a). |
+ if (type == GL_FLOAT && internalformat == GL_RGBA |
+ && m_contextSupport->isExtensionEnabled("GL_CHROMIUM_color_buffer_float_rgba")) |
+ return GL_RGBA32F_EXT; |
+ if (type == GL_FLOAT && internalformat == GL_RGB |
+ && m_contextSupport->isExtensionEnabled("GL_CHROMIUM_color_buffer_float_rgb")) |
+ return GL_RGB32F_EXT; |
+ return internalformat; |
Ken Russell (switch to Gerrit)
2014/02/11 23:46:52
There aren't any queries whose results need to be
oetuaho-nv
2014/02/12 12:45:36
I couldn't find any other calls where conversions
|
+} |
+ |
void WebGLRenderingContext::texImage2DBase(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels, ExceptionState& exceptionState) |
{ |
// All calling functions check isContextLost, so a duplicate check is not needed here. |
@@ -3322,8 +3334,7 @@ void WebGLRenderingContext::texImage2DBase(GLenum target, GLint level, GLenum in |
ASSERT(tex); |
ASSERT(!level || !WebGLTexture::isNPOT(width, height)); |
ASSERT(!pixels || validateSettableTexFormat("texImage2D", internalformat)); |
- m_context->texImage2D(target, level, internalformat, width, height, |
- border, format, type, pixels); |
+ m_context->texImage2D(target, level, convertTexInternalFormat(internalformat, type), width, height, border, format, type, pixels); |
tex->setLevelInfo(target, level, internalformat, width, height, type); |
} |