| Index: cc/ProgramBinding.cpp
|
| diff --git a/cc/ProgramBinding.cpp b/cc/ProgramBinding.cpp
|
| index 27d522609dd50b0d81cf1ac2d38fb9236a0a41bd..f538c6fbc16282a21a63182198dee4f4a49360f2 100644
|
| --- a/cc/ProgramBinding.cpp
|
| +++ b/cc/ProgramBinding.cpp
|
| @@ -29,10 +29,10 @@ ProgramBindingBase::ProgramBindingBase()
|
| ProgramBindingBase::~ProgramBindingBase()
|
| {
|
| // If you hit these asserts, you initialized but forgot to call cleanup().
|
| - ASSERT(!m_program);
|
| - ASSERT(!m_vertexShaderId);
|
| - ASSERT(!m_fragmentShaderId);
|
| - ASSERT(!m_initialized);
|
| + DCHECK(!m_program);
|
| + DCHECK(!m_vertexShaderId);
|
| + DCHECK(!m_fragmentShaderId);
|
| + DCHECK(!m_initialized);
|
| }
|
|
|
| static bool contextLost(WebGraphicsContext3D* context)
|
| @@ -47,7 +47,7 @@ void ProgramBindingBase::init(WebGraphicsContext3D* context, const std::string&
|
| m_vertexShaderId = loadShader(context, GraphicsContext3D::VERTEX_SHADER, vertexShader);
|
| if (!m_vertexShaderId) {
|
| if (!contextLost(context))
|
| - LOG_ERROR("Failed to create vertex shader");
|
| + LOG(ERROR) << "Failed to create vertex shader";
|
| return;
|
| }
|
|
|
| @@ -56,28 +56,27 @@ void ProgramBindingBase::init(WebGraphicsContext3D* context, const std::string&
|
| GLC(context, context->deleteShader(m_vertexShaderId));
|
| m_vertexShaderId = 0;
|
| if (!contextLost(context))
|
| - LOG_ERROR("Failed to create fragment shader");
|
| + LOG(ERROR) << "Failed to create fragment shader";
|
| return;
|
| }
|
|
|
| m_program = createShaderProgram(context, m_vertexShaderId, m_fragmentShaderId);
|
| - ASSERT(m_program || contextLost(context));
|
| + DCHECK(m_program || contextLost(context));
|
| }
|
|
|
| void ProgramBindingBase::link(WebGraphicsContext3D* context)
|
| {
|
| GLC(context, context->linkProgram(m_program));
|
| cleanupShaders(context);
|
| -#ifndef NDEBUG
|
| - int linked = 0;
|
| - GLC(context, context->getProgramiv(m_program, GraphicsContext3D::LINK_STATUS, &linked));
|
| - if (!linked) {
|
| - if (!contextLost(context))
|
| - LOG_ERROR("Failed to link shader program");
|
| - GLC(context, context->deleteProgram(m_program));
|
| - return;
|
| + if (DCHECK_IS_ON()) {
|
| + int linked = 0;
|
| + GLC(context, context->getProgramiv(m_program, GraphicsContext3D::LINK_STATUS, &linked));
|
| + if (!linked) {
|
| + if (!contextLost(context))
|
| + LOG(ERROR) << "Failed to link shader program";
|
| + GLC(context, context->deleteProgram(m_program));
|
| + }
|
| }
|
| -#endif
|
| }
|
|
|
| void ProgramBindingBase::cleanup(WebGraphicsContext3D* context)
|
| @@ -86,7 +85,7 @@ void ProgramBindingBase::cleanup(WebGraphicsContext3D* context)
|
| if (!m_program)
|
| return;
|
|
|
| - ASSERT(context);
|
| + DCHECK(context);
|
| GLC(context, context->deleteProgram(m_program));
|
| m_program = 0;
|
|
|
| @@ -100,14 +99,14 @@ unsigned ProgramBindingBase::loadShader(WebGraphicsContext3D* context, unsigned
|
| return 0;
|
| GLC(context, context->shaderSource(shader, shaderSource.data()));
|
| GLC(context, context->compileShader(shader));
|
| -#ifndef NDEBUG
|
| - int compiled = 0;
|
| - GLC(context, context->getShaderiv(shader, GraphicsContext3D::COMPILE_STATUS, &compiled));
|
| - if (!compiled) {
|
| - GLC(context, context->deleteShader(shader));
|
| - return 0;
|
| + if (DCHECK_IS_ON()) {
|
| + int compiled = 0;
|
| + GLC(context, context->getShaderiv(shader, GraphicsContext3D::COMPILE_STATUS, &compiled));
|
| + if (!compiled) {
|
| + GLC(context, context->deleteShader(shader));
|
| + return 0;
|
| + }
|
| }
|
| -#endif
|
| return shader;
|
| }
|
|
|
| @@ -116,7 +115,7 @@ unsigned ProgramBindingBase::createShaderProgram(WebGraphicsContext3D* context,
|
| unsigned programObject = context->createProgram();
|
| if (!programObject) {
|
| if (!contextLost(context))
|
| - LOG_ERROR("Failed to create shader program");
|
| + LOG(ERROR) << "Failed to create shader program";
|
| return 0;
|
| }
|
|
|
|
|