22 id<MTLBlitCommandEncoder>
encoder)
const {
29 if (!destination_mtl) {
33 auto source_origin_mtl =
35 auto source_size_mtl =
37 auto destination_origin_mtl =
40 [
encoder copyFromTexture:source_mtl
43 sourceOrigin:source_origin_mtl
44 sourceSize:source_size_mtl
45 toTexture:destination_mtl
48 destinationOrigin:destination_origin_mtl];
61 id<MTLBlitCommandEncoder>
encoder)
const {
68 if (!destination_mtl) {
72 auto source_origin_mtl =
74 auto source_size_mtl =
77 auto destination_bytes_per_pixel =
79 auto destination_bytes_per_row =
80 source_size_mtl.width * destination_bytes_per_pixel;
81 auto destination_bytes_per_image =
82 source_size_mtl.height * destination_bytes_per_row;
84 [
encoder copyFromTexture:source_mtl
87 sourceOrigin:source_origin_mtl
88 sourceSize:source_size_mtl
89 toBuffer:destination_mtl
91 destinationBytesPerRow:destination_bytes_per_row
92 destinationBytesPerImage:destination_bytes_per_image];
105 id<MTLBlitCommandEncoder>
encoder)
const {
112 if (!destination_mtl) {
116 auto destination_origin_mtl =
119 auto image_size =
destination->GetTextureDescriptor().size;
120 auto source_size_mtl = MTLSizeMake(image_size.width, image_size.height, 1);
122 auto destination_bytes_per_pixel =
124 auto destination_bytes_per_row =
125 source_size_mtl.width * destination_bytes_per_pixel;
126 auto destination_bytes_per_image =
127 source_size_mtl.height * destination_bytes_per_row;
129 [
encoder copyFromBuffer:source_mtl
131 sourceBytesPerRow:destination_bytes_per_row
132 sourceBytesPerImage:destination_bytes_per_image
133 sourceSize:source_size_mtl
134 toTexture:destination_mtl
137 destinationOrigin:destination_origin_mtl];
149 id<MTLBlitCommandEncoder>
encoder)
const {
static TextureMTL & Cast(Texture &base)
id< MTLBuffer > GetMTLBuffer() const
id< MTLTexture > GetMTLTexture() const
bool GenerateMipmap(id< MTLBlitCommandEncoder > encoder)
constexpr size_t BytesPerPixelForPixelFormat(PixelFormat format)
bool Encode(id< MTLBlitCommandEncoder > encoder) const override
~BlitCopyBufferToTextureCommandMTL() override
std::string GetLabel() const override
std::shared_ptr< Texture > destination
IPoint destination_origin
~BlitCopyTextureToBufferCommandMTL() override
std::string GetLabel() const override
bool Encode(id< MTLBlitCommandEncoder > encoder) const override
std::shared_ptr< Texture > source
size_t destination_offset
~BlitCopyTextureToTextureCommandMTL() override
std::string GetLabel() const override
bool Encode(id< MTLBlitCommandEncoder > encoder) const override
IPoint destination_origin
bool Encode(id< MTLBlitCommandEncoder > encoder) const override
~BlitGenerateMipmapCommandMTL() override
std::string GetLabel() const override
std::shared_ptr< const DeviceBuffer > buffer
constexpr Type GetY() const
Returns the Y coordinate of the upper left corner, equivalent to |GetOrigin().y|.
constexpr Type GetHeight() const
Returns the height of the rectangle, equivalent to |GetSize().height|.
constexpr Type GetX() const
Returns the X coordinate of the upper left corner, equivalent to |GetOrigin().x|.
constexpr Type GetWidth() const
Returns the width of the rectangle, equivalent to |GetSize().width|.