Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Impeller] Remove capability to read from onscreen. #47808

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions impeller/entity/entity_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -333,16 +333,11 @@ bool EntityPass::Render(ContentContext& renderer,
.coverage = Rect::MakeSize(root_render_target.GetRenderTargetSize()),
.clip_depth = 0}};

bool supports_onscreen_backdrop_reads =
renderer.GetDeviceCapabilities().SupportsReadFromOnscreenTexture() &&
// If the backend doesn't have `SupportsReadFromResolve`, we need to flip
// between two textures when restoring a previous MSAA pass.
renderer.GetDeviceCapabilities().SupportsReadFromResolve();
bool reads_from_onscreen_backdrop = GetTotalPassReads(renderer) > 0;
// In this branch path, we need to render everything to an offscreen texture
// and then blit the results onto the onscreen texture. If using this branch,
// there's no need to set up a stencil attachment on the root render target.
if (!supports_onscreen_backdrop_reads && reads_from_onscreen_backdrop) {
if (reads_from_onscreen_backdrop) {
auto offscreen_target =
CreateRenderTarget(renderer, root_render_target.GetRenderTargetSize(),
GetClearColor(render_target.GetRenderTargetSize()));
Expand Down
4 changes: 0 additions & 4 deletions impeller/renderer/backend/gles/capabilities_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ bool CapabilitiesGLES::SupportsComputeSubgroups() const {
return false;
}

bool CapabilitiesGLES::SupportsReadFromOnscreenTexture() const {
return false;
}

bool CapabilitiesGLES::SupportsReadFromResolve() const {
return false;
}
Expand Down
3 changes: 0 additions & 3 deletions impeller/renderer/backend/gles/capabilities_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ class CapabilitiesGLES final
// |Capabilities|
bool SupportsComputeSubgroups() const override;

// |Capabilities|
bool SupportsReadFromOnscreenTexture() const override;

// |Capabilities|
bool SupportsReadFromResolve() const override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ TEST(CapabilitiesGLES, CanInitializeWithDefaults) {
EXPECT_FALSE(capabilities->SupportsFramebufferFetch());
EXPECT_FALSE(capabilities->SupportsCompute());
EXPECT_FALSE(capabilities->SupportsComputeSubgroups());
EXPECT_FALSE(capabilities->SupportsReadFromOnscreenTexture());
EXPECT_FALSE(capabilities->SupportsReadFromResolve());
EXPECT_FALSE(capabilities->SupportsDecalSamplerAddressMode());
EXPECT_FALSE(capabilities->SupportsDeviceTransientTextures());
Expand Down
1 change: 0 additions & 1 deletion impeller/renderer/backend/metal/context_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ static bool DeviceSupportsComputeSubgroups(id<MTLDevice> device) {
.SetSupportsCompute(true)
.SetSupportsComputeSubgroups(DeviceSupportsComputeSubgroups(device))
.SetSupportsReadFromResolve(true)
.SetSupportsReadFromOnscreenTexture(true)
.SetSupportsDeviceTransientTextures(true)
.Build();
}
Expand Down
5 changes: 0 additions & 5 deletions impeller/renderer/backend/vulkan/capabilities_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,6 @@ bool CapabilitiesVK::SupportsReadFromResolve() const {
return false;
}

// |Capabilities|
bool CapabilitiesVK::SupportsReadFromOnscreenTexture() const {
return false;
}

bool CapabilitiesVK::SupportsDecalSamplerAddressMode() const {
return true;
}
Expand Down
3 changes: 0 additions & 3 deletions impeller/renderer/backend/vulkan/capabilities_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ class CapabilitiesVK final : public Capabilities,
// |Capabilities|
bool SupportsReadFromResolve() const override;

// |Capabilities|
bool SupportsReadFromOnscreenTexture() const override;

// |Capabilities|
bool SupportsDecalSamplerAddressMode() const override;

Expand Down
28 changes: 6 additions & 22 deletions impeller/renderer/capabilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ class StandardCapabilities final : public Capabilities {
return supports_compute_subgroups_;
}

// |Capabilities|
bool SupportsReadFromOnscreenTexture() const override {
return supports_read_from_onscreen_texture_;
}

// |Capabilities|
bool SupportsReadFromResolve() const override {
return supports_read_from_resolve_;
Expand Down Expand Up @@ -91,7 +86,6 @@ class StandardCapabilities final : public Capabilities {
bool supports_framebuffer_fetch,
bool supports_compute,
bool supports_compute_subgroups,
bool supports_read_from_onscreen_texture,
bool supports_read_from_resolve,
bool supports_decal_sampler_address_mode,
bool supports_device_transient_textures,
Expand All @@ -105,8 +99,6 @@ class StandardCapabilities final : public Capabilities {
supports_framebuffer_fetch_(supports_framebuffer_fetch),
supports_compute_(supports_compute),
supports_compute_subgroups_(supports_compute_subgroups),
supports_read_from_onscreen_texture_(
supports_read_from_onscreen_texture),
supports_read_from_resolve_(supports_read_from_resolve),
supports_decal_sampler_address_mode_(
supports_decal_sampler_address_mode),
Expand All @@ -124,7 +116,6 @@ class StandardCapabilities final : public Capabilities {
bool supports_framebuffer_fetch_ = false;
bool supports_compute_ = false;
bool supports_compute_subgroups_ = false;
bool supports_read_from_onscreen_texture_ = false;
bool supports_read_from_resolve_ = false;
bool supports_decal_sampler_address_mode_ = false;
bool supports_device_transient_textures_ = false;
Expand Down Expand Up @@ -180,18 +171,6 @@ CapabilitiesBuilder& CapabilitiesBuilder::SetSupportsComputeSubgroups(
return *this;
}

CapabilitiesBuilder& CapabilitiesBuilder::SetSupportsReadFromOnscreenTexture(
bool read_from_onscreen_texture) {
supports_read_from_onscreen_texture_ = read_from_onscreen_texture;
return *this;
}

CapabilitiesBuilder& CapabilitiesBuilder::SetSupportsReadFromResolve(
bool read_from_resolve) {
supports_read_from_resolve_ = read_from_resolve;
return *this;
}

CapabilitiesBuilder& CapabilitiesBuilder::SetDefaultColorFormat(
PixelFormat value) {
default_color_format_ = value;
Expand All @@ -210,6 +189,12 @@ CapabilitiesBuilder& CapabilitiesBuilder::SetDefaultDepthStencilFormat(
return *this;
}

CapabilitiesBuilder& CapabilitiesBuilder::SetSupportsReadFromResolve(
bool read_from_resolve) {
supports_read_from_resolve_ = read_from_resolve;
return *this;
}

CapabilitiesBuilder& CapabilitiesBuilder::SetSupportsDecalSamplerAddressMode(
bool value) {
supports_decal_sampler_address_mode_ = value;
Expand All @@ -231,7 +216,6 @@ std::unique_ptr<Capabilities> CapabilitiesBuilder::Build() {
supports_framebuffer_fetch_, //
supports_compute_, //
supports_compute_subgroups_, //
supports_read_from_onscreen_texture_, //
supports_read_from_resolve_, //
supports_decal_sampler_address_mode_, //
supports_device_transient_textures_, //
Expand Down
7 changes: 0 additions & 7 deletions impeller/renderer/capabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ class Capabilities {
/// command subgroups.
virtual bool SupportsComputeSubgroups() const = 0;

/// @brief Whether the context backend supports binding the on-screen surface
/// texture for shader reading.
virtual bool SupportsReadFromOnscreenTexture() const = 0;

/// @brief Whether the context backend supports binding the current
/// `RenderPass` attachments. This is supported if the backend can
/// guarantee that attachment textures will not be mutated until the
Expand Down Expand Up @@ -136,8 +132,6 @@ class CapabilitiesBuilder {

CapabilitiesBuilder& SetSupportsComputeSubgroups(bool value);

CapabilitiesBuilder& SetSupportsReadFromOnscreenTexture(bool value);

CapabilitiesBuilder& SetSupportsReadFromResolve(bool value);

CapabilitiesBuilder& SetDefaultColorFormat(PixelFormat value);
Expand All @@ -160,7 +154,6 @@ class CapabilitiesBuilder {
bool supports_framebuffer_fetch_ = false;
bool supports_compute_ = false;
bool supports_compute_subgroups_ = false;
bool supports_read_from_onscreen_texture_ = false;
bool supports_read_from_resolve_ = false;
bool supports_decal_sampler_address_mode_ = false;
bool supports_device_transient_textures_ = false;
Expand Down
1 change: 0 additions & 1 deletion impeller/renderer/capabilities_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ CAPABILITY_TEST(SupportsTextureToTextureBlits, false);
CAPABILITY_TEST(SupportsFramebufferFetch, false);
CAPABILITY_TEST(SupportsCompute, false);
CAPABILITY_TEST(SupportsComputeSubgroups, false);
CAPABILITY_TEST(SupportsReadFromOnscreenTexture, false);
CAPABILITY_TEST(SupportsReadFromResolve, false);
CAPABILITY_TEST(SupportsDecalSamplerAddressMode, false);
CAPABILITY_TEST(SupportsDeviceTransientTextures, false);
Expand Down