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

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

Issue 1960543002: Optimize render passes with single quads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: With filter test Created 4 years, 6 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/output/gl_renderer.h ('k') | cc/test/data/rotated_drop_shadow_filter_gl.png » ('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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 582
583 gl_->LineWidth(quad->width); 583 gl_->LineWidth(quad->width);
584 584
585 // The indices for the line are stored in the same array as the triangle 585 // The indices for the line are stored in the same array as the triangle
586 // indices. 586 // indices.
587 gl_->DrawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_SHORT, 0); 587 gl_->DrawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_SHORT, 0);
588 } 588 }
589 589
590 static sk_sp<SkImage> WrapTexture( 590 static sk_sp<SkImage> WrapTexture(
591 const ResourceProvider::ScopedReadLockGL& lock, 591 const ResourceProvider::ScopedReadLockGL& lock,
592 GrContext* context) { 592 GrContext* context,
593 bool is_render_pass_input) {
593 // Wrap a given texture in a Ganesh platform texture. 594 // Wrap a given texture in a Ganesh platform texture.
594 GrBackendTextureDesc backend_texture_description; 595 GrBackendTextureDesc backend_texture_description;
595 GrGLTextureInfo texture_info; 596 GrGLTextureInfo texture_info;
596 texture_info.fTarget = lock.target(); 597 texture_info.fTarget = lock.target();
597 texture_info.fID = lock.texture_id(); 598 texture_info.fID = lock.texture_id();
598 backend_texture_description.fWidth = lock.texture_size().width(); 599 backend_texture_description.fWidth = lock.texture_size().width();
599 backend_texture_description.fHeight = lock.texture_size().height(); 600 backend_texture_description.fHeight = lock.texture_size().height();
600 backend_texture_description.fConfig = kSkia8888_GrPixelConfig; 601 backend_texture_description.fConfig = kSkia8888_GrPixelConfig;
601 backend_texture_description.fTextureHandle = 602 backend_texture_description.fTextureHandle =
602 skia::GrGLTextureInfoToGrBackendObject(texture_info); 603 skia::GrGLTextureInfoToGrBackendObject(texture_info);
603 backend_texture_description.fOrigin = kBottomLeft_GrSurfaceOrigin; 604 backend_texture_description.fOrigin = is_render_pass_input
605 ? kBottomLeft_GrSurfaceOrigin
606 : kTopLeft_GrSurfaceOrigin;
604 607
605 return SkImage::MakeFromTexture(context, backend_texture_description); 608 return SkImage::MakeFromTexture(context, backend_texture_description);
606 } 609 }
607 610
608 static sk_sp<SkImage> ApplyImageFilter( 611 static sk_sp<SkImage> ApplyImageFilter(
609 std::unique_ptr<GLRenderer::ScopedUseGrContext> use_gr_context, 612 std::unique_ptr<GLRenderer::ScopedUseGrContext> use_gr_context,
610 ResourceProvider* resource_provider, 613 ResourceProvider* resource_provider,
611 const gfx::RectF& src_rect, 614 const gfx::RectF& src_rect,
612 const gfx::RectF& dst_rect, 615 const gfx::RectF& dst_rect,
613 const gfx::Vector2dF& scale, 616 const gfx::Vector2dF& scale,
614 sk_sp<SkImageFilter> filter, 617 sk_sp<SkImageFilter> filter,
615 ScopedResource* source_texture_resource, 618 const Resource* source_texture_resource,
616 SkIPoint* offset, 619 SkIPoint* offset,
617 SkIRect* subset) { 620 SkIRect* subset,
621 bool is_render_pass_input) {
618 if (!filter || !use_gr_context) 622 if (!filter || !use_gr_context)
619 return nullptr; 623 return nullptr;
620 624
621 ResourceProvider::ScopedReadLockGL lock(resource_provider, 625 ResourceProvider::ScopedReadLockGL lock(resource_provider,
622 source_texture_resource->id()); 626 source_texture_resource->id());
623 627
624 sk_sp<SkImage> src_image = WrapTexture(lock, use_gr_context->context()); 628 sk_sp<SkImage> src_image =
629 WrapTexture(lock, use_gr_context->context(), is_render_pass_input);
630
625 if (!src_image) { 631 if (!src_image) {
626 TRACE_EVENT_INSTANT0("cc", 632 TRACE_EVENT_INSTANT0("cc",
627 "ApplyImageFilter wrap background texture failed", 633 "ApplyImageFilter wrap background texture failed",
628 TRACE_EVENT_SCOPE_THREAD); 634 TRACE_EVENT_SCOPE_THREAD);
629 return nullptr; 635 return nullptr;
630 } 636 }
631 637
632 SkMatrix local_matrix; 638 SkMatrix local_matrix;
633 local_matrix.setTranslate(-src_rect.x(), -src_rect.y()); 639 local_matrix.setTranslate(-src_rect.x(), -src_rect.y());
634 local_matrix.postScale(scale.x(), scale.y()); 640 local_matrix.postScale(scale.x(), scale.y());
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 851
846 // TODO(senorblanco): background filters should be moved to the 852 // TODO(senorblanco): background filters should be moved to the
847 // makeWithFilter fast-path, and go back to calling ApplyImageFilter(). 853 // makeWithFilter fast-path, and go back to calling ApplyImageFilter().
848 // See http://crbug.com/613233. 854 // See http://crbug.com/613233.
849 if (!filter || !use_gr_context) 855 if (!filter || !use_gr_context)
850 return nullptr; 856 return nullptr;
851 857
852 ResourceProvider::ScopedReadLockGL lock(resource_provider_, 858 ResourceProvider::ScopedReadLockGL lock(resource_provider_,
853 background_texture->id()); 859 background_texture->id());
854 860
855 sk_sp<SkImage> src_image = WrapTexture(lock, use_gr_context->context()); 861 bool is_render_pass_input = true;
862 sk_sp<SkImage> src_image =
863 WrapTexture(lock, use_gr_context->context(), is_render_pass_input);
856 if (!src_image) { 864 if (!src_image) {
857 TRACE_EVENT_INSTANT0( 865 TRACE_EVENT_INSTANT0(
858 "cc", "ApplyBackgroundFilters wrap background texture failed", 866 "cc", "ApplyBackgroundFilters wrap background texture failed",
859 TRACE_EVENT_SCOPE_THREAD); 867 TRACE_EVENT_SCOPE_THREAD);
860 return nullptr; 868 return nullptr;
861 } 869 }
862 870
863 // Create surface to draw into. 871 // Create surface to draw into.
864 SkImageInfo dst_info = 872 SkImageInfo dst_info =
865 SkImageInfo::MakeN32Premul(rect.width(), rect.height()); 873 SkImageInfo::MakeN32Premul(rect.width(), rect.height());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 DCHECK(did_invert); 911 DCHECK(did_invert);
904 bool clipped = false; 912 bool clipped = false;
905 gfx::QuadF local_quad = 913 gfx::QuadF local_quad =
906 MathUtil::MapQuad(inverse_device_transform, device_quad, &clipped); 914 MathUtil::MapQuad(inverse_device_transform, device_quad, &clipped);
907 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may 915 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may
908 // cause device_quad to become clipped. To our knowledge this scenario does 916 // cause device_quad to become clipped. To our knowledge this scenario does
909 // not need to be handled differently than the unclipped case. 917 // not need to be handled differently than the unclipped case.
910 return local_quad; 918 return local_quad;
911 } 919 }
912 920
921 const TileDrawQuad* GLRenderer::CanPassBeDrawnDirectly(const RenderPass* pass) {
922 // Can only collapse a single tile quad.
923 if (pass->quad_list.size() != 1)
924 return nullptr;
925 // If we need copy requests, then render pass has to exist.
926 if (!pass->copy_requests.empty())
927 return nullptr;
928
929 const DrawQuad* quad = *pass->quad_list.BackToFrontBegin();
930 // Hack: this could be supported by concatenating transforms, but
931 // in practice if there is one quad, it is at the origin of the render pass.
932 if (!quad->shared_quad_state->quad_to_target_transform.IsIdentity())
933 return nullptr;
934 // The quad is expected to be the entire layer so that AA edges are correct.
935 if (gfx::Rect(quad->shared_quad_state->quad_layer_bounds) != quad->rect)
936 return nullptr;
937 if (quad->material != DrawQuad::TILED_CONTENT)
938 return nullptr;
939
940 const TileDrawQuad* tile_quad = TileDrawQuad::MaterialCast(quad);
941 // Hack: this could be supported by passing in a subrectangle to draw
942 // render pass, although in practice if there is only one quad there
943 // will be no border texels on the input.
944 if (tile_quad->tex_coord_rect != gfx::RectF(tile_quad->rect))
945 return nullptr;
946 // Tile quad features not supported in render pass shaders.
947 if (tile_quad->swizzle_contents || tile_quad->nearest_neighbor)
948 return nullptr;
949 // BUG=skia:3868, Skia currently doesn't support texture rectangle inputs.
950 // See also the DCHECKs about GL_TEXTURE_2D in DrawRenderPassQuad.
951 GLenum target =
952 resource_provider_->GetResourceTextureTarget(tile_quad->resource_id());
953 if (target != GL_TEXTURE_2D)
954 return nullptr;
955
956 return tile_quad;
957 }
958
913 void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, 959 void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
914 const RenderPassDrawQuad* quad, 960 const RenderPassDrawQuad* quad,
915 const gfx::QuadF* clip_region) { 961 const gfx::QuadF* clip_region) {
916 ScopedResource* contents_texture = 962 auto bypass = render_pass_bypass_quads_.find(quad->render_pass_id);
917 render_pass_textures_[quad->render_pass_id].get(); 963 if (bypass != render_pass_bypass_quads_.end()) {
918 DCHECK(contents_texture); 964 TileDrawQuad* tile_quad = &bypass->second;
919 DCHECK(contents_texture->id()); 965 // TODO(enne): format here doesn't appear to get used.
966 Resource tile_resource(tile_quad->resource_id(), tile_quad->texture_size,
967 ResourceFormat::RGBA_8888);
968 bool is_render_pass_input = false;
969 DrawRenderPassQuadInternal(frame, quad, clip_region, &tile_resource,
970 is_render_pass_input);
971 } else {
972 ScopedResource* contents_texture =
973 render_pass_textures_[quad->render_pass_id].get();
974 DCHECK(contents_texture);
975 DCHECK(contents_texture->id());
976 bool is_render_pass_input = true;
977 DrawRenderPassQuadInternal(frame, quad, clip_region, contents_texture,
978 is_render_pass_input);
979 }
980 }
920 981
982 void GLRenderer::DrawRenderPassQuadInternal(DrawingFrame* frame,
983 const RenderPassDrawQuad* quad,
984 const gfx::QuadF* clip_region,
985 const Resource* contents_texture,
986 bool is_render_pass_input) {
921 SkMatrix scale_matrix; 987 SkMatrix scale_matrix;
922 scale_matrix.setScale(quad->filters_scale.x(), quad->filters_scale.y()); 988 scale_matrix.setScale(quad->filters_scale.x(), quad->filters_scale.y());
923 gfx::RectF dst_rect(quad->filters.MapRect(quad->rect, scale_matrix)); 989 gfx::RectF dst_rect(quad->filters.MapRect(quad->rect, scale_matrix));
924 gfx::Transform quad_rect_matrix; 990 gfx::Transform quad_rect_matrix;
925 QuadRectTransform(&quad_rect_matrix, 991 QuadRectTransform(&quad_rect_matrix,
926 quad->shared_quad_state->quad_to_target_transform, 992 quad->shared_quad_state->quad_to_target_transform,
927 dst_rect); 993 dst_rect);
928 gfx::Transform contents_device_transform = 994 gfx::Transform contents_device_transform =
929 frame->window_matrix * frame->projection_matrix * quad_rect_matrix; 995 frame->window_matrix * frame->projection_matrix * quad_rect_matrix;
930 contents_device_transform.FlattenTo2d(); 996 contents_device_transform.FlattenTo2d();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 !use_shaders_for_blending && 1081 !use_shaders_for_blending &&
1016 (quad->ShouldDrawWithBlending() || !IsDefaultBlendMode(blend_mode))); 1082 (quad->ShouldDrawWithBlending() || !IsDefaultBlendMode(blend_mode)));
1017 1083
1018 // TODO(senorblanco): Cache this value so that we don't have to do it for both 1084 // TODO(senorblanco): Cache this value so that we don't have to do it for both
1019 // the surface and its replica. Apply filters to the contents texture. 1085 // the surface and its replica. Apply filters to the contents texture.
1020 sk_sp<SkImage> filter_image; 1086 sk_sp<SkImage> filter_image;
1021 GLuint filter_image_id = 0; 1087 GLuint filter_image_id = 0;
1022 SkScalar color_matrix[20]; 1088 SkScalar color_matrix[20];
1023 bool use_color_matrix = false; 1089 bool use_color_matrix = false;
1024 gfx::Size texture_size = contents_texture->size(); 1090 gfx::Size texture_size = contents_texture->size();
1025 bool flip_texture = true;
1026 gfx::Point src_offset; 1091 gfx::Point src_offset;
1027 if (!quad->filters.IsEmpty()) { 1092 if (!quad->filters.IsEmpty()) {
1028 sk_sp<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( 1093 sk_sp<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter(
1029 quad->filters, gfx::SizeF(contents_texture->size())); 1094 quad->filters, gfx::SizeF(contents_texture->size()));
1030 if (filter) { 1095 if (filter) {
1031 SkColorFilter* colorfilter_rawptr = NULL; 1096 SkColorFilter* colorfilter_rawptr = NULL;
1032 filter->asColorFilter(&colorfilter_rawptr); 1097 filter->asColorFilter(&colorfilter_rawptr);
1033 sk_sp<SkColorFilter> cf(colorfilter_rawptr); 1098 sk_sp<SkColorFilter> cf(colorfilter_rawptr);
1034 1099
1035 if (cf && cf->asColorMatrix(color_matrix)) { 1100 if (cf && cf->asColorMatrix(color_matrix)) {
(...skipping 14 matching lines...) Expand all
1050 gfx::QuadF local_clip = MapQuadToLocalSpace(transform, clip_quad); 1115 gfx::QuadF local_clip = MapQuadToLocalSpace(transform, clip_quad);
1051 dst_rect.Intersect(local_clip.BoundingBox()); 1116 dst_rect.Intersect(local_clip.BoundingBox());
1052 // If we've been fully clipped out (by crop rect or clipping), there's 1117 // If we've been fully clipped out (by crop rect or clipping), there's
1053 // nothing to draw. 1118 // nothing to draw.
1054 if (dst_rect.IsEmpty()) { 1119 if (dst_rect.IsEmpty()) {
1055 return; 1120 return;
1056 } 1121 }
1057 SkIPoint offset; 1122 SkIPoint offset;
1058 SkIRect subset; 1123 SkIRect subset;
1059 gfx::RectF src_rect(quad->rect); 1124 gfx::RectF src_rect(quad->rect);
1060 filter_image = ApplyImageFilter(ScopedUseGrContext::Create(this, frame), 1125 filter_image = ApplyImageFilter(
1061 resource_provider_, src_rect, dst_rect, 1126 ScopedUseGrContext::Create(this, frame), resource_provider_,
1062 quad->filters_scale, std::move(filter), 1127 src_rect, dst_rect, quad->filters_scale, std::move(filter),
1063 contents_texture, &offset, &subset); 1128 contents_texture, &offset, &subset, is_render_pass_input);
1064 if (!filter_image) { 1129 if (!filter_image)
1065 return; 1130 return;
1066 }
1067 filter_image_id = skia::GrBackendObjectToGrGLTextureInfo( 1131 filter_image_id = skia::GrBackendObjectToGrGLTextureInfo(
1068 filter_image->getTextureHandle(true)) 1132 filter_image->getTextureHandle(true))
1069 ->fID; 1133 ->fID;
1070 texture_size.set_width(filter_image->width()); 1134 texture_size.set_width(filter_image->width());
1071 texture_size.set_height(filter_image->height()); 1135 texture_size.set_height(filter_image->height());
1072 DCHECK(filter_image_id); 1136 DCHECK(filter_image_id);
1073 dst_rect = 1137 dst_rect =
1074 gfx::RectF(src_rect.x() + offset.fX, src_rect.y() + offset.fY, 1138 gfx::RectF(src_rect.x() + offset.fX, src_rect.y() + offset.fY,
1075 subset.width(), subset.height()); 1139 subset.width(), subset.height());
1076 src_offset.SetPoint(subset.x(), subset.y()); 1140 src_offset.SetPoint(subset.x(), subset.y());
1077 flip_texture = 1141 // If the output of the filter needs to be flipped.
1142 is_render_pass_input =
Stephen White 2016/06/03 19:30:15 <bikeshed> At this point, it's not really true tha
enne (OOO) 2016/06/03 20:40:22 Haha, yeah sure. I had named it differently befor
1078 filter_image->getTexture()->origin() == kBottomLeft_GrSurfaceOrigin; 1143 filter_image->getTexture()->origin() == kBottomLeft_GrSurfaceOrigin;
1079 } 1144 }
1080 } 1145 }
1081 } 1146 }
1082 1147
1083 std::unique_ptr<ResourceProvider::ScopedSamplerGL> mask_resource_lock; 1148 std::unique_ptr<ResourceProvider::ScopedSamplerGL> mask_resource_lock;
1084 unsigned mask_texture_id = 0; 1149 unsigned mask_texture_id = 0;
1085 SamplerType mask_sampler = SAMPLER_TYPE_NA; 1150 SamplerType mask_sampler = SAMPLER_TYPE_NA;
1086 if (quad->mask_resource_id()) { 1151 if (quad->mask_resource_id()) {
1087 mask_resource_lock.reset(new ResourceProvider::ScopedSamplerGL( 1152 mask_resource_lock.reset(new ResourceProvider::ScopedSamplerGL(
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 SetUseProgram(program->program()); 1250 SetUseProgram(program->program());
1186 program->vertex_shader().FillLocations(&locations); 1251 program->vertex_shader().FillLocations(&locations);
1187 program->fragment_shader().FillLocations(&locations); 1252 program->fragment_shader().FillLocations(&locations);
1188 gl_->Uniform1i(locations.sampler, 0); 1253 gl_->Uniform1i(locations.sampler, 0);
1189 } 1254 }
1190 gfx::RectF tex_rect(src_offset.x(), src_offset.y(), dst_rect.width(), 1255 gfx::RectF tex_rect(src_offset.x(), src_offset.y(), dst_rect.width(),
1191 dst_rect.height()); 1256 dst_rect.height());
1192 tex_rect.Scale(1.0f / texture_size.width(), 1.0f / texture_size.height()); 1257 tex_rect.Scale(1.0f / texture_size.width(), 1.0f / texture_size.height());
1193 1258
1194 DCHECK(locations.tex_transform != -1 || IsContextLost()); 1259 DCHECK(locations.tex_transform != -1 || IsContextLost());
1195 if (flip_texture) { 1260 if (is_render_pass_input) {
1196 // Flip the content vertically in the shader, as the RenderPass input 1261 // Flip the content vertically in the shader, as the RenderPass input
1197 // texture is already oriented the same way as the framebuffer, but the 1262 // texture is already oriented the same way as the framebuffer, but the
1198 // projection transform does a flip. 1263 // projection transform does a flip.
1199 gl_->Uniform4f(locations.tex_transform, tex_rect.x(), 1.0f - tex_rect.y(), 1264 gl_->Uniform4f(locations.tex_transform, tex_rect.x(), 1.0f - tex_rect.y(),
1200 tex_rect.width(), -tex_rect.height()); 1265 tex_rect.width(), -tex_rect.height());
1201 } else { 1266 } else {
1267 // Tile textures are oriented opposite the framebuffer, so can use
1268 // the projection transform to do the flip.
1202 gl_->Uniform4f(locations.tex_transform, tex_rect.x(), tex_rect.y(), 1269 gl_->Uniform4f(locations.tex_transform, tex_rect.x(), tex_rect.y(),
1203 tex_rect.width(), tex_rect.height()); 1270 tex_rect.width(), tex_rect.height());
1204 } 1271 }
1205 1272
1206 GLint last_texture_unit = 0; 1273 GLint last_texture_unit = 0;
1207 if (locations.mask_sampler != -1) { 1274 if (locations.mask_sampler != -1) {
1208 DCHECK_NE(locations.mask_tex_coord_scale, 1); 1275 DCHECK_NE(locations.mask_tex_coord_scale, 1);
1209 DCHECK_NE(locations.mask_tex_coord_offset, 1); 1276 DCHECK_NE(locations.mask_tex_coord_offset, 1);
1210 gl_->Uniform1i(locations.mask_sampler, 1); 1277 gl_->Uniform1i(locations.mask_sampler, 1);
1211 1278
1212 gfx::RectF mask_uv_rect = quad->MaskUVRect(); 1279 gfx::RectF mask_uv_rect = quad->MaskUVRect();
1213 if (mask_sampler != SAMPLER_TYPE_2D) { 1280 if (mask_sampler != SAMPLER_TYPE_2D) {
1214 mask_uv_rect.Scale(quad->mask_texture_size.width(), 1281 mask_uv_rect.Scale(quad->mask_texture_size.width(),
1215 quad->mask_texture_size.height()); 1282 quad->mask_texture_size.height());
1216 } 1283 }
1217 1284 if (is_render_pass_input) {
1218 // Mask textures are oriented vertically flipped relative to the framebuffer 1285 // Mask textures are oriented vertically flipped relative to the
1219 // and the RenderPass contents texture, so we flip the tex coords from the 1286 // framebuffer and the RenderPass contents texture, so we flip the tex
1220 // RenderPass texture to find the mask texture coords. 1287 // coords from the RenderPass texture to find the mask texture coords.
1221 gl_->Uniform2f( 1288 gl_->Uniform2f(
1222 locations.mask_tex_coord_offset, mask_uv_rect.x(), 1289 locations.mask_tex_coord_offset, mask_uv_rect.x(),
1223 mask_uv_rect.height() / tex_rect.height() + mask_uv_rect.y()); 1290 mask_uv_rect.height() / tex_rect.height() + mask_uv_rect.y());
1224 gl_->Uniform2f(locations.mask_tex_coord_scale, 1291 gl_->Uniform2f(locations.mask_tex_coord_scale,
1225 mask_uv_rect.width() / tex_rect.width(), 1292 mask_uv_rect.width() / tex_rect.width(),
1226 -mask_uv_rect.height() / tex_rect.height()); 1293 -mask_uv_rect.height() / tex_rect.height());
1294 } else {
1295 // Tile textures are oriented the same way as mask textures.
1296 gl_->Uniform2f(locations.mask_tex_coord_offset, mask_uv_rect.x(),
1297 mask_uv_rect.y());
1298 gl_->Uniform2f(locations.mask_tex_coord_scale,
1299 mask_uv_rect.width() / tex_rect.width(),
1300 mask_uv_rect.height() / tex_rect.height());
1301 }
1227 1302
1228 last_texture_unit = 1; 1303 last_texture_unit = 1;
1229 } 1304 }
1230 1305
1231 if (locations.edge != -1) 1306 if (locations.edge != -1)
1232 gl_->Uniform3fv(locations.edge, 8, edge); 1307 gl_->Uniform3fv(locations.edge, 8, edge);
1233 1308
1234 if (locations.viewport != -1) { 1309 if (locations.viewport != -1) {
1235 float viewport[4] = { 1310 float viewport[4] = {
1236 static_cast<float>(current_window_space_viewport_.x()), 1311 static_cast<float>(current_window_space_viewport_.x()),
(...skipping 2407 matching lines...) Expand 10 before | Expand all | Expand 10 after
3644 texture_id = pending_overlay_resources_.back()->GetTextureId(); 3719 texture_id = pending_overlay_resources_.back()->GetTextureId();
3645 } 3720 }
3646 3721
3647 context_support_->ScheduleOverlayPlane( 3722 context_support_->ScheduleOverlayPlane(
3648 overlay.plane_z_order, overlay.transform, texture_id, 3723 overlay.plane_z_order, overlay.transform, texture_id,
3649 ToNearestRect(overlay.display_rect), overlay.uv_rect); 3724 ToNearestRect(overlay.display_rect), overlay.uv_rect);
3650 } 3725 }
3651 } 3726 }
3652 3727
3653 } // namespace cc 3728 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/test/data/rotated_drop_shadow_filter_gl.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698