diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-08 22:14:11 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-08 22:14:11 +0000 |
commit | a99d82fff6f153284981a7c44b2f9303de31e012 (patch) | |
tree | ca979dfb00ce009718da7f837b13a3cdc7eaf118 /cc/output/program_binding.h | |
parent | 18aa701dea5ef746a52ef43ee7f209abedb78182 (diff) | |
download | chromium_src-a99d82fff6f153284981a7c44b2f9303de31e012.zip chromium_src-a99d82fff6f153284981a7c44b2f9303de31e012.tar.gz chromium_src-a99d82fff6f153284981a7c44b2f9303de31e012.tar.bz2 |
Use GLES2Interface for shaders and programs
This uses the gpu::gles2::GLES2Interface type in the gl renderer's shader
and program code instead of WebGraphicsContext3D. For production code, the
GLES2Interface is a direct interface to the real command buffer in use. For
cc_unittests, the GLES2Interface is a stub that wraps TestWebGraphicsContext3D
so we can continue to use the same stubs/mocks for now. Once we port all of
the production code over to using GLES2Interface we should port the test context
classes over to the new base interface.
BUG=181120
Review URL: https://codereview.chromium.org/93433004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/output/program_binding.h')
-rw-r--r-- | cc/output/program_binding.h | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/cc/output/program_binding.h b/cc/output/program_binding.h index 4a75a01..912329e 100644 --- a/cc/output/program_binding.h +++ b/cc/output/program_binding.h @@ -11,7 +11,11 @@ #include "cc/output/context_provider.h" #include "cc/output/shader.h" -namespace blink { class WebGraphicsContext3D; } +namespace gpu { +namespace gles2 { +class GLES2Interface; +} +} namespace cc { @@ -20,23 +24,23 @@ class ProgramBindingBase { ProgramBindingBase(); ~ProgramBindingBase(); - bool Init(blink::WebGraphicsContext3D* context, + bool Init(gpu::gles2::GLES2Interface* context, const std::string& vertex_shader, const std::string& fragment_shader); - bool Link(blink::WebGraphicsContext3D* context); - void Cleanup(blink::WebGraphicsContext3D* context); + bool Link(gpu::gles2::GLES2Interface* context); + void Cleanup(gpu::gles2::GLES2Interface* context); unsigned program() const { return program_; } bool initialized() const { return initialized_; } protected: - unsigned LoadShader(blink::WebGraphicsContext3D* context, + unsigned LoadShader(gpu::gles2::GLES2Interface* context, unsigned type, const std::string& shader_source); - unsigned CreateShaderProgram(blink::WebGraphicsContext3D* context, + unsigned CreateShaderProgram(gpu::gles2::GLES2Interface* context, unsigned vertex_shader, unsigned fragment_shader); - void CleanupShaders(blink::WebGraphicsContext3D* context); + void CleanupShaders(gpu::gles2::GLES2Interface* context); unsigned program_; unsigned vertex_shader_id_; @@ -62,7 +66,7 @@ class ProgramBinding : public ProgramBindingBase { return; if (!ProgramBindingBase::Init( - context_provider->Context3d(), + context_provider->ContextGL(), vertex_shader_.GetShaderString(), fragment_shader_.GetShaderString(precision, sampler))) { DCHECK(context_provider->IsContextLost()); @@ -70,13 +74,13 @@ class ProgramBinding : public ProgramBindingBase { } int base_uniform_index = 0; - vertex_shader_.Init(context_provider->Context3d(), + vertex_shader_.Init(context_provider->ContextGL(), program_, &base_uniform_index); - fragment_shader_.Init(context_provider->Context3d(), + fragment_shader_.Init(context_provider->ContextGL(), program_, &base_uniform_index); // Link after binding uniforms - if (!Link(context_provider->Context3d())) { + if (!Link(context_provider->ContextGL())) { DCHECK(context_provider->IsContextLost()); return; } |