18 1.164, 1.164, 1.164, 0.0,
19 0.0, -0.392, 2.017, 0.0,
20 1.596, -0.813, 0.0, 0.0,
26 0.0, -0.344, 1.772, 0.0,
27 1.402, -0.714, 0.0, 0.0,
37 yuv_color_space_ = yuv_color_space;
40std::optional<Entity> YUVToRGBFilterContents::RenderFilter(
44 const Matrix& effect_transform,
46 const std::optional<Rect>& coverage_hint)
const {
47 if (inputs.size() < 2) {
51 using VS = YUVToRGBFilterPipeline::VertexShader;
52 using FS = YUVToRGBFilterPipeline::FragmentShader;
54 auto y_input_snapshot =
55 inputs[0]->GetSnapshot(
"YUVToRGB(Y)", renderer, entity);
56 auto uv_input_snapshot =
57 inputs[1]->GetSnapshot(
"YUVToRGB(UV)", renderer, entity);
58 if (!y_input_snapshot.has_value() || !uv_input_snapshot.has_value()) {
62 if (y_input_snapshot->texture->GetTextureDescriptor().format !=
64 uv_input_snapshot->texture->GetTextureDescriptor().format !=
72 RenderProc render_proc = [y_input_snapshot, uv_input_snapshot,
73 yuv_color_space = yuv_color_space_](
74 const ContentContext& renderer,
75 const Entity& entity, RenderPass& pass) ->
bool {
76 pass.SetCommandLabel(
"YUV to RGB Filter");
80 pass.SetPipeline(renderer.GetYUVToRGBFilterPipeline(options));
82 auto size = y_input_snapshot->texture->GetSize();
84 std::array<VS::PerVertexData, 4> vertices = {
85 VS::PerVertexData{
Point(0, 0)},
86 VS::PerVertexData{
Point(1, 0)},
87 VS::PerVertexData{
Point(0, 1)},
88 VS::PerVertexData{
Point(1, 1)},
91 auto& data_host_buffer = renderer.GetTransientsDataBuffer();
94 VS::FrameInfo frame_info;
96 entity.GetShaderClipDepth(), pass,
97 entity.GetTransform() * y_input_snapshot->transform *
100 FS::FragInfo frag_info;
101 frag_info.yuv_color_space =
static_cast<Scalar>(yuv_color_space);
102 switch (yuv_color_space) {
111 raw_ptr<const Sampler> sampler =
112 renderer.GetContext()->GetSamplerLibrary()->GetSampler({});
113 FS::BindYTexture(pass, y_input_snapshot->texture, sampler);
114 FS::BindUvTexture(pass, uv_input_snapshot->texture, sampler);
116 FS::BindFragInfo(pass, data_host_buffer.EmplaceUniform(frag_info));
117 VS::BindFrameInfo(pass, data_host_buffer.EmplaceUniform(frame_info));
119 return pass.Draw().ok();
123 [coverage](
const Entity& entity) -> std::optional<Rect> {
127 std::shared_ptr<Contents> contents =
131 sub_entity.SetContents(std::move(contents));
132 sub_entity.SetBlendMode(entity.GetBlendMode());
136std::optional<Rect> YUVToRGBFilterContents::GetFilterSourceCoverage(
137 const Matrix& effect_transform,
138 const Rect& output_limit)
const {
static std::shared_ptr< Contents > Make(RenderProc render_proc, CoverageProc coverage_proc)
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
~YUVToRGBFilterContents() override
void SetYUVColorSpace(YUVColorSpace yuv_color_space)
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
constexpr Matrix kMatrixBT601LimitedRange
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.
constexpr Matrix kMatrixBT601FullRange
LinePipeline::VertexShader VS
ContentContextOptions OptionsFromPassAndEntity(const RenderPass &pass, const Entity &entity)
A 4x4 matrix using column-major storage.
static constexpr Matrix MakeScale(const Vector3 &s)
constexpr TRect TransformBounds(const Matrix &transform) const
Creates a new bounding box that contains this transformed rectangle.