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 15cb7471435e966a58880340bf897adcb940c4a4..ddc6f0041e61810062357d8e53666340924ae9fb 100644 |
| --- a/Source/core/html/canvas/WebGLTexture.cpp |
| +++ b/Source/core/html/canvas/WebGLTexture.cpp |
| @@ -318,6 +318,7 @@ void WebGLTexture::update() |
| } |
| } |
| m_isComplete = true; |
| + bool isCubeComplete = true; |
|
Ken Russell (switch to Gerrit)
2013/06/06 23:16:43
Please make isCubeComplete a member of the WebGLTe
|
| const LevelInfo& first = m_info[0][0]; |
| GC3Dint levelCount = computeLevelCount(first.width, first.height); |
| if (levelCount < 1) |
| @@ -327,7 +328,10 @@ void WebGLTexture::update() |
| const LevelInfo& info0 = m_info[ii][0]; |
| if (!info0.valid |
| || info0.width != first.width || info0.height != first.height |
| - || info0.internalFormat != first.internalFormat || info0.type != first.type) { |
| + || info0.internalFormat != first.internalFormat || info0.type != first.type |
| + || (m_info.size() > 1 && info0.width != info0.height)) { |
| + if (m_info.size() > 1) |
| + isCubeComplete = false; |
| m_isComplete = false; |
| break; |
| } |
| @@ -347,34 +351,17 @@ void WebGLTexture::update() |
| } |
| } |
| } |
| - m_isFloatType = false; |
| - if (m_isComplete) |
| - m_isFloatType = m_info[0][0].type == GraphicsContext3D::FLOAT; |
| - else { |
| - 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; |
| - if (m_isComplete) |
| - m_isHalfFloatType = m_info[0][0].type == GraphicsContext3D::HALF_FLOAT_OES; |
| - else { |
| - for (size_t ii = 0; ii < m_info.size(); ++ii) { |
| - if (m_info[ii][0].type == GraphicsContext3D::HALF_FLOAT_OES) { |
| - m_isHalfFloatType = true; |
| - break; |
| - } |
| - } |
| - } |
| + m_isFloatType = m_info[0][0].type == GraphicsContext3D::FLOAT; |
| + m_isHalfFloatType = m_info[0][0].type == GraphicsContext3D::HALF_FLOAT_OES; |
|
bajones
2013/06/05 17:29:00
This feels unrelated to the cubemap change. What's
Jun Jiang
2013/06/06 01:19:48
This change is to optimize the check on whether th
|
| m_needToUseBlackTexture = false; |
| // NPOT |
| if (m_isNPOT && ((m_minFilter != GraphicsContext3D::NEAREST && m_minFilter != GraphicsContext3D::LINEAR) |
| || m_wrapS != GraphicsContext3D::CLAMP_TO_EDGE || m_wrapT != GraphicsContext3D::CLAMP_TO_EDGE)) |
| m_needToUseBlackTexture = true; |
| + // If it is a Cube texture, check Cube Completeness first |
| + if (m_info.size() > 1 && !isCubeComplete) |
| + m_needToUseBlackTexture = true; |
| // Completeness |
| if (!m_isComplete && m_minFilter != GraphicsContext3D::NEAREST && m_minFilter != GraphicsContext3D::LINEAR) |
| m_needToUseBlackTexture = true; |