20std::optional<Entity> LinearToSrgbFilterContents::RenderFilter(
22 const ContentContext& renderer,
24 const Matrix& effect_transform,
26 const std::optional<Rect>& coverage_hint)
const {
31 using VS = LinearToSrgbFilterPipeline::VertexShader;
32 using FS = LinearToSrgbFilterPipeline::FragmentShader;
35 inputs[0]->GetSnapshot(
"LinearToSrgb", renderer, entity);
36 if (!input_snapshot.has_value()) {
45 const ContentContext& renderer,
46 const Entity& entity, RenderPass& pass) ->
bool {
47 pass.SetCommandLabel(
"Linear to sRGB Filter");
51 pass.SetPipeline(renderer.GetLinearToSrgbFilterPipeline(options));
53 auto size = input_snapshot->texture->GetSize();
54 std::array<VS::PerVertexData, 4> vertices = {
55 VS::PerVertexData{
Point(0, 0)},
56 VS::PerVertexData{
Point(1, 0)},
57 VS::PerVertexData{
Point(0, 1)},
58 VS::PerVertexData{
Point(1, 1)},
61 auto& data_host_buffer = renderer.GetTransientsDataBuffer();
64 VS::FrameInfo frame_info;
66 entity.GetShaderClipDepth(), pass,
67 entity.GetTransform() * input_snapshot->transform *
69 frame_info.texture_sampler_y_coord_scale =
70 input_snapshot->texture->GetYCoordScale();
72 FS::FragInfo frag_info;
73 frag_info.input_alpha =
75 ? input_snapshot->opacity
79 pass, input_snapshot->texture,
80 renderer.GetContext()->GetSamplerLibrary()->GetSampler({}));
81 FS::BindFragInfo(pass, data_host_buffer.EmplaceUniform(frag_info));
82 VS::BindFrameInfo(pass, data_host_buffer.EmplaceUniform(frame_info));
84 return pass.Draw().ok();
88 [coverage](
const Entity& entity) -> std::optional<Rect> {
89 return coverage.TransformBounds(entity.GetTransform());
95 sub_entity.SetContents(std::move(contents));
96 sub_entity.SetBlendMode(entity.GetBlendMode());
static std::shared_ptr< Contents > Make(RenderProc render_proc, CoverageProc coverage_proc)
AbsorbOpacity GetAbsorbOpacity() const
std::function< std::optional< Rect >(const Entity &entity)> CoverageProc
std::function< bool(const ContentContext &renderer, const Entity &entity, RenderPass &pass)> RenderProc
Matrix GetShaderTransform(const RenderPass &pass) const
LinearToSrgbFilterContents()
~LinearToSrgbFilterContents() override
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
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 OptionsFromPassAndEntity(const RenderPass &pass, const Entity &entity)
static constexpr Matrix MakeScale(const Vector3 &s)