12 #include "impeller/entity/texture_fill.frag.h"
13 #include "impeller/entity/texture_fill.vert.h"
41 if (geometry_->
ShouldSkip() || alpha_ <= 0.0) {
51 renderer.
GetContext()->GetSamplerLibrary()->GetSampler(
52 dst_sampler_descriptor);
56 using VS = TextureFillVertexShader;
57 using FS = TextureFillFragmentShader;
62 renderer.
GetContext()->GetSamplerLibrary()->GetSampler(
63 dst_sampler_descriptor);
67 pipeline_options.depth_write_enabled =
76 VS::FrameInfo frame_info;
78 frame_info.texture_sampler_y_coord_scale =
79 geometry_->
GetAtlas()->GetYCoordScale();
81 VS::BindFrameInfo(pass, host_buffer.EmplaceUniform(frame_info));
83 FS::FragInfo frag_info;
84 frag_info.alpha = alpha_;
85 FS::BindFragInfo(pass, host_buffer.EmplaceUniform((frag_info)));
86 FS::BindTextureSampler(pass, geometry_->
GetAtlas(), dst_sampler);
87 return pass.
Draw().ok();
100 auto inverted_blend_mode =
105 FS::FragInfo frag_info;
106 VS::FrameInfo frame_info;
108 FS::BindTextureSamplerDst(pass, geometry_->
GetAtlas(), dst_sampler);
109 frame_info.texture_sampler_y_coord_scale =
110 geometry_->
GetAtlas()->GetYCoordScale();
112 frag_info.output_alpha = alpha_;
113 frag_info.input_alpha = 1.0;
119 FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info));
123 auto uniform_view = host_buffer.EmplaceUniform(frame_info);
124 VS::BindFrameInfo(pass, uniform_view);
126 return pass.
Draw().ok();
132 #ifdef IMPELLER_DEBUG
138 FS::BindTextureSampler(pass, geometry_->
GetAtlas(), dst_sampler);
140 VUS::FrameInfo frame_info;
141 FS::FragInfo frag_info;
143 frame_info.texture_sampler_y_coord_scale =
144 geometry_->
GetAtlas()->GetYCoordScale();
147 frag_info.alpha = alpha_;
148 frag_info.blend_mode =
static_cast<int>(blend_mode);
154 FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info));
155 VUS::BindFrameInfo(pass, host_buffer.EmplaceUniform(frame_info));
157 return pass.
Draw().ok();
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
void SetGeometry(AtlasGeometry *geometry)
std::optional< Rect > GetCoverage(const Entity &entity) const override
Get the area of the render pass that will be affected when this contents is rendered.
void SetAlpha(Scalar alpha)
~AtlasContents() override
virtual VertexBuffer CreateSimpleVertexBuffer(HostBuffer &host_buffer) const =0
virtual Rect ComputeBoundingBox() const =0
virtual bool ShouldUseBlend() const =0
virtual std::shared_ptr< Texture > GetAtlas() const =0
virtual const SamplerDescriptor & GetSamplerDescriptor() const =0
virtual bool ShouldSkip() const =0
virtual VertexBuffer CreateBlendVertexBuffer(HostBuffer &host_buffer) const =0
virtual BlendMode GetBlendMode() const =0
virtual bool SupportsDecalSamplerAddressMode() const =0
Whether the context backend supports SamplerAddressMode::Decal.
HostBuffer & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.
PipelineRef GetPorterDuffPipeline(BlendMode mode, ContentContextOptions opts) const
const Capabilities & GetDeviceCapabilities() const
PipelineRef GetDrawVerticesUberShader(ContentContextOptions opts) const
PipelineRef GetTexturePipeline(ContentContextOptions opts) const
std::shared_ptr< Context > GetContext() const
Matrix GetShaderTransform(const RenderPass &pass) const
Get the vertex shader transform used for drawing this Entity.
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
Render passes encode render commands directed as one specific render target into an underlying comman...
virtual bool SetVertexBuffer(VertexBuffer buffer)
Specify the vertex and index buffer to use for this command.
virtual void SetPipeline(PipelineRef pipeline)
The pipeline to use for this command.
virtual fml::Status Draw()
Record the currently pending command.
virtual void SetCommandLabel(std::string_view label)
The debugging label to use for the command.
VertexShader_ VertexShader
FragmentShader_ FragmentShader
A wrapper around a raw ptr that adds additional unopt mode only checks.
@ kDecal
decal sampling mode is only supported on devices that pass the Capabilities.SupportsDecalSamplerAddre...
GlyphAtlasPipeline::VertexShader VS
std::optional< BlendMode > InvertPorterDuffBlend(BlendMode blend_mode)
GlyphAtlasPipeline::FragmentShader FS
ContentContextOptions OptionsFromPassAndEntity(const RenderPass &pass, const Entity &entity)
ContentContextOptions OptionsFromPass(const RenderPass &pass)
SamplerAddressMode width_address_mode
constexpr TRect TransformBounds(const Matrix &transform) const
Creates a new bounding box that contains this transformed rectangle.