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

Unified Diff: cc/program_binding.cc

Issue 11415040: Relax assertions around context loss and program initialization. Higher level code will take care o… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
« cc/program_binding.h ('K') | « cc/program_binding.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/program_binding.cc
diff --git a/cc/program_binding.cc b/cc/program_binding.cc
index ccbca53d9953b1585e7a5aa17fc4100746da5220..bf053c5e5eac3698535a71ba399c20059fbb685e 100644
--- a/cc/program_binding.cc
+++ b/cc/program_binding.cc
@@ -31,18 +31,12 @@ ProgramBindingBase::~ProgramBindingBase()
DCHECK(!m_initialized);
}
-static bool contextLost(WebGraphicsContext3D* context)
-{
- return (context->getGraphicsResetStatusARB() != GL_NO_ERROR);
-}
-
-
void ProgramBindingBase::init(WebGraphicsContext3D* context, const std::string& vertexShader, const std::string& fragmentShader)
{
TRACE_EVENT0("cc", "ProgramBindingBase::init");
m_vertexShaderId = loadShader(context, GL_VERTEX_SHADER, vertexShader);
if (!m_vertexShaderId) {
- if (!contextLost(context))
+ if (!IsContextLost(context))
LOG(ERROR) << "Failed to create vertex shader";
return;
}
@@ -51,13 +45,13 @@ void ProgramBindingBase::init(WebGraphicsContext3D* context, const std::string&
if (!m_fragmentShaderId) {
GLC(context, context->deleteShader(m_vertexShaderId));
m_vertexShaderId = 0;
- if (!contextLost(context))
+ if (!IsContextLost(context))
LOG(ERROR) << "Failed to create fragment shader";
return;
}
m_program = createShaderProgram(context, m_vertexShaderId, m_fragmentShaderId);
- DCHECK(m_program || contextLost(context));
+ DCHECK(m_program || IsContextLost(context));
}
void ProgramBindingBase::link(WebGraphicsContext3D* context)
@@ -68,7 +62,7 @@ void ProgramBindingBase::link(WebGraphicsContext3D* context)
int linked = 0;
GLC(context, context->getProgramiv(m_program, GL_LINK_STATUS, &linked));
if (!linked) {
- if (!contextLost(context))
+ if (!IsContextLost(context))
LOG(ERROR) << "Failed to link shader program";
GLC(context, context->deleteProgram(m_program));
}
@@ -110,7 +104,7 @@ unsigned ProgramBindingBase::createShaderProgram(WebGraphicsContext3D* context,
{
unsigned programObject = context->createProgram();
if (!programObject) {
- if (!contextLost(context))
+ if (!IsContextLost(context))
LOG(ERROR) << "Failed to create shader program";
return 0;
}
@@ -137,4 +131,8 @@ void ProgramBindingBase::cleanupShaders(WebGraphicsContext3D* context)
}
}
+bool ProgramBindingBase::IsContextLost(WebGraphicsContext3D* context) {
+ return (context->getGraphicsResetStatusARB() != GL_NO_ERROR);
+}
+
} // namespace cc
« cc/program_binding.h ('K') | « cc/program_binding.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698