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..c5d2bff5446ba69dec7f58f3b38cd8c397ccb980 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,11 +232,17 @@ bool WebGLTexture::isNPOT() const |
return m_isNPOT; |
} |
-bool WebGLTexture::needToUseBlackTexture() const |
+bool WebGLTexture::needToUseBlackTexture(TextureExtensionFlag flag) const |
{ |
if (!object()) |
return false; |
- return m_needToUseBlackTexture; |
+ if (m_needToUseBlackTexture) |
+ return true; |
+ 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; |
+ } |
+ return false; |
} |
void WebGLTexture::deleteObjectImpl(GraphicsContext3D* context3d, Platform3DObject object) |
@@ -340,6 +348,28 @@ 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; |
+ } |
+ } |
+ } |
Ken Russell (switch to Gerrit)
2013/05/20 19:46:45
OK. It still isn't clear to me that scanning throu
|
+ 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_needToUseBlackTexture = false; |
// NPOT |