Skip to content

Commit

Permalink
Fix potential null-point references (flutter#37678)
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik authored Nov 16, 2022
1 parent d7f49f6 commit c5e6a38
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion impeller/renderer/backend/vulkan/command_buffer_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ std::shared_ptr<RenderPass> CommandBufferVK::OnCreateRenderPass(
}

std::shared_ptr<BlitPass> CommandBufferVK::OnCreateBlitPass() const {
FML_UNREACHABLE();
// TODO(kaushikiska): https://github.com/flutter/flutter/issues/112649
return nullptr;
}

std::shared_ptr<ComputePass> CommandBufferVK::OnCreateComputePass() const {
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/painting/image_decoder_impeller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,19 @@ sk_sp<DlImage> ImageDecoderImpeller::UploadTexture(

{
auto command_buffer = context->CreateCommandBuffer();
command_buffer->SetLabel("Mipmap Command Buffer");
if (!command_buffer) {
FML_DLOG(ERROR)
<< "Could not create command buffer for mipmap generation.";
return nullptr;
}
command_buffer->SetLabel("Mipmap Command Buffer");

auto blit_pass = command_buffer->CreateBlitPass();
blit_pass->SetLabel("Mipmap Blit Pass");
if (!blit_pass) {
FML_DLOG(ERROR) << "Could not create blit pass for mipmap generation.";
return nullptr;
}

blit_pass->SetLabel("Mipmap Blit Pass");
blit_pass->GenerateMipmap(texture);

blit_pass->EncodeCommands(context->GetResourceAllocator());
Expand Down Expand Up @@ -233,6 +232,7 @@ void ImageDecoderImpeller::Decode(fml::RefPtr<ImageDescriptor> descriptor,
io_runner = runners_.GetIOTaskRunner(), //
result //
]() {
FML_CHECK(context) << "No valid impeller context";
auto max_size_supported =
context->GetResourceAllocator()->GetMaxTextureSizeSupported();

Expand Down
5 changes: 5 additions & 0 deletions shell/platform/android/android_surface_vulkan_impeller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ bool AndroidSurfaceVulkanImpeller::SetNativeWindow(
return false;
}

std::shared_ptr<impeller::Context>
AndroidSurfaceVulkanImpeller::GetImpellerContext() {
return impeller_context_;
}

} // namespace flutter
3 changes: 3 additions & 0 deletions shell/platform/android/android_surface_vulkan_impeller.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class AndroidSurfaceVulkanImpeller : public AndroidSurface {
// |AndroidSurface|
bool ResourceContextClearCurrent() override;

// |AndroidSurface|
std::shared_ptr<impeller::Context> GetImpellerContext() override;

// |AndroidSurface|
bool SetNativeWindow(fml::RefPtr<AndroidNativeWindow> window) override;

Expand Down

0 comments on commit c5e6a38

Please sign in to comment.