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

Side by Side Diff: cc/output/gl_renderer.cc

Issue 2811013002: Revert: cc: RenderSurfaceImpl tile mask layer. (Closed)
Patch Set: Created 3 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « cc/layers/render_surface_impl_unittest.cc ('k') | cc/output/renderer_pixeltest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // Whether the original background texture is needed for the mask. 217 // Whether the original background texture is needed for the mask.
218 bool mask_for_background = false; 218 bool mask_for_background = false;
219 219
220 // Whether a color matrix needs to be applied by the shaders when drawing 220 // Whether a color matrix needs to be applied by the shaders when drawing
221 // the RPDQ. 221 // the RPDQ.
222 bool use_color_matrix = false; 222 bool use_color_matrix = false;
223 223
224 gfx::QuadF surface_quad; 224 gfx::QuadF surface_quad;
225 225
226 gfx::Transform contents_device_transform; 226 gfx::Transform contents_device_transform;
227
228 gfx::RectF tex_coord_rect;
229 }; 227 };
230 228
231 static GLint GetActiveTextureUnit(GLES2Interface* gl) { 229 static GLint GetActiveTextureUnit(GLES2Interface* gl) {
232 GLint active_unit = 0; 230 GLint active_unit = 0;
233 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); 231 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit);
234 return active_unit; 232 return active_unit;
235 } 233 }
236 234
237 class GLRenderer::ScopedUseGrContext { 235 class GLRenderer::ScopedUseGrContext {
238 public: 236 public:
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 } 1028 }
1031 1029
1032 void GLRenderer::DrawRenderPassQuad(const RenderPassDrawQuad* quad, 1030 void GLRenderer::DrawRenderPassQuad(const RenderPassDrawQuad* quad,
1033 const gfx::QuadF* clip_region) { 1031 const gfx::QuadF* clip_region) {
1034 auto bypass = render_pass_bypass_quads_.find(quad->render_pass_id); 1032 auto bypass = render_pass_bypass_quads_.find(quad->render_pass_id);
1035 DrawRenderPassDrawQuadParams params; 1033 DrawRenderPassDrawQuadParams params;
1036 params.quad = quad; 1034 params.quad = quad;
1037 params.clip_region = clip_region; 1035 params.clip_region = clip_region;
1038 params.window_matrix = current_frame()->window_matrix; 1036 params.window_matrix = current_frame()->window_matrix;
1039 params.projection_matrix = current_frame()->projection_matrix; 1037 params.projection_matrix = current_frame()->projection_matrix;
1040 params.tex_coord_rect = quad->tex_coord_rect;
1041 if (bypass != render_pass_bypass_quads_.end()) { 1038 if (bypass != render_pass_bypass_quads_.end()) {
1042 TileDrawQuad* tile_quad = &bypass->second; 1039 TileDrawQuad* tile_quad = &bypass->second;
1043 // RGBA_8888 here is arbitrary and unused. 1040 // RGBA_8888 here is arbitrary and unused.
1044 Resource tile_resource(tile_quad->resource_id(), tile_quad->texture_size, 1041 Resource tile_resource(tile_quad->resource_id(), tile_quad->texture_size,
1045 ResourceFormat::RGBA_8888, 1042 ResourceFormat::RGBA_8888,
1046 current_frame()->current_render_pass->color_space); 1043 current_frame()->current_render_pass->color_space);
1047 // The projection matrix used by GLRenderer has a flip. As tile texture 1044 // The projection matrix used by GLRenderer has a flip. As tile texture
1048 // inputs are oriented opposite to framebuffer outputs, don't flip via 1045 // inputs are oriented opposite to framebuffer outputs, don't flip via
1049 // texture coords and let the projection matrix naturallyd o it. 1046 // texture coords and let the projection matrix naturallyd o it.
1050 params.flip_texture = false; 1047 params.flip_texture = false;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 ScopedUseGrContext::Create(this), resource_provider_, src_rect, 1235 ScopedUseGrContext::Create(this), resource_provider_, src_rect,
1239 params->dst_rect, quad->filters_scale, std::move(filter), 1236 params->dst_rect, quad->filters_scale, std::move(filter),
1240 params->contents_texture, &offset, &subset, params->flip_texture, 1237 params->contents_texture, &offset, &subset, params->flip_texture,
1241 quad->filters_origin); 1238 quad->filters_origin);
1242 if (!params->filter_image) 1239 if (!params->filter_image)
1243 return false; 1240 return false;
1244 params->dst_rect = 1241 params->dst_rect =
1245 gfx::RectF(src_rect.x() + offset.fX, src_rect.y() + offset.fY, 1242 gfx::RectF(src_rect.x() + offset.fX, src_rect.y() + offset.fY,
1246 subset.width(), subset.height()); 1243 subset.width(), subset.height());
1247 params->src_offset.SetPoint(subset.x(), subset.y()); 1244 params->src_offset.SetPoint(subset.x(), subset.y());
1248 gfx::RectF tex_rect = gfx::RectF(gfx::PointF(params->src_offset),
1249 params->dst_rect.size());
1250 params->tex_coord_rect = tex_rect;
1251 } 1245 }
1252 } 1246 }
1253 } 1247 }
1254 return true; 1248 return true;
1255 } 1249 }
1256 1250
1257 void GLRenderer::UpdateRPDQTexturesForSampling( 1251 void GLRenderer::UpdateRPDQTexturesForSampling(
1258 DrawRenderPassDrawQuadParams* params) { 1252 DrawRenderPassDrawQuadParams* params) {
1259 if (params->quad->mask_resource_id()) { 1253 if (params->quad->mask_resource_id()) {
1260 params->mask_resource_lock.reset(new ResourceProvider::ScopedSamplerGL( 1254 params->mask_resource_lock.reset(new ResourceProvider::ScopedSamplerGL(
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 SetUseProgram(ProgramKey::RenderPass( 1314 SetUseProgram(ProgramKey::RenderPass(
1321 tex_coord_precision, sampler_type, shader_blend_mode, 1315 tex_coord_precision, sampler_type, shader_blend_mode,
1322 params->use_aa ? USE_AA : NO_AA, mask_mode, 1316 params->use_aa ? USE_AA : NO_AA, mask_mode,
1323 mask_for_background, params->use_color_matrix), 1317 mask_for_background, params->use_color_matrix),
1324 params->contents_resource_lock 1318 params->contents_resource_lock
1325 ? params->contents_resource_lock->color_space() 1319 ? params->contents_resource_lock->color_space()
1326 : gfx::ColorSpace()); 1320 : gfx::ColorSpace());
1327 } 1321 }
1328 1322
1329 void GLRenderer::UpdateRPDQUniforms(DrawRenderPassDrawQuadParams* params) { 1323 void GLRenderer::UpdateRPDQUniforms(DrawRenderPassDrawQuadParams* params) {
1330 gfx::RectF tex_rect = params->tex_coord_rect; 1324 gfx::RectF tex_rect = params->quad->tex_coord_rect;
1325 if (tex_rect.IsEmpty()) {
1326 // TODO(sunxd): make this never be empty.
1327 tex_rect =
1328 gfx::RectF(gfx::PointF(params->src_offset), params->dst_rect.size());
1329 }
1331 1330
1332 gfx::Size texture_size; 1331 gfx::Size texture_size;
1333 if (params->filter_image) { 1332 if (params->filter_image) {
1334 texture_size.set_width(params->filter_image->width()); 1333 texture_size.set_width(params->filter_image->width());
1335 texture_size.set_height(params->filter_image->height()); 1334 texture_size.set_height(params->filter_image->height());
1336 } else { 1335 } else {
1337 texture_size = params->contents_texture->size(); 1336 texture_size = params->contents_texture->size();
1338 } 1337 }
1339 tex_rect.Scale(1.0f / texture_size.width(), 1.0f / texture_size.height()); 1338 tex_rect.Scale(1.0f / texture_size.width(), 1.0f / texture_size.height());
1340 1339
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after
3324 DCHECK(contents_texture); 3323 DCHECK(contents_texture);
3325 3324
3326 // Configure parameters as if drawing to a framebuffer the size of the 3325 // Configure parameters as if drawing to a framebuffer the size of the
3327 // screen. 3326 // screen.
3328 DrawRenderPassDrawQuadParams params; 3327 DrawRenderPassDrawQuadParams params;
3329 params.quad = ca_layer_overlay->rpdq; 3328 params.quad = ca_layer_overlay->rpdq;
3330 params.flip_texture = true; 3329 params.flip_texture = true;
3331 params.contents_texture = contents_texture; 3330 params.contents_texture = contents_texture;
3332 params.quad_to_target_transform = 3331 params.quad_to_target_transform =
3333 params.quad->shared_quad_state->quad_to_target_transform; 3332 params.quad->shared_quad_state->quad_to_target_transform;
3334 params.tex_coord_rect = params.quad->tex_coord_rect;
3335 3333
3336 // Calculate projection and window matrices using InitializeViewport(). This 3334 // Calculate projection and window matrices using InitializeViewport(). This
3337 // requires creating a dummy DrawingFrame. 3335 // requires creating a dummy DrawingFrame.
3338 { 3336 {
3339 DrawingFrame dummy_frame; 3337 DrawingFrame dummy_frame;
3340 gfx::Rect frame_rect(current_frame()->device_viewport_size); 3338 gfx::Rect frame_rect(current_frame()->device_viewport_size);
3341 force_drawing_frame_framebuffer_unflipped_ = true; 3339 force_drawing_frame_framebuffer_unflipped_ = true;
3342 InitializeViewport(&dummy_frame, frame_rect, frame_rect, frame_rect.size()); 3340 InitializeViewport(&dummy_frame, frame_rect, frame_rect, frame_rect.size());
3343 force_drawing_frame_framebuffer_unflipped_ = false; 3341 force_drawing_frame_framebuffer_unflipped_ = false;
3344 params.projection_matrix = dummy_frame.projection_matrix; 3342 params.projection_matrix = dummy_frame.projection_matrix;
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
3596 return; 3594 return;
3597 3595
3598 // Report GPU overdraw as a percentage of |max_result|. 3596 // Report GPU overdraw as a percentage of |max_result|.
3599 TRACE_COUNTER1( 3597 TRACE_COUNTER1(
3600 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", 3598 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw",
3601 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / 3599 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) /
3602 max_result); 3600 max_result);
3603 } 3601 }
3604 3602
3605 } // namespace cc 3603 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/render_surface_impl_unittest.cc ('k') | cc/output/renderer_pixeltest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698