File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -337,8 +337,8 @@ ContentContext::ContentContext(
337337 clip_pipelines_.SetDefault (
338338 options,
339339 std::make_unique<ClipPipeline>(*context_, clip_pipeline_descriptor));
340- texture_downsample_pipelines_.CreateDefault (*context_,
341- options_trianglestrip);
340+ texture_downsample_pipelines_.CreateDefault (
341+ *context_, options_trianglestrip, {supports_decal} );
342342 rrect_blur_pipelines_.CreateDefault (*context_, options_trianglestrip);
343343 texture_strict_src_pipelines_.CreateDefault (*context_, options);
344344 tiled_texture_pipelines_.CreateDefault (*context_, options,
Original file line number Diff line number Diff line change 99#include " flutter/fml/make_copyable.h"
1010#include " impeller/entity/contents/clip_contents.h"
1111#include " impeller/entity/contents/content_context.h"
12+ #include " impeller/entity/entity.h"
1213#include " impeller/entity/texture_downsample.frag.h"
1314#include " impeller/entity/texture_fill.frag.h"
1415#include " impeller/entity/texture_fill.vert.h"
@@ -406,6 +407,8 @@ fml::StatusOr<RenderTarget> MakeDownsampleSubpass(
406407 frag_info.edge = edge;
407408 frag_info.ratio = ratio;
408409 frag_info.pixel_size = Vector2 (1 .0f / Size (input_texture->GetSize ()));
410+ frag_info.use_decal =
411+ (tile_mode == Entity::TileMode::kDecal ) ? 1.0 : 0.0 ;
409412
410413 const Quad& uvs = pass_args.uvs ;
411414 std::array<VS ::PerVertexData, 4 > vertices = {
Original file line number Diff line number Diff line change @@ -7,11 +7,14 @@ precision mediump float;
77#include < impeller/ constants.glsl>
88#include < impeller/ types.glsl>
99
10+ layout (constant_id = 0 ) const float supports_decal = 1.0 ;
11+
1012uniform f16sampler2D texture_sampler;
1113
1214uniform FragInfo {
1315 float edge;
1416 float ratio;
17+ float use_decal;
1518 vec2 pixel_size;
1619}
1720frag_info;
@@ -20,13 +23,24 @@ in highp vec2 v_texture_coords;
2023
2124out vec4 frag_color;
2225
26+ vec4 Sample(vec2 uv) {
27+ if (supports_decal == 1.0 ) {
28+ return texture(texture_sampler, uv, float16_t(kDefaultMipBias));
29+ } else {
30+ if (frag_info.use_decal == 1.0 &&
31+ (uv.x < 0 || uv.y < 0 || uv.x > 1 || uv.y > 1 )) {
32+ return vec4 (0 );
33+ } else {
34+ return texture(texture_sampler, uv, float16_t(kDefaultMipBias));
35+ }
36+ }
37+ }
38+
2339void main() {
2440 vec4 total = vec4 (0.0 );
2541 for (float i = - frag_info.edge; i <= frag_info.edge; i += 2 ) {
2642 for (float j = - frag_info.edge; j <= frag_info.edge; j += 2 ) {
27- total += (texture(texture_sampler,
28- v_texture_coords + frag_info.pixel_size * vec2 (i, j),
29- float16_t(kDefaultMipBias)) *
43+ total += (Sample(v_texture_coords + frag_info.pixel_size * vec2 (i, j)) *
3044 frag_info.ratio);
3145 }
3246 }
Original file line number Diff line number Diff line change 48454845 },
48464846 "thread_occupancy" : 100 ,
48474847 "uniform_registers_used" : 1 ,
4848- "work_registers_used" : 4
4848+ "work_registers_used" : 3
48494849 }
48504850 }
48514851 }
You can’t perform that action at this time.
0 commit comments