8#ifndef skgpu_graphite_MtlBlitCommandEncoder_DEFINED
9#define skgpu_graphite_MtlBlitCommandEncoder_DEFINED
16#import <Metal/Metal.h>
26 id<MTLCommandBuffer> commandBuffer) {
29 sk_cfp<id<MTLBlitCommandEncoder>>
encoder =
30 sk_ret_cfp<id<MTLBlitCommandEncoder>>([commandBuffer blitCommandEncoder]);
36 const char*
getResourceType()
const override {
return "Metal Blit Command Encoder"; }
44#ifdef SK_BUILD_FOR_MAC
45 void synchronizeResource(id<MTLBuffer>
buffer) {
46 [(*fCommandEncoder) synchronizeResource:
buffer];
50 void fillBuffer(id<MTLBuffer>
buffer,
size_t bufferOffset,
size_t bytes, uint8_t value) {
52 range:NSMakeRange(bufferOffset, bytes)
60 size_t bufferRowBytes) {
64 sourceOrigin: MTLOriginMake(srcRect.
left(), srcRect.
top(), 0)
65 sourceSize: MTLSizeMake(srcRect.
width(), srcRect.
height(), 1)
67 destinationOffset: bufferOffset
68 destinationBytesPerRow: bufferRowBytes
69 destinationBytesPerImage: bufferRowBytes * srcRect.
height()];
74 size_t bufferRowBytes,
77 unsigned int dstLevel) {
79 sourceOffset: bufferOffset
80 sourceBytesPerRow: bufferRowBytes
81 sourceBytesPerImage: bufferRowBytes * dstRect.
height()
82 sourceSize: MTLSizeMake(dstRect.
width(), dstRect.
height(), 1)
85 destinationLevel: dstLevel
86 destinationOrigin: MTLOriginMake(dstRect.
left(), dstRect.
top(), 0)];
91 id<MTLTexture> dstTexture,
97 sourceOrigin: MTLOriginMake(srcRect.
x(), srcRect.
y(), 0)
98 sourceSize: MTLSizeMake(srcRect.
width(), srcRect.
height(), 1)
101 destinationLevel: mipLevel
102 destinationOrigin: MTLOriginMake(dstPoint.
fX, dstPoint.
fY, 0)];
107 id<MTLBuffer> dstBuffer,
111 sourceOffset: srcOffset
113 destinationOffset: dstOffset
123 sk_cfp<id<MTLBlitCommandEncoder>>
encoder)
128 "MtlBlitCommandEncoder")
132 fCommandEncoder.reset();
135 sk_cfp<id<MTLBlitCommandEncoder>> fCommandEncoder;
@ kYes
Do pre-clip the geometry before applying the (perspective) matrix.
void freeGpuData() override
void fillBuffer(id< MTLBuffer > buffer, size_t bufferOffset, size_t bytes, uint8_t value)
void pushDebugGroup(NSString *string)
static sk_sp< MtlBlitCommandEncoder > Make(const SharedContext *sharedContext, id< MTLCommandBuffer > commandBuffer)
void copyFromTexture(id< MTLTexture > texture, SkIRect srcRect, id< MTLBuffer > buffer, size_t bufferOffset, size_t bufferRowBytes)
void copyTextureToTexture(id< MTLTexture > srcTexture, SkIRect srcRect, id< MTLTexture > dstTexture, SkIPoint dstPoint, int mipLevel)
const char * getResourceType() const override
void copyBufferToBuffer(id< MTLBuffer > srcBuffer, size_t srcOffset, id< MTLBuffer > dstBuffer, size_t dstOffset, size_t size)
void copyFromBuffer(id< MTLBuffer > buffer, size_t bufferOffset, size_t bufferRowBytes, id< MTLTexture > texture, SkIRect dstRect, unsigned int dstLevel)
const SharedContext * sharedContext() const
static const uint8_t buffer[]
constexpr int32_t x() const
constexpr int32_t y() const
constexpr int32_t top() const
constexpr int32_t height() const
constexpr int32_t width() const
constexpr int32_t left() const