[Impeller] Add offscreen texture checkerboarding (flutter/engine#41199)
Part of: https://github.com/flutter/flutter/issues/124819. Adds an offscreen texture checkerboarding feature with an overridable color picker. By default, it should look the same as our current checkerboarding for Skia. It can be turned on/off at any time while recording commands.
This commit is contained in:
@@ -1158,6 +1158,8 @@ ORIGIN: ../../../flutter/impeller/entity/contents/anonymous_contents.cc + ../../
|
||||
ORIGIN: ../../../flutter/impeller/entity/contents/anonymous_contents.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/entity/contents/atlas_contents.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/entity/contents/atlas_contents.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/entity/contents/checkerboard_contents.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/entity/contents/checkerboard_contents.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/entity/contents/clip_contents.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/entity/contents/clip_contents.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/entity/contents/color_source_contents.cc + ../../../flutter/LICENSE
|
||||
@@ -1285,6 +1287,8 @@ ORIGIN: ../../../flutter/impeller/entity/shaders/color_matrix_color_filter.frag
|
||||
ORIGIN: ../../../flutter/impeller/entity/shaders/color_matrix_color_filter.vert + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/entity/shaders/conical_gradient_fill.frag + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/entity/shaders/conical_gradient_ssbo_fill.frag + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/entity/shaders/debug/checkerboard.frag + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/entity/shaders/debug/checkerboard.vert + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/entity/shaders/gaussian_blur/gaussian_blur.glsl + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/entity/shaders/gaussian_blur/gaussian_blur.vert + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/entity/shaders/gaussian_blur/gaussian_blur_alpha_decal.frag + ../../../flutter/LICENSE
|
||||
@@ -3748,6 +3752,8 @@ FILE: ../../../flutter/impeller/entity/contents/anonymous_contents.cc
|
||||
FILE: ../../../flutter/impeller/entity/contents/anonymous_contents.h
|
||||
FILE: ../../../flutter/impeller/entity/contents/atlas_contents.cc
|
||||
FILE: ../../../flutter/impeller/entity/contents/atlas_contents.h
|
||||
FILE: ../../../flutter/impeller/entity/contents/checkerboard_contents.cc
|
||||
FILE: ../../../flutter/impeller/entity/contents/checkerboard_contents.h
|
||||
FILE: ../../../flutter/impeller/entity/contents/clip_contents.cc
|
||||
FILE: ../../../flutter/impeller/entity/contents/clip_contents.h
|
||||
FILE: ../../../flutter/impeller/entity/contents/color_source_contents.cc
|
||||
@@ -3875,6 +3881,8 @@ FILE: ../../../flutter/impeller/entity/shaders/color_matrix_color_filter.frag
|
||||
FILE: ../../../flutter/impeller/entity/shaders/color_matrix_color_filter.vert
|
||||
FILE: ../../../flutter/impeller/entity/shaders/conical_gradient_fill.frag
|
||||
FILE: ../../../flutter/impeller/entity/shaders/conical_gradient_ssbo_fill.frag
|
||||
FILE: ../../../flutter/impeller/entity/shaders/debug/checkerboard.frag
|
||||
FILE: ../../../flutter/impeller/entity/shaders/debug/checkerboard.vert
|
||||
FILE: ../../../flutter/impeller/entity/shaders/gaussian_blur/gaussian_blur.glsl
|
||||
FILE: ../../../flutter/impeller/entity/shaders/gaussian_blur/gaussian_blur.vert
|
||||
FILE: ../../../flutter/impeller/entity/shaders/gaussian_blur/gaussian_blur_alpha_decal.frag
|
||||
|
||||
@@ -9,6 +9,10 @@ config("impeller_public_config") {
|
||||
|
||||
defines = []
|
||||
|
||||
if (impeller_debug) {
|
||||
defines += [ "IMPELLER_DEBUG=1" ]
|
||||
}
|
||||
|
||||
if (impeller_supports_rendering) {
|
||||
defines += [ "IMPELLER_SUPPORTS_RENDERING=1" ]
|
||||
}
|
||||
|
||||
@@ -2139,5 +2139,29 @@ TEST_P(AiksTest, CanRenderTinyOverlappingSubpasses) {
|
||||
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
}
|
||||
|
||||
/// Tests that the debug checkerboard displays for offscreen textures when
|
||||
/// enabled. Most of the complexity here is just to future proof by making pass
|
||||
/// collapsing hard.
|
||||
TEST_P(AiksTest, CanRenderOffscreenCheckerboard) {
|
||||
Canvas canvas;
|
||||
canvas.debug_options.offscreen_texture_checkerboard = true;
|
||||
|
||||
canvas.DrawPaint({.color = Color::AntiqueWhite()});
|
||||
canvas.DrawCircle({400, 300}, 200,
|
||||
{.color = Color::CornflowerBlue().WithAlpha(0.75)});
|
||||
|
||||
canvas.SaveLayer({.blend_mode = BlendMode::kMultiply});
|
||||
{
|
||||
canvas.DrawCircle({500, 400}, 200,
|
||||
{.color = Color::DarkBlue().WithAlpha(0.75)});
|
||||
canvas.DrawCircle({550, 450}, 200,
|
||||
{.color = Color::LightCoral().WithAlpha(0.75),
|
||||
.blend_mode = BlendMode::kLuminosity});
|
||||
}
|
||||
canvas.Restore();
|
||||
|
||||
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
}
|
||||
|
||||
} // namespace testing
|
||||
} // namespace impeller
|
||||
|
||||
@@ -75,6 +75,8 @@ void Canvas::Save(
|
||||
if (create_subpass) {
|
||||
entry.is_subpass = true;
|
||||
auto subpass = std::make_unique<EntityPass>();
|
||||
subpass->SetEnableOffscreenCheckerboard(
|
||||
debug_options.offscreen_texture_checkerboard);
|
||||
subpass->SetBackdropFilter(std::move(backdrop_filter));
|
||||
subpass->SetBlendMode(blend_mode);
|
||||
current_pass_ = GetCurrentPass().AddSubpass(std::move(subpass));
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
@@ -29,6 +30,14 @@ class Entity;
|
||||
|
||||
class Canvas {
|
||||
public:
|
||||
struct DebugOptions {
|
||||
/// When enabled, layers that are rendered to an offscreen texture
|
||||
/// internally get a translucent checkerboard pattern painted over them.
|
||||
///
|
||||
/// Requires the `IMPELLER_DEBUG` preprocessor flag.
|
||||
bool offscreen_texture_checkerboard = false;
|
||||
} debug_options;
|
||||
|
||||
Canvas();
|
||||
|
||||
~Canvas();
|
||||
|
||||
@@ -39,7 +39,7 @@ std::ostream& ValidationLog::GetStream() {
|
||||
|
||||
void ImpellerValidationBreak(const char* message) {
|
||||
// Nothing to do. Exists for the debugger.
|
||||
#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE
|
||||
#ifdef IMPELLER_DEBUG
|
||||
std::stringstream stream;
|
||||
stream << "Break on '" << __FUNCTION__
|
||||
<< "' to inspect point of failure: " << message;
|
||||
@@ -48,7 +48,7 @@ void ImpellerValidationBreak(const char* message) {
|
||||
} else {
|
||||
FML_LOG(INFO) << stream.str();
|
||||
}
|
||||
#endif // FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE
|
||||
#endif // IMPELLER_DEBUG
|
||||
}
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
@@ -72,6 +72,13 @@ impeller_shaders("entity_shaders") {
|
||||
"shaders/yuv_to_rgb_filter.vert",
|
||||
"shaders/blending/porter_duff_blend.frag",
|
||||
]
|
||||
|
||||
if (impeller_debug) {
|
||||
shaders += [
|
||||
"shaders/debug/checkerboard.frag",
|
||||
"shaders/debug/checkerboard.vert",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
impeller_shaders("modern_entity_shaders") {
|
||||
@@ -221,6 +228,13 @@ impeller_component("entity") {
|
||||
"inline_pass_context.h",
|
||||
]
|
||||
|
||||
if (impeller_debug) {
|
||||
sources += [
|
||||
"contents/checkerboard_contents.cc",
|
||||
"contents/checkerboard_contents.h",
|
||||
]
|
||||
}
|
||||
|
||||
public_deps = [
|
||||
":entity_shaders",
|
||||
":framebuffer_blend_entity_shaders",
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "impeller/entity/contents/checkerboard_contents.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "impeller/core/formats.h"
|
||||
#include "impeller/entity/contents/content_context.h"
|
||||
#include "impeller/renderer/command.h"
|
||||
#include "impeller/renderer/render_pass.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
CheckerboardContents::CheckerboardContents() = default;
|
||||
|
||||
CheckerboardContents::~CheckerboardContents() = default;
|
||||
|
||||
bool CheckerboardContents::Render(const ContentContext& renderer,
|
||||
const Entity& entity,
|
||||
RenderPass& pass) const {
|
||||
auto& host_buffer = pass.GetTransientsBuffer();
|
||||
|
||||
using VS = CheckerboardPipeline::VertexShader;
|
||||
using FS = CheckerboardPipeline::FragmentShader;
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Checkerboard";
|
||||
|
||||
auto options = OptionsFromPass(pass);
|
||||
options.blend_mode = BlendMode::kSourceOver;
|
||||
options.stencil_compare = CompareFunction::kAlways; // Ignore all clips.
|
||||
options.stencil_operation = StencilOperation::kKeep;
|
||||
options.primitive_type = PrimitiveType::kTriangleStrip;
|
||||
cmd.pipeline = renderer.GetCheckerboardPipeline(options);
|
||||
|
||||
VertexBufferBuilder<typename VS::PerVertexData> vtx_builder;
|
||||
vtx_builder.AddVertices({
|
||||
{Point(-1, -1)},
|
||||
{Point(1, -1)},
|
||||
{Point(-1, 1)},
|
||||
{Point(1, 1)},
|
||||
});
|
||||
cmd.BindVertices(vtx_builder.CreateVertexBuffer(host_buffer));
|
||||
|
||||
FS::FragInfo frag_info;
|
||||
frag_info.color = color_;
|
||||
frag_info.square_size = square_size_;
|
||||
FS::BindFragInfo(cmd, host_buffer.EmplaceUniform(frag_info));
|
||||
|
||||
pass.AddCommand(cmd);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<Rect> CheckerboardContents::GetCoverage(
|
||||
const Entity& entity) const {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void CheckerboardContents::SetColor(Color color) {
|
||||
color_ = color;
|
||||
}
|
||||
|
||||
void CheckerboardContents::SetSquareSize(Scalar square_size) {
|
||||
square_size_ = square_size;
|
||||
}
|
||||
|
||||
} // namespace impeller
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "impeller/entity/contents/contents.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
/// A special Contents that renders a translucent checkerboard pattern with a
|
||||
/// random color over the entire pass texture. This is useful for visualizing
|
||||
/// offscreen textures.
|
||||
class CheckerboardContents final : public Contents {
|
||||
public:
|
||||
CheckerboardContents();
|
||||
|
||||
// |Contents|
|
||||
~CheckerboardContents() override;
|
||||
|
||||
// |Contents|
|
||||
bool Render(const ContentContext& renderer,
|
||||
const Entity& entity,
|
||||
RenderPass& pass) const override;
|
||||
|
||||
// |Contents|
|
||||
std::optional<Rect> GetCoverage(const Entity& entity) const override;
|
||||
|
||||
void SetColor(Color color);
|
||||
|
||||
void SetSquareSize(Scalar square_size);
|
||||
|
||||
private:
|
||||
Color color_ = Color::Red().WithAlpha(0.25);
|
||||
Scalar square_size_ = 12;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(CheckerboardContents);
|
||||
};
|
||||
|
||||
} // namespace impeller
|
||||
@@ -170,6 +170,11 @@ ContentContext::ContentContext(std::shared_ptr<Context> context)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef IMPELLER_DEBUG
|
||||
checkerboard_pipelines_[{}] =
|
||||
CreateDefaultPipeline<CheckerboardPipeline>(*context_);
|
||||
#endif // IMPELLER_DEBUG
|
||||
|
||||
solid_fill_pipelines_[{}] =
|
||||
CreateDefaultPipeline<SolidFillPipeline>(*context_);
|
||||
linear_gradient_fill_pipelines_[{}] =
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
#include "impeller/renderer/pipeline.h"
|
||||
#include "impeller/scene/scene_context.h"
|
||||
|
||||
#ifdef IMPELLER_DEBUG
|
||||
#include "impeller/entity/checkerboard.frag.h"
|
||||
#include "impeller/entity/checkerboard.vert.h"
|
||||
#endif // IMPELLER_DEBUG
|
||||
|
||||
#include "impeller/entity/blend.frag.h"
|
||||
#include "impeller/entity/blend.vert.h"
|
||||
#include "impeller/entity/border_mask_blur.frag.h"
|
||||
@@ -103,6 +108,11 @@
|
||||
|
||||
namespace impeller {
|
||||
|
||||
#ifdef IMPELLER_DEBUG
|
||||
using CheckerboardPipeline =
|
||||
RenderPipelineT<CheckerboardVertexShader, CheckerboardFragmentShader>;
|
||||
#endif // IMPELLER_DEBUG
|
||||
|
||||
using LinearGradientFillPipeline =
|
||||
RenderPipelineT<GradientFillVertexShader, LinearGradientFillFragmentShader>;
|
||||
using SolidFillPipeline =
|
||||
@@ -327,6 +337,13 @@ class ContentContext {
|
||||
|
||||
std::shared_ptr<Tessellator> GetTessellator() const;
|
||||
|
||||
#ifdef IMPELLER_DEBUG
|
||||
std::shared_ptr<Pipeline<PipelineDescriptor>> GetCheckerboardPipeline(
|
||||
ContentContextOptions opts) const {
|
||||
return GetPipeline(checkerboard_pipelines_, opts);
|
||||
}
|
||||
#endif // IMPELLER_DEBUG
|
||||
|
||||
std::shared_ptr<Pipeline<PipelineDescriptor>> GetLinearGradientFillPipeline(
|
||||
ContentContextOptions opts) const {
|
||||
return GetPipeline(linear_gradient_fill_pipelines_, opts);
|
||||
@@ -674,6 +691,11 @@ class ContentContext {
|
||||
// These are mutable because while the prototypes are created eagerly, any
|
||||
// variants requested from that are lazily created and cached in the variants
|
||||
// map.
|
||||
|
||||
#ifdef IMPELLER_DEBUG
|
||||
mutable Variants<CheckerboardPipeline> checkerboard_pipelines_;
|
||||
#endif // IMPELLER_DEBUG
|
||||
|
||||
mutable Variants<SolidFillPipeline> solid_fill_pipelines_;
|
||||
mutable Variants<LinearGradientFillPipeline> linear_gradient_fill_pipelines_;
|
||||
mutable Variants<RadialGradientFillPipeline> radial_gradient_fill_pipelines_;
|
||||
|
||||
@@ -29,12 +29,7 @@ ContentContextOptions OptionsFromPass(const RenderPass& pass) {
|
||||
|
||||
ContentContextOptions OptionsFromPassAndEntity(const RenderPass& pass,
|
||||
const Entity& entity) {
|
||||
ContentContextOptions opts;
|
||||
opts.sample_count = pass.GetRenderTarget().GetSampleCount();
|
||||
opts.color_attachment_pixel_format =
|
||||
pass.GetRenderTarget().GetRenderTargetPixelFormat();
|
||||
opts.has_stencil_attachment =
|
||||
pass.GetRenderTarget().GetStencilAttachment().has_value();
|
||||
ContentContextOptions opts = OptionsFromPass(pass);
|
||||
opts.blend_mode = entity.GetBlendMode();
|
||||
return opts;
|
||||
}
|
||||
|
||||
@@ -24,11 +24,16 @@
|
||||
#include "impeller/entity/contents/texture_contents.h"
|
||||
#include "impeller/entity/entity.h"
|
||||
#include "impeller/entity/inline_pass_context.h"
|
||||
#include "impeller/geometry/color.h"
|
||||
#include "impeller/geometry/path_builder.h"
|
||||
#include "impeller/renderer/command.h"
|
||||
#include "impeller/renderer/command_buffer.h"
|
||||
#include "impeller/renderer/render_pass.h"
|
||||
|
||||
#ifdef IMPELLER_DEBUG
|
||||
#include "impeller/entity/contents/checkerboard_contents.h"
|
||||
#endif // IMPELLER_DEBUG
|
||||
|
||||
namespace impeller {
|
||||
|
||||
EntityPass::EntityPass() = default;
|
||||
@@ -481,23 +486,23 @@ EntityPass::EntityResult EntityPass::GetEntityForElement(
|
||||
return EntityPass::EntityResult::Success(element_entity);
|
||||
}
|
||||
|
||||
bool EntityPass::OnRender(ContentContext& renderer,
|
||||
ISize root_pass_size,
|
||||
EntityPassTarget& pass_target,
|
||||
Point global_pass_position,
|
||||
Point local_pass_position,
|
||||
uint32_t pass_depth,
|
||||
StencilCoverageStack& stencil_coverage_stack,
|
||||
size_t stencil_depth_floor,
|
||||
std::shared_ptr<Contents> backdrop_filter_contents,
|
||||
std::optional<InlinePassContext::RenderPassResult>
|
||||
collapsed_parent_pass) const {
|
||||
bool EntityPass::OnRender(
|
||||
ContentContext& renderer,
|
||||
ISize root_pass_size,
|
||||
EntityPassTarget& pass_target,
|
||||
Point global_pass_position,
|
||||
Point local_pass_position,
|
||||
uint32_t pass_depth,
|
||||
StencilCoverageStack& stencil_coverage_stack,
|
||||
size_t stencil_depth_floor,
|
||||
std::shared_ptr<Contents> backdrop_filter_contents,
|
||||
const std::optional<InlinePassContext::RenderPassResult>&
|
||||
collapsed_parent_pass) const {
|
||||
TRACE_EVENT0("impeller", "EntityPass::OnRender");
|
||||
|
||||
auto context = renderer.GetContext();
|
||||
InlinePassContext pass_context(context, pass_target,
|
||||
GetTotalPassReads(renderer),
|
||||
std::move(collapsed_parent_pass));
|
||||
InlinePassContext pass_context(
|
||||
context, pass_target, GetTotalPassReads(renderer), collapsed_parent_pass);
|
||||
if (!pass_context.IsValid()) {
|
||||
VALIDATION_LOG << SPrintF("Pass context invalid (Depth=%d)", pass_depth);
|
||||
return false;
|
||||
@@ -725,6 +730,31 @@ bool EntityPass::OnRender(ContentContext& renderer,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef IMPELLER_DEBUG
|
||||
//--------------------------------------------------------------------------
|
||||
/// Draw debug checkerboard over offscreen textures.
|
||||
///
|
||||
|
||||
// When the pass depth is > 0, this EntityPass is being rendered to an
|
||||
// offscreen texture.
|
||||
if (enable_offscreen_debug_checkerboard_ &&
|
||||
!collapsed_parent_pass.has_value() && pass_depth > 0) {
|
||||
auto result = pass_context.GetRenderPass(pass_depth);
|
||||
if (!result.pass) {
|
||||
// Failure to produce a render pass should be explained by specific errors
|
||||
// in `InlinePassContext::GetRenderPass()`.
|
||||
return false;
|
||||
}
|
||||
auto checkerboard = CheckerboardContents();
|
||||
auto color = ColorHSB(0, // hue
|
||||
1, // saturation
|
||||
std::max(0.0, 0.6 - pass_depth / 5), // brightness
|
||||
0.25); // alpha
|
||||
checkerboard.SetColor(Color(color));
|
||||
checkerboard.Render(renderer, {}, *result.pass);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -822,4 +852,8 @@ void EntityPass::SetBackdropFilter(std::optional<BackdropFilterProc> proc) {
|
||||
backdrop_filter_proc_ = std::move(proc);
|
||||
}
|
||||
|
||||
void EntityPass::SetEnableOffscreenCheckerboard(bool enabled) {
|
||||
enable_offscreen_debug_checkerboard_ = enabled;
|
||||
}
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
@@ -92,6 +92,8 @@ class EntityPass {
|
||||
|
||||
void SetBackdropFilter(std::optional<BackdropFilterProc> proc);
|
||||
|
||||
void SetEnableOffscreenCheckerboard(bool enabled);
|
||||
|
||||
std::optional<Rect> GetSubpassCoverage(
|
||||
const EntityPass& subpass,
|
||||
std::optional<Rect> coverage_crop) const;
|
||||
@@ -196,7 +198,7 @@ class EntityPass {
|
||||
StencilCoverageStack& stencil_coverage_stack,
|
||||
size_t stencil_depth_floor = 0,
|
||||
std::shared_ptr<Contents> backdrop_filter_contents = nullptr,
|
||||
std::optional<InlinePassContext::RenderPassResult>
|
||||
const std::optional<InlinePassContext::RenderPassResult>&
|
||||
collapsed_parent_pass = std::nullopt) const;
|
||||
|
||||
/// The list of renderable items in the scene. Each of these items is
|
||||
@@ -209,6 +211,7 @@ class EntityPass {
|
||||
BlendMode blend_mode_ = BlendMode::kSourceOver;
|
||||
bool cover_whole_screen_ = false;
|
||||
Color clear_color_ = Color::BlackTransparent();
|
||||
bool enable_offscreen_debug_checkerboard_ = false;
|
||||
|
||||
/// These values are incremented whenever something is added to the pass that
|
||||
/// requires reading from the backdrop texture. Currently, this can happen in
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
uniform FragInfo {
|
||||
vec4 color;
|
||||
float square_size;
|
||||
}
|
||||
frag_info;
|
||||
|
||||
out vec4 frag_color;
|
||||
|
||||
void main() {
|
||||
vec2 square = floor(gl_FragCoord.xy / frag_info.square_size);
|
||||
frag_color = mod(square.x + square.y, 2.0) * frag_info.color;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
in vec2 position;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(position, 0.0, 1.0);
|
||||
}
|
||||
@@ -118,6 +118,18 @@ struct TSize {
|
||||
}
|
||||
};
|
||||
|
||||
// RHS algebraic operations with arithmetic types.
|
||||
|
||||
template <class T, class U, class = std::enable_if_t<std::is_arithmetic_v<U>>>
|
||||
constexpr TSize<T> operator*(U s, const TSize<T>& p) {
|
||||
return p * s;
|
||||
}
|
||||
|
||||
template <class T, class U, class = std::enable_if_t<std::is_arithmetic_v<U>>>
|
||||
constexpr TSize<T> operator/(U s, const TSize<T>& p) {
|
||||
return {static_cast<T>(s) / p.x, static_cast<T>(s) / p.y};
|
||||
}
|
||||
|
||||
using Size = TSize<Scalar>;
|
||||
using ISize = TSize<int64_t>;
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@ import("//flutter/impeller/tools/malioc.gni")
|
||||
import("//flutter/testing/testing.gni")
|
||||
|
||||
declare_args() {
|
||||
impeller_debug =
|
||||
flutter_runtime_mode == "debug" || flutter_runtime_mode == "profile"
|
||||
|
||||
# Whether the Metal backend is enabled.
|
||||
impeller_enable_metal = is_mac || is_ios
|
||||
|
||||
|
||||
@@ -1578,6 +1578,137 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"flutter/impeller/entity/checkerboard.frag.vkspv": {
|
||||
"Mali-G78": {
|
||||
"core": "Mali-G78",
|
||||
"filename": "flutter/impeller/entity/checkerboard.frag.vkspv",
|
||||
"has_side_effects": false,
|
||||
"has_uniform_computation": true,
|
||||
"modifies_coverage": false,
|
||||
"reads_color_buffer": false,
|
||||
"type": "Fragment",
|
||||
"uses_late_zs_test": false,
|
||||
"uses_late_zs_update": false,
|
||||
"variants": {
|
||||
"Main": {
|
||||
"fp16_arithmetic": 0,
|
||||
"has_stack_spilling": false,
|
||||
"performance": {
|
||||
"longest_path_bound_pipelines": [
|
||||
"load_store"
|
||||
],
|
||||
"longest_path_cycles": [
|
||||
0.171875,
|
||||
0.171875,
|
||||
0.140625,
|
||||
0.0625,
|
||||
1.0,
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"pipelines": [
|
||||
"arith_total",
|
||||
"arith_fma",
|
||||
"arith_cvt",
|
||||
"arith_sfu",
|
||||
"load_store",
|
||||
"varying",
|
||||
"texture"
|
||||
],
|
||||
"shortest_path_bound_pipelines": [
|
||||
"load_store"
|
||||
],
|
||||
"shortest_path_cycles": [
|
||||
0.171875,
|
||||
0.171875,
|
||||
0.140625,
|
||||
0.0625,
|
||||
1.0,
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"total_bound_pipelines": [
|
||||
"load_store"
|
||||
],
|
||||
"total_cycles": [
|
||||
0.171875,
|
||||
0.171875,
|
||||
0.140625,
|
||||
0.0625,
|
||||
1.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
"stack_spill_bytes": 0,
|
||||
"thread_occupancy": 100,
|
||||
"uniform_registers_used": 8,
|
||||
"work_registers_used": 7
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"flutter/impeller/entity/checkerboard.vert.vkspv": {
|
||||
"Mali-G78": {
|
||||
"core": "Mali-G78",
|
||||
"filename": "flutter/impeller/entity/checkerboard.vert.vkspv",
|
||||
"has_uniform_computation": false,
|
||||
"type": "Vertex",
|
||||
"variants": {
|
||||
"Position": {
|
||||
"fp16_arithmetic": null,
|
||||
"has_stack_spilling": false,
|
||||
"performance": {
|
||||
"longest_path_bound_pipelines": [
|
||||
"load_store"
|
||||
],
|
||||
"longest_path_cycles": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
2.0,
|
||||
0.0
|
||||
],
|
||||
"pipelines": [
|
||||
"arith_total",
|
||||
"arith_fma",
|
||||
"arith_cvt",
|
||||
"arith_sfu",
|
||||
"load_store",
|
||||
"texture"
|
||||
],
|
||||
"shortest_path_bound_pipelines": [
|
||||
"load_store"
|
||||
],
|
||||
"shortest_path_cycles": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
2.0,
|
||||
0.0
|
||||
],
|
||||
"total_bound_pipelines": [
|
||||
"load_store"
|
||||
],
|
||||
"total_cycles": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
2.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
"stack_spill_bytes": 0,
|
||||
"thread_occupancy": 100,
|
||||
"uniform_registers_used": 8,
|
||||
"work_registers_used": 32
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"flutter/impeller/entity/color_matrix_color_filter.frag.vkspv": {
|
||||
"Mali-G78": {
|
||||
"core": "Mali-G78",
|
||||
@@ -6035,6 +6166,227 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"flutter/impeller/entity/gles/checkerboard.frag.gles": {
|
||||
"Mali-G78": {
|
||||
"core": "Mali-G78",
|
||||
"filename": "flutter/impeller/entity/gles/checkerboard.frag.gles",
|
||||
"has_side_effects": false,
|
||||
"has_uniform_computation": true,
|
||||
"modifies_coverage": false,
|
||||
"reads_color_buffer": false,
|
||||
"type": "Fragment",
|
||||
"uses_late_zs_test": false,
|
||||
"uses_late_zs_update": false,
|
||||
"variants": {
|
||||
"Main": {
|
||||
"fp16_arithmetic": 0,
|
||||
"has_stack_spilling": false,
|
||||
"performance": {
|
||||
"longest_path_bound_pipelines": [
|
||||
"load_store"
|
||||
],
|
||||
"longest_path_cycles": [
|
||||
0.265625,
|
||||
0.265625,
|
||||
0.171875,
|
||||
0.0625,
|
||||
1.0,
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"pipelines": [
|
||||
"arith_total",
|
||||
"arith_fma",
|
||||
"arith_cvt",
|
||||
"arith_sfu",
|
||||
"load_store",
|
||||
"varying",
|
||||
"texture"
|
||||
],
|
||||
"shortest_path_bound_pipelines": [
|
||||
"load_store"
|
||||
],
|
||||
"shortest_path_cycles": [
|
||||
0.265625,
|
||||
0.265625,
|
||||
0.140625,
|
||||
0.0625,
|
||||
1.0,
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"total_bound_pipelines": [
|
||||
"load_store"
|
||||
],
|
||||
"total_cycles": [
|
||||
0.265625,
|
||||
0.265625,
|
||||
0.171875,
|
||||
0.0625,
|
||||
1.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
"stack_spill_bytes": 0,
|
||||
"thread_occupancy": 100,
|
||||
"uniform_registers_used": 14,
|
||||
"work_registers_used": 20
|
||||
}
|
||||
}
|
||||
},
|
||||
"Mali-T880": {
|
||||
"core": "Mali-T880",
|
||||
"filename": "flutter/impeller/entity/gles/checkerboard.frag.gles",
|
||||
"has_uniform_computation": false,
|
||||
"type": "Fragment",
|
||||
"variants": {
|
||||
"Main": {
|
||||
"has_stack_spilling": false,
|
||||
"performance": {
|
||||
"longest_path_bound_pipelines": [
|
||||
"arithmetic"
|
||||
],
|
||||
"longest_path_cycles": [
|
||||
1.9800000190734863,
|
||||
1.0,
|
||||
0.0
|
||||
],
|
||||
"pipelines": [
|
||||
"arithmetic",
|
||||
"load_store",
|
||||
"texture"
|
||||
],
|
||||
"shortest_path_bound_pipelines": [
|
||||
"arithmetic"
|
||||
],
|
||||
"shortest_path_cycles": [
|
||||
1.9800000190734863,
|
||||
1.0,
|
||||
0.0
|
||||
],
|
||||
"total_bound_pipelines": [
|
||||
"arithmetic"
|
||||
],
|
||||
"total_cycles": [
|
||||
2.3333332538604736,
|
||||
1.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
"thread_occupancy": 100,
|
||||
"uniform_registers_used": 2,
|
||||
"work_registers_used": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"flutter/impeller/entity/gles/checkerboard.vert.gles": {
|
||||
"Mali-G78": {
|
||||
"core": "Mali-G78",
|
||||
"filename": "flutter/impeller/entity/gles/checkerboard.vert.gles",
|
||||
"has_uniform_computation": false,
|
||||
"type": "Vertex",
|
||||
"variants": {
|
||||
"Position": {
|
||||
"fp16_arithmetic": null,
|
||||
"has_stack_spilling": false,
|
||||
"performance": {
|
||||
"longest_path_bound_pipelines": [
|
||||
"load_store"
|
||||
],
|
||||
"longest_path_cycles": [
|
||||
0.015625,
|
||||
0.0,
|
||||
0.015625,
|
||||
0.0,
|
||||
2.0,
|
||||
0.0
|
||||
],
|
||||
"pipelines": [
|
||||
"arith_total",
|
||||
"arith_fma",
|
||||
"arith_cvt",
|
||||
"arith_sfu",
|
||||
"load_store",
|
||||
"texture"
|
||||
],
|
||||
"shortest_path_bound_pipelines": [
|
||||
"load_store"
|
||||
],
|
||||
"shortest_path_cycles": [
|
||||
0.015625,
|
||||
0.0,
|
||||
0.015625,
|
||||
0.0,
|
||||
2.0,
|
||||
0.0
|
||||
],
|
||||
"total_bound_pipelines": [
|
||||
"load_store"
|
||||
],
|
||||
"total_cycles": [
|
||||
0.015625,
|
||||
0.0,
|
||||
0.015625,
|
||||
0.0,
|
||||
2.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
"stack_spill_bytes": 0,
|
||||
"thread_occupancy": 100,
|
||||
"uniform_registers_used": 8,
|
||||
"work_registers_used": 32
|
||||
}
|
||||
}
|
||||
},
|
||||
"Mali-T880": {
|
||||
"core": "Mali-T880",
|
||||
"filename": "flutter/impeller/entity/gles/checkerboard.vert.gles",
|
||||
"has_uniform_computation": false,
|
||||
"type": "Vertex",
|
||||
"variants": {
|
||||
"Main": {
|
||||
"has_stack_spilling": false,
|
||||
"performance": {
|
||||
"longest_path_bound_pipelines": [
|
||||
"load_store"
|
||||
],
|
||||
"longest_path_cycles": [
|
||||
1.3200000524520874,
|
||||
3.0,
|
||||
0.0
|
||||
],
|
||||
"pipelines": [
|
||||
"arithmetic",
|
||||
"load_store",
|
||||
"texture"
|
||||
],
|
||||
"shortest_path_bound_pipelines": [
|
||||
"load_store"
|
||||
],
|
||||
"shortest_path_cycles": [
|
||||
1.3200000524520874,
|
||||
3.0,
|
||||
0.0
|
||||
],
|
||||
"total_bound_pipelines": [
|
||||
"load_store"
|
||||
],
|
||||
"total_cycles": [
|
||||
1.3333333730697632,
|
||||
3.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
"thread_occupancy": 100,
|
||||
"uniform_registers_used": 2,
|
||||
"work_registers_used": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"flutter/impeller/entity/gles/color_matrix_color_filter.frag.gles": {
|
||||
"Mali-G78": {
|
||||
"core": "Mali-G78",
|
||||
|
||||
Reference in New Issue
Block a user