21 blend_mode_ = blend_mode;
25 std::shared_ptr<Contents> child_contents) {
26 child_contents_ = std::move(child_contents);
30std::optional<Rect> FramebufferBlendContents::GetCoverage(
31 const Entity& entity)
const {
32 return child_contents_->GetCoverage(entity);
35bool FramebufferBlendContents::Render(
const ContentContext& renderer,
37 RenderPass& pass)
const {
38 if (!renderer.GetDeviceCapabilities().SupportsFramebufferFetch()) {
42 using VS = FramebufferBlendScreenPipeline::VertexShader;
43 using FS = FramebufferBlendScreenPipeline::FragmentShader;
45 auto& data_host_buffer = renderer.GetTransientsDataBuffer();
47 auto src_snapshot = child_contents_->RenderToSnapshot(
50 .sampler_descriptor = std::nullopt,
53 .label =
"FramebufferBlendContents Snapshot"});
55 if (!src_snapshot.has_value()) {
59 auto size = src_snapshot->texture->GetSize();
61 std::array<VS::PerVertexData, 4> vertices = {
72 pass.SetCommandLabel(
"Framebuffer Advanced Blend Filter");
76 switch (blend_mode_) {
78 pass.SetPipeline(renderer.GetFramebufferBlendScreenPipeline(options));
81 pass.SetPipeline(renderer.GetFramebufferBlendOverlayPipeline(options));
84 pass.SetPipeline(renderer.GetFramebufferBlendDarkenPipeline(options));
87 pass.SetPipeline(renderer.GetFramebufferBlendLightenPipeline(options));
90 pass.SetPipeline(renderer.GetFramebufferBlendColorDodgePipeline(options));
93 pass.SetPipeline(renderer.GetFramebufferBlendColorBurnPipeline(options));
96 pass.SetPipeline(renderer.GetFramebufferBlendHardLightPipeline(options));
99 pass.SetPipeline(renderer.GetFramebufferBlendSoftLightPipeline(options));
102 pass.SetPipeline(renderer.GetFramebufferBlendDifferencePipeline(options));
105 pass.SetPipeline(renderer.GetFramebufferBlendExclusionPipeline(options));
108 pass.SetPipeline(renderer.GetFramebufferBlendMultiplyPipeline(options));
111 pass.SetPipeline(renderer.GetFramebufferBlendHuePipeline(options));
114 pass.SetPipeline(renderer.GetFramebufferBlendSaturationPipeline(options));
117 pass.SetPipeline(renderer.GetFramebufferBlendColorPipeline(options));
120 pass.SetPipeline(renderer.GetFramebufferBlendLuminosityPipeline(options));
126 VS::FrameInfo frame_info;
127 FS::FragInfo frag_info;
129 auto src_sampler_descriptor = src_snapshot->sampler_descriptor;
130 if (renderer.GetDeviceCapabilities().SupportsDecalSamplerAddressMode()) {
134 raw_ptr<const Sampler> src_sampler =
135 renderer.GetContext()->GetSamplerLibrary()->GetSampler(
136 src_sampler_descriptor);
137 FS::BindTextureSamplerSrc(pass, src_snapshot->texture, src_sampler);
140 src_snapshot->transform);
141 frame_info.src_y_coord_scale = src_snapshot->texture->GetYCoordScale();
142 VS::BindFrameInfo(pass, data_host_buffer.EmplaceUniform(frame_info));
144 frag_info.src_input_alpha = src_snapshot->opacity;
145 frag_info.dst_input_alpha = 1.0;
146 FS::BindFragInfo(pass, data_host_buffer.EmplaceUniform(frag_info));
148 return pass.Draw().ok();
Matrix GetShaderTransform(const RenderPass &pass) const
void SetChildContents(std::shared_ptr< Contents > child_contents)
const Geometry * GetGeometry() const override
Get the geometry that this contents will use to render.
~FramebufferBlendContents() override
void SetBlendMode(BlendMode blend_mode)
FramebufferBlendContents()
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
@ kDecal
decal sampling mode is only supported on devices that pass the Capabilities.SupportsDecalSamplerAddre...
LinePipeline::FragmentShader FS
VertexBuffer CreateVertexBuffer(std::array< VertexType, size > input, HostBuffer &data_host_buffer)
Create an index-less vertex buffer from a fixed size array.
LinePipeline::VertexShader VS
ContentContextOptions OptionsFromPass(const RenderPass &pass)
static constexpr TRect MakeSize(const TSize< U > &size)