| Flutter Impeller |

Public Member Functions | List of all members
impeller::BlitCopyBufferToTextureCommandVK Struct Reference

`#include <blit_command_vk.h>`

Inheritance diagram for impeller::BlitCopyBufferToTextureCommandVK:

## Public Member Functions
| ~BlitCopyBufferToTextureCommandVK () override
std::string | GetLabel () const override
bool | Encode (CommandEncoderVK &encoder) const override
Public Member Functions inherited from impeller::BlitEncodeVK
virtual | ~BlitEncodeVK ()

## Additional Inherited Members
Static Public Member Functions inherited from impeller::BackendCast< BlitEncodeVK, BlitCommand >
static BlitEncodeVK & | Cast (BlitCommand &base)
static const BlitEncodeVK & | Cast (const BlitCommand &base)
static BlitEncodeVK * | Cast (BlitCommand *base)
static const BlitEncodeVK * | Cast (const BlitCommand *base)
Public Attributes inherited from impeller::BlitCopyBufferToTextureCommand
BufferView | source
std::shared_ptr< Texture > | destination
IPoint | destination_origin
Public Attributes inherited from impeller::BlitCommand
std::string | label

## Detailed Description

Definition at line 46 of file blit_command_vk.h.

## Constructor & Destructor Documentation

## ◆ ~BlitCopyBufferToTextureCommandVK()

impeller::BlitCopyBufferToTextureCommandVK::~BlitCopyBufferToTextureCommandVK | ( |  | ) |
| override default

BlitCopyBufferToTextureCommandVK

## Member Function Documentation

## ◆ Encode()

bool impeller::BlitCopyBufferToTextureCommandVK::Encode | ( | CommandEncoderVK & | encoder | ) | const
| override virtual

Implements impeller::BlitEncodeVK.

Definition at line 159 of file blit_command_vk.cc.

159 {
160 const auto& cmd_buffer = encoder.GetCommandBuffer();
161
162 // cast destination to TextureVK
163 const auto& dst = TextureVK::Cast(*destination);
164 const auto& src = DeviceBufferVK::Cast(*source.buffer);
165
166 if (!encoder.Track(source.buffer) || !encoder.Track(destination)) {
167 return false;
168 }
169
170 BarrierVK dst_barrier;
171 dst_barrier.cmd_buffer = cmd_buffer;
172 dst_barrier.new_layout = vk::ImageLayout::eTransferDstOptimal;
173 dst_barrier.src_access = {};
174 dst_barrier.src_stage = vk::PipelineStageFlagBits::eTopOfPipe;
175 dst_barrier.dst_access =
176 vk::AccessFlagBits::eShaderRead | vk::AccessFlagBits::eTransferWrite;
177 dst_barrier.dst_stage = vk::PipelineStageFlagBits::eFragmentShader |
178 vk::PipelineStageFlagBits::eTransfer;
179
180 vk::BufferImageCopy image_copy;
181 image_copy.setBufferOffset(source.range.offset);
182 image_copy.setBufferRowLength(0);
183 image_copy.setBufferImageHeight(0);
184 image_copy.setImageSubresource(
185 vk::ImageSubresourceLayers(vk::ImageAspectFlagBits::eColor, 0, 0, 1));
186 image_copy.setImageOffset(
187 vk::Offset3D(destination_origin.x, destination_origin.y, 0));
188 image_copy.setImageExtent(vk::Extent3D(destination->GetSize().width,
189 destination->GetSize().height, 1));
190
191 if (!dst.SetLayout(dst_barrier)) {
192 VALIDATION_LOG << "Could not encode layout transition.";
193 return false;
194 }
195
196 cmd_buffer.copyBufferToImage(src.GetBuffer(), //
197 dst.GetImage(), //
198 dst_barrier.new_layout, //
199 image_copy //
200 );
201
202 return true;
203 }

References impeller::BufferView::buffer, impeller::BackendCast< DeviceBufferVK, Buffer >::Cast(), impeller::BackendCast< TextureVK, Texture >::Cast(), impeller::BarrierVK::cmd_buffer, impeller::BlitCopyBufferToTextureCommand::destination, impeller::BlitCopyBufferToTextureCommand::destination_origin, impeller::BarrierVK::dst_access, impeller::BarrierVK::dst_stage, impeller::CommandEncoderVK::GetCommandBuffer(), impeller::BarrierVK::new_layout, impeller::Range::offset, impeller::BufferView::range, impeller::BlitCopyBufferToTextureCommand::source, impeller::BarrierVK::src_access, impeller::BarrierVK::src_stage, impeller::CommandEncoderVK::Track(), VALIDATION_LOG, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::testing::TEST().

## ◆ GetLabel()

std::string impeller::BlitCopyBufferToTextureCommandVK::GetLabel | ( |  | ) | const
| override virtual

Implements impeller::BlitEncodeVK.

Definition at line 155 of file blit_command_vk.cc.

155 {
156 return label;
157 }

References impeller::BlitCommand::label.

The documentation for this struct was generated from the following files:

- impeller/renderer/backend/vulkan/blit_command_vk.h
- impeller/renderer/backend/vulkan/blit_command_vk.cc

impeller::TPoint::y
Type y
Definition: point.h:24
impeller::Range::offset
size_t offset
Definition: range.h:14
impeller::BufferView::range
Range range
Definition: buffer_view.h:16
impeller::BlitCommand::label
std::string label
Definition: blit_command.h:14
impeller::BlitCopyBufferToTextureCommand::source
BufferView source
Definition: blit_command.h:32
impeller::BufferView::buffer
std::shared_ptr< const Buffer > buffer
Definition: buffer_view.h:14
impeller::TPoint::x
Type x
Definition: point.h:23
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:60
impeller::BackendCast< TextureVK, Texture >::Cast
static TextureVK & Cast(Texture &base)
Definition: backend_cast.h:14
impeller::BlitCopyBufferToTextureCommand::destination_origin
IPoint destination_origin
Definition: blit_command.h:34
impeller::BlitCopyBufferToTextureCommand::destination
std::shared_ptr< Texture > destination
Definition: blit_command.h:33