17 blend_mode_ = blend_mode;
21 std::shared_ptr<Contents> child_contents) {
22 child_contents_ = std::move(child_contents);
26std::optional<Rect> FramebufferBlendContents::GetCoverage(
27 const Entity& entity)
const {
28 return child_contents_->GetCoverage(entity);
31bool FramebufferBlendContents::Render(
const ContentContext& renderer,
33 RenderPass& pass)
const {
34 if (!renderer.GetDeviceCapabilities().SupportsFramebufferFetch()) {
38 using VS = FramebufferBlendScreenPipeline::VertexShader;
39 using FS = FramebufferBlendScreenPipeline::FragmentShader;
41 auto& data_host_buffer = renderer.GetTransientsDataBuffer();
43 auto src_snapshot = child_contents_->RenderToSnapshot(
46 .sampler_descriptor = std::nullopt,
49 .label =
"FramebufferBlendContents Snapshot"});
51 if (!src_snapshot.has_value()) {
55 auto size = src_snapshot->texture->GetSize();
57 std::array<VS::PerVertexData, 4> vertices = {
68 pass.SetCommandLabel(
"Framebuffer Advanced Blend Filter");
72 switch (blend_mode_) {
74 pass.SetPipeline(renderer.GetFramebufferBlendScreenPipeline(options));
77 pass.SetPipeline(renderer.GetFramebufferBlendOverlayPipeline(options));
80 pass.SetPipeline(renderer.GetFramebufferBlendDarkenPipeline(options));
83 pass.SetPipeline(renderer.GetFramebufferBlendLightenPipeline(options));
86 pass.SetPipeline(renderer.GetFramebufferBlendColorDodgePipeline(options));
89 pass.SetPipeline(renderer.GetFramebufferBlendColorBurnPipeline(options));
92 pass.SetPipeline(renderer.GetFramebufferBlendHardLightPipeline(options));
95 pass.SetPipeline(renderer.GetFramebufferBlendSoftLightPipeline(options));
98 pass.SetPipeline(renderer.GetFramebufferBlendDifferencePipeline(options));
101 pass.SetPipeline(renderer.GetFramebufferBlendExclusionPipeline(options));
104 pass.SetPipeline(renderer.GetFramebufferBlendMultiplyPipeline(options));
107 pass.SetPipeline(renderer.GetFramebufferBlendHuePipeline(options));
110 pass.SetPipeline(renderer.GetFramebufferBlendSaturationPipeline(options));
113 pass.SetPipeline(renderer.GetFramebufferBlendColorPipeline(options));
116 pass.SetPipeline(renderer.GetFramebufferBlendLuminosityPipeline(options));
122 VS::FrameInfo frame_info;
123 FS::FragInfo frag_info;
125 auto src_sampler_descriptor = src_snapshot->sampler_descriptor;
126 if (renderer.GetDeviceCapabilities().SupportsDecalSamplerAddressMode()) {
130 raw_ptr<const Sampler> src_sampler =
131 renderer.GetContext()->GetSamplerLibrary()->GetSampler(
132 src_sampler_descriptor);
133 FS::BindTextureSamplerSrc(pass, src_snapshot->texture, src_sampler);
136 src_snapshot->transform);
137 frame_info.src_y_coord_scale = src_snapshot->texture->GetYCoordScale();
138 VS::BindFrameInfo(pass, data_host_buffer.EmplaceUniform(frame_info));
140 frag_info.src_input_alpha = src_snapshot->opacity;
141 frag_info.dst_input_alpha = 1.0;
142 FS::BindFragInfo(pass, data_host_buffer.EmplaceUniform(frag_info));
144 return pass.Draw().ok();
Matrix GetShaderTransform(const RenderPass &pass) const
void SetChildContents(std::shared_ptr< Contents > child_contents)
~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)