#include <MtlCommandBuffer.h>
|
| ~MtlCommandBuffer () override |
|
bool | setNewCommandBufferResources () override |
|
void | addWaitSemaphores (size_t numWaitSemaphores, const BackendSemaphore *waitSemaphores) override |
|
void | addSignalSemaphores (size_t numSignalSemaphores, const BackendSemaphore *signalSemaphores) override |
|
bool | isFinished () |
|
void | waitUntilFinished () |
|
bool | commit () |
|
Public Member Functions inherited from skgpu::graphite::CommandBuffer |
virtual | ~CommandBuffer () |
|
void | trackResource (sk_sp< Resource > resource) |
|
void | trackCommandBufferResource (sk_sp< Resource > resource) |
|
void | resetCommandBuffer () |
|
virtual bool | setNewCommandBufferResources ()=0 |
|
void | addFinishedProc (sk_sp< RefCntedCallback > finishedProc) |
|
void | callFinishedProcs (bool success) |
|
virtual void | addWaitSemaphores (size_t numWaitSemaphores, const BackendSemaphore *waitSemaphores) |
|
virtual void | addSignalSemaphores (size_t numWaitSemaphores, const BackendSemaphore *signalSemaphores) |
|
virtual void | prepareSurfaceForStateUpdate (SkSurface *targetSurface, const MutableTextureState *newState) |
|
void | addBuffersToAsyncMapOnSubmit (SkSpan< const sk_sp< Buffer > >) |
|
SkSpan< const sk_sp< Buffer > > | buffersToAsyncMapOnSubmit () const |
|
bool | addRenderPass (const RenderPassDesc &, sk_sp< Texture > colorTexture, sk_sp< Texture > resolveTexture, sk_sp< Texture > depthStencilTexture, SkRect viewport, const DrawPassList &drawPasses) |
|
bool | addComputePass (DispatchGroupSpan dispatchGroups) |
|
bool | copyBufferToBuffer (const Buffer *srcBuffer, size_t srcOffset, sk_sp< Buffer > dstBuffer, size_t dstOffset, size_t size) |
|
bool | copyTextureToBuffer (sk_sp< Texture >, SkIRect srcRect, sk_sp< Buffer >, size_t bufferOffset, size_t bufferRowBytes) |
|
bool | copyBufferToTexture (const Buffer *, sk_sp< Texture >, const BufferTextureCopyData *, int count) |
|
bool | copyTextureToTexture (sk_sp< Texture > src, SkIRect srcRect, sk_sp< Texture > dst, SkIPoint dstPoint, int mipLevel) |
|
bool | synchronizeBufferToCpu (sk_sp< Buffer >) |
|
bool | clearBuffer (const Buffer *buffer, size_t offset, size_t size) |
|
void | setReplayTranslation (SkIVector translation) |
|
void | clearReplayTranslation () |
|
Definition at line 31 of file MtlCommandBuffer.h.
◆ ~MtlCommandBuffer()
skgpu::graphite::MtlCommandBuffer::~MtlCommandBuffer |
( |
| ) |
|
|
override |
◆ addSignalSemaphores()
void skgpu::graphite::MtlCommandBuffer::addSignalSemaphores |
( |
size_t |
numSignalSemaphores, |
|
|
const BackendSemaphore * |
signalSemaphores |
|
) |
| |
|
overridevirtual |
Reimplemented from skgpu::graphite::CommandBuffer.
Definition at line 130 of file MtlCommandBuffer.mm.
131 {
132 if (!signalSemaphores) {
134 return;
135 }
136
137
138 SkASSERT(!fActiveRenderCommandEncoder);
139 SkASSERT(!fActiveComputeCommandEncoder);
140 this->endBlitCommandEncoder();
141
142 if (@available(macOS 10.14, iOS 12.0, tvOS 12.0, *)) {
143 for (
size_t i = 0;
i < numSignalSemaphores; ++
i) {
144 auto semaphore = signalSemaphores[
i];
146 id<MTLEvent> mtlEvent = (__bridge id<MTLEvent>)semaphore.getMtlEvent();
147 [(*fCommandBuffer) encodeSignalEvent: mtlEvent
148 value: semaphore.getMtlValue()];
149 }
150 }
151 }
152}
◆ addWaitSemaphores()
void skgpu::graphite::MtlCommandBuffer::addWaitSemaphores |
( |
size_t |
numWaitSemaphores, |
|
|
const BackendSemaphore * |
waitSemaphores |
|
) |
| |
|
overridevirtual |
Reimplemented from skgpu::graphite::CommandBuffer.
Definition at line 107 of file MtlCommandBuffer.mm.
108 {
109 if (!waitSemaphores) {
111 return;
112 }
113
114
115 SkASSERT(!fActiveRenderCommandEncoder);
116 SkASSERT(!fActiveComputeCommandEncoder);
117 this->endBlitCommandEncoder();
118 if (@available(macOS 10.14, iOS 12.0, tvOS 12.0, *)) {
119 for (
size_t i = 0;
i < numWaitSemaphores; ++
i) {
120 auto semaphore = waitSemaphores[
i];
122 id<MTLEvent> mtlEvent = (__bridge id<MTLEvent>)semaphore.getMtlEvent();
123 [(*fCommandBuffer) encodeWaitForEvent: mtlEvent
124 value: semaphore.getMtlValue()];
125 }
126 }
127 }
128}
◆ commit()
bool skgpu::graphite::MtlCommandBuffer::commit |
( |
| ) |
|
Definition at line 83 of file MtlCommandBuffer.mm.
83 {
84 SkASSERT(!fActiveRenderCommandEncoder);
85 SkASSERT(!fActiveComputeCommandEncoder);
86 this->endBlitCommandEncoder();
87 [(*fCommandBuffer)
commit];
88
89 if ((*fCommandBuffer).status == MTLCommandBufferStatusError) {
90 NSString* description = (*fCommandBuffer).error.localizedDescription;
91 const char* errorString = [description UTF8String];
92 SKGPU_LOG_E(
"Failure submitting command buffer: %s", errorString);
93 }
94
95 return ((*fCommandBuffer).status != MTLCommandBufferStatusError);
96}
#define SKGPU_LOG_E(fmt,...)
◆ isFinished()
bool skgpu::graphite::MtlCommandBuffer::isFinished |
( |
| ) |
|
|
inline |
Definition at line 45 of file MtlCommandBuffer.h.
45 {
46 return (*fCommandBuffer).status == MTLCommandBufferStatusCompleted ||
47 (*fCommandBuffer).status == MTLCommandBufferStatusError;
48
49 }
◆ Make()
Definition at line 30 of file MtlCommandBuffer.mm.
32 {
33 auto commandBuffer = std::unique_ptr<MtlCommandBuffer>(
34 new MtlCommandBuffer(
queue, sharedContext, resourceProvider));
35 if (!commandBuffer) {
36 return nullptr;
37 }
38 if (!commandBuffer->createNewMTLCommandBuffer()) {
39 return nullptr;
40 }
41 return commandBuffer;
42}
◆ setNewCommandBufferResources()
bool skgpu::graphite::MtlCommandBuffer::setNewCommandBufferResources |
( |
| ) |
|
|
overridevirtual |
◆ waitUntilFinished()
void skgpu::graphite::MtlCommandBuffer::waitUntilFinished |
( |
| ) |
|
|
inline |
Definition at line 50 of file MtlCommandBuffer.h.
50 {
51
52 if ((*fCommandBuffer).status == MTLCommandBufferStatusScheduled ||
53 (*fCommandBuffer).status == MTLCommandBufferStatusCommitted) {
54 [(*fCommandBuffer) waitUntilCompleted];
55 }
58 (int)(*fCommandBuffer).status);
60 }
61 }
The documentation for this class was generated from the following files: