summaryrefslogtreecommitdiffstats
path: root/cc/output
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-06 19:44:57 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-06 19:44:57 +0000
commitf5931d4341bc85b6f987c2b664154cc047f2b570 (patch)
tree345c258cb9134399e1770e8d102b6305e20e5cd7 /cc/output
parent91dcae34f2f3c83e2bdddb9908c5ce394069e4bf (diff)
downloadchromium_src-f5931d4341bc85b6f987c2b664154cc047f2b570.zip
chromium_src-f5931d4341bc85b6f987c2b664154cc047f2b570.tar.gz
chromium_src-f5931d4341bc85b6f987c2b664154cc047f2b570.tar.bz2
Remove WGC3D::isContextLost references from cc
The notion of whether a context is lost is a property of both the gpu:: context itself and the system providing it. For instance, the content context provider checks if there is an error in the context or if the IPC channel backing the command buffer is down. Thus, asking if a context is lost really should go through the ContextProvider. This patch routes all lost context checks from cc through the ContextProvider. Unfortunately, this required reworking the program initialization code considerably due to the way some DCHECKs were written. The new model is that the program binding itself is inert upon construction and all initialization is done in the Initialize() call. This call is still made eagerly for some expected-to-be-common programs and lazily for the rest. This patch moves when the linkProgram() call is issued slightly for the eagerly compiled programs, but it shouldn't make any difference in practice. This patch also revamps TextureLayerClient to hide the backing context since cc only makes two calls (check for loss and insert rate limiting token) on the client's context. R=piman BUG=181120 Review URL: https://codereview.chromium.org/51653008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233325 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/output')
-rw-r--r--cc/output/context_provider.cc3
-rw-r--r--cc/output/context_provider.h4
-rw-r--r--cc/output/delegating_renderer.cc3
-rw-r--r--cc/output/gl_renderer.cc531
-rw-r--r--cc/output/gl_renderer.h111
-rw-r--r--cc/output/gl_renderer_unittest.cc51
-rw-r--r--cc/output/program_binding.cc35
-rw-r--r--cc/output/program_binding.h46
-rw-r--r--cc/output/shader.cc64
-rw-r--r--cc/output/shader.h30
10 files changed, 324 insertions, 554 deletions
diff --git a/cc/output/context_provider.cc b/cc/output/context_provider.cc
index a823fa2..853a519 100644
--- a/cc/output/context_provider.cc
+++ b/cc/output/context_provider.cc
@@ -9,8 +9,7 @@
namespace cc {
ContextProvider::Capabilities::Capabilities()
- : bind_uniform_location(false),
- discard_backbuffer(false),
+ : discard_backbuffer(false),
egl_image_external(false),
fast_npot_mo8_textures(false),
iosurface(false),
diff --git a/cc/output/context_provider.h b/cc/output/context_provider.h
index 0a794d7..d87127c 100644
--- a/cc/output/context_provider.h
+++ b/cc/output/context_provider.h
@@ -29,7 +29,6 @@ class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> {
virtual class GrContext* GrContext() = 0;
struct Capabilities {
- bool bind_uniform_location;
bool discard_backbuffer;
bool egl_image_external;
bool fast_npot_mo8_textures;
@@ -53,6 +52,9 @@ class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> {
// Returns the capabilities of the currently bound 3d context.
virtual Capabilities ContextCapabilities() = 0;
+ // Checks if the context is currently known to be lost.
+ virtual bool IsContextLost() = 0;
+
// Ask the provider to check if the contexts are valid or lost. If they are,
// this should invalidate the provider so that it can be replaced with a new
// one.
diff --git a/cc/output/delegating_renderer.cc b/cc/output/delegating_renderer.cc
index 9195e80..5140532 100644
--- a/cc/output/delegating_renderer.cc
+++ b/cc/output/delegating_renderer.cc
@@ -149,8 +149,7 @@ bool DelegatingRenderer::IsContextLost() {
ContextProvider* context_provider = output_surface_->context_provider();
if (!context_provider)
return false;
- return context_provider->Context3d()->getGraphicsResetStatusARB() !=
- GL_NO_ERROR;
+ return context_provider->IsContextLost();
}
void DelegatingRenderer::SetVisible(bool visible) {
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 8c201aa..7a3065a 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -166,7 +166,6 @@ GLRenderer::GLRenderer(RendererClient* client,
context_support_(output_surface->context_provider()->ContextSupport()),
texture_mailbox_deleter_(texture_mailbox_deleter),
is_backbuffer_discarded_(false),
- is_using_bind_uniform_(false),
visible_(true),
is_scissor_enabled_(false),
stencil_shadow_(false),
@@ -212,8 +211,6 @@ bool GLRenderer::Initialize() {
capabilities_.using_discard_framebuffer =
context_caps.discard_framebuffer;
- is_using_bind_uniform_ = context_caps.bind_uniform_location;
-
if (!InitializeSharedObjects())
return false;
@@ -1705,8 +1702,8 @@ void GLRenderer::DrawPictureQuad(const DrawingFrame* frame,
struct TextureProgramBinding {
template <class Program>
- void Set(Program* program, WebKit::WebGraphicsContext3D* context) {
- DCHECK(program && (program->initialized() || context->isContextLost()));
+ void Set(Program* program) {
+ DCHECK(program);
program_id = program->program();
sampler_location = program->fragment_shader().sampler_location();
matrix_location = program->vertex_shader().matrix_location();
@@ -1721,8 +1718,8 @@ struct TextureProgramBinding {
struct TexTransformTextureProgramBinding : TextureProgramBinding {
template <class Program>
- void Set(Program* program, WebKit::WebGraphicsContext3D* context) {
- TextureProgramBinding::Set(program, context);
+ void Set(Program* program) {
+ TextureProgramBinding::Set(program);
tex_transform_location = program->vertex_shader().tex_transform_location();
vertex_opacity_location =
program->vertex_shader().vertex_opacity_location();
@@ -1809,18 +1806,16 @@ void GLRenderer::EnqueueTextureQuad(const DrawingFrame* frame,
TexTransformTextureProgramBinding binding;
if (quad->premultiplied_alpha) {
if (quad->background_color == SK_ColorTRANSPARENT) {
- binding.Set(GetTextureProgram(tex_coord_precision), Context());
+ binding.Set(GetTextureProgram(tex_coord_precision));
} else {
- binding.Set(GetTextureBackgroundProgram(tex_coord_precision), Context());
+ binding.Set(GetTextureBackgroundProgram(tex_coord_precision));
}
} else {
if (quad->background_color == SK_ColorTRANSPARENT) {
- binding.Set(GetNonPremultipliedTextureProgram(tex_coord_precision),
- Context());
+ binding.Set(GetNonPremultipliedTextureProgram(tex_coord_precision));
} else {
binding.Set(
- GetNonPremultipliedTextureBackgroundProgram(tex_coord_precision),
- Context());
+ GetNonPremultipliedTextureBackgroundProgram(tex_coord_precision));
}
}
@@ -1873,7 +1868,7 @@ void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame* frame,
quad->shared_quad_state->visible_content_rect.bottom_right());
TexTransformTextureProgramBinding binding;
- binding.Set(GetTextureIOSurfaceProgram(tex_coord_precision), Context());
+ binding.Set(GetTextureIOSurfaceProgram(tex_coord_precision));
SetUseProgram(binding.program_id);
GLC(Context(), Context()->uniform1i(binding.sampler_location, 0));
@@ -2516,23 +2511,23 @@ bool GLRenderer::InitializeSharedObjects() {
// Create an FBO for doing offscreen rendering.
GLC(context_, offscreen_framebuffer_id_ = context_->createFramebuffer());
- // We will always need these programs to render, so create the programs
- // eagerly so that the shader compilation can start while we do other work.
- // Other programs are created lazily on first access.
shared_geometry_ = make_scoped_ptr(
new GeometryBinding(context_, QuadVertexRect()));
- render_pass_program_ = make_scoped_ptr(
- new RenderPassProgram(context_, TexCoordPrecisionMedium));
- render_pass_program_highp_ = make_scoped_ptr(
- new RenderPassProgram(context_, TexCoordPrecisionHigh));
- tile_program_ = make_scoped_ptr(
- new TileProgram(context_, TexCoordPrecisionMedium));
- tile_program_opaque_ = make_scoped_ptr(
- new TileProgramOpaque(context_, TexCoordPrecisionMedium));
- tile_program_highp_ = make_scoped_ptr(
- new TileProgram(context_, TexCoordPrecisionHigh));
- tile_program_opaque_highp_ = make_scoped_ptr(
- new TileProgramOpaque(context_, TexCoordPrecisionHigh));
+ // We will always need these programs to render, so initialize the programs
+ // eagerly so that the shader compilation can start while we do other work.
+ // Other programs are initialized lazily on first access.
+ render_pass_program_.Initialize(output_surface_->context_provider(),
+ TexCoordPrecisionMedium);
+ render_pass_program_highp_.Initialize(output_surface_->context_provider(),
+ TexCoordPrecisionHigh);
+ tile_program_.Initialize(output_surface_->context_provider(),
+ TexCoordPrecisionMedium);
+ tile_program_opaque_.Initialize(output_surface_->context_provider(),
+ TexCoordPrecisionMedium);
+ tile_program_highp_.Initialize(output_surface_->context_provider(),
+ TexCoordPrecisionHigh);
+ tile_program_opaque_highp_.Initialize(output_surface_->context_provider(),
+ TexCoordPrecisionHigh);
GLC(context_, context_->flush());
@@ -2541,382 +2536,318 @@ bool GLRenderer::InitializeSharedObjects() {
const GLRenderer::TileCheckerboardProgram*
GLRenderer::GetTileCheckerboardProgram() {
- if (!tile_checkerboard_program_)
- tile_checkerboard_program_ = make_scoped_ptr(
- new TileCheckerboardProgram(context_, TexCoordPrecisionNA));
- if (!tile_checkerboard_program_->initialized()) {
+ if (!tile_checkerboard_program_.initialized()) {
TRACE_EVENT0("cc", "GLRenderer::checkerboardProgram::initalize");
- tile_checkerboard_program_->Initialize(context_, is_using_bind_uniform_);
+ tile_checkerboard_program_.Initialize(
+ output_surface_->context_provider(), TexCoordPrecisionNA);
}
- return tile_checkerboard_program_.get();
+ return &tile_checkerboard_program_;
}
const GLRenderer::DebugBorderProgram* GLRenderer::GetDebugBorderProgram() {
- if (!debug_border_program_)
- debug_border_program_ = make_scoped_ptr(
- new DebugBorderProgram(context_, TexCoordPrecisionNA));
- if (!debug_border_program_->initialized()) {
+ if (!debug_border_program_.initialized()) {
TRACE_EVENT0("cc", "GLRenderer::debugBorderProgram::initialize");
- debug_border_program_->Initialize(context_, is_using_bind_uniform_);
+ debug_border_program_.Initialize(
+ output_surface_->context_provider(), TexCoordPrecisionNA);
}
- return debug_border_program_.get();
+ return &debug_border_program_;
}
const GLRenderer::SolidColorProgram* GLRenderer::GetSolidColorProgram() {
- if (!solid_color_program_)
- solid_color_program_ = make_scoped_ptr(
- new SolidColorProgram(context_, TexCoordPrecisionNA));
- if (!solid_color_program_->initialized()) {
+ if (!solid_color_program_.initialized()) {
TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize");
- solid_color_program_->Initialize(context_, is_using_bind_uniform_);
+ solid_color_program_.Initialize(
+ output_surface_->context_provider(), TexCoordPrecisionNA);
}
- return solid_color_program_.get();
+ return &solid_color_program_;
}
const GLRenderer::SolidColorProgramAA* GLRenderer::GetSolidColorProgramAA() {
- if (!solid_color_program_aa_) {
- solid_color_program_aa_ =
- make_scoped_ptr(new SolidColorProgramAA(context_, TexCoordPrecisionNA));
- }
- if (!solid_color_program_aa_->initialized()) {
+ if (!solid_color_program_aa_.initialized()) {
TRACE_EVENT0("cc", "GLRenderer::solidColorProgramAA::initialize");
- solid_color_program_aa_->Initialize(context_, is_using_bind_uniform_);
+ solid_color_program_aa_.Initialize(
+ output_surface_->context_provider(), TexCoordPrecisionNA);
}
- return solid_color_program_aa_.get();
+ return &solid_color_program_aa_;
}
const GLRenderer::RenderPassProgram* GLRenderer::GetRenderPassProgram(
TexCoordPrecision precision) {
- scoped_ptr<RenderPassProgram>& program =
- (precision == TexCoordPrecisionHigh) ? render_pass_program_highp_
- : render_pass_program_;
- DCHECK(program);
+ RenderPassProgram* program =
+ (precision == TexCoordPrecisionHigh) ? &render_pass_program_highp_
+ : &render_pass_program_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::RenderPassProgramAA* GLRenderer::GetRenderPassProgramAA(
TexCoordPrecision precision) {
- scoped_ptr<RenderPassProgramAA>& program =
- (precision == TexCoordPrecisionHigh) ? render_pass_program_aa_highp_
- : render_pass_program_aa_;
- if (!program)
- program =
- make_scoped_ptr(new RenderPassProgramAA(context_, precision));
+ RenderPassProgramAA* program =
+ (precision == TexCoordPrecisionHigh) ? &render_pass_program_aa_highp_
+ : &render_pass_program_aa_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::renderPassProgramAA::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::RenderPassMaskProgram*
GLRenderer::GetRenderPassMaskProgram(TexCoordPrecision precision) {
- scoped_ptr<RenderPassMaskProgram>& program =
- (precision == TexCoordPrecisionHigh) ? render_pass_mask_program_highp_
- : render_pass_mask_program_;
- if (!program)
- program = make_scoped_ptr(new RenderPassMaskProgram(context_, precision));
+ RenderPassMaskProgram* program =
+ (precision == TexCoordPrecisionHigh) ? &render_pass_mask_program_highp_
+ : &render_pass_mask_program_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgram::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::RenderPassMaskProgramAA*
GLRenderer::GetRenderPassMaskProgramAA(TexCoordPrecision precision) {
- scoped_ptr<RenderPassMaskProgramAA>& program =
- (precision == TexCoordPrecisionHigh) ? render_pass_mask_program_aa_highp_
- : render_pass_mask_program_aa_;
- if (!program)
- program =
- make_scoped_ptr(new RenderPassMaskProgramAA(context_, precision));
+ RenderPassMaskProgramAA* program =
+ (precision == TexCoordPrecisionHigh) ? &render_pass_mask_program_aa_highp_
+ : &render_pass_mask_program_aa_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgramAA::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::RenderPassColorMatrixProgram*
GLRenderer::GetRenderPassColorMatrixProgram(TexCoordPrecision precision) {
- scoped_ptr<RenderPassColorMatrixProgram>& program =
+ RenderPassColorMatrixProgram* program =
(precision == TexCoordPrecisionHigh) ?
- render_pass_color_matrix_program_highp_ :
- render_pass_color_matrix_program_;
- if (!program)
- program = make_scoped_ptr(
- new RenderPassColorMatrixProgram(context_, precision));
+ &render_pass_color_matrix_program_highp_ :
+ &render_pass_color_matrix_program_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::renderPassColorMatrixProgram::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::RenderPassColorMatrixProgramAA*
GLRenderer::GetRenderPassColorMatrixProgramAA(TexCoordPrecision precision) {
- scoped_ptr<RenderPassColorMatrixProgramAA>& program =
+ RenderPassColorMatrixProgramAA* program =
(precision == TexCoordPrecisionHigh) ?
- render_pass_color_matrix_program_aa_highp_ :
- render_pass_color_matrix_program_aa_;
- if (!program)
- program = make_scoped_ptr(
- new RenderPassColorMatrixProgramAA(context_, precision));
+ &render_pass_color_matrix_program_aa_highp_ :
+ &render_pass_color_matrix_program_aa_;
if (!program->initialized()) {
TRACE_EVENT0("cc",
"GLRenderer::renderPassColorMatrixProgramAA::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::RenderPassMaskColorMatrixProgram*
GLRenderer::GetRenderPassMaskColorMatrixProgram(TexCoordPrecision precision) {
- scoped_ptr<RenderPassMaskColorMatrixProgram>& program =
+ RenderPassMaskColorMatrixProgram* program =
(precision == TexCoordPrecisionHigh) ?
- render_pass_mask_color_matrix_program_highp_ :
- render_pass_mask_color_matrix_program_;
- if (!program)
- program = make_scoped_ptr(
- new RenderPassMaskColorMatrixProgram(context_, precision));
+ &render_pass_mask_color_matrix_program_highp_ :
+ &render_pass_mask_color_matrix_program_;
if (!program->initialized()) {
TRACE_EVENT0("cc",
"GLRenderer::renderPassMaskColorMatrixProgram::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::RenderPassMaskColorMatrixProgramAA*
GLRenderer::GetRenderPassMaskColorMatrixProgramAA(TexCoordPrecision precision) {
- scoped_ptr<RenderPassMaskColorMatrixProgramAA>& program =
+ RenderPassMaskColorMatrixProgramAA* program =
(precision == TexCoordPrecisionHigh) ?
- render_pass_mask_color_matrix_program_aa_highp_ :
- render_pass_mask_color_matrix_program_aa_;
- if (!program)
- program = make_scoped_ptr(
- new RenderPassMaskColorMatrixProgramAA(context_, precision));
+ &render_pass_mask_color_matrix_program_aa_highp_ :
+ &render_pass_mask_color_matrix_program_aa_;
if (!program->initialized()) {
TRACE_EVENT0("cc",
"GLRenderer::renderPassMaskColorMatrixProgramAA::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::TileProgram* GLRenderer::GetTileProgram(
TexCoordPrecision precision) {
- scoped_ptr<TileProgram>& program =
- (precision == TexCoordPrecisionHigh) ? tile_program_highp_
- : tile_program_;
- DCHECK(program);
+ TileProgram* program =
+ (precision == TexCoordPrecisionHigh) ? &tile_program_highp_
+ : &tile_program_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::tileProgram::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::TileProgramOpaque* GLRenderer::GetTileProgramOpaque(
TexCoordPrecision precision) {
- scoped_ptr<TileProgramOpaque>& program =
- (precision == TexCoordPrecisionHigh) ? tile_program_opaque_highp_
- : tile_program_opaque_;
+ TileProgramOpaque* program =
+ (precision == TexCoordPrecisionHigh) ? &tile_program_opaque_highp_
+ : &tile_program_opaque_;
DCHECK(program);
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::tileProgramOpaque::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::TileProgramAA* GLRenderer::GetTileProgramAA(
TexCoordPrecision precision) {
- scoped_ptr<TileProgramAA>& program =
- (precision == TexCoordPrecisionHigh) ? tile_program_aa_highp_
- : tile_program_aa_;
- if (!program)
- program = make_scoped_ptr(new TileProgramAA(context_, precision));
+ TileProgramAA* program =
+ (precision == TexCoordPrecisionHigh) ? &tile_program_aa_highp_
+ : &tile_program_aa_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::tileProgramAA::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::TileProgramSwizzle* GLRenderer::GetTileProgramSwizzle(
TexCoordPrecision precision) {
- scoped_ptr<TileProgramSwizzle>& program =
- (precision == TexCoordPrecisionHigh) ? tile_program_swizzle_highp_
- : tile_program_swizzle_;
- if (!program)
- program = make_scoped_ptr(new TileProgramSwizzle(context_, precision));
+ TileProgramSwizzle* program =
+ (precision == TexCoordPrecisionHigh) ? &tile_program_swizzle_highp_
+ : &tile_program_swizzle_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzle::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::TileProgramSwizzleOpaque*
GLRenderer::GetTileProgramSwizzleOpaque(TexCoordPrecision precision) {
- scoped_ptr<TileProgramSwizzleOpaque>& program =
- (precision == TexCoordPrecisionHigh) ? tile_program_swizzle_opaque_highp_
- : tile_program_swizzle_opaque_;
- if (!program)
- program = make_scoped_ptr(
- new TileProgramSwizzleOpaque(context_, precision));
+ TileProgramSwizzleOpaque* program =
+ (precision == TexCoordPrecisionHigh) ? &tile_program_swizzle_opaque_highp_
+ : &tile_program_swizzle_opaque_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleOpaque::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::TileProgramSwizzleAA* GLRenderer::GetTileProgramSwizzleAA(
TexCoordPrecision precision) {
- scoped_ptr<TileProgramSwizzleAA>& program =
- (precision == TexCoordPrecisionHigh) ? tile_program_swizzle_aa_highp_
- : tile_program_swizzle_aa_;
- if (!program)
- program = make_scoped_ptr(new TileProgramSwizzleAA(context_, precision));
+ TileProgramSwizzleAA* program =
+ (precision == TexCoordPrecisionHigh) ? &tile_program_swizzle_aa_highp_
+ : &tile_program_swizzle_aa_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleAA::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::TextureProgram* GLRenderer::GetTextureProgram(
TexCoordPrecision precision) {
- scoped_ptr<TextureProgram>& program =
- (precision == TexCoordPrecisionHigh) ? texture_program_highp_
- : texture_program_;
- if (!program)
- program = make_scoped_ptr(new TextureProgram(context_, precision));
+ TextureProgram* program =
+ (precision == TexCoordPrecisionHigh) ? &texture_program_highp_
+ : &texture_program_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::NonPremultipliedTextureProgram*
GLRenderer::GetNonPremultipliedTextureProgram(TexCoordPrecision precision) {
- scoped_ptr<NonPremultipliedTextureProgram>& program =
+ NonPremultipliedTextureProgram* program =
(precision == TexCoordPrecisionHigh) ?
- nonpremultiplied_texture_program_highp_ :
- nonpremultiplied_texture_program_;
- if (!program) {
- program = make_scoped_ptr(
- new NonPremultipliedTextureProgram(context_, precision));
- }
+ &nonpremultiplied_texture_program_highp_ :
+ &nonpremultiplied_texture_program_;
if (!program->initialized()) {
TRACE_EVENT0("cc",
"GLRenderer::NonPremultipliedTextureProgram::Initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::TextureBackgroundProgram*
GLRenderer::GetTextureBackgroundProgram(TexCoordPrecision precision) {
- scoped_ptr<TextureBackgroundProgram>& program =
- (precision == TexCoordPrecisionHigh) ? texture_background_program_highp_
- : texture_background_program_;
- if (!program) {
- program = make_scoped_ptr(
- new TextureBackgroundProgram(context_, precision));
- }
+ TextureBackgroundProgram* program =
+ (precision == TexCoordPrecisionHigh) ? &texture_background_program_highp_
+ : &texture_background_program_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::NonPremultipliedTextureBackgroundProgram*
GLRenderer::GetNonPremultipliedTextureBackgroundProgram(
TexCoordPrecision precision) {
- scoped_ptr<NonPremultipliedTextureBackgroundProgram>& program =
+ NonPremultipliedTextureBackgroundProgram* program =
(precision == TexCoordPrecisionHigh) ?
- nonpremultiplied_texture_background_program_highp_ :
- nonpremultiplied_texture_background_program_;
- if (!program) {
- program = make_scoped_ptr(
- new NonPremultipliedTextureBackgroundProgram(context_, precision));
- }
+ &nonpremultiplied_texture_background_program_highp_ :
+ &nonpremultiplied_texture_background_program_;
if (!program->initialized()) {
TRACE_EVENT0("cc",
"GLRenderer::NonPremultipliedTextureProgram::Initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::TextureIOSurfaceProgram*
GLRenderer::GetTextureIOSurfaceProgram(TexCoordPrecision precision) {
- scoped_ptr<TextureIOSurfaceProgram>& program =
- (precision == TexCoordPrecisionHigh) ? texture_io_surface_program_highp_
- : texture_io_surface_program_;
- if (!program)
- program =
- make_scoped_ptr(new TextureIOSurfaceProgram(context_, precision));
+ TextureIOSurfaceProgram* program =
+ (precision == TexCoordPrecisionHigh) ? &texture_io_surface_program_highp_
+ : &texture_io_surface_program_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::textureIOSurfaceProgram::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram(
TexCoordPrecision precision) {
- scoped_ptr<VideoYUVProgram>& program =
- (precision == TexCoordPrecisionHigh) ? video_yuv_program_highp_
- : video_yuv_program_;
- if (!program)
- program = make_scoped_ptr(new VideoYUVProgram(context_, precision));
+ VideoYUVProgram* program =
+ (precision == TexCoordPrecisionHigh) ? &video_yuv_program_highp_
+ : &video_yuv_program_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::videoYUVProgram::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::VideoYUVAProgram* GLRenderer::GetVideoYUVAProgram(
TexCoordPrecision precision) {
- scoped_ptr<VideoYUVAProgram>& program =
- (precision == TexCoordPrecisionHigh) ? video_yuva_program_highp_
- : video_yuva_program_;
- if (!program)
- program = make_scoped_ptr(new VideoYUVAProgram(context_, precision));
+ VideoYUVAProgram* program =
+ (precision == TexCoordPrecisionHigh) ? &video_yuva_program_highp_
+ : &video_yuva_program_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::videoYUVAProgram::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
const GLRenderer::VideoStreamTextureProgram*
GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) {
if (!Capabilities().using_egl_image)
return NULL;
- scoped_ptr<VideoStreamTextureProgram>& program =
- (precision == TexCoordPrecisionHigh) ? video_stream_texture_program_highp_
- : video_stream_texture_program_;
- if (!program)
- program =
- make_scoped_ptr(new VideoStreamTextureProgram(context_, precision));
+ VideoStreamTextureProgram* program = (precision == TexCoordPrecisionHigh)
+ ? &video_stream_texture_program_highp_
+ : &video_stream_texture_program_;
if (!program->initialized()) {
TRACE_EVENT0("cc", "GLRenderer::streamTextureProgram::initialize");
- program->Initialize(context_, is_using_bind_uniform_);
+ program->Initialize(output_surface_->context_provider(), precision);
}
- return program.get();
+ return program;
}
void GLRenderer::CleanupSharedObjects() {
@@ -2924,110 +2855,62 @@ void GLRenderer::CleanupSharedObjects() {
shared_geometry_.reset();
- if (tile_program_)
- tile_program_->Cleanup(context_);
- if (tile_program_opaque_)
- tile_program_opaque_->Cleanup(context_);
- if (tile_program_swizzle_)
- tile_program_swizzle_->Cleanup(context_);
- if (tile_program_swizzle_opaque_)
- tile_program_swizzle_opaque_->Cleanup(context_);
- if (tile_program_aa_)
- tile_program_aa_->Cleanup(context_);
- if (tile_program_swizzle_aa_)
- tile_program_swizzle_aa_->Cleanup(context_);
- if (tile_checkerboard_program_)
- tile_checkerboard_program_->Cleanup(context_);
-
- if (tile_program_highp_)
- tile_program_highp_->Cleanup(context_);
- if (tile_program_opaque_highp_)
- tile_program_opaque_highp_->Cleanup(context_);
- if (tile_program_swizzle_highp_)
- tile_program_swizzle_highp_->Cleanup(context_);
- if (tile_program_swizzle_opaque_highp_)
- tile_program_swizzle_opaque_highp_->Cleanup(context_);
- if (tile_program_aa_highp_)
- tile_program_aa_highp_->Cleanup(context_);
- if (tile_program_swizzle_aa_highp_)
- tile_program_swizzle_aa_highp_->Cleanup(context_);
-
- if (render_pass_mask_program_)
- render_pass_mask_program_->Cleanup(context_);
- if (render_pass_program_)
- render_pass_program_->Cleanup(context_);
- if (render_pass_mask_program_aa_)
- render_pass_mask_program_aa_->Cleanup(context_);
- if (render_pass_program_aa_)
- render_pass_program_aa_->Cleanup(context_);
- if (render_pass_color_matrix_program_)
- render_pass_color_matrix_program_->Cleanup(context_);
- if (render_pass_mask_color_matrix_program_aa_)
- render_pass_mask_color_matrix_program_aa_->Cleanup(context_);
- if (render_pass_color_matrix_program_aa_)
- render_pass_color_matrix_program_aa_->Cleanup(context_);
- if (render_pass_mask_color_matrix_program_)
- render_pass_mask_color_matrix_program_->Cleanup(context_);
-
- if (render_pass_mask_program_highp_)
- render_pass_mask_program_highp_->Cleanup(context_);
- if (render_pass_program_highp_)
- render_pass_program_highp_->Cleanup(context_);
- if (render_pass_mask_program_aa_highp_)
- render_pass_mask_program_aa_highp_->Cleanup(context_);
- if (render_pass_program_aa_highp_)
- render_pass_program_aa_highp_->Cleanup(context_);
- if (render_pass_color_matrix_program_highp_)
- render_pass_color_matrix_program_highp_->Cleanup(context_);
- if (render_pass_mask_color_matrix_program_aa_highp_)
- render_pass_mask_color_matrix_program_aa_highp_->Cleanup(context_);
- if (render_pass_color_matrix_program_aa_highp_)
- render_pass_color_matrix_program_aa_highp_->Cleanup(context_);
- if (render_pass_mask_color_matrix_program_highp_)
- render_pass_mask_color_matrix_program_highp_->Cleanup(context_);
-
- if (texture_program_)
- texture_program_->Cleanup(context_);
- if (nonpremultiplied_texture_program_)
- nonpremultiplied_texture_program_->Cleanup(context_);
- if (texture_background_program_)
- texture_background_program_->Cleanup(context_);
- if (nonpremultiplied_texture_background_program_)
- nonpremultiplied_texture_background_program_->Cleanup(context_);
- if (texture_io_surface_program_)
- texture_io_surface_program_->Cleanup(context_);
-
- if (texture_program_highp_)
- texture_program_highp_->Cleanup(context_);
- if (nonpremultiplied_texture_program_highp_)
- nonpremultiplied_texture_program_highp_->Cleanup(context_);
- if (texture_background_program_highp_)
- texture_background_program_highp_->Cleanup(context_);
- if (nonpremultiplied_texture_background_program_highp_)
- nonpremultiplied_texture_background_program_highp_->Cleanup(context_);
- if (texture_io_surface_program_highp_)
- texture_io_surface_program_highp_->Cleanup(context_);
-
- if (video_yuv_program_)
- video_yuv_program_->Cleanup(context_);
- if (video_yuva_program_)
- video_yuva_program_->Cleanup(context_);
- if (video_stream_texture_program_)
- video_stream_texture_program_->Cleanup(context_);
-
- if (video_yuv_program_highp_)
- video_yuv_program_highp_->Cleanup(context_);
- if (video_yuva_program_highp_)
- video_yuva_program_highp_->Cleanup(context_);
- if (video_stream_texture_program_highp_)
- video_stream_texture_program_highp_->Cleanup(context_);
-
- if (debug_border_program_)
- debug_border_program_->Cleanup(context_);
- if (solid_color_program_)
- solid_color_program_->Cleanup(context_);
- if (solid_color_program_aa_)
- solid_color_program_aa_->Cleanup(context_);
+ tile_program_.Cleanup(context_);
+ tile_program_opaque_.Cleanup(context_);
+ tile_program_swizzle_.Cleanup(context_);
+ tile_program_swizzle_opaque_.Cleanup(context_);
+ tile_program_aa_.Cleanup(context_);
+ tile_program_swizzle_aa_.Cleanup(context_);
+ tile_checkerboard_program_.Cleanup(context_);
+
+ tile_program_highp_.Cleanup(context_);
+ tile_program_opaque_highp_.Cleanup(context_);
+ tile_program_swizzle_highp_.Cleanup(context_);
+ tile_program_swizzle_opaque_highp_.Cleanup(context_);
+ tile_program_aa_highp_.Cleanup(context_);
+ tile_program_swizzle_aa_highp_.Cleanup(context_);
+
+ render_pass_mask_program_.Cleanup(context_);
+ render_pass_program_.Cleanup(context_);
+ render_pass_mask_program_aa_.Cleanup(context_);
+ render_pass_program_aa_.Cleanup(context_);
+ render_pass_color_matrix_program_.Cleanup(context_);
+ render_pass_mask_color_matrix_program_aa_.Cleanup(context_);
+ render_pass_color_matrix_program_aa_.Cleanup(context_);
+ render_pass_mask_color_matrix_program_.Cleanup(context_);
+
+ render_pass_mask_program_highp_.Cleanup(context_);
+ render_pass_program_highp_.Cleanup(context_);
+ render_pass_mask_program_aa_highp_.Cleanup(context_);
+ render_pass_program_aa_highp_.Cleanup(context_);
+ render_pass_color_matrix_program_highp_.Cleanup(context_);
+ render_pass_mask_color_matrix_program_aa_highp_.Cleanup(context_);
+ render_pass_color_matrix_program_aa_highp_.Cleanup(context_);
+ render_pass_mask_color_matrix_program_highp_.Cleanup(context_);
+
+ texture_program_.Cleanup(context_);
+ nonpremultiplied_texture_program_.Cleanup(context_);
+ texture_background_program_.Cleanup(context_);
+ nonpremultiplied_texture_background_program_.Cleanup(context_);
+ texture_io_surface_program_.Cleanup(context_);
+
+ texture_program_highp_.Cleanup(context_);
+ nonpremultiplied_texture_program_highp_.Cleanup(context_);
+ texture_background_program_highp_.Cleanup(context_);
+ nonpremultiplied_texture_background_program_highp_.Cleanup(context_);
+ texture_io_surface_program_highp_.Cleanup(context_);
+
+ video_yuv_program_.Cleanup(context_);
+ video_yuva_program_.Cleanup(context_);
+ video_stream_texture_program_.Cleanup(context_);
+
+ video_yuv_program_highp_.Cleanup(context_);
+ video_yuva_program_highp_.Cleanup(context_);
+ video_stream_texture_program_highp_.Cleanup(context_);
+
+ debug_border_program_.Cleanup(context_);
+ solid_color_program_.Cleanup(context_);
+ solid_color_program_aa_.Cleanup(context_);
if (offscreen_framebuffer_id_)
GLC(context_, context_->deleteFramebuffer(offscreen_framebuffer_id_));
@@ -3085,7 +2968,7 @@ bool GLRenderer::CanUseSkiaGPUBackend() const {
}
bool GLRenderer::IsContextLost() {
- return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR);
+ return output_surface_->context_provider()->IsContextLost();
}
} // namespace cc
diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h
index d65e638..86fc945 100644
--- a/cc/output/gl_renderer.h
+++ b/cc/output/gl_renderer.h
@@ -357,72 +357,65 @@ class CC_EXPORT GLRenderer : public DirectRenderer {
const SolidColorProgram* GetSolidColorProgram();
const SolidColorProgramAA* GetSolidColorProgramAA();
- scoped_ptr<TileProgram> tile_program_;
- scoped_ptr<TileProgramOpaque> tile_program_opaque_;
- scoped_ptr<TileProgramAA> tile_program_aa_;
- scoped_ptr<TileProgramSwizzle> tile_program_swizzle_;
- scoped_ptr<TileProgramSwizzleOpaque> tile_program_swizzle_opaque_;
- scoped_ptr<TileProgramSwizzleAA> tile_program_swizzle_aa_;
- scoped_ptr<TileCheckerboardProgram> tile_checkerboard_program_;
-
- scoped_ptr<TileProgram> tile_program_highp_;
- scoped_ptr<TileProgramOpaque> tile_program_opaque_highp_;
- scoped_ptr<TileProgramAA> tile_program_aa_highp_;
- scoped_ptr<TileProgramSwizzle> tile_program_swizzle_highp_;
- scoped_ptr<TileProgramSwizzleOpaque> tile_program_swizzle_opaque_highp_;
- scoped_ptr<TileProgramSwizzleAA> tile_program_swizzle_aa_highp_;
-
- scoped_ptr<TextureProgram> texture_program_;
- scoped_ptr<NonPremultipliedTextureProgram> nonpremultiplied_texture_program_;
- scoped_ptr<TextureBackgroundProgram> texture_background_program_;
- scoped_ptr<NonPremultipliedTextureBackgroundProgram>
+ TileProgram tile_program_;
+ TileProgramOpaque tile_program_opaque_;
+ TileProgramAA tile_program_aa_;
+ TileProgramSwizzle tile_program_swizzle_;
+ TileProgramSwizzleOpaque tile_program_swizzle_opaque_;
+ TileProgramSwizzleAA tile_program_swizzle_aa_;
+ TileCheckerboardProgram tile_checkerboard_program_;
+
+ TileProgram tile_program_highp_;
+ TileProgramOpaque tile_program_opaque_highp_;
+ TileProgramAA tile_program_aa_highp_;
+ TileProgramSwizzle tile_program_swizzle_highp_;
+ TileProgramSwizzleOpaque tile_program_swizzle_opaque_highp_;
+ TileProgramSwizzleAA tile_program_swizzle_aa_highp_;
+
+ TextureProgram texture_program_;
+ NonPremultipliedTextureProgram nonpremultiplied_texture_program_;
+ TextureBackgroundProgram texture_background_program_;
+ NonPremultipliedTextureBackgroundProgram
nonpremultiplied_texture_background_program_;
- scoped_ptr<TextureIOSurfaceProgram> texture_io_surface_program_;
+ TextureIOSurfaceProgram texture_io_surface_program_;
- scoped_ptr<TextureProgram> texture_program_highp_;
- scoped_ptr<NonPremultipliedTextureProgram>
- nonpremultiplied_texture_program_highp_;
- scoped_ptr<TextureBackgroundProgram> texture_background_program_highp_;
- scoped_ptr<NonPremultipliedTextureBackgroundProgram>
+ TextureProgram texture_program_highp_;
+ NonPremultipliedTextureProgram nonpremultiplied_texture_program_highp_;
+ TextureBackgroundProgram texture_background_program_highp_;
+ NonPremultipliedTextureBackgroundProgram
nonpremultiplied_texture_background_program_highp_;
- scoped_ptr<TextureIOSurfaceProgram> texture_io_surface_program_highp_;
-
- scoped_ptr<RenderPassProgram> render_pass_program_;
- scoped_ptr<RenderPassProgramAA> render_pass_program_aa_;
- scoped_ptr<RenderPassMaskProgram> render_pass_mask_program_;
- scoped_ptr<RenderPassMaskProgramAA> render_pass_mask_program_aa_;
- scoped_ptr<RenderPassColorMatrixProgram> render_pass_color_matrix_program_;
- scoped_ptr<RenderPassColorMatrixProgramAA>
- render_pass_color_matrix_program_aa_;
- scoped_ptr<RenderPassMaskColorMatrixProgram>
- render_pass_mask_color_matrix_program_;
- scoped_ptr<RenderPassMaskColorMatrixProgramAA>
- render_pass_mask_color_matrix_program_aa_;
-
- scoped_ptr<RenderPassProgram> render_pass_program_highp_;
- scoped_ptr<RenderPassProgramAA> render_pass_program_aa_highp_;
- scoped_ptr<RenderPassMaskProgram> render_pass_mask_program_highp_;
- scoped_ptr<RenderPassMaskProgramAA> render_pass_mask_program_aa_highp_;
- scoped_ptr<RenderPassColorMatrixProgram>
- render_pass_color_matrix_program_highp_;
- scoped_ptr<RenderPassColorMatrixProgramAA>
- render_pass_color_matrix_program_aa_highp_;
- scoped_ptr<RenderPassMaskColorMatrixProgram>
- render_pass_mask_color_matrix_program_highp_;
- scoped_ptr<RenderPassMaskColorMatrixProgramAA>
+ TextureIOSurfaceProgram texture_io_surface_program_highp_;
+
+ RenderPassProgram render_pass_program_;
+ RenderPassProgramAA render_pass_program_aa_;
+ RenderPassMaskProgram render_pass_mask_program_;
+ RenderPassMaskProgramAA render_pass_mask_program_aa_;
+ RenderPassColorMatrixProgram render_pass_color_matrix_program_;
+ RenderPassColorMatrixProgramAA render_pass_color_matrix_program_aa_;
+ RenderPassMaskColorMatrixProgram render_pass_mask_color_matrix_program_;
+ RenderPassMaskColorMatrixProgramAA render_pass_mask_color_matrix_program_aa_;
+
+ RenderPassProgram render_pass_program_highp_;
+ RenderPassProgramAA render_pass_program_aa_highp_;
+ RenderPassMaskProgram render_pass_mask_program_highp_;
+ RenderPassMaskProgramAA render_pass_mask_program_aa_highp_;
+ RenderPassColorMatrixProgram render_pass_color_matrix_program_highp_;
+ RenderPassColorMatrixProgramAA render_pass_color_matrix_program_aa_highp_;
+ RenderPassMaskColorMatrixProgram render_pass_mask_color_matrix_program_highp_;
+ RenderPassMaskColorMatrixProgramAA
render_pass_mask_color_matrix_program_aa_highp_;
- scoped_ptr<VideoYUVProgram> video_yuv_program_;
- scoped_ptr<VideoYUVAProgram> video_yuva_program_;
- scoped_ptr<VideoStreamTextureProgram> video_stream_texture_program_;
+ VideoYUVProgram video_yuv_program_;
+ VideoYUVAProgram video_yuva_program_;
+ VideoStreamTextureProgram video_stream_texture_program_;
- scoped_ptr<VideoYUVProgram> video_yuv_program_highp_;
- scoped_ptr<VideoYUVAProgram> video_yuva_program_highp_;
- scoped_ptr<VideoStreamTextureProgram> video_stream_texture_program_highp_;
+ VideoYUVProgram video_yuv_program_highp_;
+ VideoYUVAProgram video_yuva_program_highp_;
+ VideoStreamTextureProgram video_stream_texture_program_highp_;
- scoped_ptr<DebugBorderProgram> debug_border_program_;
- scoped_ptr<SolidColorProgram> solid_color_program_;
- scoped_ptr<SolidColorProgramAA> solid_color_program_aa_;
+ DebugBorderProgram debug_border_program_;
+ SolidColorProgram solid_color_program_;
+ SolidColorProgramAA solid_color_program_aa_;
WebKit::WebGraphicsContext3D* context_;
gpu::ContextSupport* context_support_;
diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc
index 36daf00..daf7868 100644
--- a/cc/output/gl_renderer_unittest.cc
+++ b/cc/output/gl_renderer_unittest.cc
@@ -57,8 +57,8 @@ namespace cc {
#define EXPECT_PROGRAM_VALID(program_binding) \
do { \
- EXPECT_TRUE(program_binding->program()); \
- EXPECT_TRUE(program_binding->initialized()); \
+ EXPECT_TRUE((program_binding)->program()); \
+ EXPECT_TRUE((program_binding)->initialized()); \
} while (false)
// Explicitly named to be a friend in GLRenderer for shader access.
@@ -262,56 +262,56 @@ class GLRendererShaderTest : public testing::Test {
}
void TestRenderPassProgram() {
- EXPECT_PROGRAM_VALID(renderer_->render_pass_program_);
- EXPECT_EQ(renderer_->render_pass_program_->program(),
+ EXPECT_PROGRAM_VALID(&renderer_->render_pass_program_);
+ EXPECT_EQ(renderer_->render_pass_program_.program(),
renderer_->program_shadow_);
}
void TestRenderPassColorMatrixProgram() {
- EXPECT_PROGRAM_VALID(renderer_->render_pass_color_matrix_program_);
- EXPECT_EQ(renderer_->render_pass_color_matrix_program_->program(),
+ EXPECT_PROGRAM_VALID(&renderer_->render_pass_color_matrix_program_);
+ EXPECT_EQ(renderer_->render_pass_color_matrix_program_.program(),
renderer_->program_shadow_);
}
void TestRenderPassMaskProgram() {
- EXPECT_PROGRAM_VALID(renderer_->render_pass_mask_program_);
- EXPECT_EQ(renderer_->render_pass_mask_program_->program(),
+ EXPECT_PROGRAM_VALID(&renderer_->render_pass_mask_program_);
+ EXPECT_EQ(renderer_->render_pass_mask_program_.program(),
renderer_->program_shadow_);
}
void TestRenderPassMaskColorMatrixProgram() {
- EXPECT_PROGRAM_VALID(renderer_->render_pass_mask_color_matrix_program_);
- EXPECT_EQ(renderer_->render_pass_mask_color_matrix_program_->program(),
+ EXPECT_PROGRAM_VALID(&renderer_->render_pass_mask_color_matrix_program_);
+ EXPECT_EQ(renderer_->render_pass_mask_color_matrix_program_.program(),
renderer_->program_shadow_);
}
void TestRenderPassProgramAA() {
- EXPECT_PROGRAM_VALID(renderer_->render_pass_program_aa_);
- EXPECT_EQ(renderer_->render_pass_program_aa_->program(),
+ EXPECT_PROGRAM_VALID(&renderer_->render_pass_program_aa_);
+ EXPECT_EQ(renderer_->render_pass_program_aa_.program(),
renderer_->program_shadow_);
}
void TestRenderPassColorMatrixProgramAA() {
- EXPECT_PROGRAM_VALID(renderer_->render_pass_color_matrix_program_aa_);
- EXPECT_EQ(renderer_->render_pass_color_matrix_program_aa_->program(),
+ EXPECT_PROGRAM_VALID(&renderer_->render_pass_color_matrix_program_aa_);
+ EXPECT_EQ(renderer_->render_pass_color_matrix_program_aa_.program(),
renderer_->program_shadow_);
}
void TestRenderPassMaskProgramAA() {
- EXPECT_PROGRAM_VALID(renderer_->render_pass_mask_program_aa_);
- EXPECT_EQ(renderer_->render_pass_mask_program_aa_->program(),
+ EXPECT_PROGRAM_VALID(&renderer_->render_pass_mask_program_aa_);
+ EXPECT_EQ(renderer_->render_pass_mask_program_aa_.program(),
renderer_->program_shadow_);
}
void TestRenderPassMaskColorMatrixProgramAA() {
- EXPECT_PROGRAM_VALID(renderer_->render_pass_mask_color_matrix_program_aa_);
- EXPECT_EQ(renderer_->render_pass_mask_color_matrix_program_aa_->program(),
+ EXPECT_PROGRAM_VALID(&renderer_->render_pass_mask_color_matrix_program_aa_);
+ EXPECT_EQ(renderer_->render_pass_mask_color_matrix_program_aa_.program(),
renderer_->program_shadow_);
}
void TestSolidColorProgramAA() {
- EXPECT_PROGRAM_VALID(renderer_->solid_color_program_aa_);
- EXPECT_EQ(renderer_->solid_color_program_aa_->program(),
+ EXPECT_PROGRAM_VALID(&renderer_->solid_color_program_aa_);
+ EXPECT_EQ(renderer_->solid_color_program_aa_.program(),
renderer_->program_shadow_);
}
@@ -570,9 +570,7 @@ TEST(GLRendererTest2, InitializationDoesNotMakeSynchronousCalls) {
class LoseContextOnFirstGetContext : public TestWebGraphicsContext3D {
public:
- LoseContextOnFirstGetContext() : context_lost_(false) {}
-
- virtual bool makeContextCurrent() OVERRIDE { return !context_lost_; }
+ LoseContextOnFirstGetContext() {}
virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value)
OVERRIDE {
@@ -585,13 +583,6 @@ class LoseContextOnFirstGetContext : public TestWebGraphicsContext3D {
context_lost_ = true;
*value = 0;
}
-
- virtual WGC3Denum getGraphicsResetStatusARB() OVERRIDE {
- return context_lost_ ? 1 : 0;
- }
-
- private:
- bool context_lost_;
};
TEST(GLRendererTest2, InitializationWithQuicklyLostContextDoesNotAssert) {
diff --git a/cc/output/program_binding.cc b/cc/output/program_binding.cc
index 5b7b13e..d68df80 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
diff --git a/cc/output/program_binding.h b/cc/output/program_binding.h
index ee9d284..01efa9c 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;
}
diff --git a/cc/output/shader.cc b/cc/output/shader.cc
index beabf8d..cf4a5ed 100644
--- a/cc/output/shader.cc
+++ b/cc/output/shader.cc
@@ -27,16 +27,10 @@ static void GetProgramUniformLocations(WebGraphicsContext3D* context,
size_t count,
const char** uniforms,
int* locations,
- bool using_bind_uniform,
int* base_uniform_index) {
for (size_t i = 0; i < count; i++) {
- if (using_bind_uniform) {
- locations[i] = (*base_uniform_index)++;
- context->bindUniformLocationCHROMIUM(program, locations[i], uniforms[i]);
- } else {
- locations[i] = context->getUniformLocation(program, uniforms[i]);
- DCHECK_NE(locations[i], -1);
- }
+ locations[i] = (*base_uniform_index)++;
+ context->bindUniformLocationCHROMIUM(program, locations[i], uniforms[i]);
}
}
@@ -121,7 +115,6 @@ VertexShaderPosTex::VertexShaderPosTex()
void VertexShaderPosTex::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"matrix",
@@ -133,7 +126,6 @@ void VertexShaderPosTex::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
matrix_location_ = locations[0];
}
@@ -157,7 +149,6 @@ VertexShaderPosTexYUVStretch::VertexShaderPosTexYUVStretch()
void VertexShaderPosTexYUVStretch::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"matrix",
@@ -170,7 +161,6 @@ void VertexShaderPosTexYUVStretch::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
matrix_location_ = locations[0];
tex_scale_location_ = locations[1];
@@ -196,7 +186,6 @@ VertexShaderPos::VertexShaderPos()
void VertexShaderPos::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"matrix",
@@ -208,7 +197,6 @@ void VertexShaderPos::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
matrix_location_ = locations[0];
}
@@ -230,7 +218,6 @@ VertexShaderPosTexTransform::VertexShaderPosTexTransform()
void VertexShaderPosTexTransform::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"matrix",
@@ -244,7 +231,6 @@ void VertexShaderPosTexTransform::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
matrix_location_ = locations[0];
tex_transform_location_ = locations[1];
@@ -288,7 +274,6 @@ VertexShaderQuad::VertexShaderQuad()
void VertexShaderQuad::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"matrix",
@@ -301,7 +286,6 @@ void VertexShaderQuad::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
matrix_location_ = locations[0];
quad_location_ = locations[1];
@@ -347,7 +331,6 @@ VertexShaderQuadAA::VertexShaderQuadAA()
void VertexShaderQuadAA::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"matrix",
@@ -362,7 +345,6 @@ void VertexShaderQuadAA::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
matrix_location_ = locations[0];
viewport_location_ = locations[1];
@@ -406,7 +388,6 @@ VertexShaderQuadTexTransformAA::VertexShaderQuadTexTransformAA()
void VertexShaderQuadTexTransformAA::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"matrix",
@@ -422,7 +403,6 @@ void VertexShaderQuadTexTransformAA::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
matrix_location_ = locations[0];
viewport_location_ = locations[1];
@@ -468,7 +448,6 @@ VertexShaderTile::VertexShaderTile()
void VertexShaderTile::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"matrix",
@@ -482,7 +461,6 @@ void VertexShaderTile::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
matrix_location_ = locations[0];
quad_location_ = locations[1];
@@ -514,7 +492,6 @@ VertexShaderTileAA::VertexShaderTileAA()
void VertexShaderTileAA::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"matrix",
@@ -530,7 +507,6 @@ void VertexShaderTileAA::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
matrix_location_ = locations[0];
viewport_location_ = locations[1];
@@ -575,7 +551,6 @@ VertexShaderVideoTransform::VertexShaderVideoTransform()
void VertexShaderVideoTransform::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"matrix",
@@ -588,7 +563,6 @@ void VertexShaderVideoTransform::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
matrix_location_ = locations[0];
tex_matrix_location_ = locations[1];
@@ -615,7 +589,6 @@ FragmentTexAlphaBinding::FragmentTexAlphaBinding()
void FragmentTexAlphaBinding::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"s_texture",
@@ -628,7 +601,6 @@ void FragmentTexAlphaBinding::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
sampler_location_ = locations[0];
alpha_location_ = locations[1];
@@ -642,7 +614,6 @@ FragmentTexColorMatrixAlphaBinding::FragmentTexColorMatrixAlphaBinding()
void FragmentTexColorMatrixAlphaBinding::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"s_texture",
@@ -657,7 +628,6 @@ void FragmentTexColorMatrixAlphaBinding::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
sampler_location_ = locations[0];
alpha_location_ = locations[1];
@@ -670,7 +640,6 @@ FragmentTexOpaqueBinding::FragmentTexOpaqueBinding()
void FragmentTexOpaqueBinding::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"s_texture",
@@ -682,7 +651,6 @@ void FragmentTexOpaqueBinding::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
sampler_location_ = locations[0];
}
@@ -692,7 +660,6 @@ FragmentShaderOESImageExternal::FragmentShaderOESImageExternal()
void FragmentShaderOESImageExternal::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"s_texture",
@@ -704,7 +671,6 @@ void FragmentShaderOESImageExternal::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
sampler_location_ = locations[0];
}
@@ -795,7 +761,6 @@ FragmentTexBackgroundBinding::FragmentTexBackgroundBinding()
void FragmentTexBackgroundBinding::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"s_texture",
@@ -808,7 +773,6 @@ void FragmentTexBackgroundBinding::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
sampler_location_ = locations[0];
@@ -925,7 +889,6 @@ FragmentShaderRGBATexAlphaAA::FragmentShaderRGBATexAlphaAA()
void FragmentShaderRGBATexAlphaAA::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"s_texture",
@@ -938,7 +901,6 @@ void FragmentShaderRGBATexAlphaAA::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
sampler_location_ = locations[0];
alpha_location_ = locations[1];
@@ -970,7 +932,6 @@ FragmentTexClampAlphaAABinding::FragmentTexClampAlphaAABinding()
void FragmentTexClampAlphaAABinding::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"s_texture",
@@ -984,7 +945,6 @@ void FragmentTexClampAlphaAABinding::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
sampler_location_ = locations[0];
alpha_location_ = locations[1];
@@ -1046,7 +1006,6 @@ FragmentShaderRGBATexAlphaMask::FragmentShaderRGBATexAlphaMask()
void FragmentShaderRGBATexAlphaMask::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"s_texture",
@@ -1062,7 +1021,6 @@ void FragmentShaderRGBATexAlphaMask::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
sampler_location_ = locations[0];
mask_sampler_location_ = locations[1];
@@ -1101,7 +1059,6 @@ FragmentShaderRGBATexAlphaMaskAA::FragmentShaderRGBATexAlphaMaskAA()
void FragmentShaderRGBATexAlphaMaskAA::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"s_texture",
@@ -1117,7 +1074,6 @@ void FragmentShaderRGBATexAlphaMaskAA::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
sampler_location_ = locations[0];
mask_sampler_location_ = locations[1];
@@ -1164,7 +1120,6 @@ FragmentShaderRGBATexAlphaMaskColorMatrixAA::
void FragmentShaderRGBATexAlphaMaskColorMatrixAA::Init(
WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"s_texture",
@@ -1182,7 +1137,6 @@ void FragmentShaderRGBATexAlphaMaskColorMatrixAA::Init(
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
sampler_location_ = locations[0];
mask_sampler_location_ = locations[1];
@@ -1236,7 +1190,6 @@ FragmentShaderRGBATexAlphaColorMatrixAA::
void FragmentShaderRGBATexAlphaColorMatrixAA::Init(
WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"s_texture",
@@ -1251,7 +1204,6 @@ void FragmentShaderRGBATexAlphaColorMatrixAA::Init(
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
sampler_location_ = locations[0];
alpha_location_ = locations[1];
@@ -1295,7 +1247,6 @@ FragmentShaderRGBATexAlphaMaskColorMatrix::
void FragmentShaderRGBATexAlphaMaskColorMatrix::Init(
WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"s_texture",
@@ -1313,7 +1264,6 @@ void FragmentShaderRGBATexAlphaMaskColorMatrix::Init(
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
sampler_location_ = locations[0];
mask_sampler_location_ = locations[1];
@@ -1362,7 +1312,6 @@ FragmentShaderYUVVideo::FragmentShaderYUVVideo()
void FragmentShaderYUVVideo::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"y_texture",
@@ -1379,7 +1328,6 @@ void FragmentShaderYUVVideo::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
y_texture_location_ = locations[0];
u_texture_location_ = locations[1];
@@ -1424,7 +1372,6 @@ FragmentShaderYUVAVideo::FragmentShaderYUVAVideo()
void FragmentShaderYUVAVideo::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"y_texture",
@@ -1442,7 +1389,6 @@ void FragmentShaderYUVAVideo::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
y_texture_location_ = locations[0];
u_texture_location_ = locations[1];
@@ -1483,7 +1429,6 @@ FragmentShaderColor::FragmentShaderColor()
void FragmentShaderColor::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"color",
@@ -1495,7 +1440,6 @@ void FragmentShaderColor::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
color_location_ = locations[0];
}
@@ -1516,7 +1460,6 @@ FragmentShaderColorAA::FragmentShaderColorAA()
void FragmentShaderColorAA::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"color",
@@ -1528,7 +1471,6 @@ void FragmentShaderColorAA::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
color_location_ = locations[0];
}
@@ -1556,7 +1498,6 @@ FragmentShaderCheckerboard::FragmentShaderCheckerboard()
void FragmentShaderCheckerboard::Init(WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {
static const char* uniforms[] = {
"alpha",
@@ -1571,7 +1512,6 @@ void FragmentShaderCheckerboard::Init(WebGraphicsContext3D* context,
arraysize(uniforms),
uniforms,
locations,
- using_bind_uniform,
base_uniform_index);
alpha_location_ = locations[0];
tex_transform_location_ = locations[1];
diff --git a/cc/output/shader.h b/cc/output/shader.h
index 7135bef..615fcb8 100644
--- a/cc/output/shader.h
+++ b/cc/output/shader.h
@@ -48,7 +48,6 @@ class VertexShaderPosTex {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
std::string GetShaderString() const;
@@ -66,7 +65,6 @@ class VertexShaderPosTexYUVStretch {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
std::string GetShaderString() const;
@@ -86,7 +84,6 @@ class VertexShaderPos {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
std::string GetShaderString() const;
@@ -102,7 +99,6 @@ class VertexShaderPosTexIdentity {
public:
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index) {}
std::string GetShaderString() const;
};
@@ -113,7 +109,6 @@ class VertexShaderPosTexTransform {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
std::string GetShaderString() const;
@@ -135,7 +130,6 @@ class VertexShaderQuad {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
std::string GetShaderString() const;
@@ -157,7 +151,6 @@ class VertexShaderQuadAA {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
std::string GetShaderString() const;
@@ -182,7 +175,6 @@ class VertexShaderQuadTexTransformAA {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
std::string GetShaderString() const;
@@ -208,7 +200,6 @@ class VertexShaderTile {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
std::string GetShaderString() const;
@@ -234,7 +225,6 @@ class VertexShaderTileAA {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
std::string GetShaderString() const;
@@ -262,7 +252,6 @@ class VertexShaderVideoTransform {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
std::string GetShaderString() const;
@@ -282,7 +271,6 @@ class FragmentTexAlphaBinding {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
int alpha_location() const { return alpha_location_; }
int fragment_tex_transform_location() const { return -1; }
@@ -301,8 +289,7 @@ class FragmentTexColorMatrixAlphaBinding {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool usingBindUniform,
- int* baseUniformIndex);
+ int* base_uniform_index);
int alpha_location() const { return alpha_location_; }
int color_matrix_location() const { return color_matrix_location_; }
int color_offset_location() const { return color_offset_location_; }
@@ -322,7 +309,6 @@ class FragmentTexOpaqueBinding {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
int alpha_location() const { return -1; }
int fragment_tex_transform_location() const { return -1; }
@@ -341,7 +327,6 @@ class FragmentTexBackgroundBinding {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
int background_color_location() const { return background_color_location_; }
int sampler_location() const { return sampler_location_; }
@@ -421,7 +406,6 @@ class FragmentShaderOESImageExternal : public FragmentTexAlphaBinding {
std::string GetShaderString(TexCoordPrecision precision) const;
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
private:
int sampler_location_;
@@ -435,7 +419,6 @@ class FragmentShaderRGBATexAlphaAA {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
std::string GetShaderString(TexCoordPrecision precision) const;
@@ -455,7 +438,6 @@ class FragmentTexClampAlphaAABinding {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
int alpha_location() const { return alpha_location_; }
int sampler_location() const { return sampler_location_; }
@@ -491,7 +473,6 @@ class FragmentShaderRGBATexAlphaMask {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
int alpha_location() const { return alpha_location_; }
int sampler_location() const { return sampler_location_; }
@@ -520,7 +501,6 @@ class FragmentShaderRGBATexAlphaMaskAA {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
int alpha_location() const { return alpha_location_; }
int sampler_location() const { return sampler_location_; }
@@ -549,7 +529,6 @@ class FragmentShaderRGBATexAlphaMaskColorMatrixAA {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
int alpha_location() const { return alpha_location_; }
int sampler_location() const { return sampler_location_; }
@@ -580,7 +559,6 @@ class FragmentShaderRGBATexAlphaColorMatrixAA {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
int alpha_location() const { return alpha_location_; }
int sampler_location() const { return sampler_location_; }
@@ -601,7 +579,6 @@ class FragmentShaderRGBATexAlphaMaskColorMatrix {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
int alpha_location() const { return alpha_location_; }
int sampler_location() const { return sampler_location_; }
@@ -632,7 +609,6 @@ class FragmentShaderYUVVideo {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
int y_texture_location() const { return y_texture_location_; }
int u_texture_location() const { return u_texture_location_; }
@@ -660,7 +636,6 @@ class FragmentShaderYUVAVideo {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
int y_texture_location() const { return y_texture_location_; }
@@ -690,7 +665,6 @@ class FragmentShaderColor {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
int color_location() const { return color_location_; }
@@ -707,7 +681,6 @@ class FragmentShaderColorAA {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
int color_location() const { return color_location_; }
@@ -724,7 +697,6 @@ class FragmentShaderCheckerboard {
void Init(WebKit::WebGraphicsContext3D* context,
unsigned program,
- bool using_bind_uniform,
int* base_uniform_index);
int alpha_location() const { return alpha_location_; }
int tex_transform_location() const { return tex_transform_location_; }