Index: content/common/gpu/client/gl_helper_scaling.cc |
diff --git a/content/common/gpu/client/gl_helper_scaling.cc b/content/common/gpu/client/gl_helper_scaling.cc |
index b248d9d92048e0ebbde1ef2490405963a0b9c18a..6ef4b847056e03d8e3958ef595d6af890f38714e 100644 |
--- a/content/common/gpu/client/gl_helper_scaling.cc |
+++ b/content/common/gpu/client/gl_helper_scaling.cc |
@@ -15,6 +15,7 @@ |
#include "base/message_loop/message_loop.h" |
#include "base/time/time.h" |
#include "base/trace_event/trace_event.h" |
+#include "gpu/command_buffer/client/context_support.h" |
#include "gpu/command_buffer/client/gles2_interface.h" |
#include "third_party/skia/include/core/SkRegion.h" |
#include "ui/gfx/geometry/rect.h" |
@@ -24,8 +25,13 @@ using gpu::gles2::GLES2Interface; |
namespace content { |
-GLHelperScaling::GLHelperScaling(GLES2Interface* gl, GLHelper* helper) |
- : gl_(gl), helper_(helper), vertex_attributes_buffer_(gl_) { |
+GLHelperScaling::GLHelperScaling(GLES2Interface* gl, |
+ gpu::ContextSupport* context_support, |
+ GLHelper* helper) |
+ : gl_(gl), |
+ context_support_(context_support), |
+ helper_(helper), |
+ vertex_attributes_buffer_(gl_) { |
InitBuffer(); |
} |
@@ -50,7 +56,8 @@ class ShaderProgram : public base::RefCounted<ShaderProgram> { |
color_weights_location_(-1) {} |
// Compile shader program. |
- void Setup(const GLchar* vertex_shader_text, |
+ void Setup(gpu::ContextSupport* context_support, |
+ const GLchar* vertex_shader_text, |
const GLchar* fragment_shader_text); |
// UseProgram must be called with GL_TEXTURE_2D bound to the |
@@ -828,12 +835,14 @@ scoped_refptr<ShaderProgram> GLHelperScaling::GetShaderProgram(ShaderType type, |
shared_variables + "void main() {\n" + fragment_program + |
"}\n"; |
- cache_entry->Setup(vertex_program.c_str(), fragment_program.c_str()); |
+ cache_entry->Setup(context_support_, vertex_program.c_str(), |
+ fragment_program.c_str()); |
} |
return cache_entry; |
} |
-void ShaderProgram::Setup(const GLchar* vertex_shader_text, |
+void ShaderProgram::Setup(gpu::ContextSupport* context_support, |
+ const GLchar* vertex_shader_text, |
const GLchar* fragment_shader_text) { |
// Shaders to map the source texture to |dst_texture_|. |
GLuint vertex_shader = |
@@ -876,7 +885,8 @@ void ShaderProgram::Setup(const GLchar* vertex_shader_text, |
// be able to return an error. Fortunately, many users of this code |
// check for context loss at a higher level. |
if (!Initialized()) { |
- LOG(ERROR) << "ShaderProgram::Setup: initialization failed (context lost?)"; |
+ // Should only fail due to context loss, anything else is a bug. |
+ DCHECK(context_support->IsContextLost()); |
Ken Russell (switch to Gerrit)
2015/05/29 17:47:05
To be closer to the previous code, should this be
danakj
2015/05/29 18:30:14
Sure ya.
|
} |
return; |
} |