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

Unified Diff: cc/output/program_binding.cc

Issue 51653008: Remove WGC3D::isContextLost references from cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android build Created 7 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
« no previous file with comments | « cc/output/program_binding.h ('k') | cc/output/shader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/program_binding.cc
diff --git a/cc/output/program_binding.cc b/cc/output/program_binding.cc
index 5b7b13ee06daced13c42a48603bd28dfaa698062..d68df802d503b2a6bc779f0e5c90ce38c2a570e1 100644
--- a/cc/output/program_binding.cc
+++ b/cc/output/program_binding.cc
@@ -28,49 +28,47 @@ ProgramBindingBase::~ProgramBindingBase() {
DCHECK(!initialized_);
}
-void ProgramBindingBase::Init(WebGraphicsContext3D* context,
+bool ProgramBindingBase::Init(WebGraphicsContext3D* context,
const std::string& vertex_shader,
const std::string& fragment_shader) {
TRACE_EVENT0("cc", "ProgramBindingBase::init");
vertex_shader_id_ = LoadShader(context, GL_VERTEX_SHADER, vertex_shader);
- if (!vertex_shader_id_) {
- if (!IsContextLost(context))
- LOG(ERROR) << "Failed to create vertex shader";
- return;
- }
+ if (!vertex_shader_id_)
+ return false;
fragment_shader_id_ =
LoadShader(context, GL_FRAGMENT_SHADER, fragment_shader);
if (!fragment_shader_id_) {
GLC(context, context->deleteShader(vertex_shader_id_));
vertex_shader_id_ = 0;
- if (!IsContextLost(context))
- LOG(ERROR) << "Failed to create fragment shader";
- return;
+ return false;
}
program_ =
CreateShaderProgram(context, vertex_shader_id_, fragment_shader_id_);
- DCHECK(program_ || IsContextLost(context));
+ return !!program_;
}
-void ProgramBindingBase::Link(WebGraphicsContext3D* context) {
+bool ProgramBindingBase::Link(WebGraphicsContext3D* context) {
GLC(context, context->linkProgram(program_));
CleanupShaders(context);
if (!program_)
- return;
+ return false;
#ifndef NDEBUG
int linked = 0;
GLC(context, context->getProgramiv(program_, GL_LINK_STATUS, &linked));
if (!linked) {
- if (!IsContextLost(context))
- LOG(ERROR) << "Failed to link shader program";
GLC(context, context->deleteProgram(program_));
+ return false;
}
#endif
+ return true;
}
void ProgramBindingBase::Cleanup(WebGraphicsContext3D* context) {
+ if (!initialized_)
+ return;
+
initialized_ = false;
if (!program_)
return;
@@ -105,11 +103,8 @@ unsigned ProgramBindingBase::CreateShaderProgram(WebGraphicsContext3D* context,
unsigned vertex_shader,
unsigned fragment_shader) {
unsigned program_object = context->createProgram();
- if (!program_object) {
- if (!IsContextLost(context))
- LOG(ERROR) << "Failed to create shader program";
+ if (!program_object)
return 0;
- }
GLC(context, context->attachShader(program_object, vertex_shader));
GLC(context, context->attachShader(program_object, fragment_shader));
@@ -143,8 +138,4 @@ void ProgramBindingBase::CleanupShaders(WebGraphicsContext3D* context) {
}
}
-bool ProgramBindingBase::IsContextLost(WebGraphicsContext3D* context) {
- return (context->getGraphicsResetStatusARB() != GL_NO_ERROR);
-}
-
} // namespace cc
« no previous file with comments | « cc/output/program_binding.h ('k') | cc/output/shader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698