| Index: cc/layers/delegated_renderer_layer_impl.cc
|
| diff --git a/cc/layers/delegated_renderer_layer_impl.cc b/cc/layers/delegated_renderer_layer_impl.cc
|
| index 17a0c1c95ac25b8efe7c84a52749ac4af74bdaa7..daa3662428adea78fe41d7882a711879050d6941 100644
|
| --- a/cc/layers/delegated_renderer_layer_impl.cc
|
| +++ b/cc/layers/delegated_renderer_layer_impl.cc
|
| @@ -240,13 +240,19 @@ RenderPass::Id DelegatedRendererLayerImpl::NextContributingRenderPassId(
|
| return RenderPass::Id(previous.layer_id, previous.index + 1);
|
| }
|
|
|
| -RenderPass::Id DelegatedRendererLayerImpl::ConvertDelegatedRenderPassId(
|
| - RenderPass::Id delegated_render_pass_id) const {
|
| +bool DelegatedRendererLayerImpl::ConvertDelegatedRenderPassId(
|
| + RenderPass::Id delegated_render_pass_id,
|
| + RenderPass::Id* output_render_pass_id) const {
|
| base::hash_map<RenderPass::Id, int>::const_iterator found =
|
| render_passes_index_by_id_.find(delegated_render_pass_id);
|
| - DCHECK(found != render_passes_index_by_id_.end());
|
| + if (found == render_passes_index_by_id_.end()) {
|
| + // Be robust against a RenderPass id that isn't part of the frame.
|
| + return false;
|
| + }
|
| unsigned delegated_render_pass_index = found->second;
|
| - return RenderPass::Id(id(), IndexToId(delegated_render_pass_index));
|
| + *output_render_pass_id =
|
| + RenderPass::Id(id(), IndexToId(delegated_render_pass_index));
|
| + return true;
|
| }
|
|
|
| void DelegatedRendererLayerImpl::AppendContributingRenderPasses(
|
| @@ -254,10 +260,14 @@ void DelegatedRendererLayerImpl::AppendContributingRenderPasses(
|
| DCHECK(HasContributingDelegatedRenderPasses());
|
|
|
| for (size_t i = 0; i < render_passes_in_draw_order_.size() - 1; ++i) {
|
| - RenderPass::Id output_render_pass_id =
|
| - ConvertDelegatedRenderPassId(render_passes_in_draw_order_[i]->id);
|
| + RenderPass::Id output_render_pass_id(-1, -1);
|
| + bool present =
|
| + ConvertDelegatedRenderPassId(render_passes_in_draw_order_[i]->id,
|
| + &output_render_pass_id);
|
|
|
| // Don't clash with the RenderPass we generate if we own a RenderSurface.
|
| + DCHECK(present) << render_passes_in_draw_order_[i]->id.layer_id << ", "
|
| + << render_passes_in_draw_order_[i]->id.index;
|
| DCHECK_GT(output_render_pass_id.index, 0);
|
|
|
| render_pass_sink->AppendRenderPass(
|
| @@ -447,18 +457,26 @@ void DelegatedRendererLayerImpl::AppendRenderPassQuads(
|
| } else {
|
| RenderPass::Id delegated_contributing_render_pass_id =
|
| RenderPassDrawQuad::MaterialCast(delegated_quad)->render_pass_id;
|
| - RenderPass::Id output_contributing_render_pass_id =
|
| - ConvertDelegatedRenderPassId(delegated_contributing_render_pass_id);
|
| - DCHECK(output_contributing_render_pass_id !=
|
| - append_quads_data->render_pass_id);
|
| -
|
| - output_quad = RenderPassDrawQuad::MaterialCast(delegated_quad)->Copy(
|
| - output_shared_quad_state,
|
| - output_contributing_render_pass_id).PassAs<DrawQuad>();
|
| + RenderPass::Id output_contributing_render_pass_id(-1, -1);
|
| +
|
| + bool present =
|
| + ConvertDelegatedRenderPassId(delegated_contributing_render_pass_id,
|
| + &output_contributing_render_pass_id);
|
| +
|
| + // The frame may have a RenderPassDrawQuad that points to a RenderPass not
|
| + // part of the frame. Just ignore these quads.
|
| + if (present) {
|
| + DCHECK(output_contributing_render_pass_id !=
|
| + append_quads_data->render_pass_id);
|
| +
|
| + output_quad = RenderPassDrawQuad::MaterialCast(delegated_quad)->Copy(
|
| + output_shared_quad_state,
|
| + output_contributing_render_pass_id).PassAs<DrawQuad>();
|
| + }
|
| }
|
| - DCHECK(output_quad.get());
|
|
|
| - quad_sink->Append(output_quad.Pass(), append_quads_data);
|
| + if (output_quad)
|
| + quad_sink->Append(output_quad.Pass(), append_quads_data);
|
| }
|
| }
|
|
|
|
|