13#include "impeller/entity/texture_downsample.frag.h"
14#include "impeller/entity/texture_downsample_bounded.frag.h"
15#include "impeller/entity/texture_fill.frag.h"
16#include "impeller/entity/texture_fill.vert.h"
28constexpr Scalar kMaxSigma = 500.0f;
66 return Vector2(std::clamp(vec2.
x, min, max),
67 std::clamp(vec2.
y, min, max));
94BlurInfo CalculateBlurInfo(
const Entity& entity,
95 const Matrix& effect_transform,
102 ExtractScale(entity.GetTransform().Basis());
104 Vector2(entity.GetTransform().m[12], entity.GetTransform().m[13]);
129std::optional<Snapshot> GetSnapshot(
const std::shared_ptr<FilterInput>&
input,
130 const ContentContext& renderer,
131 const Entity& entity,
132 const std::optional<Rect>& coverage_hint) {
133 std::optional<Snapshot> input_snapshot =
134 input->GetSnapshot(
"GaussianBlur", renderer, entity,
136 if (!input_snapshot.has_value()) {
140 return input_snapshot;
145Rect MakeReferenceUVs(
const Rect& reference,
const Rect& rect) {
148 return result.Scale(1.0f /
Vector2(reference.GetSize()));
151Quad MakeReferenceUVs(
const Rect& reference,
const Quad& target_quad) {
154 1.0f / reference.GetHeight(), 1.0f)) *
156 Vector3(-reference.GetLeft(), -reference.GetTop(), 0));
160Quad CalculateSnapshotUVs(
161 const Snapshot& input_snapshot,
162 const std::optional<Rect>& source_expanded_coverage_hint) {
163 std::optional<Rect> input_snapshot_coverage = input_snapshot.GetCoverage();
165 FML_DCHECK(input_snapshot.transform.IsTranslationScaleOnly());
166 if (source_expanded_coverage_hint.has_value() &&
167 input_snapshot_coverage.has_value()) {
169 std::optional<Rect>
uvs =
170 MakeReferenceUVs(input_snapshot_coverage.value(),
171 source_expanded_coverage_hint.value())
174 if (
uvs.has_value()) {
175 blur_uvs[0] =
uvs->GetLeftTop();
176 blur_uvs[1] =
uvs->GetRightTop();
177 blur_uvs[2] =
uvs->GetLeftBottom();
178 blur_uvs[3] =
uvs->GetRightBottom();
185 if (divisor == 0.0f) {
189 Scalar remainder = fmod(val, divisor);
190 if (remainder != 0.0f) {
191 return val + (divisor - remainder);
198 if (divisor == 0.0f) {
202 Scalar remainder = fmod(val, divisor);
203 if (remainder != 0.0f) {
204 return val - remainder;
229Matrix PrecomputeQuadLineParameters(
const Quad& bounds) {
230 auto computeLine = [](
const Point& p0,
const Point&
p1) -> Vector4 {
244 Scalar C = -(A * p0.x + B * p0.y);
245 return Vector4(A, B, C, 0.0);
248 const Point& topLeft = bounds[0];
249 const Point& topRight = bounds[1];
250 const Point& botLeft = bounds[2];
251 const Point& botRight = bounds[3];
254 result.vec[0] = computeLine(topLeft, topRight);
255 result.vec[1] = computeLine(topRight, botRight);
256 result.vec[2] = computeLine(botRight, botLeft);
257 result.vec[3] = computeLine(botLeft, topLeft);
261struct DownsamplePassArgs {
284DownsamplePassArgs CalculateDownsamplePassArgs(
287 const Snapshot& input_snapshot,
288 const std::optional<Rect>& source_expanded_coverage_hint,
289 const std::optional<Quad>& source_bounds,
290 const std::shared_ptr<FilterInput>&
input,
291 const Entity& snapshot_entity) {
299 Vector2 downsample_scalar(desired_scalar, desired_scalar);
309 std::optional<Rect> snapshot_coverage = input_snapshot.GetCoverage();
310 if (input_snapshot.transform.Equals(snapshot_entity.GetTransform()) &&
311 source_expanded_coverage_hint.has_value() &&
312 snapshot_coverage.has_value() &&
313 snapshot_coverage->Contains(source_expanded_coverage_hint.value())) {
322 int32_t divisor = std::round(1.0f / desired_scalar);
324 FloorToDivisible(source_expanded_coverage_hint->GetLeft(), divisor),
325 FloorToDivisible(source_expanded_coverage_hint->GetTop(), divisor),
326 source_expanded_coverage_hint->GetRight(),
327 source_expanded_coverage_hint->GetBottom());
329 aligned_coverage_hint.GetX(), aligned_coverage_hint.GetY(),
330 CeilToDivisible(aligned_coverage_hint.GetWidth(), divisor),
331 CeilToDivisible(aligned_coverage_hint.GetHeight(), divisor));
332 ISize source_size =
ISize(aligned_coverage_hint.GetSize().width,
333 aligned_coverage_hint.GetSize().height);
334 Vector2 downsampled_size = source_size * downsample_scalar;
336 FML_DCHECK(std::modf(downsampled_size.x, &int_part) == 0.0f);
337 FML_DCHECK(std::modf(downsampled_size.y, &int_part) == 0.0f);
343 Quad uvs = CalculateSnapshotUVs(input_snapshot, aligned_coverage_hint);
345 if (source_bounds.has_value()) {
346 uv_bounds = MakeReferenceUVs(input_snapshot.GetCoverage().value(),
347 source_bounds.value());
355 {aligned_coverage_hint.GetX(), aligned_coverage_hint.GetY(), 0})};
358 auto input_snapshot_size = input_snapshot.texture->GetSize();
361 Vector2 downsampled_size = source_rect_padded.GetSize() * downsample_scalar;
363 ISize(ceil(downsampled_size.x), ceil(downsampled_size.y));
364 Vector2 divisible_size(CeilToDivisible(source_rect_padded.GetSize().width,
365 1.0 / downsample_scalar.x),
366 CeilToDivisible(source_rect_padded.GetSize().height,
367 1.0 / downsample_scalar.y));
373 (divisible_size.x - source_rect_padded.GetSize().width) / 2.0
377 (divisible_size.
y - source_rect_padded.GetSize().
height) / 2.0
379 source_rect_padded = source_rect.Expand(divisible_padding);
384 input, snapshot_entity, source_rect_padded, input_snapshot_size);
386 if (source_bounds.has_value()) {
389 input_snapshot.transform.Invert().Transform(source_bounds.value()));
397 .transform = input_snapshot.transform *
406 const ContentContext& renderer,
408 const std::shared_ptr<Texture>& input_texture,
409 const SamplerDescriptor& sampler_descriptor,
410 const DownsamplePassArgs& pass_args,
412 using VS = TextureFillVertexShader;
419 bool may_reuse_mipmap =
420 !pass_args.uv_bounds.has_value() &&
421 (pass_args.effective_scalar.x >= 0.5f ||
422 (!input_texture->NeedsMipmapGeneration() &&
423 input_texture->GetTextureDescriptor().mip_count > 1));
424 if (may_reuse_mipmap) {
426 [&](
const ContentContext& renderer, RenderPass& pass) {
427 HostBuffer& data_host_buffer = renderer.GetTransientsDataBuffer();
429 pass.SetCommandLabel(
"Gaussian blur downsample");
432 pass.SetPipeline(renderer.GetTexturePipeline(pipeline_options));
434 TextureFillVertexShader::FrameInfo frame_info;
437 TextureFillFragmentShader::FragInfo frag_info;
438 frag_info.alpha = 1.0;
440 const Quad&
uvs = pass_args.uvs;
441 std::array<VS::PerVertexData, 4> vertices = {
442 VS::PerVertexData{
Point(0, 0),
uvs[0]},
443 VS::PerVertexData{
Point(1, 0),
uvs[1]},
444 VS::PerVertexData{
Point(0, 1),
uvs[2]},
445 VS::PerVertexData{
Point(1, 1),
uvs[3]},
449 SamplerDescriptor linear_sampler_descriptor = sampler_descriptor;
450 SetTileMode(&linear_sampler_descriptor, renderer, tile_mode);
453 TextureFillVertexShader::BindFrameInfo(
454 pass, data_host_buffer.EmplaceUniform(frame_info));
455 TextureFillFragmentShader::BindFragInfo(
456 pass, data_host_buffer.EmplaceUniform(frag_info));
457 TextureFillFragmentShader::BindTextureSampler(
459 renderer.GetContext()->GetSamplerLibrary()->GetSampler(
460 linear_sampler_descriptor));
462 return pass.Draw().ok();
464 return renderer.MakeSubpass(
"Gaussian Blur Filter", pass_args.subpass_size,
472 if (pass_args.effective_scalar.x <= 0.0625f) {
474 ratio = 1.0f / 64.0f;
475 }
else if (pass_args.effective_scalar.x <= 0.125f) {
477 ratio = 1.0f / 16.0f;
480 [&](
const ContentContext& renderer, RenderPass& pass) {
481 HostBuffer& data_host_buffer = renderer.GetTransientsDataBuffer();
483 pass.SetCommandLabel(
"Gaussian blur downsample");
486 if (pass_args.uv_bounds.has_value()) {
488 renderer.GetDownsampleBoundedPipeline(pipeline_options));
490 TextureDownsampleBoundedFragmentShader::BoundInfo bound_info;
491 bound_info.quad_line_params =
492 PrecomputeQuadLineParameters(pass_args.uv_bounds.value());
493 TextureDownsampleBoundedFragmentShader::BindBoundInfo(
494 pass, data_host_buffer.EmplaceUniform(bound_info));
496#ifdef IMPELLER_ENABLE_OPENGLES
499 if (renderer.GetDeviceCapabilities()
500 .SupportsDecalSamplerAddressMode() ||
503 renderer.GetDownsamplePipeline(pipeline_options));
506 renderer.GetDownsampleTextureGlesPipeline(pipeline_options));
509 pass.SetPipeline(renderer.GetDownsamplePipeline(pipeline_options));
513 TextureFillVertexShader::FrameInfo frame_info;
516 TextureDownsampleFragmentShader::FragInfo frag_info;
517 frag_info.edge = edge;
518 frag_info.ratio = ratio;
519 frag_info.pixel_size =
Vector2(1.0f /
Size(input_texture->GetSize()));
521 const Quad&
uvs = pass_args.uvs;
522 std::array<VS::PerVertexData, 4> vertices = {
523 VS::PerVertexData{
Point(0, 0),
uvs[0]},
524 VS::PerVertexData{
Point(1, 0),
uvs[1]},
525 VS::PerVertexData{
Point(0, 1),
uvs[2]},
526 VS::PerVertexData{
Point(1, 1),
uvs[3]},
530 SamplerDescriptor linear_sampler_descriptor = sampler_descriptor;
531 SetTileMode(&linear_sampler_descriptor, renderer, tile_mode);
534 TextureFillVertexShader::BindFrameInfo(
535 pass, data_host_buffer.EmplaceUniform(frame_info));
536 TextureDownsampleFragmentShader::BindFragInfo(
537 pass, data_host_buffer.EmplaceUniform(frag_info));
538 TextureDownsampleFragmentShader::BindTextureSampler(
540 renderer.GetContext()->GetSamplerLibrary()->GetSampler(
541 linear_sampler_descriptor));
543 return pass.Draw().ok();
545 return renderer.MakeSubpass(
"Gaussian Blur Filter", pass_args.subpass_size,
553 const ContentContext& renderer,
555 const RenderTarget& input_pass,
556 const SamplerDescriptor& sampler_descriptor,
557 const BlurParameters& blur_info,
558 std::optional<RenderTarget> destination_target,
559 const Quad& blur_uvs) {
566 const std::shared_ptr<Texture>& input_texture =
567 input_pass.GetRenderTargetTexture();
573 [&](
const ContentContext& renderer, RenderPass& pass) {
574 GaussianBlurVertexShader::FrameInfo frame_info;
577 HostBuffer& data_host_buffer = renderer.GetTransientsDataBuffer();
581 pass.SetPipeline(renderer.GetGaussianBlurPipeline(options));
586 GaussianBlurFragmentShader::FragInfo frag_info;
587 frag_info.unpremultiply = blur_info.apply_unpremultiply;
588 frag_info.sample_count = lerped_kernel.sample_count;
589 GaussianBlurFragmentShader::BindFragInfo(
590 pass, data_host_buffer.EmplaceUniform(frag_info));
592 std::array<VS::PerVertexData, 4> vertices = {
593 VS::PerVertexData{blur_uvs[0], blur_uvs[0]},
594 VS::PerVertexData{blur_uvs[1], blur_uvs[1]},
595 VS::PerVertexData{blur_uvs[2], blur_uvs[2]},
596 VS::PerVertexData{blur_uvs[3], blur_uvs[3]},
600 SamplerDescriptor linear_sampler_descriptor = sampler_descriptor;
603 GaussianBlurFragmentShader::BindTextureSampler(
605 renderer.GetContext()->GetSamplerLibrary()->GetSampler(
606 linear_sampler_descriptor));
607 GaussianBlurVertexShader::BindFrameInfo(
608 pass, data_host_buffer.EmplaceUniform(frame_info));
609 GaussianBlurFragmentShader::BindKernelSamples(
611 data_host_buffer.EmplaceUniform(lerped_kernel.kernel_samples));
612 return pass.Draw().ok();
614 if (destination_target.has_value()) {
615 return renderer.MakeSubpass(
"Gaussian Blur Filter",
619 return renderer.MakeSubpass(
626 return static_cast<int>(std::round(radius * scalar));
630 const Entity& entity,
631 const std::shared_ptr<FilterInput>&
input,
632 const Snapshot& input_snapshot,
634 const Geometry* geometry) {
635 Matrix entity_transform = entity.GetTransform();
636 Matrix blur_transform = blur_entity.GetTransform();
640 entity_transform, blur_transform, geometry](
641 const ContentContext& renderer,
642 const Entity& entity, RenderPass& pass)
mutable {
644 clipper.SetClipDepth(entity.GetClipDepth());
645 clipper.SetTransform(entity.GetTransform() * entity_transform);
647 auto geom_result = geometry->GetPositionBuffer(renderer, clipper, pass);
649 ClipContents clip_contents(geometry->GetCoverage(clipper.GetTransform())
650 .value_or(Rect::MakeLTRB(0, 0, 0, 0)),
652 clip_contents.SetClipOperation(clip_operation);
653 clip_contents.SetGeometry(std::move(geom_result));
655 if (!clip_contents.Render(renderer, pass, entity.GetClipDepth())) {
658 blur_entity.SetClipDepth(entity.GetClipDepth());
659 blur_entity.SetTransform(entity.GetTransform() * blur_transform);
661 return blur_entity.Render(renderer, pass);
665 blur_transform](
const Entity& entity)
mutable {
666 blur_entity.SetTransform(entity.GetTransform() * blur_transform);
667 return blur_entity.GetCoverage();
675 const Entity& entity,
676 const std::shared_ptr<FilterInput>&
input,
677 const Snapshot& input_snapshot,
679 const Geometry* geometry,
682 switch (blur_style) {
687 input, input_snapshot,
688 std::move(blur_entity), geometry);
692 input, input_snapshot,
693 std::move(blur_entity), geometry);
695 Entity snapshot_entity =
698 Matrix blurred_transform = blur_entity.GetTransform();
699 Matrix snapshot_transform =
700 entity.GetTransform() *
703 input_snapshot.transform;
706 blurred_transform, snapshot_transform,
707 snapshot_entity = std::move(snapshot_entity)](
708 const ContentContext& renderer,
709 const Entity& entity,
710 RenderPass& pass)
mutable {
711 snapshot_entity.SetTransform(entity.GetTransform() *
713 snapshot_entity.SetClipDepth(entity.GetClipDepth());
714 if (!snapshot_entity.Render(renderer, pass)) {
717 blur_entity.SetClipDepth(entity.GetClipDepth());
718 blur_entity.SetTransform(entity.GetTransform() * blurred_transform);
719 return blur_entity.Render(renderer, pass);
722 blurred_transform](
const Entity& entity)
mutable {
723 blur_entity.SetTransform(entity.GetTransform() * blurred_transform);
724 return blur_entity.GetCoverage();
732GaussianBlurFilterContents::GaussianBlurFilterContents(
736 std::optional<Rect> bounds,
739 : sigma_(sigma_x, sigma_y),
740 tile_mode_(tile_mode),
742 mask_blur_style_(mask_blur_style),
743 mask_geometry_(mask_geometry) {
755 Scalar raw_result = 4.0 / sigma;
757 Scalar exponent = round(log2f(raw_result));
759 exponent = std::max(-4.0f, exponent);
760 Scalar rounded = powf(2.0f, exponent);
764 if (rounded < 0.125f) {
765 Scalar rounded_plus = powf(2.0f, exponent + 1);
767 int kernel_size_plus = (ScaleBlurRadius(
blur_radius, rounded_plus) * 2) + 1;
771 static constexpr int32_t kEighthDownsampleKernalWidthMax = 41;
772 result = kernel_size_plus <= kEighthDownsampleKernalWidthMax ? rounded_plus
779 const Matrix& effect_transform,
780 const Rect& output_limit)
const {
787 return output_limit.
Expand(
Point(blur_radii.
x, blur_radii.
y));
793 const Matrix& effect_transform)
const {
794 if (inputs.empty()) {
797 std::optional<Rect> input_coverage = inputs[0]->GetCoverage(entity);
798 if (!input_coverage.has_value()) {
802 BlurInfo blur_info = CalculateBlurInfo(entity, effect_transform, sigma_);
803 return input_coverage.value().Expand(
804 Point(blur_info.local_padding.x, blur_info.local_padding.y));
807std::optional<Entity> GaussianBlurFilterContents::RenderFilter(
811 const Matrix& effect_transform,
812 const Rect& coverage,
813 const std::optional<Rect>& coverage_hint)
const {
814 if (inputs.empty()) {
818 BlurInfo blur_info = CalculateBlurInfo(entity, effect_transform, sigma_);
823 std::optional<Rect> expanded_coverage_hint;
824 if (coverage_hint.has_value()) {
825 expanded_coverage_hint = coverage_hint->Expand(blur_info.local_padding);
828 Entity snapshot_entity = entity.
Clone();
833 std::optional<Rect> source_expanded_coverage_hint;
834 if (expanded_coverage_hint.has_value()) {
835 source_expanded_coverage_hint = expanded_coverage_hint->TransformBounds(
839 std::optional<Snapshot> input_snapshot = GetSnapshot(
840 inputs[0], renderer, snapshot_entity, source_expanded_coverage_hint);
841 if (!input_snapshot.has_value()) {
845 std::optional<Quad> source_bounds;
846 if (bounds_.has_value()) {
847 Matrix
transform = snapshot_entity.GetTransform() * effect_transform;
848 source_bounds = bounds_->GetTransformedPoints(
transform);
860 input_snapshot->transform);
870 std::shared_ptr<CommandBuffer> command_buffer_1 =
872 if (!command_buffer_1) {
876 DownsamplePassArgs downsample_pass_args = CalculateDownsamplePassArgs(
877 blur_info.scaled_sigma, blur_info.padding, input_snapshot.value(),
878 source_expanded_coverage_hint, source_bounds, inputs[0], snapshot_entity);
881 renderer, command_buffer_1, input_snapshot->texture,
882 input_snapshot->sampler_descriptor, downsample_pass_args, tile_mode_);
884 if (!pass1_out.
ok()) {
889 1.0 /
Vector2(pass1_out.
value().GetRenderTargetTexture()->GetSize());
893 std::shared_ptr<CommandBuffer> command_buffer_2 =
895 if (!command_buffer_2) {
900 renderer, command_buffer_2, pass1_out.
value(),
901 input_snapshot->sampler_descriptor,
903 .blur_uv_offset = Point(0.0, pass1_pixel_size.y),
904 .blur_sigma = blur_info.scaled_sigma.y *
905 downsample_pass_args.effective_scalar.y,
906 .blur_radius = ScaleBlurRadius(
907 blur_info.blur_radius.y, downsample_pass_args.effective_scalar.y),
909 .apply_unpremultiply = false,
911 std::nullopt, blur_uvs);
913 if (!pass2_out.
ok()) {
917 std::shared_ptr<CommandBuffer> command_buffer_3 =
919 if (!command_buffer_3) {
924 auto pass3_destination = pass2_out.
value().GetRenderTargetTexture() !=
925 pass1_out.
value().GetRenderTargetTexture()
926 ? std::optional<RenderTarget>(pass1_out.
value())
927 :
std::optional<RenderTarget>(
std::nullopt);
930 renderer, command_buffer_3, pass2_out.
value(),
931 input_snapshot->sampler_descriptor,
933 .blur_uv_offset = Point(pass1_pixel_size.x, 0.0),
934 .blur_sigma = blur_info.scaled_sigma.x *
935 downsample_pass_args.effective_scalar.x,
936 .blur_radius = ScaleBlurRadius(
937 blur_info.blur_radius.x, downsample_pass_args.effective_scalar.x),
939 .apply_unpremultiply = bounds_.has_value(),
941 pass3_destination, blur_uvs);
943 if (!pass3_out.
ok()) {
947 if (!(renderer.
GetContext()->EnqueueCommandBuffer(
948 std::move(command_buffer_1)) &&
950 std::move(command_buffer_2)) &&
952 std::move(command_buffer_3)))) {
959 pass2_out.
value().GetRenderTargetSize()) &&
960 (pass2_out.
value().GetRenderTargetSize() ==
961 pass3_out.
value().GetRenderTargetSize()));
963 SamplerDescriptor sampler_desc = MakeSamplerDescriptor(
967 Snapshot{.texture = pass3_out.
value().GetRenderTargetTexture(),
972 downsample_pass_args.transform *
974 .sampler_descriptor = sampler_desc,
975 .opacity = input_snapshot->opacity,
976 .needs_rasterization_for_runtime_effects =
true},
979 return ApplyBlurStyle(mask_blur_style_, entity, inputs[0],
980 input_snapshot.value(), std::move(blur_output_entity),
981 mask_geometry_, blur_info.source_space_scalar,
982 blur_info.source_space_offset);
990 const std::shared_ptr<FilterInput>& filter_input,
992 const Rect& source_rect,
993 const ISize& texture_size) {
994 Matrix input_transform = filter_input->GetLocalTransform(entity);
998 {1.0f / texture_size.
width, 1.0f / texture_size.
height, 1.0f});
999 return uv_transform.
Transform(coverage_quad);
1007 Scalar clamped = std::min(sigma, kMaxSigma);
1008 constexpr Scalar a = 3.4e-06;
1009 constexpr Scalar b = -3.4e-3;
1011 Scalar scalar =
c + b * clamped + a * clamped * clamped;
1012 return clamped * scalar;
1045 .coefficient = expf(-0.5f * (
x *
x) /
1047 (sqrtf(2.0f * M_PI) * parameters.
blur_sigma),
1053 for (
auto& sample : result.
samples) {
1054 sample.coefficient /= tally;
1069 sizeof(std::array<Vector4, kGaussianBlurMaxKernelSize>));
1085 left.coefficient + right.coefficient;
1087 Point uv = (left.uv_offset * left.coefficient +
1088 right.uv_offset * right.coefficient) /
1089 (left.coefficient + right.coefficient);
virtual bool SupportsDecalSamplerAddressMode() const =0
Whether the context backend supports SamplerAddressMode::Decal.
const Capabilities & GetDeviceCapabilities() const
std::function< bool(const ContentContext &, RenderPass &)> SubpassCallback
std::shared_ptr< Context > GetContext() const
static std::shared_ptr< Contents > MakeAnonymous(RenderProc render_proc, CoverageProc coverage_proc)
void SetTransform(const Matrix &transform)
Set the global transform matrix for this Entity.
BlendMode GetBlendMode() const
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
static Entity FromSnapshot(const Snapshot &snapshot, BlendMode blend_mode=BlendMode::kSrcOver)
Create an entity that can be used to render a given snapshot.
@ kNormal
Blurred inside and outside.
@ kOuter
Nothing inside, blurred outside.
@ kInner
Blurred inside, nothing outside.
@ kSolid
Solid inside, blurred outside.
static Scalar CalculateBlurRadius(Scalar sigma)
static Scalar ScaleSigma(Scalar sigma)
std::optional< Rect > GetFilterSourceCoverage(const Matrix &effect_transform, const Rect &output_limit) const override
Internal utility method for |GetSourceCoverage| that computes the inverse effect of this transform on...
std::optional< Rect > GetFilterCoverage(const FilterInput::Vector &inputs, const Entity &entity, const Matrix &effect_transform) const override
Internal utility method for |GetLocalCoverage| that computes the output coverage of this filter acros...
static Scalar CalculateScale(Scalar sigma)
static Quad CalculateUVs(const std::shared_ptr< FilterInput > &filter_input, const Entity &entity, const Rect &source_rect, const ISize &texture_size)
#define FML_DCHECK(condition)
Vector2 local_padding
Padding in unrotated local space.
Vector2 blur_radius
Blur radius in source pixels based on scaled_sigma.
ISize subpass_size
The output size of the down-sampling pass.
Vector2 source_space_offset
Vector2 source_space_scalar
The scalar that is used to get from source space to unrotated local space.
Vector2 padding
The halo padding in source space.
std::optional< Quad > uv_bounds
Vector2 scaled_sigma
Sigma when considering an entity's scale and the effect transform.
internal::CopyableLambda< T > MakeCopyable(T lambda)
LerpHackResult LerpHackKernelSamples(const KernelSamples ¶meters)
static constexpr int32_t kGaussianBlurMaxKernelSize
@ kDecal
decal sampling mode is only supported on devices that pass the Capabilities.SupportsDecalSamplerAddre...
constexpr float kEhCloseEnough
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
KernelSamples GenerateBlurInfo(BlurParameters parameters)
ContentContextOptions OptionsFromPass(const RenderPass &pass)
MinMagFilter
Describes how the texture should be sampled when the texture is being shrunk (minified) or expanded (...
std::array< Point, 4 > Quad
GaussianBlurPipeline::FragmentShader GaussianBlurFragmentShader
GaussianBlurPipeline::VertexShader GaussianBlurVertexShader
std::shared_ptr< CommandBuffer > command_buffer
static constexpr int kMaxKernelSize
KernelSample samples[kMaxKernelSize]
GaussianBlurPipeline::FragmentShader::KernelSamples kernel_samples
A 4x4 matrix using column-major storage.
static constexpr Matrix MakeOrthographic(TSize< T > size)
static constexpr Matrix MakeTranslation(const Vector3 &t)
constexpr Matrix Basis() const
The Matrix without its w components (without translation).
constexpr Quad Transform(const Quad &quad) const
static constexpr Matrix MakeScale(const Vector3 &s)
For convolution filters, the "radius" is the size of the convolution kernel to use on the local space...
SamplerAddressMode width_address_mode
SamplerAddressMode height_address_mode
In filters that use Gaussian distributions, "sigma" is a size of one standard deviation in terms of t...
constexpr Scalar GetLength() const
static constexpr TRect MakeOriginSize(const TPoint< Type > &origin, const TSize< Type > &size)
static constexpr TRect MakeXYWH(Type x, Type y, Type width, Type height)
constexpr std::array< TPoint< T >, 4 > GetTransformedPoints(const Matrix &transform) const
static constexpr TRect MakeSize(const TSize< U > &size)
constexpr TRect< T > Expand(T left, T top, T right, T bottom) const
Returns a rectangle with expanded edges. Negative expansion results in shrinking.
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)