Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
++
  • Loading branch information
jonahwilliams committed Apr 23, 2024
commit 17591cf9a55188e4943dfb59155877f3c9c9ed7a
4 changes: 4 additions & 0 deletions impeller/entity/contents/vertices_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@ bool VerticesSimpleBlendContents::Render(const ContentContext& renderer,
frag_info.dst_coeff_src_alpha = blend_coefficients[3];
frag_info.dst_coeff_src_color = blend_coefficients[4];

// These values are ignored if the platform supports native decal mode.
frag_info.tmx = static_cast<int>(tile_mode_x_);
frag_info.tmy = static_cast<int>(tile_mode_y_);

auto& host_buffer = renderer.GetTransientsBuffer();
FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info));

Expand Down
14 changes: 10 additions & 4 deletions impeller/entity/shaders/blending/porter_duff_blend.frag
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ uniform FragInfo {
float16_t dst_coeff_src_color;
float16_t input_alpha;
float16_t output_alpha;
float tmx;
float tmy;
}
frag_info;

Expand All @@ -29,16 +31,20 @@ in f16vec4 v_color;

out f16vec4 frag_color;

f16vec4 Sample(f16sampler2D texture_sampler, vec2 texture_coords) {
f16vec4 Sample(f16sampler2D texture_sampler,
vec2 texture_coords,
float tmx,
float tmy) {
if (supports_decal > 0.0) {
return texture(texture_sampler, texture_coords);
}
return IPHalfSampleDecal(texture_sampler, texture_coords);
return IPHalfSampleWithTileMode(texture_sampler, texture_coords, tmx, tmy);
}

void main() {
f16vec4 dst =
texture(texture_sampler_dst, v_texture_coords) * frag_info.input_alpha;
f16vec4 dst = texture(texture_sampler_dst, v_texture_coords, frag_info.tmx,
frag_info.tmy) *
frag_info.input_alpha;
f16vec4 src = v_color;
frag_color =
src * (frag_info.src_coeff + dst.a * frag_info.src_coeff_dst_alpha) +
Expand Down