#include <GrMtlCommandBuffer.h>
Definition at line 30 of file GrMtlCommandBuffer.h.
◆ ~GrMtlCommandBuffer()
GrMtlCommandBuffer::~GrMtlCommandBuffer |
( |
| ) |
|
|
override |
Definition at line 48 of file GrMtlCommandBuffer.mm.
48 {
49 this->endAllEncoding();
52
53 fCmdBuffer = nil;
54}
void callFinishedCallbacks()
◆ addCompletedHandler()
void GrMtlCommandBuffer::addCompletedHandler |
( |
MTLCommandBufferHandler |
block | ) |
|
|
inline |
Definition at line 53 of file GrMtlCommandBuffer.h.
53 {
55 }
void addCompletedHandler(MTLCommandBufferHandler block)
◆ addFinishedCallback()
Definition at line 40 of file GrMtlCommandBuffer.h.
40 {
42 }
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
◆ addGrBuffer()
void GrMtlCommandBuffer::addGrBuffer |
( |
sk_sp< const GrBuffer > |
buffer | ) |
|
|
inline |
◆ addGrSurface()
void GrMtlCommandBuffer::addGrSurface |
( |
sk_sp< const GrSurface > |
surface | ) |
|
|
inline |
◆ addResource()
◆ callFinishedCallbacks()
void GrMtlCommandBuffer::callFinishedCallbacks |
( |
| ) |
|
|
inline |
◆ commit()
bool GrMtlCommandBuffer::commit |
( |
bool |
waitUntilCompleted | ) |
|
Definition at line 181 of file GrMtlCommandBuffer.mm.
181 {
182 this->endAllEncoding();
183 if ([fCmdBuffer status] != MTLCommandBufferStatusNotEnqueued) {
184 NSLog(@"GrMtlCommandBuffer: Tried to commit command buffer while in invalid state.\n");
185 return false;
186 }
190#if defined(SK_BUILD_FOR_IOS) && defined(SK_METAL_WAIT_UNTIL_SCHEDULED)
191
192
193 } else {
194 [fCmdBuffer waitUntilScheduled];
195#endif
196 }
197
198 if ([fCmdBuffer status] == MTLCommandBufferStatusError) {
199 SkDebugf(
"Error submitting command buffer.\n");
202 }
203 }
204
205 return ([fCmdBuffer status] != MTLCommandBufferStatusError);
206}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
void waitUntilCompleted()
bool commit(bool waitUntilCompleted)
const uint8_t uint32_t uint32_t GError ** error
◆ encodeSignalEvent()
void GrMtlCommandBuffer::encodeSignalEvent |
( |
sk_sp< GrMtlEvent > |
event, |
|
|
uint64_t |
value |
|
) |
| |
Definition at line 220 of file GrMtlCommandBuffer.mm.
220 {
222 this->endAllEncoding();
223 if (@available(macOS 10.14, iOS 12.0, tvOS 12.0, *)) {
226 }
227 fHasWork = true;
228}
void addResource(const sk_sp< const GrManagedResource > &resource)
void encodeSignalEvent(sk_sp< GrMtlEvent >, uint64_t value)
◆ encodeWaitForEvent()
void GrMtlCommandBuffer::encodeWaitForEvent |
( |
sk_sp< GrMtlEvent > |
event, |
|
|
uint64_t |
value |
|
) |
| |
Definition at line 230 of file GrMtlCommandBuffer.mm.
230 {
232 this->endAllEncoding();
233
234 if (@available(macOS 10.14, iOS 12.0, tvOS 12.0, *)) {
237 }
238 fHasWork = true;
239}
void encodeWaitForEvent(sk_sp< GrMtlEvent >, uint64_t value)
◆ getBlitCommandEncoder()
id< MTLBlitCommandEncoder > GrMtlCommandBuffer::getBlitCommandEncoder |
( |
| ) |
|
Definition at line 64 of file GrMtlCommandBuffer.mm.
64 {
65 if (fActiveBlitCommandEncoder) {
66 return fActiveBlitCommandEncoder;
67 }
68
69 this->endAllEncoding();
70 if (fCmdBuffer.status != MTLCommandBufferStatusNotEnqueued) {
71 NSLog(@"GrMtlCommandBuffer: tried to create MTLBlitCommandEncoder while in invalid state.");
72 return nullptr;
73 }
74 fActiveBlitCommandEncoder = [fCmdBuffer blitCommandEncoder];
75 fHasWork = true;
76
77 return fActiveBlitCommandEncoder;
78}
◆ getRenderCommandEncoder() [1/2]
Definition at line 147 of file GrMtlCommandBuffer.mm.
149 {
150 if (nil != fPreviousRenderPassDescriptor) {
151 if (
compatible(fPreviousRenderPassDescriptor.colorAttachments[0],
152 descriptor.colorAttachments[0], pipelineState) &&
153 compatible(fPreviousRenderPassDescriptor.stencilAttachment,
154 descriptor.stencilAttachment, pipelineState)) {
155 return fActiveRenderCommandEncoder.get();
156 }
157 }
158
160}
static bool compatible(const MTLRenderPassAttachmentDescriptor *first, const MTLRenderPassAttachmentDescriptor *second, const GrMtlPipelineState *pipelineState)
GrMtlRenderCommandEncoder * getRenderCommandEncoder(MTLRenderPassDescriptor *, const GrMtlPipelineState *, GrMtlOpsRenderPass *opsRenderPass)
◆ getRenderCommandEncoder() [2/2]
Definition at line 162 of file GrMtlCommandBuffer.mm.
164 {
165 this->endAllEncoding();
166 if (fCmdBuffer.status != MTLCommandBufferStatusNotEnqueued) {
167 NSLog(@"GrMtlCommandBuffer: tried to create MTLRenderCommandEncoder while in bad state.");
168 return nullptr;
169 }
171 [fCmdBuffer renderCommandEncoderWithDescriptor:descriptor]);
172 if (opsRenderPass) {
174 }
175 fPreviousRenderPassDescriptor = descriptor;
176 fHasWork = true;
177
178 return fActiveRenderCommandEncoder.get();
179}
void initRenderState(GrMtlRenderCommandEncoder *)
static std::unique_ptr< GrMtlRenderCommandEncoder > Make(id< MTLRenderCommandEncoder > encoder)
◆ hasWork()
bool GrMtlCommandBuffer::hasWork |
( |
| ) |
|
|
inline |
◆ isCompleted()
bool GrMtlCommandBuffer::isCompleted |
( |
| ) |
|
|
inline |
Definition at line 77 of file GrMtlCommandBuffer.h.
77 {
78 return fCmdBuffer.status == MTLCommandBufferStatusCompleted ||
79 fCmdBuffer.status == MTLCommandBufferStatusError;
80 }
◆ Make()
Definition at line 24 of file GrMtlCommandBuffer.mm.
24 {
25 id<MTLCommandBuffer> mtlCommandBuffer;
26#if GR_METAL_SDK_VERSION >= 230
27 if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) {
28 MTLCommandBufferDescriptor*
desc = [[MTLCommandBufferDescriptor alloc]
init];
29 desc.errorOptions = MTLCommandBufferErrorOptionEncoderExecutionStatus;
30 mtlCommandBuffer = [
queue commandBufferWithDescriptor:
desc];
31 } else {
32 mtlCommandBuffer = [
queue commandBuffer];
33 }
34#else
35 mtlCommandBuffer = [
queue commandBuffer];
36#endif
37 if (nil == mtlCommandBuffer) {
38 return nullptr;
39 }
40
41#ifdef SK_ENABLE_MTL_DEBUG_INFO
42 mtlCommandBuffer.label = @"GrMtlCommandBuffer::Make";
43#endif
44
46}
◆ popDebugGroup()
void GrMtlCommandBuffer::popDebugGroup |
( |
| ) |
|
|
inline |
Definition at line 89 of file GrMtlCommandBuffer.h.
89 {
90 if (@available(macOS 10.13, iOS 11.0, tvOS 11.0, *)) {
92 }
93 }
◆ pushDebugGroup()
void GrMtlCommandBuffer::pushDebugGroup |
( |
NSString * |
string | ) |
|
|
inline |
Definition at line 83 of file GrMtlCommandBuffer.h.
83 {
84 if (@available(macOS 10.13, iOS 11.0, tvOS 11.0, *)) {
86 }
87 }
void pushDebugGroup(NSString *string)
◆ releaseResources()
void GrMtlCommandBuffer::releaseResources |
( |
| ) |
|
Definition at line 56 of file GrMtlCommandBuffer.mm.
56 {
58
59 fTrackedResources.
clear();
60 fTrackedGrBuffers.
clear();
61 fTrackedGrSurfaces.clear();
62}
#define TRACE_EVENT0(category_group, name)
◆ waitUntilCompleted()
void GrMtlCommandBuffer::waitUntilCompleted |
( |
| ) |
|
|
inline |
The documentation for this class was generated from the following files: