Skip to content
This repository has been archived by the owner on Feb 25, 2025. It is now read-only.

Commit

Permalink
fix cr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik committed Feb 9, 2023
1 parent bfb2403 commit 3b9054a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
38 changes: 21 additions & 17 deletions impeller/renderer/backend/vulkan/blit_command_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ namespace impeller {

BlitEncodeVK::~BlitEncodeVK() = default;

// BEGIN: BlitCopyTextureToTextureCommandVK
//------------------------------------------------------------------------------
/// BlitCopyTextureToTextureCommandVK
///

BlitCopyTextureToTextureCommandVK::~BlitCopyTextureToTextureCommandVK() =
default;
Expand All @@ -23,16 +25,16 @@ std::string BlitCopyTextureToTextureCommandVK::GetLabel() const {
[[nodiscard]] bool BlitCopyTextureToTextureCommandVK::Encode(
FencedCommandBufferVK* fenced_command_buffer) const {
// cast source and destination to TextureVK
auto& source_tex_vk = TextureVK::Cast(*source);
auto& dest_tex_vk = TextureVK::Cast(*destination);
const auto& source_tex_vk = TextureVK::Cast(*source);
const auto& dest_tex_vk = TextureVK::Cast(*destination);

// get the vulkan image and image view
auto source_image = source_tex_vk.GetImage();
auto dest_image = dest_tex_vk.GetImage();
const auto source_image = source_tex_vk.GetImage();
const auto dest_image = dest_tex_vk.GetImage();

// copy the source image to the destination image, from source_region to
// destination_origin.
vk::ImageCopy image_copy{};
vk::ImageCopy image_copy;
image_copy.setSrcSubresource(
vk::ImageSubresourceLayers(vk::ImageAspectFlagBits::eColor, 0, 0, 1));
image_copy.setDstSubresource(
Expand Down Expand Up @@ -63,6 +65,7 @@ std::string BlitCopyTextureToTextureCommandVK::GetLabel() const {
vk::ImageLayout::eTransferSrcOptimal);
bool success = transition_source_cmd.Submit(fenced_command_buffer);
if (!success) {
VALIDATION_LOG << "Failed to transition source image layout";
return false;
}

Expand All @@ -72,6 +75,7 @@ std::string BlitCopyTextureToTextureCommandVK::GetLabel() const {
vk::ImageLayout::eTransferDstOptimal);
success = transition_dest_cmd.Submit(fenced_command_buffer);
if (!success) {
VALIDATION_LOG << "Failed to transition destination image layout";
return false;
}

Expand All @@ -88,9 +92,9 @@ std::string BlitCopyTextureToTextureCommandVK::GetLabel() const {
return true;
}

// END: BlitCopyTextureToTextureCommandVK

// BEGIN: BlitCopyTextureToBufferCommandVK
//------------------------------------------------------------------------------
/// BlitCopyTextureToBufferCommandVK
///

BlitCopyTextureToBufferCommandVK::~BlitCopyTextureToBufferCommandVK() = default;

Expand All @@ -101,14 +105,14 @@ std::string BlitCopyTextureToBufferCommandVK::GetLabel() const {
[[nodiscard]] bool BlitCopyTextureToBufferCommandVK::Encode(
FencedCommandBufferVK* fenced_command_buffer) const {
// cast source and destination to TextureVK
auto& source_tex_vk = TextureVK::Cast(*source);
auto& dest_buf_vk = DeviceBufferVK::Cast(*destination);
const auto& source_tex_vk = TextureVK::Cast(*source);
const auto& dest_buf_vk = DeviceBufferVK::Cast(*destination);

// get the vulkan image and image view
auto source_image = source_tex_vk.GetImage();
const auto source_image = source_tex_vk.GetImage();

// get buffer image handle
auto dest_buffer = dest_buf_vk.GetVKBufferHandle();
const auto dest_buffer = dest_buf_vk.GetVKBufferHandle();

// copy the source image to the destination buffer, from source_region to
// destination_origin.
Expand Down Expand Up @@ -155,9 +159,9 @@ std::string BlitCopyTextureToBufferCommandVK::GetLabel() const {
return true;
}

// END: BlitCopyTextureToBufferCommandVK

// BEGIN: BlitGenerateMipmapCommandVK
//------------------------------------------------------------------------------
/// BlitGenerateMipmapCommandVK
///

BlitGenerateMipmapCommandVK::~BlitGenerateMipmapCommandVK() = default;

Expand All @@ -169,7 +173,7 @@ std::string BlitGenerateMipmapCommandVK::GetLabel() const {
FencedCommandBufferVK* fenced_command_buffer) const {
// TODO(https://github.com/flutter/flutter/issues/120134): Support generating
// mipmaps on Vulkan.
FML_LOG(ERROR) << "Generating mipmaps is not yet supported on Vulkan";
IMPELLER_UNIMPLEMENTED;
return true;
}

Expand Down
2 changes: 2 additions & 0 deletions impeller/renderer/backend/vulkan/commands_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class TransitionImageLayoutCommandVK {
vk::Image image_;
vk::ImageLayout old_layout_;
vk::ImageLayout new_layout_;

FML_DISALLOW_COPY_AND_ASSIGN(TransitionImageLayoutCommandVK);
};

} // namespace impeller

0 comments on commit 3b9054a

Please sign in to comment.