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

Unified Diff: cc/output/program_binding.h

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/gl_renderer_unittest.cc ('k') | cc/output/program_binding.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/program_binding.h
diff --git a/cc/output/program_binding.h b/cc/output/program_binding.h
index ee9d284fa7ff12a4c228f3a200c4bfbb19e8c314..01efa9c1c90a81508cc34cabdc21a09e2b3e17cc 100644
--- a/cc/output/program_binding.h
+++ b/cc/output/program_binding.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/logging.h"
+#include "cc/output/context_provider.h"
#include "cc/output/shader.h"
namespace WebKit { class WebGraphicsContext3D; }
@@ -19,10 +20,10 @@ class ProgramBindingBase {
ProgramBindingBase();
~ProgramBindingBase();
- void Init(WebKit::WebGraphicsContext3D* context,
+ bool Init(WebKit::WebGraphicsContext3D* context,
const std::string& vertex_shader,
const std::string& fragment_shader);
- void Link(WebKit::WebGraphicsContext3D* context);
+ bool Link(WebKit::WebGraphicsContext3D* context);
void Cleanup(WebKit::WebGraphicsContext3D* context);
unsigned program() const { return program_; }
@@ -36,7 +37,6 @@ class ProgramBindingBase {
unsigned vertex_shader,
unsigned fragment_shader);
void CleanupShaders(WebKit::WebGraphicsContext3D* context);
- bool IsContextLost(WebKit::WebGraphicsContext3D* context);
unsigned program_;
unsigned vertex_shader_id_;
@@ -50,35 +50,35 @@ class ProgramBindingBase {
template <class VertexShader, class FragmentShader>
class ProgramBinding : public ProgramBindingBase {
public:
- explicit ProgramBinding(WebKit::WebGraphicsContext3D* context,
- TexCoordPrecision precision) {
- ProgramBindingBase::Init(
- context,
- vertex_shader_.GetShaderString(),
- fragment_shader_.GetShaderString(precision));
- }
+ ProgramBinding() {}
- void Initialize(WebKit::WebGraphicsContext3D* context,
- bool using_bind_uniform) {
- DCHECK(context);
+ void Initialize(ContextProvider* context_provider,
+ TexCoordPrecision precision) {
+ DCHECK(context_provider);
DCHECK(!initialized_);
- if (IsContextLost(context))
+ if (context_provider->IsContextLost())
return;
- // Need to bind uniforms before linking
- if (!using_bind_uniform)
- Link(context);
+ if (!ProgramBindingBase::Init(
+ context_provider->Context3d(),
+ vertex_shader_.GetShaderString(),
+ fragment_shader_.GetShaderString(precision))) {
+ DCHECK(context_provider->IsContextLost());
+ return;
+ }
int base_uniform_index = 0;
- vertex_shader_.Init(
- context, program_, using_bind_uniform, &base_uniform_index);
- fragment_shader_.Init(
- context, program_, using_bind_uniform, &base_uniform_index);
+ vertex_shader_.Init(context_provider->Context3d(),
+ program_, &base_uniform_index);
+ fragment_shader_.Init(context_provider->Context3d(),
+ program_, &base_uniform_index);
// Link after binding uniforms
- if (using_bind_uniform)
- Link(context);
+ if (!Link(context_provider->Context3d())) {
+ DCHECK(context_provider->IsContextLost());
+ return;
+ }
initialized_ = true;
}
« no previous file with comments | « cc/output/gl_renderer_unittest.cc ('k') | cc/output/program_binding.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698