Blit passes encode blit into the underlying command buffer. More...
#include <blit_pass.h>
Public Member Functions | |
| virtual | ~BlitPass () |
| virtual bool | IsValid () const =0 |
| void | SetLabel (std::string_view label) |
| virtual bool | ConvertTextureToShaderRead (const std::shared_ptr< Texture > &texture) |
| If the texture is not already in a shader read internal state, then convert it to that state. | |
| virtual bool | ResizeTexture (const std::shared_ptr< Texture > &source, const std::shared_ptr< Texture > &destination)=0 |
| Resize the [source] texture into the [destination] texture. | |
| bool | AddCopy (std::shared_ptr< Texture > source, std::shared_ptr< Texture > destination, std::optional< IRect > source_region=std::nullopt, IPoint destination_origin={}, std::string_view label="") |
| Record a command to copy the contents of one texture to another texture. The blit area is limited by the intersection of the texture coverage with respect the source region and destination origin. | |
| bool | AddCopy (std::shared_ptr< Texture > source, std::shared_ptr< DeviceBuffer > destination, std::optional< IRect > source_region=std::nullopt, size_t destination_offset=0, std::string_view label="") |
| Record a command to copy the contents of a texture to a buffer. | |
| bool | AddCopy (BufferView source, std::shared_ptr< Texture > destination, std::optional< IRect > destination_region=std::nullopt, std::string_view label="", uint32_t mip_level=0, uint32_t slice=0, bool convert_to_read=true) |
| Record a command to copy the contents of a buffer to a texture. | |
| bool | GenerateMipmap (std::shared_ptr< Texture > texture, std::string_view label="") |
| Record a command to generate all mip levels for a texture. | |
| virtual bool | EncodeCommands () const =0 |
| Encode the recorded commands to the underlying command buffer. | |
Protected Member Functions | |
| BlitPass () | |
| virtual void | OnSetLabel (std::string_view label)=0 |
| virtual bool | OnCopyTextureToTextureCommand (std::shared_ptr< Texture > source, std::shared_ptr< Texture > destination, IRect source_region, IPoint destination_origin, std::string_view label)=0 |
| virtual bool | OnCopyTextureToBufferCommand (std::shared_ptr< Texture > source, std::shared_ptr< DeviceBuffer > destination, IRect source_region, size_t destination_offset, std::string_view label)=0 |
| virtual bool | OnCopyBufferToTextureCommand (BufferView source, std::shared_ptr< Texture > destination, IRect destination_region, std::string_view label, uint32_t mip_level, uint32_t slice, bool convert_to_read)=0 |
| virtual bool | OnGenerateMipmapCommand (std::shared_ptr< Texture > texture, std::string_view label)=0 |
Blit passes encode blit into the underlying command buffer.
Blit passes can be obtained from the command buffer in which
the pass is meant to encode commands into.
CommandBuffer Definition at line 27 of file blit_pass.h.
|
virtualdefault |
|
explicitprotected |
Definition at line 16 of file blit_pass.cc.
| bool impeller::BlitPass::AddCopy | ( | BufferView | source, |
| std::shared_ptr< Texture > | destination, | ||
| std::optional< IRect > | destination_region = std::nullopt, |
||
| std::string_view | label = "", |
||
| uint32_t | mip_level = 0, |
||
| uint32_t | slice = 0, |
||
| bool | convert_to_read = true |
||
| ) |
Record a command to copy the contents of a buffer to a texture.
| [in] | source | The buffer view to read for copying. |
| [in] | destination | The texture to overwrite using the source contents. |
| [in] | destination_region | The offset to start writing to in the destination texture. If not provided, this defaults to the entire texture. |
| [in] | label | The optional debug label to give the command. |
| [in] | mip_level | The mip level to write to. |
| [in] | slice | For cubemap textures, the slice to write data to. |
| [in] | convert_to_read | Whether to convert the texture to a shader read state. Defaults to true. |
If a region smaller than the texture size is provided, the contents are treated as containing tightly packed pixel data of that region. Only the portion of the texture in this region is replaced and existing data is preserved.
For example, to replace the top left 10 x 10 region of a larger 100 x 100 texture, the region is {0, 0, 10, 10} and the expected buffer size in bytes is 100 x bpp.
Definition at line 117 of file blit_pass.cc.
References impeller::TRect< T >::Area(), impeller::BytesPerPixelForPixelFormat(), impeller::TRect< T >::GetBottom(), impeller::BufferView::GetRange(), impeller::TRect< T >::GetRight(), impeller::TRect< T >::GetX(), impeller::TRect< T >::GetY(), impeller::TSize< T >::height, impeller::Range::length, impeller::TRect< T >::MakeSize(), OnCopyBufferToTextureCommand(), VALIDATION_LOG, and impeller::TSize< T >::width.
| bool impeller::BlitPass::AddCopy | ( | std::shared_ptr< Texture > | source, |
| std::shared_ptr< DeviceBuffer > | destination, | ||
| std::optional< IRect > | source_region = std::nullopt, |
||
| size_t | destination_offset = 0, |
||
| std::string_view | label = "" |
||
| ) |
Record a command to copy the contents of a texture to a buffer.
| [in] | source | The texture to read for copying. |
| [in] | destination | The buffer to overwrite using the source contents. |
| [in] | source_region | The optional region of the source texture to use for copying. If not specified, the full size of the source texture is used. |
| [in] | destination_origin | The origin to start writing to in the destination texture. |
| [in] | label | The optional debug label to give the command. |
Definition at line 77 of file blit_pass.cc.
References impeller::BytesPerPixelForPixelFormat(), impeller::TRect< T >::MakeSize(), OnCopyTextureToBufferCommand(), and VALIDATION_LOG.
| bool impeller::BlitPass::AddCopy | ( | std::shared_ptr< Texture > | source, |
| std::shared_ptr< Texture > | destination, | ||
| std::optional< IRect > | source_region = std::nullopt, |
||
| IPoint | destination_origin = {}, |
||
| std::string_view | label = "" |
||
| ) |
Record a command to copy the contents of one texture to another texture. The blit area is limited by the intersection of the texture coverage with respect the source region and destination origin.
| [in] | source | The texture to read for copying. |
| [in] | destination | The texture to overwrite using the source contents. |
| [in] | source_region | The optional region of the source texture to use for copying. If not specified, the full size of the source texture is used. |
| [in] | destination_origin | The origin to start writing to in the destination texture. |
| [in] | label | The optional debug label to give the command. |
Definition at line 27 of file blit_pass.cc.
References impeller::TRect< T >::MakeSize(), OnCopyTextureToTextureCommand(), impeller::PixelFormatToString(), and VALIDATION_LOG.
|
virtual |
If the texture is not already in a shader read internal state, then convert it to that state.
This API is only used by Vulkan.
Definition at line 164 of file blit_pass.cc.
|
pure virtual |
Encode the recorded commands to the underlying command buffer.
| bool impeller::BlitPass::GenerateMipmap | ( | std::shared_ptr< Texture > | texture, |
| std::string_view | label = "" |
||
| ) |
Record a command to generate all mip levels for a texture.
| [in] | texture | The texture to generate mipmaps for. |
| [in] | label | The optional debug label to give the command. |
Definition at line 169 of file blit_pass.cc.
References OnGenerateMipmapCommand(), texture, and VALIDATION_LOG.
|
pure virtual |
|
protectedpure virtual |
Referenced by AddCopy().
|
protectedpure virtual |
Referenced by AddCopy().
|
protectedpure virtual |
Referenced by AddCopy().
|
protectedpure virtual |
Referenced by GenerateMipmap().
|
protectedpure virtual |
Referenced by SetLabel().
|
pure virtual |
Resize the [source] texture into the [destination] texture.
On Metal platforms, [destination] is required to be non-lossy
and have the Shader read capability.
| void impeller::BlitPass::SetLabel | ( | std::string_view | label | ) |
Definition at line 20 of file blit_pass.cc.
References OnSetLabel().