Chromium Code Reviews| Index: Source/core/html/canvas/WebGLTexture.cpp |
| diff --git a/Source/core/html/canvas/WebGLTexture.cpp b/Source/core/html/canvas/WebGLTexture.cpp |
| index c8c23bd4be545a9c05708dcf75ca32171cb10ca0..9ad4d55b49cc9a9749297e48e31e6ba5cadf3f64 100644 |
| --- a/Source/core/html/canvas/WebGLTexture.cpp |
| +++ b/Source/core/html/canvas/WebGLTexture.cpp |
| @@ -48,6 +48,8 @@ WebGLTexture::WebGLTexture(WebGLRenderingContext* ctx) |
| , m_isNPOT(false) |
| , m_isComplete(false) |
| , m_needToUseBlackTexture(false) |
| + , m_isFloatType(false) |
| + , m_isHalfFloatType(false) |
| { |
| setObject(ctx->graphicsContext3D()->createTexture()); |
| } |
| @@ -230,10 +232,14 @@ bool WebGLTexture::isNPOT() const |
| return m_isNPOT; |
| } |
| -bool WebGLTexture::needToUseBlackTexture() const |
| +bool WebGLTexture::needToUseBlackTexture(TextureExtensionFlag flag) const |
| { |
| if (!object()) |
| return false; |
| + if ((m_isFloatType && !(flag & TextureFloatLinearExtensionEnabled)) || (m_isHalfFloatType && !(flag && TextureHalfFloatLinearExtensionEnabled))) { |
| + if (m_magFilter != GraphicsContext3D::NEAREST || (m_minFilter != GraphicsContext3D::NEAREST && m_minFilter != GraphicsContext3D::NEAREST_MIPMAP_NEAREST)) |
| + return true; |
| + } |
|
Ken Russell (switch to Gerrit)
2013/05/15 23:25:10
Per the comment below, I would write this for clar
|
| return m_needToUseBlackTexture; |
| } |
| @@ -310,6 +316,20 @@ void WebGLTexture::update() |
| break; |
| } |
| } |
| + m_isFloatType = false; |
| + for (size_t ii = 0; ii < m_info.size(); ++ii) { |
| + if (m_info[ii][0].type == GraphicsContext3D::FLOAT) { |
| + m_isFloatType = true; |
| + break; |
| + } |
| + } |
| + m_isHalfFloatType = false; |
| + for (size_t ii = 0; ii < m_info.size(); ++ii) { |
| + if (m_info[ii][0].type == GraphicsContext3D::HALF_FLOAT_OES) { |
| + m_isHalfFloatType = true; |
| + break; |
| + } |
| + } |
|
Ken Russell (switch to Gerrit)
2013/05/15 23:25:10
It isn't necessary to scan all the mip levels. If
Jun Jiang
2013/05/16 02:25:43
Here only mip level 0 is checked. The "for" loop h
|
| m_isComplete = true; |
| const LevelInfo& first = m_info[0][0]; |
| GC3Dint levelCount = computeLevelCount(first.width, first.height); |