|
| 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. More...
|
| |
| virtual bool | ResizeTexture (const std::shared_ptr< Texture > &source, const std::shared_ptr< Texture > &destination)=0 |
| | Resize the [source] texture into the [destination] texture. More...
|
| |
| 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. More...
|
| |
| 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. More...
|
| |
| 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. More...
|
| |
| bool | GenerateMipmap (std::shared_ptr< Texture > texture, std::string_view label="") |
| | Record a command to generate all mip levels for a texture. More...
|
| |
| virtual bool | EncodeCommands () const =0 |
| | Encode the recorded commands to the underlying command buffer. More...
|
| |
|
| | 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.
- See also
CommandBuffer
Definition at line 27 of file blit_pass.h.
| 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.
- Parameters
-
| [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. |
- Returns
- If the command was valid for subsequent commitment.
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.
125 VALIDATION_LOG <<
"Attempted to add a texture blit with no destination.";
128 ISize destination_size = destination->GetSize();
129 IRect destination_region_value =
131 if (destination_region_value.GetX() < 0 ||
132 destination_region_value.GetY() < 0 ||
133 destination_region_value.GetRight() > destination_size.width ||
134 destination_region_value.GetBottom() > destination_size.height) {
135 VALIDATION_LOG <<
"Blit region cannot be larger than destination texture.";
139 auto bytes_per_pixel =
141 auto bytes_per_region = destination_region_value.Area() * bytes_per_pixel;
143 if (source.GetRange().length != bytes_per_region) {
145 <<
"Attempted to add a texture blit with out of bounds access.";
148 if (mip_level >= destination->GetMipCount()) {
149 VALIDATION_LOG <<
"Invalid value for mip_level: " << mip_level <<
". "
150 <<
"The destination texture has "
151 << destination->GetMipCount() <<
" mip levels.";
160 destination_region_value, label,
161 mip_level, slice, convert_to_read);
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
constexpr size_t BytesPerPixelForPixelFormat(PixelFormat format)
constexpr static TRect MakeSize(const TSize< U > &size)
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.