Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(616)

Unified Diff: Source/core/html/canvas/WebGLTexture.cpp

Issue 16437002: Add check on Cube Completeness for Cube textures and improve the efficiency of checks associated wi… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change code to make it more clear Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/canvas/WebGLTexture.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..61bce3430e361e0400fb81ee5749345e0bf461c8 100644
--- a/Source/core/html/canvas/WebGLTexture.cpp
+++ b/Source/core/html/canvas/WebGLTexture.cpp
@@ -44,6 +44,7 @@ WebGLTexture::WebGLTexture(WebGLRenderingContext* ctx)
, m_wrapS(GraphicsContext3D::REPEAT)
, m_wrapT(GraphicsContext3D::REPEAT)
, m_isNPOT(false)
+ , m_isCubeComplete(false)
, m_isComplete(false)
, m_needToUseBlackTexture(false)
, m_isFloatType(false)
@@ -282,7 +283,8 @@ bool WebGLTexture::canGenerateMipmaps()
const LevelInfo& info = m_info[ii][0];
if (!info.valid
|| info.width != first.width || info.height != first.height
- || info.internalFormat != first.internalFormat || info.type != first.type)
+ || info.internalFormat != first.internalFormat || info.type != first.type
+ || (m_info.size() > 1 && !m_isCubeComplete))
return false;
}
return true;
@@ -318,6 +320,7 @@ void WebGLTexture::update()
}
}
m_isComplete = true;
+ m_isCubeComplete = true;
const LevelInfo& first = m_info[0][0];
GC3Dint levelCount = computeLevelCount(first.width, first.height);
if (levelCount < 1)
@@ -327,7 +330,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)
+ m_isCubeComplete = false;
m_isComplete = false;
break;
}
@@ -347,34 +353,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;
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 && !m_isCubeComplete)
+ m_needToUseBlackTexture = true;
// Completeness
if (!m_isComplete && m_minFilter != GraphicsContext3D::NEAREST && m_minFilter != GraphicsContext3D::LINEAR)
m_needToUseBlackTexture = true;
« no previous file with comments | « Source/core/html/canvas/WebGLTexture.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698