Commit 29e1187b authored by ccameron's avatar ccameron Committed by Commit bot

Revert of cc: Always log shader compiler errors (patchset #2 id:20001 of...

Revert of cc: Always log shader compiler errors (patchset #2 id:20001 of https://codereview.chromium.org/2712033004/ )

Reason for revert:
Causes performance regression
BUG=699743

Original issue's description:
> cc: Always log shader compiler errors
>
> This is a catastrophic error, and should spam the console.
>
> BUG=695431
> CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel
>
> Review-Url: https://codereview.chromium.org/2712033004
> Cr-Commit-Position: refs/heads/master@{#453019}
> Committed: https://chromium.googlesource.com/chromium/src/+/7d39070d75082cd35a08775dd792d67cd2beeb40

TBR=enne@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=695431

Review-Url: https://codereview.chromium.org/2799743005
Cr-Commit-Position: refs/heads/master@{#462646}
parent 96fe1d78
......@@ -177,24 +177,21 @@ bool ProgramBindingBase::Init(GLES2Interface* context,
return !!program_;
}
bool ProgramBindingBase::Link(GLES2Interface* context,
const std::string& vertex_source,
const std::string& fragment_source) {
bool ProgramBindingBase::Link(GLES2Interface* context) {
context->LinkProgram(program_);
CleanupShaders(context);
if (!program_)
return false;
#ifndef NDEBUG
int linked = 0;
context->GetProgramiv(program_, GL_LINK_STATUS, &linked);
if (!linked) {
char buffer[1024] = "";
context->GetProgramInfoLog(program_, sizeof(buffer), nullptr, buffer);
LOG(ERROR) << "Error linking shader: " << buffer << "\n"
<< "Vertex shader:\n"
<< vertex_source << "Fragment shader:\n"
<< fragment_source;
DLOG(ERROR) << "Error compiling shader: " << buffer;
return false;
}
#endif
return true;
}
......@@ -224,16 +221,17 @@ unsigned ProgramBindingBase::LoadShader(GLES2Interface* context,
shader_source_str,
shader_length);
context->CompileShader(shader);
#if DCHECK_IS_ON()
int compiled = 0;
context->GetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
if (!compiled) {
char buffer[1024] = "";
context->GetShaderInfoLog(shader, sizeof(buffer), nullptr, buffer);
LOG(ERROR) << "Error compiling shader: " << buffer << "\n"
<< "Shader program:\n"
<< shader_source;
DLOG(ERROR) << "Error compiling shader: " << buffer
<< "\n shader program: " << shader_source;
return 0u;
}
#endif
return shader;
}
......
......@@ -32,9 +32,7 @@ class ProgramBindingBase {
bool Init(gpu::gles2::GLES2Interface* context,
const std::string& vertex_shader,
const std::string& fragment_shader);
bool Link(gpu::gles2::GLES2Interface* context,
const std::string& vertex_source,
const std::string& fragment_source);
bool Link(gpu::gles2::GLES2Interface* context);
void Cleanup(gpu::gles2::GLES2Interface* context);
unsigned program() const { return program_; }
......@@ -405,10 +403,9 @@ class Program : public ProgramBindingBase {
if (IsContextLost(context_provider->ContextGL()))
return;
std::string vertex_source = vertex_shader_.GetShaderString();
std::string fragment_source = fragment_shader_.GetShaderString();
if (!ProgramBindingBase::Init(context_provider->ContextGL(), vertex_source,
fragment_source)) {
if (!ProgramBindingBase::Init(context_provider->ContextGL(),
vertex_shader_.GetShaderString(),
fragment_shader_.GetShaderString())) {
DCHECK(IsContextLost(context_provider->ContextGL()));
return;
}
......@@ -420,7 +417,7 @@ class Program : public ProgramBindingBase {
program_, &base_uniform_index);
// Link after binding uniforms
if (!Link(context_provider->ContextGL(), vertex_source, fragment_source)) {
if (!Link(context_provider->ContextGL())) {
DCHECK(IsContextLost(context_provider->ContextGL()));
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment