Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
impeller::BlitCopyBufferToTextureCommandVK Struct Reference

#include <blit_command_vk.h>

Inheritance diagram for impeller::BlitCopyBufferToTextureCommandVK:
impeller::BlitCopyBufferToTextureCommand impeller::BlitEncodeVK impeller::BlitCommand impeller::BackendCast< BlitEncodeVK, BlitCommand >

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 BlitEncodeVKCast (BlitCommand &base)
 
static const BlitEncodeVKCast (const BlitCommand &base)
 
static BlitEncodeVKCast (BlitCommand *base)
 
static const BlitEncodeVKCast (const BlitCommand *base)
 
- Public Attributes inherited from impeller::BlitCopyBufferToTextureCommand
BufferView source
 
std::shared_ptr< Texturedestination
 
IPoint destination_origin
 
- Public Attributes inherited from impeller::BlitCommand
std::string label
 

Detailed Description

Definition at line 47 of file blit_command_vk.h.

Constructor & Destructor Documentation

◆ ~BlitCopyBufferToTextureCommandVK()

impeller::BlitCopyBufferToTextureCommandVK::~BlitCopyBufferToTextureCommandVK ( )
overridedefault

Member Function Documentation

◆ Encode()

bool impeller::BlitCopyBufferToTextureCommandVK::Encode ( CommandEncoderVK encoder) const
overridevirtual

Implements impeller::BlitEncodeVK.

Definition at line 222 of file blit_command_vk.cc.

222 {
223 const auto& cmd_buffer = encoder.GetCommandBuffer();
224
225 // cast destination to TextureVK
226 const auto& dst = TextureVK::Cast(*destination);
227 const auto& src = DeviceBufferVK::Cast(*source.buffer);
228
229 if (!encoder.Track(source.buffer) || !encoder.Track(destination)) {
230 return false;
231 }
232
233 BarrierVK dst_barrier;
234 dst_barrier.cmd_buffer = cmd_buffer;
235 dst_barrier.new_layout = vk::ImageLayout::eTransferDstOptimal;
236 dst_barrier.src_access = {};
237 dst_barrier.src_stage = vk::PipelineStageFlagBits::eTopOfPipe;
238 dst_barrier.dst_access =
239 vk::AccessFlagBits::eShaderRead | vk::AccessFlagBits::eTransferWrite;
240 dst_barrier.dst_stage = vk::PipelineStageFlagBits::eFragmentShader |
241 vk::PipelineStageFlagBits::eTransfer;
242
243 vk::BufferImageCopy image_copy;
244 image_copy.setBufferOffset(source.range.offset);
245 image_copy.setBufferRowLength(0);
246 image_copy.setBufferImageHeight(0);
247 image_copy.setImageSubresource(
248 vk::ImageSubresourceLayers(vk::ImageAspectFlagBits::eColor, 0, 0, 1));
249 image_copy.setImageOffset(
250 vk::Offset3D(destination_origin.x, destination_origin.y, 0));
251 image_copy.setImageExtent(vk::Extent3D(destination->GetSize().width,
252 destination->GetSize().height, 1));
253
254 if (!dst.SetLayout(dst_barrier)) {
255 VALIDATION_LOG << "Could not encode layout transition.";
256 return false;
257 }
258
259 cmd_buffer.copyBufferToImage(src.GetBuffer(), //
260 dst.GetImage(), //
261 dst_barrier.new_layout, //
262 image_copy //
263 );
264
265 return true;
266}
static TextureVK & Cast(Texture &base)
dst
Definition cp.py:12
std::shared_ptr< Texture > destination
std::shared_ptr< const DeviceBuffer > buffer
Definition buffer_view.h:16
size_t offset
Definition range.h:15
#define VALIDATION_LOG
Definition validation.h:73

◆ GetLabel()

std::string impeller::BlitCopyBufferToTextureCommandVK::GetLabel ( ) const
overridevirtual

Implements impeller::BlitEncodeVK.

Definition at line 218 of file blit_command_vk.cc.

218 {
219 return label;
220}

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