mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Revert "[Impeller] mark decoded images as optimized for GPU access (#40356)" (flutter/engine#40387)
Revert "[Impeller] mark decoded images as optimized for GPU access"
This commit is contained in:
parent
c7b040ec98
commit
c13f016ce4
@ -130,11 +130,6 @@ bool BlitPassGLES::OnCopyTextureToBufferCommand(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BlitPassGLES::OnOptimizeForGPUAccess(std::shared_ptr<Texture> texture,
|
||||
std::string label) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// |BlitPass|
|
||||
bool BlitPassGLES::OnGenerateMipmapCommand(std::shared_ptr<Texture> texture,
|
||||
std::string label) {
|
||||
|
||||
@ -50,10 +50,6 @@ class BlitPassGLES final : public BlitPass {
|
||||
size_t destination_offset,
|
||||
std::string label) override;
|
||||
|
||||
// |BlitPass|
|
||||
bool OnOptimizeForGPUAccess(std::shared_ptr<Texture> texture,
|
||||
std::string label) override;
|
||||
|
||||
// |BlitPass|
|
||||
bool OnGenerateMipmapCommand(std::shared_ptr<Texture> texture,
|
||||
std::string label) override;
|
||||
|
||||
@ -50,13 +50,4 @@ struct BlitGenerateMipmapCommandMTL : public BlitGenerateMipmapCommand,
|
||||
[[nodiscard]] bool Encode(id<MTLBlitCommandEncoder> encoder) const override;
|
||||
};
|
||||
|
||||
struct BlitOptimizeGPUAccessCommandMTL : public BlitGenerateMipmapCommand,
|
||||
public BlitEncodeMTL {
|
||||
~BlitOptimizeGPUAccessCommandMTL() override;
|
||||
|
||||
std::string GetLabel() const override;
|
||||
|
||||
[[nodiscard]] bool Encode(id<MTLBlitCommandEncoder> encoder) const override;
|
||||
};
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
@ -112,23 +112,4 @@ bool BlitGenerateMipmapCommandMTL::Encode(
|
||||
return true;
|
||||
};
|
||||
|
||||
BlitOptimizeGPUAccessCommandMTL::~BlitOptimizeGPUAccessCommandMTL() = default;
|
||||
|
||||
std::string BlitOptimizeGPUAccessCommandMTL::GetLabel() const {
|
||||
return label;
|
||||
}
|
||||
|
||||
bool BlitOptimizeGPUAccessCommandMTL::Encode(
|
||||
id<MTLBlitCommandEncoder> encoder) const {
|
||||
if (@available(macOS 10.14, iOS 12, tvOS 12, *)) {
|
||||
auto texture_mtl = TextureMTL::Cast(*texture).GetMTLTexture();
|
||||
if (!texture_mtl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
[encoder optimizeContentsForGPUAccess:texture_mtl];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
@ -57,10 +57,6 @@ class BlitPassMTL final : public BlitPass {
|
||||
bool OnGenerateMipmapCommand(std::shared_ptr<Texture> texture,
|
||||
std::string label) override;
|
||||
|
||||
// |BlitPass|
|
||||
bool OnOptimizeForGPUAccess(std::shared_ptr<Texture> texture,
|
||||
std::string label) override;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(BlitPassMTL);
|
||||
};
|
||||
|
||||
|
||||
@ -134,15 +134,4 @@ bool BlitPassMTL::OnGenerateMipmapCommand(std::shared_ptr<Texture> texture,
|
||||
return true;
|
||||
}
|
||||
|
||||
// |BlitPass|
|
||||
bool BlitPassMTL::OnOptimizeForGPUAccess(std::shared_ptr<Texture> texture,
|
||||
std::string label) {
|
||||
auto command = std::make_unique<BlitOptimizeGPUAccessCommandMTL>();
|
||||
command->label = label;
|
||||
command->texture = std::move(texture);
|
||||
|
||||
commands_.emplace_back(std::move(command));
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
@ -87,12 +87,6 @@ bool BlitPassVK::OnCopyTextureToBufferCommand(
|
||||
return true;
|
||||
}
|
||||
|
||||
// |BlitPass|
|
||||
bool BlitPassVK::OnOptimizeForGPUAccess(std::shared_ptr<Texture> texture,
|
||||
std::string label) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// |BlitPass|
|
||||
bool BlitPassVK::OnGenerateMipmapCommand(std::shared_ptr<Texture> texture,
|
||||
std::string label) {
|
||||
|
||||
@ -51,9 +51,6 @@ class BlitPassVK final : public BlitPass {
|
||||
std::string label) override;
|
||||
|
||||
// |BlitPass|
|
||||
bool OnOptimizeForGPUAccess(std::shared_ptr<Texture> texture,
|
||||
std::string label) override;
|
||||
// |BlitPass|
|
||||
bool OnGenerateMipmapCommand(std::shared_ptr<Texture> texture,
|
||||
std::string label) override;
|
||||
|
||||
|
||||
@ -116,11 +116,6 @@ bool BlitPass::AddCopy(std::shared_ptr<Texture> source,
|
||||
std::move(label));
|
||||
}
|
||||
|
||||
bool BlitPass::OptimizeForGPUAccess(std::shared_ptr<Texture> texture,
|
||||
std::string label) {
|
||||
return OnOptimizeForGPUAccess(std::move(texture), std::move(label));
|
||||
}
|
||||
|
||||
bool BlitPass::GenerateMipmap(std::shared_ptr<Texture> texture,
|
||||
std::string label) {
|
||||
if (!texture) {
|
||||
|
||||
@ -95,19 +95,6 @@ class BlitPass {
|
||||
///
|
||||
bool GenerateMipmap(std::shared_ptr<Texture> texture, std::string label = "");
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/// @brief Optimize the provided texture for GPU access.
|
||||
/// This will no-op on platforms where this functionality is
|
||||
/// unsupported.
|
||||
///
|
||||
/// @param[in] texture The texture to generate mipmaps for.
|
||||
/// @param[in] label The optional debug label to give the command.
|
||||
///
|
||||
/// @return If the command was valid for subsequent commitment.
|
||||
///
|
||||
bool OptimizeForGPUAccess(std::shared_ptr<Texture> texture,
|
||||
std::string label = "");
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/// @brief Encode the recorded commands to the underlying command buffer.
|
||||
///
|
||||
@ -140,9 +127,6 @@ class BlitPass {
|
||||
size_t destination_offset,
|
||||
std::string label) = 0;
|
||||
|
||||
virtual bool OnOptimizeForGPUAccess(std::shared_ptr<Texture> texture,
|
||||
std::string label) = 0;
|
||||
|
||||
virtual bool OnGenerateMipmapCommand(std::shared_ptr<Texture> texture,
|
||||
std::string label) = 0;
|
||||
|
||||
|
||||
@ -62,9 +62,6 @@ class MockBlitPass : public BlitPass {
|
||||
size_t destination_offset,
|
||||
std::string label));
|
||||
|
||||
MOCK_METHOD2(OnOptimizeForGPUAccess,
|
||||
bool(std::shared_ptr<Texture> texture, std::string label));
|
||||
|
||||
MOCK_METHOD2(OnGenerateMipmapCommand,
|
||||
bool(std::shared_ptr<Texture> texture, std::string label));
|
||||
};
|
||||
|
||||
@ -286,7 +286,6 @@ sk_sp<DlImage> ImageDecoderImpeller::UploadTexture(
|
||||
}
|
||||
blit_pass->SetLabel("Mipmap Blit Pass");
|
||||
blit_pass->GenerateMipmap(texture);
|
||||
blit_pass->OptimizeForGPUAccess(texture);
|
||||
|
||||
blit_pass->EncodeCommands(context->GetResourceAllocator());
|
||||
if (!command_buffer->SubmitCommands()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user